]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/routerpanel.cpp
Avoid negative values of wait_time
[r2c2.git] / source / engineer / routerpanel.cpp
index 11056ea85f28e578c58bbd20b1b65045b1fa669b..30857ceb7f9b0980de21ed0fce8e6fcc4b5493ef 100644 (file)
@@ -78,6 +78,7 @@ void RouterPanel::route_selected(unsigned index)
 void RouterPanel::goto_clicked()
 {
        goto_pick = true;
+       goto_target = 0;
        signal_grab_pointer.emit();
 }
 
@@ -94,7 +95,7 @@ void RouterPanel::button_press(int x, int y, unsigned btn)
                goto_highlight = 0;
 
                if(goto_target && btn==1)
-                       train.ai_message(TrainAI::Message("set-destination-block", goto_target));
+                       train.ai_message(TrainAI::Message("set-destination", static_cast<const TrackChain *>(goto_target)));
        }
 }
 
@@ -109,7 +110,7 @@ void RouterPanel::pointer_motion(int x, int y)
                map_coords_to_ancestor(rx, ry, *find_ancestor<GLtk::Root>());
                Ray ray = engineer.get_main_view().create_ray(rx, ry);
                Track *track = engineer.get_layout().pick<Track>(ray);
-               if(track)
+               if(track && &track->get_block()!=goto_target)
                {
                        goto_target = &track->get_block();
                        delete goto_highlight;