mail[Wesnoth-commits] r43680 - /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 June 24, 2010 - 08:27:
Author: gabba
Date: Thu Jun 24 08:27:52 2010
New Revision: 43680

URL: http://svn.gna.org/viewcvs/wesnoth?rev=43680&view=rev
Log:
Whiteboard: handle case where executing move results in no movement, such as 
when unit has no movement points remaining.

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=43680&r1=43679&r2=43680&view=diff
==============================================================================
--- trunk/src/whiteboard/move.cpp (original)
+++ trunk/src/whiteboard/move.cpp Thu Jun 24 08:27:52 2010
@@ -76,20 +76,25 @@
 
 bool move::execute()
 {
+       bool move_finished_completely = false;
+
        arrow_->set_alpha(ALPHA_HIGHLIGHT);
 
        const arrow_path_t& arrow_path = arrow_->get_path();
        static const bool show_move = false;
        map_location final_location;
-       ::move_unit(NULL, arrow_path, &recorder, resources::undo_stack, 
show_move, &final_location,
+       int steps_done = ::move_unit(NULL, arrow_path, &recorder, 
resources::undo_stack, show_move, &final_location,
                        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 move_finished_successfully = false;
        if (arrow_path.back() == final_location)
        {
-               move_finished_successfully = true;
+               move_finished_completely = true;
+       }
+       else if (steps_done == 0)
+       {
+               DBG_WB << "Move execution resulted in zero movement.\n";
        }
        else if (final_location.valid())
        {
@@ -124,7 +129,7 @@
                WRN_WB << "Unit disappeared from map during move execution; 
Case unhandled as yet.\n";
        }
 
-       return move_finished_successfully;
+       return move_finished_completely;
 }
 
 modifier_ptr move::apply_temp_modifier(unit_map& unit_map)




Related Messages


Powered by MHonArc, Updated Thu Jun 24 09:00:20 2010