Пример #1
0
/**
 * Redoes this action.
 * @return true on success; false on an error.
 */
bool dismiss_action::redo(int side)
{
	team &current_team = resources::gameboard->teams()[side-1];

	resources::recorder->redo(replay_data);
	replay_data.clear();
	current_team.recall_list().erase_if_matches_id(dismissed_unit->id());
	execute_redo_umc_wml();
	return true;
}
Пример #2
0
/**
 * Redoes this action.
 * @return true on success; false on an error.
 */
bool move_action::redo(int side)
{
	game_display & gui = *resources::screen;
	unit_map &   units = *resources::units;
	team &current_team = (*resources::teams)[side-1];

	// Check units.
	unit_map::iterator u = units.find(route.front());
	if ( u == units.end() ) {
		ERR_NG << "Illegal movement 'redo'." << std::endl;
		assert(false);
		return false;
	}

	// Adjust starting moves.
	const int saved_moves = starting_moves;
	starting_moves = u->movement_left();

	// Move the unit.
	unit_display::move_unit(route, u.get_shared_ptr());
	units.move(u->get_location(), route.back());
	u = units.find(route.back());
	unit::clear_status_caches();

	// Set the unit's state.
	u->set_goto(goto_hex);
	u->set_movement(saved_moves, true);
	u->anim_comp().set_standing();

	if ( resources::gameboard->map().is_village(route.back()) ) {
		get_village(route.back(), u->side(), NULL, false);
		//MP_COUNTDOWN restore capture bonus
		if ( countdown_time_bonus )
		{
			current_team.set_action_bonus_count(1 + current_team.action_bonus_count());
		}
	}

	gui.invalidate_unit_after_move(route.front(), route.back());
	resources::recorder->redo(replay_data);
	replay_data.clear();
	execute_redo_umc_wml();
	return true;
}