mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Simplified and fixed server restart procedure:
- Replaced several assertions with runtime_error's to detect them in release builds - Removed multiple dispatchMainThread calls in server shutdown code to simplify debugging and code flow - Moved handling of gameplay shutdown and score calculation from PlayerInterface to ServerHandler (not perfect, but better than before)
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#include "CGameInfo.h"
|
||||
#include "windows/GUIClasses.h"
|
||||
#include "mapView/mapHandler.h"
|
||||
#include "adventureMap/AdventureMapInterface.h"
|
||||
#include "adventureMap/CInGameConsole.h"
|
||||
#include "battle/BattleInterface.h"
|
||||
#include "battle/BattleWindow.h"
|
||||
@ -408,6 +409,20 @@ void ApplyClientNetPackVisitor::visitPlayerEndsGame(PlayerEndsGame & pack)
|
||||
{
|
||||
callAllInterfaces(cl, &IGameEventsReceiver::gameOver, pack.player, pack.victoryLossCheckResult);
|
||||
|
||||
bool lastHumanEndsGame = CSH->howManyPlayerInterfaces() == 1 && vstd::contains(cl.playerint, pack.player) && cl.getPlayerState(pack.player)->human && !settings["session"]["spectate"].Bool();
|
||||
|
||||
if (lastHumanEndsGame)
|
||||
{
|
||||
assert(adventureInt);
|
||||
if(adventureInt)
|
||||
{
|
||||
GH.windows().popWindows(GH.windows().count());
|
||||
adventureInt.reset();
|
||||
}
|
||||
|
||||
CSH->showHighScoresAndEndGameplay(pack.player, pack.victoryLossCheckResult.victory());
|
||||
}
|
||||
|
||||
// In auto testing pack.mode we always close client if red pack.player won or lose
|
||||
if(!settings["session"]["testmap"].isNull() && pack.player == PlayerColor(0))
|
||||
{
|
||||
|
Reference in New Issue
Block a user