mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Set matches that never reached gameplay state to 'cancelled' state
This commit is contained in:
parent
862f6f8c7b
commit
89d091a386
@ -82,7 +82,7 @@
|
||||
"vcmi.lobby.header.rooms" : "Game Rooms - %d",
|
||||
"vcmi.lobby.header.channels" : "Chat Channels",
|
||||
"vcmi.lobby.header.chat.global" : "Global Game Chat - %s", // %s -> language name
|
||||
"vcmi.lobby.header.chat.match" : "Previous game chat from %s", // %s -> game start date & time
|
||||
"vcmi.lobby.header.chat.match" : "Chat from previous game on %s", // %s -> game start date & time
|
||||
"vcmi.lobby.header.chat.player" : "Private chat with %s", // %s -> nickname of another player
|
||||
"vcmi.lobby.header.history" : "Your Previous Games",
|
||||
"vcmi.lobby.header.players" : "Players Online - %d",
|
||||
|
@ -90,14 +90,20 @@ void LobbyDatabase::clearOldData()
|
||||
)";
|
||||
|
||||
//FIXME: set different status for rooms that never reached in game state
|
||||
static const std::string removeActiveRooms = R"(
|
||||
static const std::string removeActiveLobbyRooms = R"(
|
||||
UPDATE gameRooms
|
||||
SET status = 4
|
||||
WHERE status IN (0,1,2)
|
||||
)";
|
||||
static const std::string removeActiveGameRooms = R"(
|
||||
UPDATE gameRooms
|
||||
SET status = 5
|
||||
WHERE status <> 5
|
||||
WHERE status = 3
|
||||
)";
|
||||
|
||||
database->prepare(removeActiveAccounts)->execute();
|
||||
database->prepare(removeActiveRooms)->execute();
|
||||
database->prepare(removeActiveLobbyRooms)->execute();
|
||||
database->prepare(removeActiveGameRooms)->execute();
|
||||
}
|
||||
|
||||
void LobbyDatabase::prepareStatements()
|
||||
@ -209,7 +215,7 @@ void LobbyDatabase::prepareStatements()
|
||||
FROM gameRoomPlayers grp
|
||||
LEFT JOIN gameRooms gr ON gr.roomID = grp.roomID
|
||||
LEFT JOIN accounts a ON gr.hostAccountID = a.accountID
|
||||
WHERE grp.accountID = ? AND status IN (4,5)
|
||||
WHERE grp.accountID = ? AND status = 5
|
||||
ORDER BY secondsElapsed ASC
|
||||
)");
|
||||
|
||||
|
@ -283,11 +283,17 @@ void LobbyServer::onDisconnected(const NetworkConnectionPtr & connection, const
|
||||
if(activeGameRooms.count(connection))
|
||||
{
|
||||
std::string gameRoomID = activeGameRooms.at(connection);
|
||||
database->setGameRoomStatus(gameRoomID, LobbyRoomState::CLOSED);
|
||||
|
||||
for(const auto & accountConnection : activeAccounts)
|
||||
if (database->isPlayerInGameRoom(accountConnection.second, gameRoomID))
|
||||
sendMatchesHistory(accountConnection.first);
|
||||
if (database->getGameRoomStatus(gameRoomID) == LobbyRoomState::BUSY)
|
||||
{
|
||||
database->setGameRoomStatus(gameRoomID, LobbyRoomState::CLOSED);
|
||||
for(const auto & accountConnection : activeAccounts)
|
||||
if (database->isPlayerInGameRoom(accountConnection.second, gameRoomID))
|
||||
sendMatchesHistory(accountConnection.first);
|
||||
}
|
||||
else
|
||||
database->setGameRoomStatus(gameRoomID, LobbyRoomState::CANCELLED);
|
||||
|
||||
activeGameRooms.erase(connection);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user