diff --git a/Release/Plugins/RenX.Core.lib b/Release/Plugins/RenX.Core.lib
index 246ee2e..7158b4b 100644
Binary files a/Release/Plugins/RenX.Core.lib and b/Release/Plugins/RenX.Core.lib differ
diff --git a/RenX.Core/RenX.Core.vcxproj b/RenX.Core/RenX.Core.vcxproj
index 3677619..87d9cf7 100644
--- a/RenX.Core/RenX.Core.vcxproj
+++ b/RenX.Core/RenX.Core.vcxproj
@@ -77,6 +77,7 @@
+
@@ -84,6 +85,7 @@
+
diff --git a/RenX.Core/RenX.Core.vcxproj.filters b/RenX.Core/RenX.Core.vcxproj.filters
index 4b29fda..e375b38 100644
--- a/RenX.Core/RenX.Core.vcxproj.filters
+++ b/RenX.Core/RenX.Core.vcxproj.filters
@@ -44,6 +44,9 @@
Header Files
+
+ Header Files
+
@@ -61,5 +64,8 @@
Source Files
+
+ Source Files
+
\ No newline at end of file
diff --git a/RenX.Core/RenX_Server.cpp b/RenX.Core/RenX_Server.cpp
index 52db0ee..df5b878 100644
--- a/RenX.Core/RenX_Server.cpp
+++ b/RenX.Core/RenX_Server.cpp
@@ -115,7 +115,7 @@ int RenX::Server::sendMessage(const Jupiter::ReadableString &message)
int RenX::Server::sendMessage(RenX::PlayerInfo *player, const Jupiter::ReadableString &message)
{
- if (RenX::Server::gameVersion.equals("Open Beta 2"))
+ if (RenX::Server::profile->privateMessages == false)
return RenX::Server::sendMessage(message);
return RenX::Server::sock.send(Jupiter::StringS::Format("cevaprivatesay pid%d %.*s\n", player->id, message.size(), message.ptr()));
@@ -621,6 +621,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
iWinType = Base;
this->needsCList = true;
+ if (this->profile->disconnectOnGameOver)
+ this->silenceParts = true;
+
onPreGameOver(this, iWinType, team, gScore, nScore);
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnGameOver(this, iWinType, team, gScore, nScore);
@@ -632,6 +635,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
int nScore = buff.getWord(3, RenX::DelimS).gotoWord(1, "=").asInt(10);
this->needsCList = true;
+ if (this->profile->disconnectOnGameOver)
+ this->silenceParts = true;
+
if (gScore == nScore)
{
onPreGameOver(this, Tie, Other, gScore, nScore);
@@ -675,8 +681,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
PARSE_PLAYER_DATA();
if (action.equals("disconnected"))
{
- for (size_t i = 0; i < xPlugins.size(); i++)
- xPlugins.get(i)->RenX_OnPart(this, player);
+ if (this->silenceParts == false)
+ for (size_t i = 0; i < xPlugins.size(); i++)
+ xPlugins.get(i)->RenX_OnPart(this, player);
this->removePlayer(player);
player = nullptr;
}
@@ -829,6 +836,14 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
buff.shiftRight(1);
this->rconVersion = buff.asInt(10);
this->gameVersion = buff.substring(3);
+
+ if (this->rconVersion == 1)
+ this->profile = RenX::openBeta1Profile;
+ else if (gameVersion.equals("Open Beta 2"))
+ this->profile = RenX::openBeta2Profile;
+ else if (gameVersion.equals("Open Beta 3"))
+ this->profile = RenX::openBeta3Profile;
+
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnVersion(this, buff);
buff.shiftLeft(1);
@@ -870,6 +885,7 @@ bool RenX::Server::connect()
RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("s\n"));
RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("clogclientlist\n"));
RenX::Server::connected = true;
+ RenX::Server::silenceParts = false;
return true;
}
RenX::Server::connected = false;
diff --git a/RenX.Core/RenX_Server.h b/RenX.Core/RenX_Server.h
index f385867..261283d 100644
--- a/RenX.Core/RenX_Server.h
+++ b/RenX.Core/RenX_Server.h
@@ -31,6 +31,7 @@
#include "Jupiter/INIFile.h"
#include "Jupiter/Thinker.h"
#include "RenX.h"
+#include "RenX_ServerProfile.h"
/** DLL Linkage Nagging */
#if defined _MSC_VER
@@ -63,6 +64,7 @@ namespace RenX
public: // RenX::Server
Jupiter::DLList players; /** A list of players in the server */
Jupiter::INIFile varData; /** This may be replaced later with a more dedicated type. */
+ const RenX::ServerProfile *profile = RenX::defaultProfile;
/**
* @brief Checks if the server is connected to RCON.
@@ -419,6 +421,7 @@ namespace RenX
private:
bool connected = false;
bool needsCList = false;
+ bool silenceParts = false;
unsigned int rconVersion = 0;
unsigned short port;
int logChanType;
diff --git a/RenX.Core/RenX_ServerProfile.cpp b/RenX.Core/RenX_ServerProfile.cpp
new file mode 100644
index 0000000..e8909a5
--- /dev/null
+++ b/RenX.Core/RenX_ServerProfile.cpp
@@ -0,0 +1,61 @@
+/**
+ * Copyright (C) 2014 Justin James.
+ *
+ * This license must be preserved.
+ * Any applications, libraries, or code which make any use of any
+ * component of this program must not be commercial, unless explicit
+ * permission is granted from the original author. The use of this
+ * program for non-profit purposes is permitted.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * In the event that this license restricts you from making desired use of this program, contact the original author.
+ * Written by Justin James
+ */
+
+#include "RenX_ServerProfile.h"
+
+struct BaseProfile : RenX::ServerProfile
+{
+ BaseProfile()
+ {
+ supported = true;
+ privateMessages = true;
+ disconnectOnGameOver = false;
+ }
+};
+
+struct IdealProfile : BaseProfile
+{
+} _idealProfile;
+const RenX::ServerProfile *RenX::defaultProfile = &_idealProfile;
+
+struct OpenBeta1Profile : BaseProfile
+{
+ OpenBeta1Profile()
+ {
+ supported = false;
+ privateMessages = false;
+ }
+} _openBeta1Profile;
+const RenX::ServerProfile *RenX::openBeta1Profile = &_openBeta1Profile;
+
+struct OpenBeta2Profile : BaseProfile
+{
+ OpenBeta2Profile()
+ {
+ privateMessages = false;
+ }
+} _openBeta2Profile;
+const RenX::ServerProfile *RenX::openBeta2Profile = &_openBeta2Profile;
+
+struct OpenBeta3Profile : BaseProfile
+{
+ OpenBeta3Profile()
+ {
+ disconnectOnGameOver = true;
+ }
+} _openBeta3Profile;
+const RenX::ServerProfile *RenX::openBeta3Profile = &_openBeta3Profile;
diff --git a/RenX.Core/RenX_ServerProfile.h b/RenX.Core/RenX_ServerProfile.h
new file mode 100644
index 0000000..07ee519
--- /dev/null
+++ b/RenX.Core/RenX_ServerProfile.h
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2014 Justin James.
+ *
+ * This license must be preserved.
+ * Any applications, libraries, or code which make any use of any
+ * component of this program must not be commercial, unless explicit
+ * permission is granted from the original author. The use of this
+ * program for non-profit purposes is permitted.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * In the event that this license restricts you from making desired use of this program, contact the original author.
+ * Written by Justin James
+ */
+
+#if !defined _RENX_SERVERPROFILE_H_HEADER
+#define _RENX_SERVERPROFILE_H_HEADER
+
+/**
+ * @file RenX_ServerProfile.h
+ * @brief Defines the ServerProfile class, and known profiles.
+ */
+
+#include "RenX.h"
+
+namespace RenX
+{
+ /**
+ * @brief Contains information about features supported by a server version.
+ */
+ struct RENX_API ServerProfile
+ {
+ bool supported;
+ bool privateMessages;
+ bool disconnectOnGameOver;
+ };
+
+ RENX_API extern const ServerProfile *defaultProfile; /** Default server profile */
+ RENX_API extern const ServerProfile *openBeta1Profile; /** Open Beta 1 server profile */
+ RENX_API extern const ServerProfile *openBeta2Profile; /** Open Beta 2 server profile */
+ RENX_API extern const ServerProfile *openBeta3Profile; /** Open Beta 3 server profile */
+
+}
+
+#endif // _RENX_SERVERPROFILE_H_HEADER
\ No newline at end of file