fixed "play side turn" not working (bug #11118)

at least partly fix "replays always corrupt" (bug #10976)

commiting for YogiHH/jhinrichs since network is not working for him here at FOSDEM:
This commit is contained in:
Nils Kneuper 2008-02-24 14:56:31 +00:00
parent 741a8d9f5e
commit a04bfae9b5
2 changed files with 24 additions and 12 deletions

View file

@ -12,6 +12,9 @@ Version 1.3.18+svn:
* All animations are disabled when the LOW_MEM compile switch is activated * All animations are disabled when the LOW_MEM compile switch is activated
* correct FIREBALL_MISSILE not being synchronized properly. All UMC users * correct FIREBALL_MISSILE not being synchronized properly. All UMC users
need to check units using that macro need to check units using that macro
* replays:
* fixed "play side turn" not working (bug #11118)
* at least partly fix "replays always corrupt" (bug #10976)
Version 1.3.18: Version 1.3.18:
* campaigns: * campaigns:

View file

@ -286,27 +286,24 @@ void replay_controller::play_turn(){
gui_->invalidate_game_status(); gui_->invalidate_game_status();
events::raise_draw_event(); events::raise_draw_event();
while ((static_cast<size_t>(player_number_) <= teams_.size()) && bool last_team = false;
(!recorder.at_end())){
while ( (!last_team) && (!recorder.at_end()) ){
last_team = static_cast<size_t>(player_number_) == teams_.size();
play_side(player_number_ - 1, false); play_side(player_number_ - 1, false);
play_slice(); play_slice();
player_number_++;
update_teams();
update_gui();
} }
status_.next_turn();
finish_turn();
player_number_ = 1;
current_turn_++;
} }
void replay_controller::play_side(const unsigned int /*team_index*/, bool){ void replay_controller::play_side(const unsigned int /*team_index*/, bool){
if (recorder.at_end()){ if (recorder.at_end()){
return; return;
} }
DBG_REPLAY << "Status turn number: " << status_.turn() << "\n";
DBG_REPLAY << "Replay_Controller turn number: " << current_turn_ << "\n";
DBG_REPLAY << "Player number: " << player_number_ << "\n";
// If a side is empty skip over it. // If a side is empty skip over it.
if (current_team().is_empty()) return; if (current_team().is_empty()) return;
@ -333,6 +330,18 @@ void replay_controller::play_side(const unsigned int /*team_index*/, bool){
uit->second.new_turn(); uit->second.new_turn();
} }
} }
player_number_++;
if (static_cast<size_t>(player_number_) > teams_.size()){
status_.next_turn();
finish_turn();
player_number_ = 1;
current_turn_++;
}
update_teams();
update_gui();
} }
catch (replay::error&) //if replay throws an error, we don't want to get thrown out completely catch (replay::error&) //if replay throws an error, we don't want to get thrown out completely
{ {