diff --git a/include/Network/PingedCompatibleServer.h b/include/Network/PingedCompatibleServer.h index b5fa211..b487a2e 100644 --- a/include/Network/PingedCompatibleServer.h +++ b/include/Network/PingedCompatibleServer.h @@ -11,13 +11,13 @@ struct PingedCompatibleServer { unsigned short mPort; unsigned int mPing; int mProtocolVersion; - int mGameModeId; + int mServerAvailability; int mCurrentPlayers; int mMaxPlayers; unsigned long long mServerId; PingedCompatibleServer() - : mPort(0), mPing(0), mProtocolVersion(0), mGameModeId(0), mCurrentPlayers(0), mMaxPlayers(0), + : mPort(0), mPing(0), mProtocolVersion(0), mServerAvailability(1), mCurrentPlayers(0), mMaxPlayers(0), mServerId(0) {} std::string toAnnouncement(unsigned short portV4, unsigned short portV6) const; diff --git a/src/Network/PingedCompatibleServer.cpp b/src/Network/PingedCompatibleServer.cpp index f43c328..f5af7ce 100644 --- a/src/Network/PingedCompatibleServer.cpp +++ b/src/Network/PingedCompatibleServer.cpp @@ -21,11 +21,7 @@ static std::vector splitAnnouncement(const std::string &raw) { return fields; } -static int announcementGameModeId(const std::string &gameMode) { - if (gameMode == "Creative") - return 2; - if (gameMode == "Adventure") - return 3; +static int serverAvailability() { return 1; } @@ -38,7 +34,7 @@ std::string PingedCompatibleServer::toAnnouncement(unsigned short portV4, unsign std::to_string(mServerId) + ";" + mSubName + ";" + mGameMode + ";" + - std::to_string(announcementGameModeId(mGameMode)) + ";" + + std::to_string(serverAvailability()) + ";" + std::to_string(portV4) + ";" + std::to_string(portV6) + ";"; } @@ -62,7 +58,7 @@ bool PingedCompatibleServer::parse(const std::string &rawAnnouncement, PingedCom if (fields.size() > 8) outServer.mGameMode = fields[8]; if (fields.size() > 9) - outServer.mGameModeId = atoi(fields[9].c_str()); + outServer.mServerAvailability = atoi(fields[9].c_str()); if (fields.size() > 10) outServer.mPort = (unsigned short) atoi(fields[10].c_str()); diff --git a/src/Network/Server/BedrockListener.cpp b/src/Network/Server/BedrockListener.cpp index a7b5bc1..fa7d0b2 100644 --- a/src/Network/Server/BedrockListener.cpp +++ b/src/Network/Server/BedrockListener.cpp @@ -30,7 +30,7 @@ namespace { const int LISTENER_IDLE_WAIT_MS = 1; const char *GAME_MODE_NAME = "Survival"; - const int GAME_MODE_ID = 1; + const int SERVER_AVAILABILITY = 1; const char *GAME_VERSION_KEY = "GameVersion"; const char *NONCE_KEY = "Nonce"; @@ -111,7 +111,7 @@ bool BedrockListener::_addConnector(TransportLayer layer, std::string &outError) announcement.mSubName = settings.mSubName; announcement.mGameVersion = settings.mGameVersion; announcement.mGameMode = GAME_MODE_NAME; - announcement.mGameModeId = GAME_MODE_ID; + announcement.mServerAvailability = SERVER_AVAILABILITY; announcement.mProtocolVersion = settings.mProtocolVersion; announcement.mMaxPlayers = settings.mMaxPlayers; announcement.mPort = settings.mPort;