Browse Source

RenX::Server: Added 'gameVersionNumber' with appropriate accessor function (RCONv4)

pull/3/head
Jessica James 9 years ago
parent
commit
175aa11d90
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 21
      RenX.Core/RenX_Server.cpp
  3. 10
      RenX.Core/RenX_Server.h

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

21
RenX.Core/RenX_Server.cpp

@ -3173,10 +3173,24 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
{ {
Jupiter::ReferenceString raw = Jupiter::ReferenceString::substring(line, 1); Jupiter::ReferenceString raw = Jupiter::ReferenceString::substring(line, 1);
this->rconVersion = raw.asInt(10); this->rconVersion = raw.asInt(10);
this->gameVersion = raw.substring(3);
if (this->rconVersion >= 3) if (this->rconVersion >= 3)
{ {
if (this->rconVersion == 3) // Old format: 003Open Beta 5.12
this->gameVersion = raw.substring(3);
else // New format: 004 | Game Version Number | Game Version
{
this->gameVersionNumber = tokens.getToken(1).asInt(10);
this->gameVersion = tokens.getToken(2);
if (this->gameVersion.isEmpty())
{
RenX::Server::sendLogChan(STRING_LITERAL_AS_REFERENCE(IRCCOLOR "04[Error]" IRCCOLOR " Disconnected from Renegade-X server (Protocol Error)."));
this->disconnect(RenX::DisconnectReason::ProtocolError);
break;
}
}
RenX::Server::sock.send("s\n"_jrs); RenX::Server::sock.send("s\n"_jrs);
RenX::Server::send("serverinfo"_jrs); RenX::Server::send("serverinfo"_jrs);
RenX::Server::send("gameinfo"_jrs); RenX::Server::send("gameinfo"_jrs);
@ -3296,6 +3310,11 @@ unsigned int RenX::Server::getVersion() const
return RenX::Server::rconVersion; return RenX::Server::rconVersion;
} }
unsigned int RenX::Server::getGameVersionNumber() const
{
return RenX::Server::gameVersionNumber;
}
const Jupiter::ReadableString &RenX::Server::getGameVersion() const const Jupiter::ReadableString &RenX::Server::getGameVersion() const
{ {
return RenX::Server::gameVersion; return RenX::Server::gameVersion;

10
RenX.Core/RenX_Server.h

@ -944,12 +944,19 @@ namespace RenX
void wipeData(); void wipeData();
/** /**
* @brief Fetches the RCON version number, or 0 or none has been set. * @brief Fetches the RCON version number, or 0 if none has been set.
* *
* @return RCON version number * @return RCON version number
*/ */
unsigned int getVersion() const; unsigned int getVersion() const;
/**
* @brief Fetches the game version number, or 0 if none has been set.
*
* @return Game version number
*/
unsigned int getGameVersionNumber() const;
/** /**
* @brief Fetches the game version string, or an empty string if none has been set. * @brief Fetches the game version string, or an empty string if none has been set.
* *
@ -1020,6 +1027,7 @@ namespace RenX
size_t bot_count = 0; size_t bot_count = 0;
size_t player_rdns_resolutions_pending = 0; size_t player_rdns_resolutions_pending = 0;
unsigned int rconVersion = 0; unsigned int rconVersion = 0;
unsigned int gameVersionNumber = 0;
double crateRespawnAfterPickup = 0.0; double crateRespawnAfterPickup = 0.0;
uuid_func calc_uuid; uuid_func calc_uuid;
std::chrono::steady_clock::time_point lastAttempt = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point lastAttempt = std::chrono::steady_clock::now();

Loading…
Cancel
Save