Skip to content

Commit

Permalink
play_turn signals instead of throwing in replay_controller
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jun 8, 2014
1 parent ccbe0b5 commit 08edc77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/replay_controller.cpp
Expand Up @@ -369,7 +369,7 @@ possible_end_play_signal replay_controller::replay_next_turn(){
is_playing_ = true;
replay_ui_playback_should_start();

HANDLE_END_PLAY_SIGNAL( play_turn() );
PROPOGATE_END_PLAY_SIGNAL( play_turn() );

if (!skip_replay_ || !is_playing_){
gui_->scroll_to_leader(gameboard_.units_, player_number_,game_display::ONSCREEN,false);
Expand Down Expand Up @@ -477,13 +477,13 @@ possible_end_play_signal replay_controller::play_replay(){
possible_end_play_signal replay_controller::play_replay_main_loop() {
DBG_REPLAY << "starting main loop\n" << (SDL_GetTicks() - ticks_) << "\n";
for(; !recorder.at_end() && is_playing_; first_player_ = 1) {
HANDLE_END_PLAY_SIGNAL ( play_turn() );
PROPOGATE_END_PLAY_SIGNAL ( play_turn() );
}
return boost::none;
}

//make all sides move, then stop
void replay_controller::play_turn(){
possible_end_play_signal replay_controller::play_turn(){

LOG_REPLAY << "turn: " << current_turn_ << "\n";

Expand All @@ -495,9 +495,10 @@ void replay_controller::play_turn(){

while ( (!last_team) && (!recorder.at_end()) && is_playing_ ){
last_team = static_cast<size_t>(player_number_) == gameboard_.teams_.size();
play_side();
play_slice();
HANDLE_END_PLAY_SIGNAL( play_side() );
HANDLE_END_PLAY_SIGNAL( play_slice() );
}
return boost::none;
}

//make only one side move
Expand Down
2 changes: 1 addition & 1 deletion src/replay_controller.hpp
Expand Up @@ -59,7 +59,7 @@ class replay_controller : public play_controller

private:
void init();
virtual void play_turn();
possible_end_play_signal play_turn();
virtual void play_side();
void update_teams();
void update_gui();
Expand Down

0 comments on commit 08edc77

Please sign in to comment.