Opened 8 years ago

Last modified 8 years ago

#1204 new enhancement/feature request

Make number of warnings for route_guard configurable

Reported by: rainer dorsch Owned by: KaZeR
Priority: minor Milestone:
Component: core Version: git master
Severity: normal Keywords:


route_guard is decribed here:

When somebody deviates from the planed route and misses the warning, he will not notice. A fix would be to make the number of warnings configurable through navit.xml

Add a num_warnings field to route_guard (and make it configurable through navit.xml) and modify in osm_core.c

if ( this->warned == 0 && this->min_dist < min_dist && min_dist < this->max_dist) {

navit_say(nav, _("Return to route!")); this->warned = 1;

} else if( min_dist < this->min_dist ) {

this->warned = 0;



if ( this->warned < num_warnings && this->min_dist < min_dist && min_dist < this->max_dist) {

navit_say(nav, _("Return to route!")); this->warned++;

} else if( min_dist < this->min_dist ) {

this->warned = 0;


I apologize that I could not provide a full patch file, but I never added an option to navit.xml.

Thanks, Rainer

Change History (1)

comment:1 Changed 8 years ago by tryagain


To add an option to navit.xml, at first you'll need an attribute. Look at attr_def.h and see if there exists already any suitable one, not used by route_guard osd. If there's no such an attribute, add new one to that file, keeping in mind that your attribute should be placed at the end of the section, right before ATTR2() style definition starting next section. For example, to create a simple int attribute, place it before ATTR2(0x00027500,type_rel_abs_begin) line.

Then, to easily work with attribute, you'll have to add a new member to the struct route_guard (that's what your variable num_warnings should be).

You should initialize num_warnings member in osd_route_guard_new function using attribute value supplied in navit.xml. Use attr_search for that like it's done for other attributes, don't forget to include some default value.


p.s. Please don't forget to document your change after it's merged into svn ;)

Note: See TracTickets for help on using tickets.