fix 21933
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]
This commit is contained in:
parent
bcf2852761
commit
e454252f21
3 changed files with 8 additions and 8 deletions
|
@ -569,7 +569,7 @@ void play_controller::fire_start(bool execute){
|
||||||
if(execute) {
|
if(execute) {
|
||||||
gamedata_.set_phase(game_data::START);
|
gamedata_.set_phase(game_data::START);
|
||||||
game_events::fire("start");
|
game_events::fire("start");
|
||||||
check_end_level();
|
check_victory();
|
||||||
// start event may modify start turn with WML, reflect any changes.
|
// start event may modify start turn with WML, reflect any changes.
|
||||||
start_turn_ = turn();
|
start_turn_ = turn();
|
||||||
gamedata_.get_variable("turn_number") = int(start_turn_);
|
gamedata_.get_variable("turn_number") = int(start_turn_);
|
||||||
|
@ -1376,8 +1376,6 @@ void play_controller::set_defeat_music_list(const std::string& list)
|
||||||
|
|
||||||
void play_controller::check_victory()
|
void play_controller::check_victory()
|
||||||
{
|
{
|
||||||
check_end_level();
|
|
||||||
|
|
||||||
std::set<unsigned> not_defeated;
|
std::set<unsigned> not_defeated;
|
||||||
for (unit_map::const_iterator i = units_.begin(),
|
for (unit_map::const_iterator i = units_.begin(),
|
||||||
i_end = units_.end(); i != i_end; ++i)
|
i_end = units_.end(); i != i_end; ++i)
|
||||||
|
@ -1408,6 +1406,8 @@ void play_controller::check_victory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_end_level();
|
||||||
|
|
||||||
bool found_player = false;
|
bool found_player = false;
|
||||||
|
|
||||||
for (std::set<unsigned>::iterator n = not_defeated.begin(); n != not_defeated.end(); ++n) {
|
for (std::set<unsigned>::iterator n = not_defeated.begin(); n != not_defeated.end(); ++n) {
|
||||||
|
|
|
@ -218,7 +218,7 @@ void playmp_controller::play_human_turn(){
|
||||||
}
|
}
|
||||||
|
|
||||||
play_slice();
|
play_slice();
|
||||||
check_end_level();
|
check_victory();
|
||||||
// give a chance to the whiteboard to continue an execute_all_actions
|
// give a chance to the whiteboard to continue an execute_all_actions
|
||||||
resources::whiteboard->continue_execute_all();
|
resources::whiteboard->continue_execute_all();
|
||||||
} catch(const end_level_exception&) {
|
} catch(const end_level_exception&) {
|
||||||
|
@ -284,7 +284,7 @@ void playmp_controller::play_idle_loop()
|
||||||
}
|
}
|
||||||
|
|
||||||
play_slice();
|
play_slice();
|
||||||
check_end_level();
|
check_victory();
|
||||||
} catch(const end_level_exception&) {
|
} catch(const end_level_exception&) {
|
||||||
turn_data_->send_data();
|
turn_data_->send_data();
|
||||||
throw;
|
throw;
|
||||||
|
@ -510,7 +510,7 @@ void playmp_controller::play_network_turn(){
|
||||||
}
|
}
|
||||||
|
|
||||||
play_slice();
|
play_slice();
|
||||||
check_end_level();
|
check_victory();
|
||||||
|
|
||||||
if (!network_processing_stopped_){
|
if (!network_processing_stopped_){
|
||||||
turn_data.send_data();
|
turn_data.send_data();
|
||||||
|
|
|
@ -792,7 +792,7 @@ void playsingle_controller::play_human_turn() {
|
||||||
end_turn_enable(true);
|
end_turn_enable(true);
|
||||||
while(!end_turn_) {
|
while(!end_turn_) {
|
||||||
play_slice();
|
play_slice();
|
||||||
check_end_level();
|
check_victory();
|
||||||
gui_->draw();
|
gui_->draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -989,7 +989,7 @@ void playsingle_controller::check_time_over(){
|
||||||
ai_testing::log_draw();
|
ai_testing::log_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
check_end_level();
|
check_victory();
|
||||||
throw end_level_exception(DEFEAT);
|
throw end_level_exception(DEFEAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue