Fix:Core:Set attribute active on active/inactive vehicle
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 18 Jan 2009 17:00:55 +0000 (17:00 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sun, 18 Jan 2009 17:00:55 +0000 (17:00 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1954 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/navit.c

index 00b5674..2de6d74 100644 (file)
@@ -1410,10 +1410,17 @@ navit_set_attr(struct navit *this_, struct attr *attr)
        case attr_vehicle:
                if (!this_->vehicle || this_->vehicle->vehicle != attr->u.vehicle) {
                        GList *l;
+                       struct navit_vehicle *nv;
+                       struct attr active=(struct attr){attr_active,{(void *)0}};
                        l=this_->vehicles;
                        while(l) {
-                               if (((struct navit_vehicle *)l->data)->vehicle == attr->u.vehicle) {
-                                       this_->vehicle=(struct navit_vehicle *)l->data;
+                               nv=l->data;
+                               if (nv->vehicle == attr->u.vehicle) {
+                                       if (this_->vehicle)
+                                               vehicle_set_attr(this_->vehicle->vehicle, &active, NULL);
+                                       active.u.num=1;
+                                       vehicle_set_attr(nv->vehicle, &active, NULL);
+                                       this_->vehicle=nv;
                                        attr_updated=1;
                                }
                                l=g_list_next(l);