//move all sides till stop/end
possible_end_play_signal replay_controller::play_replay(){

	if (recorder.at_end()){
		//shouldn't actually happen
		return boost::none;
	}

	is_playing_ = true;
	replay_ui_playback_should_start();

	possible_end_play_signal signal = play_replay_main_loop();

	if(signal) {
		switch ( boost::apply_visitor(get_signal_type(), *signal)) {
			case END_TURN:
				return signal;
			case END_LEVEL:
				if ( boost::apply_visitor(get_result(), *signal) == QUIT) {
					return signal;
				}
		}

	}

	if (!is_playing_) {
		gui_->scroll_to_leader(player_number_,game_display::ONSCREEN,false);
	}

	replay_ui_playback_should_stop();

	return boost::none;
}
Ejemplo n.º 2
0
//move all sides till stop/end
void replay_controller::play_replay(){

	if (recorder.at_end()){
		//shouldn't actually happen
		return;
	}

	try{
		is_playing_ = true;
		replay_ui_playback_should_start();

		DBG_REPLAY << "starting main loop\n" << (SDL_GetTicks() - ticks_) << "\n";
		for(; !recorder.at_end() && is_playing_; first_player_ = 1) {
			play_turn();
		}

		if (!is_playing_) {
			gui_->scroll_to_leader(units_, player_number_,game_display::ONSCREEN,false);
		}
	}
	catch(end_level_exception& e){
		if (e.result == QUIT) throw;
	}

	replay_ui_playback_should_stop();
}
Ejemplo n.º 3
0
void replay_controller::replay_next_turn(){
	is_playing_ = true;
	replay_ui_playback_should_start();

	play_turn();

 	if (!skip_replay_ || !is_playing_){
		gui_->scroll_to_leader(units_, player_number_,game_display::ONSCREEN,false);
	}

	replay_ui_playback_should_stop();
}
possible_end_play_signal replay_controller::replay_next_turn(){
	is_playing_ = true;
	replay_ui_playback_should_start();

	PROPOGATE_END_PLAY_SIGNAL( play_turn() );

 	if (!skip_replay_ || !is_playing_){
		gui_->scroll_to_leader(player_number_,game_display::ONSCREEN,false);
	}

	replay_ui_playback_should_stop();
	return boost::none;
}
Ejemplo n.º 5
0
void replay_controller::replay_next_side(){
	is_playing_ = true;
	replay_ui_playback_should_start();

	play_side(player_number_ - 1, false);
	while (current_team().is_empty()) {
		play_side(player_number_ - 1, false);
	}

	if (!skip_replay_ || !is_playing_) {
		gui_->scroll_to_leader(units_, player_number_,game_display::ONSCREEN,false);
	}

	replay_ui_playback_should_stop();
}
possible_end_play_signal replay_controller::replay_next_side(){
	is_playing_ = true;
	replay_ui_playback_should_start();

	HANDLE_END_PLAY_SIGNAL( play_side() );
	while (current_team().is_empty()) {
		HANDLE_END_PLAY_SIGNAL( play_side() );
	}

	if (!skip_replay_ || !is_playing_) {
		gui_->scroll_to_leader(player_number_,game_display::ONSCREEN,false);
	}

	replay_ui_playback_should_stop();
	return boost::none;
}