Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
#include "GameClient/GameWindowTransitions.h"
#include "GameClient/DisconnectMenu.h"
#include "GameLogic/ScriptEngine.h"
#include "GameNetwork/GeneralsOnline/OnlineServices_LobbyInterface.h"



Expand Down Expand Up @@ -193,13 +192,6 @@ static void surrenderQuitMenu()
msg->appendBooleanArgument(TRUE);

TheInGameUI->setClientQuiet( TRUE );

// If observers are disabled and we are not the host, exit game instead of observing
if (TheNGMPGame && !TheNGMPGame->getAllowObservers() && !TheNGMPGame->amIHost())
{
TheGameLogic->exitGame();
return;
}
}

static void restartMissionMenu()
Expand Down
25 changes: 25 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4011,6 +4011,31 @@ void GameLogic::update(void)
TheLocomotorStore->UPDATE();
TheVictoryConditions->UPDATE();

// When observers are disabled by host on GO, remove the non host player from game 10 seconds after they are defeated
static int observerKickCountdown = -1;
Player* localPlayer = ThePlayerList->getLocalPlayer();

if (TheNGMPGame && !TheNGMPGame->getAllowObservers() && !TheNGMPGame->amIHost() &&
TheGameLogic->getGameMode() == GAME_INTERNET && TheGameLogic->getFrame() > 1 &&
localPlayer && TheVictoryConditions->hasSinglePlayerBeenDefeated(localPlayer))
{
if (observerKickCountdown < 0)
observerKickCountdown = LOGICFRAMES_PER_SECOND * 10;

if (observerKickCountdown > 0)
{
observerKickCountdown--;
}
else {
TheGameLogic->exitGame(); // Time's up. kick the player
observerKickCountdown = -1;
return;
}
}
else {
observerKickCountdown = -1;
}

{
//Handle disabled statii (and re-enable objects once frame matches)
for (Object* obj = m_objList; obj; obj = obj->getNextObject())
Expand Down
Loading