/* Note: Hide the unit in its current location; do not actually remove it. * Otherwise the status displays will be wrong during the movement. */ void unit_mover::replace_temporary(unit_ptr u) { if ( disp_ == nullptr ) // No point in creating a temp unit with no way to display it. return; // Save the hidden state of the unit. was_hidden_ = u->get_hidden(); // Make our temporary unit mostly match u... temp_unit_ptr_ = fake_unit_ptr(unit_ptr(new unit(*u)), resources::fake_units); // ... but keep the temporary unhidden and hide the original. temp_unit_ptr_->set_hidden(false); u->set_hidden(true); // Update cached data. is_enemy_ = (*resources::teams)[u->side()-1].is_enemy(disp_->viewing_side()); }
bool game_board::try_add_unit_to_recall_list(const map_location&, const unit_ptr u) { teams_[u->side()-1].recall_list().add(u); return true; }