]> err.no Git - mapper/commitdiff
Fix waypoint announce loop
authorKaj-Michael Lang <milang@tal.org>
Tue, 15 Apr 2008 10:31:46 +0000 (13:31 +0300)
committerKaj-Michael Lang <milang@tal.org>
Tue, 15 Apr 2008 10:31:46 +0000 (13:31 +0300)
src/route.c

index 5b1c8400841f9fda9969c52caa068b1ef642c4c5..4058ca0d1f4a75c2d731da1c790b5caa25d02729 100644 (file)
@@ -37,6 +37,8 @@
 
 static gboolean show_directions=TRUE;
 
+static WayPoint *announced_waypoint=NULL;
+
 typedef struct _OriginToggleInfo OriginToggleInfo;
 struct _OriginToggleInfo {
        GtkWidget *rad_use_gps;
@@ -61,12 +63,13 @@ confirm = hildon_note_new_confirmation(GTK_WINDOW(_window), _("Really clear the
 
 if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) {
        route_cancel_autoroute(FALSE);
+       announced_waypoint=NULL;
        path_free(_route);
        _route=path_new();
        route_find_nearest_point();
        map_force_redraw();
 }
-_dest.valid=FALSE;
+
 gtk_widget_destroy(confirm);
 }
 
@@ -89,8 +92,11 @@ if (!_next_way)
 
 announce_thres_unsquared=(20+(guint)gps->speed)*_announce_notice_ratio*3;
 
-if (_next_way_dist_squared < (announce_thres_unsquared * announce_thres_unsquared))
+if (_next_way_dist_squared<(announce_thres_unsquared * announce_thres_unsquared) && _next_way!=announced_waypoint) {
        announce_waypoint(_next_way->desc);
+       announced_waypoint=_next_way;
+}
+
 }
 
 /**