1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Formatting

This commit is contained in:
Ivan Savenko 2024-01-11 22:51:36 +02:00
parent c4db99a60d
commit 476a05fed3
11 changed files with 96 additions and 105 deletions

View File

@ -11,15 +11,15 @@
#include "StdInc.h"
#include "GlobalLobbyClient.h"
#include "GlobalLobbyWindow.h"
#include "GlobalLobbyLoginWindow.h"
#include "GlobalLobbyWindow.h"
#include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h"
#include "../windows/InfoWindows.h"
#include "../../lib/MetaString.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/MetaString.h"
#include "../../lib/TextOperations.h"
#include "../../lib/network/NetworkClient.h"
@ -52,32 +52,32 @@ void GlobalLobbyClient::onPacketReceived(const std::shared_ptr<NetworkConnection
JsonNode json(message.data(), message.size());
if (json["type"].String() == "accountCreated")
if(json["type"].String() == "accountCreated")
return receiveAccountCreated(json);
if (json["type"].String() == "loginFailed")
if(json["type"].String() == "loginFailed")
return receiveLoginFailed(json);
if (json["type"].String() == "loginSuccess")
if(json["type"].String() == "loginSuccess")
return receiveLoginSuccess(json);
if (json["type"].String() == "chatHistory")
if(json["type"].String() == "chatHistory")
return receiveChatHistory(json);
if (json["type"].String() == "chatMessage")
if(json["type"].String() == "chatMessage")
return receiveChatMessage(json);
if (json["type"].String() == "activeAccounts")
if(json["type"].String() == "activeAccounts")
return receiveActiveAccounts(json);
throw std::runtime_error("Received unexpected message from lobby server: " + json["type"].String() );
throw std::runtime_error("Received unexpected message from lobby server: " + json["type"].String());
}
void GlobalLobbyClient::receiveAccountCreated(const JsonNode & json)
{
auto loginWindowPtr = loginWindow.lock();
if (!loginWindowPtr || !GH.windows().topWindow<GlobalLobbyLoginWindow>())
if(!loginWindowPtr || !GH.windows().topWindow<GlobalLobbyLoginWindow>())
throw std::runtime_error("lobby connection finished without active login window!");
{
@ -98,7 +98,7 @@ void GlobalLobbyClient::receiveLoginFailed(const JsonNode & json)
{
auto loginWindowPtr = loginWindow.lock();
if (!loginWindowPtr || !GH.windows().topWindow<GlobalLobbyLoginWindow>())
if(!loginWindowPtr || !GH.windows().topWindow<GlobalLobbyLoginWindow>())
throw std::runtime_error("lobby connection finished without active login window!");
loginWindowPtr->onConnectionFailed(json["reason"].String());
@ -116,7 +116,7 @@ void GlobalLobbyClient::receiveLoginSuccess(const JsonNode & json)
auto loginWindowPtr = loginWindow.lock();
if (!loginWindowPtr || !GH.windows().topWindow<GlobalLobbyLoginWindow>())
if(!loginWindowPtr || !GH.windows().topWindow<GlobalLobbyLoginWindow>())
throw std::runtime_error("lobby connection finished without active login window!");
loginWindowPtr->onConnectionSuccess();
@ -124,7 +124,7 @@ void GlobalLobbyClient::receiveLoginSuccess(const JsonNode & json)
void GlobalLobbyClient::receiveChatHistory(const JsonNode & json)
{
for (auto const & entry : json["messages"].Vector())
for(const auto & entry : json["messages"].Vector())
{
std::string accountID = entry["accountID"].String();
std::string displayName = entry["displayName"].String();
@ -164,7 +164,7 @@ void GlobalLobbyClient::onConnectionEstablished(const std::shared_ptr<NetworkCon
std::string accountID = settings["lobby"]["accountID"].String();
if (accountID.empty())
if(accountID.empty())
sendClientRegister();
else
sendClientLogin();
@ -191,7 +191,7 @@ void GlobalLobbyClient::onConnectionFailed(const std::string & errorMessage)
{
auto loginWindowPtr = loginWindow.lock();
if (!loginWindowPtr || !GH.windows().topWindow<GlobalLobbyLoginWindow>())
if(!loginWindowPtr || !GH.windows().topWindow<GlobalLobbyLoginWindow>())
throw std::runtime_error("lobby connection failed without active login window!");
logGlobal->warn("Connection to game lobby failed! Reason: %s", errorMessage);
@ -214,7 +214,7 @@ void GlobalLobbyClient::sendMessage(const JsonNode & data)
std::string payloadString = data.toJson(true);
// FIXME: find better approach
uint8_t * payloadBegin = reinterpret_cast<uint8_t*>(payloadString.data());
uint8_t * payloadBegin = reinterpret_cast<uint8_t *>(payloadString.data());
uint8_t * payloadEnd = payloadBegin + payloadString.size();
std::vector<uint8_t> payloadBuffer(payloadBegin, payloadEnd);
@ -237,7 +237,7 @@ bool GlobalLobbyClient::isConnected()
std::shared_ptr<GlobalLobbyLoginWindow> GlobalLobbyClient::createLoginWindow()
{
auto loginWindowPtr = loginWindow.lock();
if (loginWindowPtr)
if(loginWindowPtr)
return loginWindowPtr;
auto loginWindowNew = std::make_shared<GlobalLobbyLoginWindow>();
@ -249,7 +249,7 @@ std::shared_ptr<GlobalLobbyLoginWindow> GlobalLobbyClient::createLoginWindow()
std::shared_ptr<GlobalLobbyWindow> GlobalLobbyClient::createLobbyWindow()
{
auto lobbyWindowPtr = lobbyWindow.lock();
if (lobbyWindowPtr)
if(lobbyWindowPtr)
return lobbyWindowPtr;
lobbyWindowPtr = std::make_shared<GlobalLobbyWindow>();
@ -257,4 +257,3 @@ std::shared_ptr<GlobalLobbyWindow> GlobalLobbyClient::createLobbyWindow()
lobbyWindowLock = lobbyWindowPtr;
return lobbyWindowPtr;
}

View File

@ -42,6 +42,7 @@ class GlobalLobbyClient : public INetworkClientListener, boost::noncopyable
void receiveChatHistory(const JsonNode & json);
void receiveChatMessage(const JsonNode & json);
void receiveActiveAccounts(const JsonNode & json);
public:
explicit GlobalLobbyClient();
~GlobalLobbyClient();

View File

@ -14,18 +14,18 @@
#include "GlobalLobbyClient.h"
#include "GlobalLobbyWindow.h"
#include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h"
#include "../widgets/TextControls.h"
#include "../widgets/Images.h"
#include "../widgets/Buttons.h"
#include "../widgets/MiscWidgets.h"
#include "../CGameInfo.h"
#include "../CServerHandler.h"
#include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h"
#include "../widgets/Buttons.h"
#include "../widgets/Images.h"
#include "../widgets/MiscWidgets.h"
#include "../widgets/TextControls.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/CGeneralTextHandler.h"
#include "../../lib/MetaString.h"
#include "../../lib/CConfigHandler.h"
GlobalLobbyLoginWindow::GlobalLobbyLoginWindow()
: CWindowObject(BORDERED)
@ -66,7 +66,7 @@ void GlobalLobbyLoginWindow::onLogin()
config->String() = inputUsername->getText();
labelStatus->setText(CGI->generaltexth->translate("vcmi.lobby.login.connecting"));
if (!CSH->getGlobalLobby().isConnected())
if(!CSH->getGlobalLobby().isConnected())
CSH->getGlobalLobby().connect();
buttonClose->block(true);
}

View File

@ -11,17 +11,17 @@
#include "StdInc.h"
#include "GlobalLobbyServerSetup.h"
#include "../gui/CGuiHandler.h"
#include "../widgets/TextControls.h"
#include "../widgets/Images.h"
#include "../widgets/Buttons.h"
#include "../CGameInfo.h"
#include "../CServerHandler.h"
#include "../gui/CGuiHandler.h"
#include "../mainmenu/CMainMenu.h"
#include "../widgets/Buttons.h"
#include "../widgets/Images.h"
#include "../widgets/TextControls.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/CGeneralTextHandler.h"
#include "../../lib/MetaString.h"
#include "../../lib/CConfigHandler.h"
GlobalLobbyServerSetup::GlobalLobbyServerSetup()
: CWindowObject(BORDERED)
@ -85,12 +85,12 @@ void GlobalLobbyServerSetup::updateDescription()
{
MetaString description;
description.appendRawString("%s %s %s");
if (toggleRoomType->getSelected() == 0)
if(toggleRoomType->getSelected() == 0)
description.replaceTextID("vcmi.lobby.room.description.public");
else
description.replaceTextID("vcmi.lobby.room.description.private");
if (toggleGameMode->getSelected() == 0)
if(toggleGameMode->getSelected() == 0)
description.replaceTextID("vcmi.lobby.room.description.new");
else
description.replaceTextID("vcmi.lobby.room.description.load");
@ -124,7 +124,7 @@ void GlobalLobbyServerSetup::onGameModeChanged(int value)
void GlobalLobbyServerSetup::onCreate()
{
if (toggleGameMode->getSelected() == 0)
if(toggleGameMode->getSelected() == 0)
{
CSH->resetStateForLobby(StartInfo::NEW_GAME, nullptr);
CSH->screenType = ESelectionScreen::newGame;

View File

@ -16,6 +16,7 @@ class GlobalLobbyWindow;
class GlobalLobbyWidget : public InterfaceObjectConfigurable
{
GlobalLobbyWindow * window;
public:
GlobalLobbyWidget(GlobalLobbyWindow * window);

View File

@ -11,20 +11,20 @@
#include "StdInc.h"
#include "GlobalLobbyWindow.h"
#include "GlobalLobbyWidget.h"
#include "GlobalLobbyClient.h"
#include "GlobalLobbyServerSetup.h"
#include "GlobalLobbyWidget.h"
#include "../CServerHandler.h"
#include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h"
#include "../widgets/TextControls.h"
#include "../CServerHandler.h"
#include "../../lib/MetaString.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/MetaString.h"
GlobalLobbyWindow::GlobalLobbyWindow():
CWindowObject(BORDERED)
GlobalLobbyWindow::GlobalLobbyWindow()
: CWindowObject(BORDERED)
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
widget = std::make_shared<GlobalLobbyWidget>(this);

View File

@ -26,5 +26,4 @@ public:
void doCreateGameRoom();
void onGameChatMessage(const std::string & sender, const std::string & message, const std::string & when);
};

View File

@ -251,7 +251,7 @@ bool LobbyDatabase::isPlayerInGameRoom(const std::string & accountID)
bool result = false;
isPlayerInAnyGameRoomStatement->setBinds(accountID);
if (isPlayerInAnyGameRoomStatement->execute())
if(isPlayerInAnyGameRoomStatement->execute())
isPlayerInAnyGameRoomStatement->getColumns(result);
isPlayerInAnyGameRoomStatement->reset();
@ -263,7 +263,7 @@ bool LobbyDatabase::isPlayerInGameRoom(const std::string & accountID, const std:
bool result = false;
isPlayerInGameRoomStatement->setBinds(accountID, roomID);
if (isPlayerInGameRoomStatement->execute())
if(isPlayerInGameRoomStatement->execute())
isPlayerInGameRoomStatement->getColumns(result);
isPlayerInGameRoomStatement->reset();
@ -330,27 +330,18 @@ void LobbyDatabase::insertAccessCookie(const std::string & accountID, const std:
insertAccessCookieStatement->executeOnce(accountID, accessCookieUUID);
}
void LobbyDatabase::updateAccessCookie(const std::string & accountID, const std::string & accessCookieUUID)
{
void LobbyDatabase::updateAccessCookie(const std::string & accountID, const std::string & accessCookieUUID) {}
}
void LobbyDatabase::updateAccountLoginTime(const std::string & accountID) {}
void LobbyDatabase::updateAccountLoginTime(const std::string & accountID)
{
}
void LobbyDatabase::updateActiveAccount(const std::string & accountID, bool isActive)
{
}
void LobbyDatabase::updateActiveAccount(const std::string & accountID, bool isActive) {}
std::string LobbyDatabase::getAccountDisplayName(const std::string & accountID)
{
std::string result;
getAccountDisplayNameStatement->setBinds(accountID);
if (getAccountDisplayNameStatement->execute())
if(getAccountDisplayNameStatement->execute())
getAccountDisplayNameStatement->getColumns(result);
getAccountDisplayNameStatement->reset();
@ -367,7 +358,7 @@ LobbyCookieStatus LobbyDatabase::getAccountCookieStatus(const std::string & acco
bool result = false;
isAccountCookieValidStatement->setBinds(accountID, accessCookieUUID, cookieLifetime.count());
if (isAccountCookieValidStatement->execute())
if(isAccountCookieValidStatement->execute())
isAccountCookieValidStatement->getColumns(result);
isAccountCookieValidStatement->reset();
@ -394,7 +385,7 @@ bool LobbyDatabase::isAccountNameExists(const std::string & displayName)
bool result = false;
isAccountNameExistsStatement->setBinds(displayName);
if (isAccountNameExistsStatement->execute())
if(isAccountNameExistsStatement->execute())
isAccountNameExistsStatement->getColumns(result);
isAccountNameExistsStatement->reset();
return result;
@ -405,7 +396,7 @@ bool LobbyDatabase::isAccountIDExists(const std::string & accountID)
bool result = false;
isAccountIDExistsStatement->setBinds(accountID);
if (isAccountIDExistsStatement->execute())
if(isAccountIDExistsStatement->execute())
isAccountIDExistsStatement->getColumns(result);
isAccountIDExistsStatement->reset();
return result;
@ -434,7 +425,7 @@ std::string LobbyDatabase::getIdleGameRoom(const std::string & hostAccountID)
{
std::string result;
if (getIdleGameRoomStatement->execute())
if(getIdleGameRoomStatement->execute())
getIdleGameRoomStatement->getColumns(result);
getIdleGameRoomStatement->reset();
@ -445,7 +436,7 @@ std::string LobbyDatabase::getAccountGameRoom(const std::string & accountID)
{
std::string result;
if (getAccountGameRoomStatement->execute())
if(getAccountGameRoomStatement->execute())
getAccountGameRoomStatement->getColumns(result);
getAccountGameRoomStatement->reset();

View File

@ -48,9 +48,9 @@ enum class LobbyInviteStatus : int32_t
enum class LobbyRoomState : int32_t
{
IDLE, // server is ready but no players are in the room
PUBLIC, // host has joined and allows anybody to join
PRIVATE, // host has joined but only allows those he invited to join
IDLE, // server is ready but no players are in the room
PUBLIC, // host has joined and allows anybody to join
PRIVATE, // host has joined but only allows those he invited to join
//BUSY, // match is ongoing
//CANCELLED, // game room was cancelled without starting the game
//CLOSED, // game room was closed after playing for some time

View File

@ -13,24 +13,24 @@
#include "LobbyDatabase.h"
#include "../lib/JsonNode.h"
#include "../lib/network/NetworkServer.h"
#include "../lib/network/NetworkConnection.h"
#include "../lib/network/NetworkServer.h"
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
static const auto accountCookieLifetime = std::chrono::hours(24*7);
static const auto accountCookieLifetime = std::chrono::hours(24 * 7);
bool LobbyServer::isAccountNameValid(const std::string & accountName)
{
if (accountName.size() < 4)
if(accountName.size() < 4)
return false;
if (accountName.size() < 20)
if(accountName.size() < 20)
return false;
for (auto const & c : accountName)
if (!std::isalnum(c))
for(const auto & c : accountName)
if(!std::isalnum(c))
return false;
return true;
@ -44,8 +44,8 @@ std::string LobbyServer::sanitizeChatMessage(const std::string & inputString) co
NetworkConnectionPtr LobbyServer::findAccount(const std::string & accountID)
{
for (auto const & account : activeAccounts)
if (account.second.accountID == accountID)
for(const auto & account : activeAccounts)
if(account.second.accountID == accountID)
return account.first;
return nullptr;
@ -53,8 +53,8 @@ NetworkConnectionPtr LobbyServer::findAccount(const std::string & accountID)
NetworkConnectionPtr LobbyServer::findGameRoom(const std::string & gameRoomID)
{
for (auto const & account : activeGameRooms)
if (account.second.roomID == gameRoomID)
for(const auto & account : activeGameRooms)
if(account.second.roomID == gameRoomID)
return account.first;
return nullptr;
@ -105,7 +105,7 @@ void LobbyServer::sendLoginSuccess(const NetworkConnectionPtr & target, const st
JsonNode reply;
reply["type"].String() = "loginSuccess";
reply["accountCookie"].String() = accountCookie;
if (!displayName.empty())
if(!displayName.empty())
reply["displayName"].String() = displayName;
sendMessage(target, reply);
}
@ -142,7 +142,7 @@ void LobbyServer::broadcastActiveAccounts()
JsonNode jsonEntry;
jsonEntry["accountID"].String() = account.accountID;
jsonEntry["displayName"].String() = account.displayName;
// jsonEntry["status"].String() = account.status;
// jsonEntry["status"].String() = account.status;
reply["accounts"].Vector().push_back(jsonEntry);
}
@ -224,10 +224,10 @@ void LobbyServer::onDisconnected(const NetworkConnectionPtr & connection)
void LobbyServer::onPacketReceived(const NetworkConnectionPtr & connection, const std::vector<uint8_t> & message)
{
// proxy connection - no processing, only redirect
if (activeProxies.count(connection))
if(activeProxies.count(connection))
{
auto lockedPtr = activeProxies.at(connection).lock();
if (lockedPtr)
if(lockedPtr)
lockedPtr->sendPacket(message);
return;
}
@ -238,7 +238,7 @@ void LobbyServer::onPacketReceived(const NetworkConnectionPtr & connection, cons
// TODO: validate json based on received message type
// communication messages from vcmiclient
if (activeAccounts.count(connection))
if(activeAccounts.count(connection))
{
if(json["type"].String() == "sendChatMessage")
return receiveSendChatMessage(connection, json);
@ -259,7 +259,7 @@ void LobbyServer::onPacketReceived(const NetworkConnectionPtr & connection, cons
}
// communication messages from vcmiserver
if (activeGameRooms.count(connection))
if(activeGameRooms.count(connection))
{
if(json["type"].String() == "leaveGameRoom")
return receiveLeaveGameRoom(connection, json);
@ -294,7 +294,7 @@ void LobbyServer::receiveSendChatMessage(const NetworkConnectionPtr & connection
std::string messageTextClean = sanitizeChatMessage(messageText);
std::string displayName = database->getAccountDisplayName(accountID);
if (messageTextClean.empty())
if(messageTextClean.empty())
return;
database->insertChatMessage(accountID, "global", "english", messageText);
@ -308,10 +308,10 @@ void LobbyServer::receiveClientRegister(const NetworkConnectionPtr & connection,
std::string displayName = json["displayName"].String();
std::string language = json["language"].String();
if (isAccountNameValid(displayName))
if(isAccountNameValid(displayName))
return sendLoginFailed(connection, "Illegal account name");
if (database->isAccountNameExists(displayName))
if(database->isAccountNameExists(displayName))
return sendLoginFailed(connection, "Account name already in use");
std::string accountCookie = boost::uuids::to_string(boost::uuids::random_generator()());
@ -330,12 +330,12 @@ void LobbyServer::receiveClientLogin(const NetworkConnectionPtr & connection, co
std::string language = json["language"].String();
std::string version = json["version"].String();
if (!database->isAccountIDExists(accountID))
if(!database->isAccountIDExists(accountID))
return sendLoginFailed(connection, "Account not found");
auto clientCookieStatus = database->getAccountCookieStatus(accountID, accountCookie, accountCookieLifetime);
if (clientCookieStatus == LobbyCookieStatus::INVALID)
if(clientCookieStatus == LobbyCookieStatus::INVALID)
return sendLoginFailed(connection, "Authentification failure");
// prolong existing cookie
@ -366,7 +366,7 @@ void LobbyServer::receiveServerLogin(const NetworkConnectionPtr & connection, co
auto clientCookieStatus = database->getAccountCookieStatus(accountID, accountCookie, accountCookieLifetime);
if (clientCookieStatus == LobbyCookieStatus::INVALID)
if(clientCookieStatus == LobbyCookieStatus::INVALID)
{
sendLoginFailed(connection, "Invalid credentials");
}
@ -386,20 +386,20 @@ void LobbyServer::receiveClientProxyLogin(const NetworkConnectionPtr & connectio
auto clientCookieStatus = database->getAccountCookieStatus(accountID, accountCookie, accountCookieLifetime);
if (clientCookieStatus != LobbyCookieStatus::INVALID)
if(clientCookieStatus != LobbyCookieStatus::INVALID)
{
for (auto & proxyEntry : awaitingProxies)
for(auto & proxyEntry : awaitingProxies)
{
if (proxyEntry.accountID != accountID)
if(proxyEntry.accountID != accountID)
continue;
if (proxyEntry.roomID != gameRoomID)
if(proxyEntry.roomID != gameRoomID)
continue;
proxyEntry.accountConnection = connection;
auto gameRoomConnection = proxyEntry.roomConnection.lock();
if (gameRoomConnection)
if(gameRoomConnection)
{
activeProxies[gameRoomConnection] = connection;
activeProxies[connection] = gameRoomConnection;
@ -419,11 +419,11 @@ void LobbyServer::receiveServerProxyLogin(const NetworkConnectionPtr & connectio
auto clientCookieStatus = database->getGameRoomCookieStatus(gameRoomID, hostCookie, accountCookieLifetime);
if (clientCookieStatus != LobbyCookieStatus::INVALID)
if(clientCookieStatus != LobbyCookieStatus::INVALID)
{
NetworkConnectionPtr targetAccount = findAccount(guestAccountID);
if (targetAccount == nullptr)
if(targetAccount == nullptr)
return; // unknown / disconnected account
sendJoinRoomSuccess(targetAccount, gameRoomID);
@ -448,13 +448,13 @@ void LobbyServer::receiveOpenGameRoom(const NetworkConnectionPtr & connection, c
return; // only 1 room per player allowed
std::string gameRoomID = database->getIdleGameRoom(hostAccountID);
if (gameRoomID.empty())
if(gameRoomID.empty())
return;
std::string roomType = json["roomType"].String();
if (roomType == "public")
if(roomType == "public")
database->setGameRoomStatus(gameRoomID, LobbyRoomState::PUBLIC);
if (roomType == "private")
if(roomType == "private")
database->setGameRoomStatus(gameRoomID, LobbyRoomState::PRIVATE);
// TODO: additional flags / initial settings, e.g. allowCheats
@ -474,18 +474,18 @@ void LobbyServer::receiveJoinGameRoom(const NetworkConnectionPtr & connection, c
NetworkConnectionPtr targetRoom = findGameRoom(gameRoomID);
if (targetRoom == nullptr)
if(targetRoom == nullptr)
return; // unknown / disconnected room
auto roomStatus = database->getGameRoomStatus(gameRoomID);
if (roomStatus == LobbyRoomState::PRIVATE)
if(roomStatus == LobbyRoomState::PRIVATE)
{
if (database->getAccountInviteStatus(accountID, gameRoomID) != LobbyInviteStatus::INVITED)
if(database->getAccountInviteStatus(accountID, gameRoomID) != LobbyInviteStatus::INVITED)
return;
}
if (database->getGameRoomFreeSlots(gameRoomID) == 0)
if(database->getGameRoomFreeSlots(gameRoomID) == 0)
return;
sendAccountJoinsRoom(targetRoom, accountID);
@ -513,7 +513,7 @@ void LobbyServer::receiveSendInvite(const NetworkConnectionPtr & connection, con
auto targetAccount = findAccount(accountID);
if (!targetAccount)
if(!targetAccount)
return; // target player does not exists or offline
if(!database->isPlayerInGameRoom(senderName))
@ -522,7 +522,7 @@ void LobbyServer::receiveSendInvite(const NetworkConnectionPtr & connection, con
if(database->isPlayerInGameRoom(accountID))
return; // target player is busy
if (database->getAccountInviteStatus(accountID, gameRoomID) != LobbyInviteStatus::NOT_INVITED)
if(database->getAccountInviteStatus(accountID, gameRoomID) != LobbyInviteStatus::NOT_INVITED)
return; // already has invite
database->insertGameRoomInvite(accountID, gameRoomID);
@ -534,7 +534,7 @@ void LobbyServer::receiveDeclineInvite(const NetworkConnectionPtr & connection,
std::string accountID = activeAccounts[connection].accountID;
std::string gameRoomID = json["gameRoomID"].String();
if (database->getAccountInviteStatus(accountID, gameRoomID) != LobbyInviteStatus::INVITED)
if(database->getAccountInviteStatus(accountID, gameRoomID) != LobbyInviteStatus::INVITED)
return; // already has invite
database->deleteGameRoomInvite(accountID, gameRoomID);

View File

@ -9,8 +9,8 @@
*/
#pragma once
#include "LobbyDefines.h"
#include "../lib/network/NetworkListener.h"
#include "LobbyDefines.h"
VCMI_LIB_NAMESPACE_BEGIN
class JsonNode;