Fix store replays (#2301)
* Fix Store Replays Functionality For whatever reason we have a variable in the servers ini to enable/disable the storing of replays but there is no code that uses that variable. At one time there was but in light of it being removed some were along the line this add's the ability back in for server owners to disable the storing of game replay data. * Added code * Moved store replay check Moved the check for storing replay information into existing routine. * Updated Per Request Combined lines per request
This commit is contained in:
parent
f86b9e0be7
commit
c78eed576f
2 changed files with 6 additions and 5 deletions
|
@ -65,6 +65,7 @@ public:
|
||||||
virtual bool getRegOnlyServerEnabled() const { return false; }
|
virtual bool getRegOnlyServerEnabled() const { return false; }
|
||||||
virtual bool getMaxUserLimitEnabled() const { return false; }
|
virtual bool getMaxUserLimitEnabled() const { return false; }
|
||||||
virtual bool getEnableLogQuery() const { return false; }
|
virtual bool getEnableLogQuery() const { return false; }
|
||||||
|
virtual bool getStoreReplaysEnabled() const { return true; }
|
||||||
virtual int getIdleClientTimeout() const { return 0; }
|
virtual int getIdleClientTimeout() const { return 0; }
|
||||||
virtual int getClientKeepAlive() const { return 0; }
|
virtual int getClientKeepAlive() const { return 0; }
|
||||||
virtual int getMaxGameInactivityTime() const { return 9999999; }
|
virtual int getMaxGameInactivityTime() const { return 9999999; }
|
||||||
|
|
|
@ -96,7 +96,6 @@ Server_Game::~Server_Game()
|
||||||
|
|
||||||
gameClosed = true;
|
gameClosed = true;
|
||||||
sendGameEventContainer(prepareGameEvent(Event_GameClosed(), -1));
|
sendGameEventContainer(prepareGameEvent(Event_GameClosed(), -1));
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
while (playerIterator.hasNext())
|
while (playerIterator.hasNext())
|
||||||
playerIterator.next().value()->prepareDestroy();
|
playerIterator.next().value()->prepareDestroy();
|
||||||
|
@ -108,7 +107,6 @@ Server_Game::~Server_Game()
|
||||||
|
|
||||||
gameMutex.unlock();
|
gameMutex.unlock();
|
||||||
room->gamesLock.unlock();
|
room->gamesLock.unlock();
|
||||||
|
|
||||||
currentReplay->set_duration_seconds(secondsElapsed - startTimeOfThisGame);
|
currentReplay->set_duration_seconds(secondsElapsed - startTimeOfThisGame);
|
||||||
replayList.append(currentReplay);
|
replayList.append(currentReplay);
|
||||||
storeGameInformation();
|
storeGameInformation();
|
||||||
|
@ -155,13 +153,15 @@ void Server_Game::storeGameInformation()
|
||||||
server->clientsLock.lockForRead();
|
server->clientsLock.lockForRead();
|
||||||
while (allUsersIterator.hasNext()) {
|
while (allUsersIterator.hasNext()) {
|
||||||
Server_AbstractUserInterface *userHandler = server->findUser(allUsersIterator.next());
|
Server_AbstractUserInterface *userHandler = server->findUser(allUsersIterator.next());
|
||||||
if (userHandler)
|
if (userHandler && server->getStoreReplaysEnabled())
|
||||||
userHandler->sendProtocolItem(*sessionEvent);
|
userHandler->sendProtocolItem(*sessionEvent);
|
||||||
}
|
}
|
||||||
server->clientsLock.unlock();
|
server->clientsLock.unlock();
|
||||||
delete sessionEvent;
|
delete sessionEvent;
|
||||||
|
|
||||||
|
if (server->getStoreReplaysEnabled())
|
||||||
server->getDatabaseInterface()->storeGameInformation(room->getName(), gameTypes, gameInfo, allPlayersEver, allSpectatorsEver, replayList);
|
server->getDatabaseInterface()->storeGameInformation(room->getName(), gameTypes, gameInfo, allPlayersEver, allSpectatorsEver, replayList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server_Game::pingClockTimeout()
|
void Server_Game::pingClockTimeout()
|
||||||
|
|
Loading…
Reference in a new issue