mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-11 10:20:51 +00:00
Fixed: ability to move leader when recruits are planned.
This commit is contained in:
parent
e0af996ea3
commit
2c73eb7501
@ -617,17 +617,6 @@ bool mouse_handler::left_click(int x, int y, const bool browse)
|
||||
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_;
|
||||
|
||||
@ -723,6 +712,26 @@ bool mouse_handler::move_unit_along_route(pathfind::marked_route const& route, m
|
||||
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;
|
||||
try {
|
||||
moves = ::move_unit(NULL, steps, &recorder, resources::undo_stack, true, next_unit, false, check_shroud, false, sighted_result);
|
||||
|
@ -263,7 +263,8 @@ action::EXEC_RESULT move::execute()
|
||||
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user