File tree Expand file tree Collapse file tree
GeneralsMD/Code/GameEngine/Source Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5353#include " GameClient/GameWindowTransitions.h"
5454#include " GameClient/DisconnectMenu.h"
5555#include " GameLogic/ScriptEngine.h"
56- #include " GameNetwork/GeneralsOnline/OnlineServices_LobbyInterface.h"
5756
5857
5958
@@ -193,13 +192,6 @@ static void surrenderQuitMenu()
193192 msg->appendBooleanArgument (TRUE );
194193
195194 TheInGameUI->setClientQuiet ( TRUE );
196-
197- // If observers are disabled and we are not the host, exit game instead of observing
198- if (TheNGMPGame && !TheNGMPGame->getAllowObservers () && !TheNGMPGame->amIHost ())
199- {
200- TheGameLogic->exitGame ();
201- return ;
202- }
203195}
204196
205197static void restartMissionMenu ()
Original file line number Diff line number Diff line change @@ -4011,6 +4011,31 @@ void GameLogic::update(void)
40114011 TheLocomotorStore->UPDATE ();
40124012 TheVictoryConditions->UPDATE ();
40134013
4014+ // When observers are disabled by host on GO, remove the non host player from game 10 seconds after they are defeated
4015+ static int observerKickCountdown = -1 ;
4016+ Player* localPlayer = ThePlayerList->getLocalPlayer ();
4017+
4018+ if (TheNGMPGame && !TheNGMPGame->getAllowObservers () && !TheNGMPGame->amIHost () &&
4019+ TheGameLogic->getGameMode () == GAME_INTERNET && TheGameLogic->getFrame () > 1 &&
4020+ localPlayer && TheVictoryConditions->hasSinglePlayerBeenDefeated (localPlayer))
4021+ {
4022+ if (observerKickCountdown < 0 )
4023+ observerKickCountdown = LOGICFRAMES_PER_SECOND * 10 ;
4024+
4025+ if (observerKickCountdown > 0 )
4026+ {
4027+ observerKickCountdown--;
4028+ }
4029+ else {
4030+ TheGameLogic->exitGame (); // Time's up. kick the player
4031+ observerKickCountdown = -1 ;
4032+ return ;
4033+ }
4034+ }
4035+ else {
4036+ observerKickCountdown = -1 ;
4037+ }
4038+
40144039 {
40154040 // Handle disabled statii (and re-enable objects once frame matches)
40164041 for (Object* obj = m_objList; obj; obj = obj->getNextObject ())
You can’t perform that action at this time.
0 commit comments