summaryrefslogtreecommitdiff
path: root/navit/track.c
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-11-17 15:47:57 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-11-17 15:47:57 +0000
commitc415fb09b10fb0a83f94f0c7442749cde2a6653b (patch)
tree1a388349bbc5e3a113425380e196a21fa7d9afa0 /navit/track.c
parent3eaef82651557cccb14fb68ad63ca009e1dcc914 (diff)
downloadnavit-c415fb09b10fb0a83f94f0c7442749cde2a6653b.tar.gz
Add:Core:Experimental consideration of speed in tracking
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3687 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/track.c')
-rw-r--r--navit/track.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/navit/track.c b/navit/track.c
index dec8fb2aa..0da685da4 100644
--- a/navit/track.c
+++ b/navit/track.c
@@ -34,6 +34,7 @@
#include "plugin.h"
#include "vehicleprofile.h"
#include "vehicle.h"
+#include "roadprofile.h"
#include "util.h"
#include "config.h"
@@ -105,6 +106,8 @@ struct tracking {
int nostop_pref;
int offroad_limit_pref;
int route_pref;
+ int overspeed_pref;
+ int overspeed_percent_pref;
};
@@ -602,6 +605,11 @@ tracking_value(struct tracking *tr, struct tracking_line *t, int offset, struct
return value;
if (flags & 16)
value += tracking_is_on_route(tr, tr->rt, &sd->item);
+ if ((flags & 32) && tr->overspeed_percent_pref && tr->overspeed_pref ) {
+ struct roadprofile *roadprofile=g_hash_table_lookup(tr->vehicleprofile->roadprofile_hash, (void *)t->street->item.type);
+ if (roadprofile && tr->speed > roadprofile->speed * tr->overspeed_percent_pref/ 100)
+ value += tr->overspeed_pref;
+ }
return value;
}
@@ -758,6 +766,12 @@ tracking_set_attr_do(struct tracking *tr, struct attr *attr, int initial)
case attr_route_pref:
tr->route_pref=attr->u.num;
return 1;
+ case attr_overspeed_pref:
+ tr->overspeed_pref=attr->u.num;
+ return 1;
+ case attr_overspeed_percent_pref:
+ tr->overspeed_percent_pref=attr->u.num;
+ return 1;
default:
return 0;
}
@@ -916,6 +930,10 @@ tracking_map_item_attr_get(void *priv_data, enum attr_type attr_type, struct att
return 1;
case 6:
this_->debug_idx++;
+ this_->str=attr->u.str=g_strdup_printf("overspeed: %d", tracking_value(tr, this_->curr, this_->coord, &lpnt, INT_MAX/2, 32));
+ return 1;
+ case 7:
+ this_->debug_idx++;
this_->str=attr->u.str=g_strdup_printf("line %p", this_->curr);
return 1;
default: