mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-21 23:00:24 -08:00
fixed bug #61: replay doesn't show game info; also fixed playing area not being displayed in any subgame but the first
This commit is contained in:
@@ -53,6 +53,7 @@ Server_Game::Server_Game(const ServerInfo_User &_creatorInfo, int _gameId, const
|
|||||||
hostId(0),
|
hostId(0),
|
||||||
creatorInfo(new ServerInfo_User(_creatorInfo)),
|
creatorInfo(new ServerInfo_User(_creatorInfo)),
|
||||||
gameStarted(false),
|
gameStarted(false),
|
||||||
|
gameClosed(false),
|
||||||
gameId(_gameId),
|
gameId(_gameId),
|
||||||
description(_description),
|
description(_description),
|
||||||
password(_password),
|
password(_password),
|
||||||
@@ -92,6 +93,7 @@ Server_Game::~Server_Game()
|
|||||||
room->gamesMutex.lock();
|
room->gamesMutex.lock();
|
||||||
gameMutex.lock();
|
gameMutex.lock();
|
||||||
|
|
||||||
|
gameClosed = true;
|
||||||
sendGameEventContainer(prepareGameEvent(Event_GameClosed(), -1));
|
sendGameEventContainer(prepareGameEvent(Event_GameClosed(), -1));
|
||||||
|
|
||||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||||
@@ -273,7 +275,9 @@ void Server_Game::doStartGameIfReady()
|
|||||||
replayList.append(currentReplay);
|
replayList.append(currentReplay);
|
||||||
currentReplay = new GameReplay;
|
currentReplay = new GameReplay;
|
||||||
currentReplay->set_replay_id(databaseInterface->getNextReplayId());
|
currentReplay->set_replay_id(databaseInterface->getNextReplayId());
|
||||||
getInfo(*currentReplay->mutable_game_info());
|
ServerInfo_Game *gameInfo = currentReplay->mutable_game_info();
|
||||||
|
getInfo(*gameInfo);
|
||||||
|
gameInfo->set_started(false);
|
||||||
|
|
||||||
Event_GameStateChanged omniscientEvent;
|
Event_GameStateChanged omniscientEvent;
|
||||||
createGameStateChangedEvent(&omniscientEvent, 0, true, true);
|
createGameStateChangedEvent(&omniscientEvent, 0, true, true);
|
||||||
@@ -438,6 +442,7 @@ void Server_Game::removePlayer(Server_Player *player)
|
|||||||
player->prepareDestroy();
|
player->prepareDestroy();
|
||||||
|
|
||||||
if (!getPlayerCount()) {
|
if (!getPlayerCount()) {
|
||||||
|
gameClosed = true;
|
||||||
deleteLater();
|
deleteLater();
|
||||||
return;
|
return;
|
||||||
} else if (!spectator) {
|
} else if (!spectator) {
|
||||||
@@ -666,7 +671,7 @@ void Server_Game::getInfo(ServerInfo_Game &result) const
|
|||||||
|
|
||||||
result.set_room_id(room->getId());
|
result.set_room_id(room->getId());
|
||||||
result.set_game_id(gameId);
|
result.set_game_id(gameId);
|
||||||
if (players.isEmpty())
|
if (gameClosed)
|
||||||
result.set_closed(true);
|
result.set_closed(true);
|
||||||
else {
|
else {
|
||||||
for (int i = 0; i < gameTypes.size(); ++i)
|
for (int i = 0; i < gameTypes.size(); ++i)
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ private:
|
|||||||
QMap<int, Server_Player *> players;
|
QMap<int, Server_Player *> players;
|
||||||
QSet<QString> allPlayersEver, allSpectatorsEver;
|
QSet<QString> allPlayersEver, allSpectatorsEver;
|
||||||
bool gameStarted;
|
bool gameStarted;
|
||||||
|
bool gameClosed;
|
||||||
int gameId;
|
int gameId;
|
||||||
QString description;
|
QString description;
|
||||||
QString password;
|
QString password;
|
||||||
|
|||||||
Reference in New Issue
Block a user