diff --git a/common/server.h b/common/server.h index bdf172c9..a345e00a 100644 --- a/common/server.h +++ b/common/server.h @@ -65,6 +65,7 @@ public: virtual bool getRegOnlyServerEnabled() const { return false; } virtual bool getMaxUserLimitEnabled() const { return false; } virtual bool getEnableLogQuery() const { return false; } + virtual bool getStoreReplaysEnabled() const { return true; } virtual int getIdleClientTimeout() const { return 0; } virtual int getClientKeepAlive() const { return 0; } virtual int getMaxGameInactivityTime() const { return 9999999; } diff --git a/common/server_game.cpp b/common/server_game.cpp index 1a3e748f..673bb300 100644 --- a/common/server_game.cpp +++ b/common/server_game.cpp @@ -96,7 +96,6 @@ Server_Game::~Server_Game() gameClosed = true; sendGameEventContainer(prepareGameEvent(Event_GameClosed(), -1)); - QMapIterator playerIterator(players); while (playerIterator.hasNext()) playerIterator.next().value()->prepareDestroy(); @@ -108,7 +107,6 @@ Server_Game::~Server_Game() gameMutex.unlock(); room->gamesLock.unlock(); - currentReplay->set_duration_seconds(secondsElapsed - startTimeOfThisGame); replayList.append(currentReplay); storeGameInformation(); @@ -155,13 +153,15 @@ void Server_Game::storeGameInformation() server->clientsLock.lockForRead(); while (allUsersIterator.hasNext()) { Server_AbstractUserInterface *userHandler = server->findUser(allUsersIterator.next()); - if (userHandler) - userHandler->sendProtocolItem(*sessionEvent); + if (userHandler && server->getStoreReplaysEnabled()) + userHandler->sendProtocolItem(*sessionEvent); } server->clientsLock.unlock(); delete sessionEvent; - server->getDatabaseInterface()->storeGameInformation(room->getName(), gameTypes, gameInfo, allPlayersEver, allSpectatorsEver, replayList); + if (server->getStoreReplaysEnabled()) + server->getDatabaseInterface()->storeGameInformation(room->getName(), gameTypes, gameInfo, allPlayersEver, allSpectatorsEver, replayList); + } void Server_Game::pingClockTimeout()