remove show parameter from recruit_unit

This commit is contained in:
gfgtdf 2024-11-12 02:06:20 +01:00 committed by sevu
parent 3d589f8d0d
commit 24ad4cb9d2
3 changed files with 8 additions and 11 deletions

View file

@ -714,9 +714,9 @@ place_recruit_result place_recruit(unit_ptr u, const map_location &recruit_locat
}
void recruit_unit(const unit_type & u_type, int side_num, const map_location & loc,
const map_location & from, bool show)
const map_location & from)
{
show = show && !resources::controller->is_skipping_actions();
bool show = !resources::controller->is_skipping_actions();
const unit_ptr new_unit = unit::create(u_type, side_num, true);
@ -739,9 +739,9 @@ void recruit_unit(const unit_type & u_type, int side_num, const map_location & l
bool recall_unit(const std::string & id, team & current_team,
const map_location & loc, const map_location & from,
map_location::direction facing, bool show)
map_location::direction facing)
{
show = show && !resources::controller->is_skipping_actions();
bool show = !resources::controller->is_skipping_actions();
unit_ptr recall = current_team.recall_list().extract_if_matches_id(id);
if ( !recall )

View file

@ -169,7 +169,7 @@ place_recruit_result place_recruit(unit_ptr u, const map_location &recruit_locat
* statistics, and (unless @a is_ai) updating the undo stack.
*/
void recruit_unit(const unit_type & u_type, int side_num, const map_location & loc,
const map_location & from, bool show=true);
const map_location & from);
/**
* Recalls the unit with the indicated ID for the provided team.
@ -189,6 +189,5 @@ void recruit_unit(const unit_type & u_type, int side_num, const map_location & l
*/
bool recall_unit(const std::string & id, team & current_team,
const map_location & loc, const map_location & from,
map_location::direction facing = map_location::direction::indeterminate,
bool show=true);
map_location::direction facing = map_location::direction::indeterminate);
}//namespace actions

View file

@ -67,7 +67,6 @@ synced_command::map& synced_command::registry()
SYNCED_COMMAND_HANDLER_FUNCTION(recruit, child, spectator)
{
bool show = !resources::controller->is_skipping_replay();
int current_team_num = resources::controller->current_side();
team &current_team = resources::gameboard->get_team(current_team_num);
@ -122,7 +121,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(recruit, child, spectator)
spectator.error(errbuf.str());
}
actions::recruit_unit(*u_type, current_team_num, loc, from, show);
actions::recruit_unit(*u_type, current_team_num, loc, from);
LOG_REPLAY << "recruit: team=" << current_team_num << " '" << type_id << "' at (" << loc
<< ") cost=" << u_type->cost() << " from gold=" << beginning_gold << ' '
@ -132,7 +131,6 @@ SYNCED_COMMAND_HANDLER_FUNCTION(recruit, child, spectator)
SYNCED_COMMAND_HANDLER_FUNCTION(recall, child, spectator)
{
bool show = !resources::controller->is_skipping_replay();
int current_team_num = resources::controller->current_side();
team &current_team = resources::gameboard->get_team(current_team_num);
@ -140,7 +138,7 @@ SYNCED_COMMAND_HANDLER_FUNCTION(recall, child, spectator)
map_location loc(child, resources::gamedata);
map_location from(child.child_or_empty("from"), resources::gamedata);
if(!actions::recall_unit(unit_id, current_team, loc, from, map_location::direction::indeterminate, show)) {
if(!actions::recall_unit(unit_id, current_team, loc, from, map_location::direction::indeterminate)) {
spectator.error("illegal recall: unit_id '" + unit_id + "' could not be found within the recall list.\n");
//when recall_unit returned false nothing happened so we can safety return false;
return false;