Author: tschmitz
Date: Thu Aug 4 00:00:55 2011
New Revision: 50578
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50578&view=rev
Log:
Fixed: ability to move leader when recruits are planned.
Modified:
trunk/src/mouse_events.cpp
trunk/src/whiteboard/move.cpp
Modified: trunk/src/mouse_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=50578&r1=50577&r2=50578&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Thu Aug 4 00:00:55 2011
@@ -617,17 +617,6 @@
return false;
}
- //If this is a leader on a keep, ask permission to the
whiteboard to move it
- //since otherwise it may cause planned recruits to be
erased.
- if (u->can_recruit() && u->side() ==
gui().viewing_side() &&
- resources::game_map->is_keep(u->get_location())
&&
-
!resources::whiteboard->allow_leader_to_move(*u))
- {
- gui2::show_transient_message(gui_->video(), "",
- _("You cannot move your leader
away from the keep with some planned recruits left."));
- return false;
- }
-
//register the mouse-UI waypoints into the unit's
waypoints
u->waypoints() = waypoints_;
@@ -721,6 +710,26 @@
const std::vector<map_location> steps = route.steps;
if(steps.empty()) {
return false;
+ }
+
+ //If this is a leader on a keep, ask permission to the whiteboard to
move it
+ //since otherwise it may cause planned recruits to be erased.
+ {
+ unit_map::const_iterator const u = units_.find(steps.front());
+
+ if (u != units_.end()
+ && u->can_recruit()
+ && u->side() == gui().viewing_side()
+ &&
resources::game_map->is_keep(u->get_location())
+ &&
!resources::whiteboard->allow_leader_to_move(*u))
+ {
+ gui2::show_transient_message(gui_->video(), "",
+ _("You cannot move your leader away
from the keep with some planned recruits left."));
+
+ if(next_unit)
+ *next_unit = steps.front();
+ return false;
+ }
}
size_t moves = 0;
Modified: trunk/src/whiteboard/move.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/move.cpp?rev=50578&r1=50577&r2=50578&view=diff
==============================================================================
--- trunk/src/whiteboard/move.cpp (original)
+++ trunk/src/whiteboard/move.cpp Thu Aug 4 00:00:55 2011
@@ -263,7 +263,8 @@
if (final_location == route_->steps.front())
{
- WRN_WB << "Move execution resulted in zero movement.\n";
+ LOG_WB << "Move execution resulted in zero movement.\n";
+ result = action::FAIL;
}
else if (final_location.valid() &&
(unit_it = resources::units->find(final_location)) !=
resources::units->end()
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits