mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Set matches that never reached gameplay state to 'cancelled' state
This commit is contained in:
@@ -82,7 +82,7 @@
|
|||||||
"vcmi.lobby.header.rooms" : "Game Rooms - %d",
|
"vcmi.lobby.header.rooms" : "Game Rooms - %d",
|
||||||
"vcmi.lobby.header.channels" : "Chat Channels",
|
"vcmi.lobby.header.channels" : "Chat Channels",
|
||||||
"vcmi.lobby.header.chat.global" : "Global Game Chat - %s", // %s -> language name
|
"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.chat.player" : "Private chat with %s", // %s -> nickname of another player
|
||||||
"vcmi.lobby.header.history" : "Your Previous Games",
|
"vcmi.lobby.header.history" : "Your Previous Games",
|
||||||
"vcmi.lobby.header.players" : "Players Online - %d",
|
"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
|
//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
|
UPDATE gameRooms
|
||||||
SET status = 5
|
SET status = 5
|
||||||
WHERE status <> 5
|
WHERE status = 3
|
||||||
)";
|
)";
|
||||||
|
|
||||||
database->prepare(removeActiveAccounts)->execute();
|
database->prepare(removeActiveAccounts)->execute();
|
||||||
database->prepare(removeActiveRooms)->execute();
|
database->prepare(removeActiveLobbyRooms)->execute();
|
||||||
|
database->prepare(removeActiveGameRooms)->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LobbyDatabase::prepareStatements()
|
void LobbyDatabase::prepareStatements()
|
||||||
@@ -209,7 +215,7 @@ void LobbyDatabase::prepareStatements()
|
|||||||
FROM gameRoomPlayers grp
|
FROM gameRoomPlayers grp
|
||||||
LEFT JOIN gameRooms gr ON gr.roomID = grp.roomID
|
LEFT JOIN gameRooms gr ON gr.roomID = grp.roomID
|
||||||
LEFT JOIN accounts a ON gr.hostAccountID = a.accountID
|
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
|
ORDER BY secondsElapsed ASC
|
||||||
)");
|
)");
|
||||||
|
|
||||||
|
|||||||
@@ -283,11 +283,17 @@ void LobbyServer::onDisconnected(const NetworkConnectionPtr & connection, const
|
|||||||
if(activeGameRooms.count(connection))
|
if(activeGameRooms.count(connection))
|
||||||
{
|
{
|
||||||
std::string gameRoomID = activeGameRooms.at(connection);
|
std::string gameRoomID = activeGameRooms.at(connection);
|
||||||
database->setGameRoomStatus(gameRoomID, LobbyRoomState::CLOSED);
|
|
||||||
|
|
||||||
|
if (database->getGameRoomStatus(gameRoomID) == LobbyRoomState::BUSY)
|
||||||
|
{
|
||||||
|
database->setGameRoomStatus(gameRoomID, LobbyRoomState::CLOSED);
|
||||||
for(const auto & accountConnection : activeAccounts)
|
for(const auto & accountConnection : activeAccounts)
|
||||||
if (database->isPlayerInGameRoom(accountConnection.second, gameRoomID))
|
if (database->isPlayerInGameRoom(accountConnection.second, gameRoomID))
|
||||||
sendMatchesHistory(accountConnection.first);
|
sendMatchesHistory(accountConnection.first);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
database->setGameRoomStatus(gameRoomID, LobbyRoomState::CANCELLED);
|
||||||
|
|
||||||
activeGameRooms.erase(connection);
|
activeGameRooms.erase(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user