Skip to content

Commit

Permalink
move "move survivors to recall" code play_controller -> game_board
Browse files Browse the repository at this point in the history
Added at "all_survivors_to_recall" function
  • Loading branch information
cbeck88 committed Jun 9, 2014
1 parent 3c54dd6 commit 18dabe4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
10 changes: 10 additions & 0 deletions src/game_board.cpp
Expand Up @@ -51,6 +51,16 @@ void game_board::set_all_units_user_end_turn() {
}
}

void game_board::all_survivors_to_recall() {
BOOST_FOREACH (unit & un, units_) {
if (teams_[un.side() - 1].persistent()) {
un.new_turn();
un.new_scenario();
teams_[un.side() - 1].recall_list().push_back(un);
}
}
}

unit_map::iterator game_board::find_visible_unit(const map_location &loc,
const team& current_team, bool see_all)
{
Expand Down
2 changes: 2 additions & 0 deletions src/game_board.hpp
Expand Up @@ -100,6 +100,8 @@ class game_board {
void end_turn(int pnum);
void set_all_units_user_end_turn();

void all_survivors_to_recall();

// Manipulator from playturn

void side_drop_to (int side_num, team::CONTROLLER ctrl);
Expand Down
10 changes: 2 additions & 8 deletions src/playsingle_controller.cpp
Expand Up @@ -565,14 +565,8 @@ LEVEL_RESULT playsingle_controller::play_scenario(

// Add all the units that survived the scenario.
LOG_NG << "Add units that survived the scenario to the recall list.\n";
BOOST_FOREACH (unit & un, gameboard_.units_) {
if (gameboard_.teams_[un.side() - 1].persistent()) {
LOG_NG << "Added unit " << un.id() << ", " << un.name() << "\n";
un.new_turn();
un.new_scenario();
gameboard_.teams_[un.side() - 1].recall_list().push_back(un);
}
}
gameboard_.all_survivors_to_recall();

gamestate_.snapshot = config();
if(!is_observer()) {
persist_.end_transaction();
Expand Down

0 comments on commit 18dabe4

Please sign in to comment.