Skip to content

Commit

Permalink
fix 21933
Browse files Browse the repository at this point in the history
durign human turns, we now use check_victory which impied check_end_level, just like we du during ai turns.
I think actions having different when invoked by ai can never be the intended behaviour.
we also set tm->set_lost() before calling check_turn_end to that the lost_ value is also correct when ending with [endlevel]
  • Loading branch information
gfgtdf committed Apr 23, 2014
1 parent 10aa171 commit 8dee1f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/play_controller.cpp
Expand Up @@ -569,7 +569,7 @@ void play_controller::fire_start(bool execute){
if(execute) {
gamedata_.set_phase(game_data::START);
game_events::fire("start");
check_end_level();
check_victory();
// start event may modify start turn with WML, reflect any changes.
start_turn_ = turn();
gamedata_.get_variable("turn_number") = int(start_turn_);
Expand Down Expand Up @@ -1388,8 +1388,6 @@ void play_controller::set_defeat_music_list(const std::string& list)

void play_controller::check_victory()
{
check_end_level();

std::set<unsigned> not_defeated;
for (unit_map::const_iterator i = units_.begin(),
i_end = units_.end(); i != i_end; ++i)
Expand Down Expand Up @@ -1420,6 +1418,8 @@ void play_controller::check_victory()
}
}

check_end_level();

bool found_player = false;

for (std::set<unsigned>::iterator n = not_defeated.begin(); n != not_defeated.end(); ++n) {
Expand Down
6 changes: 3 additions & 3 deletions src/playmp_controller.cpp
Expand Up @@ -218,7 +218,7 @@ void playmp_controller::play_human_turn(){
}

play_slice();
check_end_level();
check_victory();
// give a chance to the whiteboard to continue an execute_all_actions
resources::whiteboard->continue_execute_all();
} catch(const end_level_exception&) {
Expand Down Expand Up @@ -284,7 +284,7 @@ void playmp_controller::play_idle_loop()
}

play_slice();
check_end_level();
check_victory();
} catch(const end_level_exception&) {
turn_data_->send_data();
throw;
Expand Down Expand Up @@ -510,7 +510,7 @@ void playmp_controller::play_network_turn(){
}

play_slice();
check_end_level();
check_victory();

if (!network_processing_stopped_){
turn_data.send_data();
Expand Down
4 changes: 2 additions & 2 deletions src/playsingle_controller.cpp
Expand Up @@ -794,7 +794,7 @@ void playsingle_controller::play_human_turn() {
end_turn_enable(true);
while(!end_turn_) {
play_slice();
check_end_level();
check_victory();
gui_->draw();
}
}
Expand Down Expand Up @@ -991,7 +991,7 @@ void playsingle_controller::check_time_over(){
ai_testing::log_draw();
}

check_end_level();
check_victory();
throw end_level_exception(DEFEAT);
}
}
Expand Down

0 comments on commit 8dee1f3

Please sign in to comment.