mail[Wesnoth-commits] r44980 - /trunk/src/whiteboard/move.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by gabrielmorin on July 31, 2010 - 12:15:
Author: gabba
Date: Sat Jul 31 12:15:33 2010
New Revision: 44980

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44980&view=rev
Log:
Whiteboard: use new method mouse_handler::move_unit_along_route() to execute 
move actions. This fixes "Enemy sighted press T to continue" behavior, even 
though a more whiteboard-specific solution would be desirable here.

Modified:
    trunk/src/whiteboard/move.cpp

Modified: trunk/src/whiteboard/move.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/move.cpp?rev=44980&r1=44979&r2=44980&view=diff
==============================================================================
--- trunk/src/whiteboard/move.cpp (original)
+++ trunk/src/whiteboard/move.cpp Sat Jul 31 12:15:33 2010
@@ -21,11 +21,11 @@
 #include "visitor.hpp"
 #include "manager.hpp"
 
-#include "actions.hpp"
 #include "arrow.hpp"
 #include "config.hpp"
 #include "foreach.hpp"
 #include "game_display.hpp"
+#include "mouse_events.hpp"
 #include "play_controller.hpp"
 #include "replay.hpp"
 #include "resources.hpp"
@@ -113,20 +113,23 @@
 
        arrow_->set_alpha(ALPHA_HIGHLIGHT);
 
-       static const bool show_move = true;
        map_location final_location;
-       int steps_done = ::move_unit(NULL, route_->steps, &recorder, 
resources::undo_stack, show_move, &final_location,
-                       false, get_current_team().auto_shroud_updates());
-       // final_location now contains the final unit location
-       // if that isn't needed, pass NULL rather than &final_location
+       bool steps_finished;
+       {
+               events::mouse_handler& mouse_handler = 
resources::controller->get_mouse_handler_base();
+               team const& viewing_team = 
(*resources::teams)[resources::screen->viewing_team()];
+               steps_finished = mouse_handler.move_unit_along_route(*route_, 
&final_location, viewing_team.auto_shroud_updates());
+               // final_location now contains the final unit location
+               // if that isn't needed, pass NULL rather than &final_location
+       }
 
        unit_map::const_iterator unit_it;
 
-       if (route_->steps.back() == final_location)
+       if (steps_finished && route_->steps.back() == final_location)
        {
                move_finished_completely = true;
        }
-       else if (steps_done == 0)
+       else if (final_location == route_->steps.front())
        {
                LOG_WB << "Move execution resulted in zero movement.\n";
        }




Related Messages


Powered by MHonArc, Updated Sat Jul 31 12:20:17 2010