Fixed replay player bug: Team1 point of view now should work

This commit is contained in:
Bartek Waresiak 2011-02-05 17:00:36 +00:00
parent 0f5584ba52
commit 60a41ba7ed
4 changed files with 12 additions and 9 deletions

View file

@ -513,7 +513,7 @@ void play_controller::init_side(const unsigned int team_index, bool is_replay){
team& current_team = teams_[team_index];
mouse_handler_.set_side(team_index + 1);
// If we are observers we move to watch next team if it is allowed
if (is_observer()
&& !current_team.get_disallow_observers()) {
@ -535,13 +535,13 @@ void play_controller::init_side(const unsigned int team_index, bool is_replay){
|| is_replay)
return;
if (!loading_game_) recorder.init_side();
do_init_side(team_index);
do_init_side(team_index, is_replay);
}
/**
* Called by replay handler or init_side() to do actual work for turn change.
*/
void play_controller::do_init_side(const unsigned int team_index){
void play_controller::do_init_side(const unsigned int team_index, bool is_replay) {
log_scope("player turn");
team& current_team = teams_[team_index];
@ -563,7 +563,7 @@ void play_controller::do_init_side(const unsigned int team_index){
game_events::fire("side " + side_num + " turn " + turn_num);
}
if(current_team.is_human()) {
if(current_team.is_human() && !is_replay) {
gui_->set_team(player_number_ - 1);
gui_->recalculate_minimap();
gui_->invalidate_all();

View file

@ -94,7 +94,7 @@ public:
virtual void toggle_grid();
virtual void search();
virtual void do_init_side(const unsigned int team_index);
virtual void do_init_side(const unsigned int team_index, bool is_replay = false);
virtual void play_side(const unsigned int team_num, bool save) = 0;
virtual void force_end_turn() = 0;

View file

@ -871,7 +871,7 @@ bool do_replay_handle(int side_num, const std::string &do_untill)
else if (cfg->child("init_side"))
{
resources::controller->do_init_side(side_num - 1);
resources::controller->do_init_side(side_num - 1, true);
}
//if there is an end turn directive

View file

@ -348,15 +348,18 @@ void replay_controller::play_side(const unsigned int /*team_index*/, bool){
}
void replay_controller::update_teams(){
int next_team = player_number_;
if(static_cast<size_t>(next_team) > teams_.size()) {
next_team = 1;
}
if (!show_team_)
gui_->set_team(next_team - 1, show_everything_);
if (!show_team_) {
gui_->set_team(next_team - 1, show_everything_);
}
::clear_shroud(next_team);
gui_->set_playing_team(next_team - 1);
gui_->invalidate_all();
}