mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-20 16:05:19 +00:00
Whiteboard/recruit: changed the place the wb intercepts recruit,
...and added planned unit map scopes. Fixes being able to plan a recruit anywhere, or to plan two recruits on the same hex.
This commit is contained in:
parent
1b359bda70
commit
c96f1e199d
@ -723,10 +723,8 @@ void menu_handler::recruit(int side_num, const map_location &last_hex)
|
||||
}
|
||||
|
||||
if(recruit_res != -1) {
|
||||
if (!resources::whiteboard->save_recruit(item_keys[recruit_res], side_num, last_hex)) {
|
||||
do_recruit(item_keys[recruit_res], side_num, last_hex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -758,22 +756,28 @@ void menu_handler::do_recruit(const std::string &name, int side_num,
|
||||
const unit_type *u_type = unit_types.find(name);
|
||||
assert(u_type);
|
||||
|
||||
{ wb::scoped_planned_pathfind_map future; //< start planned pathfind map scope
|
||||
if (u_type->cost() > current_team.gold()) {
|
||||
gui2::show_transient_message(gui_->video(), "",
|
||||
_("You don't have enough gold to recruit that unit"));
|
||||
return;
|
||||
}
|
||||
} // end planned pathfind map scope
|
||||
|
||||
last_recruit_ = name;
|
||||
const events::command_disabler disable_commands;
|
||||
|
||||
map_location loc = last_hex;
|
||||
const std::string &msg = find_recruit_location(side_num, loc);
|
||||
std::string msg;
|
||||
{ wb::scoped_planned_pathfind_map future; //< start planned pathfind map scope
|
||||
msg = find_recruit_location(side_num, loc);
|
||||
} // end planned pathfind map scope
|
||||
if (!msg.empty()) {
|
||||
gui2::show_transient_message(gui_->video(), "", msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!resources::whiteboard->save_recruit(name, side_num, loc)) {
|
||||
//create a unit with traits
|
||||
recorder.add_recruit(recruit_num, loc);
|
||||
const unit new_unit(u_type, side_num, true);
|
||||
@ -801,6 +805,7 @@ void menu_handler::do_recruit(const std::string &name, int side_num,
|
||||
gui_->invalidate_game_status();
|
||||
gui_->invalidate_all();
|
||||
recorder.add_checksum_check(loc);
|
||||
}
|
||||
}
|
||||
|
||||
void menu_handler::recall(int side_num, const map_location &last_hex)
|
||||
|
Loading…
x
Reference in New Issue
Block a user