mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Implemented room description display (map/template name)
This commit is contained in:
@@ -162,7 +162,7 @@ JsonNode LobbyServer::prepareActiveGameRooms()
|
||||
jsonEntry["gameRoomID"].String() = gameRoom.roomID;
|
||||
jsonEntry["hostAccountID"].String() = gameRoom.hostAccountID;
|
||||
jsonEntry["hostAccountDisplayName"].String() = gameRoom.hostAccountDisplayName;
|
||||
jsonEntry["description"].String() = "TODO: ROOM DESCRIPTION";
|
||||
jsonEntry["description"].String() = gameRoom.description;
|
||||
jsonEntry["playersCount"].Integer() = gameRoom.playersCount;
|
||||
jsonEntry["playersLimit"].Integer() = gameRoom.playersLimit;
|
||||
reply["gameRooms"].Vector().push_back(jsonEntry);
|
||||
@@ -329,6 +329,9 @@ void LobbyServer::onPacketReceived(const NetworkConnectionPtr & connection, cons
|
||||
std::string roomName = activeGameRooms.at(connection);
|
||||
logGlobal->info("%s: Received message of type %s", roomName, messageType);
|
||||
|
||||
if(messageType == "changeRoomDescription")
|
||||
return receiveChangeRoomDescription(connection, json);
|
||||
|
||||
if(messageType == "leaveGameRoom")
|
||||
return receiveLeaveGameRoom(connection, json);
|
||||
|
||||
@@ -573,6 +576,15 @@ void LobbyServer::receiveJoinGameRoom(const NetworkConnectionPtr & connection, c
|
||||
broadcastActiveGameRooms();
|
||||
}
|
||||
|
||||
void LobbyServer::receiveChangeRoomDescription(const NetworkConnectionPtr & connection, const JsonNode & json)
|
||||
{
|
||||
std::string gameRoomID = activeGameRooms[connection];
|
||||
std::string description = json["description"].String();
|
||||
|
||||
database->updateRoomDescription(gameRoomID, description);
|
||||
broadcastActiveGameRooms();
|
||||
}
|
||||
|
||||
void LobbyServer::receiveLeaveGameRoom(const NetworkConnectionPtr & connection, const JsonNode & json)
|
||||
{
|
||||
std::string accountID = json["accountID"].String();
|
||||
|
||||
Reference in New Issue
Block a user