Update check_victory

Backports d808b7c787


Now the game ends on all client at the same time even with victory_when_enemies_defeated_= no.

previously in mp the attribute victory_when_enemies_defeated only prevents victory for human sides but doesn't prevent defeats. This means in a simple 1vs1 Mp game with victory_when_enemies_defeated=no when side 1 gets defeated, Player 1 will get the "You have been defeated" message and for client 2 the game continues. I tested with adding victory_when_enemies_defeated =no in 2p_Arcanclave_Citadel.cfg.
When side 1 looses (leader killed) (during side 2' turn) the following happens:
[list=1]
[*]side 1 gets a "you get defeated", side 2 continues
[*]when side 1 checks "end scenario" side 2 gets a "side 1 has left the game... reassign controll to ai/human/idle/..."
[*]I clicked "controll by human" on client 2
[*]I ended side 2's turn and continued playing side 1 on client 2 and didnt get defeated
[/list]
I am sure that this is not the intended behaviour.

this commits also effects when "enemies defeated" is fired accodignly so it is fired on all clients at the same time like any synced event (previously using this event could casue OOS).
This commit is contained in:
gfgtdf 2015-07-26 20:46:53 +02:00
parent c030e1bff1
commit d625d49d37

View file

@ -1474,7 +1474,7 @@ void play_controller::check_victory()
}
}
if (found_player) {
if (found_player || found_network_player) {
game_events::fire("enemies defeated");
check_end_level();
}
@ -1484,7 +1484,7 @@ void play_controller::check_victory()
DBG_NG << "found_network_player: " << found_network_player << std::endl;
DBG_NG << "there_is_a_local_human: " << there_is_a_local_human << std::endl;
if (!victory_when_enemies_defeated_ && (found_player || (!there_is_a_local_human && found_network_player))) {
if (!victory_when_enemies_defeated_ && (found_player || found_network_player)) {
// This level has asked not to be ended by this condition.
return;
}