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:
woogerboy21
2016-12-07 07:52:39 -05:00
committed by GitHub
parent f86b9e0be7
commit c78eed576f
2 changed files with 6 additions and 5 deletions

View File

@@ -96,7 +96,6 @@ Server_Game::~Server_Game()
gameClosed = true;
sendGameEventContainer(prepareGameEvent(Event_GameClosed(), -1));
QMapIterator<int, Server_Player *> 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()