Skip to content
Permalink
Browse files

Changed version compare to ignore build type

  • Loading branch information...
ccw808 committed Jun 30, 2019
1 parent 505467e commit 4244ec52a5155d624cd5ec8dca1bdca067309358
@@ -4807,7 +4807,7 @@ void CPacketHandler::Packet_ResourceStart(NetBitStreamInterface& bitStream)
bitStream.Read(usNoClientCacheScriptCount);

// Read the declared min client version for this resource
SString strMinServerReq, strMinClientReq;
CMtaVersion strMinServerReq, strMinClientReq;
if (bitStream.Version() >= 0x32)
{
bitStream.ReadString(strMinServerReq);
@@ -21,7 +21,7 @@ extern CClientGame* g_pClientGame;
int CResource::m_iShowingCursor = 0;

CResource::CResource(unsigned short usNetID, const char* szResourceName, CClientEntity* pResourceEntity, CClientEntity* pResourceDynamicEntity,
const SString& strMinServerReq, const SString& strMinClientReq, bool bEnableOOP)
const CMtaVersion& strMinServerReq, const CMtaVersion& strMinClientReq, bool bEnableOOP)
{
m_uiScriptID = CIdArray::PopUniqueId(this, EIdClass::RESOURCE);
m_usNetID = usNetID;
@@ -49,7 +49,7 @@ class CResource
{
public:
CResource(unsigned short usNetID, const char* szResourceName, CClientEntity* pResourceEntity, CClientEntity* pResourceDynamicEntity,
const SString& strMinServerReq, const SString& strMinClientReq, bool bEnableOOP);
const CMtaVersion& strMinServerReq, const CMtaVersion& strMinClientReq, bool bEnableOOP);
~CResource();

unsigned short GetNetID() { return m_usNetID; };
@@ -102,8 +102,8 @@ class CResource

void SetRemainingNoClientCacheScripts(unsigned short usRemaining) { m_usRemainingNoClientCacheScripts = usRemaining; }
void LoadNoClientCacheScript(const char* chunk, unsigned int length, const SString& strFilename);
const SString& GetMinServerReq() const { return m_strMinServerReq; }
const SString& GetMinClientReq() const { return m_strMinClientReq; }
const CMtaVersion& GetMinServerReq() const { return m_strMinServerReq; }
const CMtaVersion& GetMinClientReq() const { return m_strMinClientReq; }
bool IsOOPEnabled() { return m_bOOPEnabled; }
void HandleDownloadedFileTrouble(CResourceFile* pResourceFile, bool bScript);
bool IsWaitingForInitialDownloads();
@@ -129,8 +129,8 @@ class CResource
class CClientEntity* m_pResourceIFPRoot;
unsigned short m_usRemainingNoClientCacheScripts;
bool m_bLoadAfterReceivingNoClientCacheScripts;
SString m_strMinServerReq;
SString m_strMinClientReq;
CMtaVersion m_strMinServerReq;
CMtaVersion m_strMinClientReq;
bool m_bOOPEnabled;
int m_iDownloadPriorityGroup;

@@ -27,7 +27,7 @@ CResourceManager::~CResourceManager()
}

CResource* CResourceManager::Add(unsigned short usNetID, const char* szResourceName, CClientEntity* pResourceEntity, CClientEntity* pResourceDynamicEntity,
const SString& strMinServerReq, const SString& strMinClientReq, bool bEnableOOP)
const CMtaVersion& strMinServerReq, const CMtaVersion& strMinClientReq, bool bEnableOOP)
{
CResource* pResource = new CResource(usNetID, szResourceName, pResourceEntity, pResourceDynamicEntity, strMinServerReq, strMinClientReq, bEnableOOP);
if (pResource)
@@ -32,7 +32,7 @@ class CResourceManager
~CResourceManager();

CResource* Add(unsigned short usNetID, const char* szResourceName, CClientEntity* pResourceEntity, CClientEntity* pResourceDynamicEntity,
const SString& strMinServerReq, const SString& strMinClientReq, bool bEnableOOP);
const CMtaVersion& strMinServerReq, const CMtaVersion& strMinClientReq, bool bEnableOOP);
CResource* GetResource(const char* szResourceName);
CResource* GetResourceFromNetID(unsigned short usNetID);
CResource* GetResourceFromScriptID(uint uiScriptID);
@@ -768,10 +768,8 @@ bool MinClientReqCheck(CScriptArgReader& argStream, const char* szVersionReq, co
{
if (pResource->GetMinClientReq() < szVersionReq)
{
#if MTASA_VERSION_TYPE == VERSION_TYPE_RELEASE
if (szReason)
argStream.SetVersionWarning(szVersionReq, "client", szReason);
#endif
return false;
}
}
@@ -1633,7 +1633,7 @@ void CGame::Packet_PlayerJoinData(CPlayerJoinDataPacket& Packet)
NetServerPlayerID p = Packet.GetSourceSocket();
SString strSerial;
SString strExtra;
SString strPlayerVersion;
CMtaVersion strPlayerVersion;
{
SFixedString<32> strSerialTemp;
SFixedString<64> strExtraTemp;
@@ -4228,7 +4228,7 @@ void CGame::SendSyncSettings(CPlayer* pPlayer)
// Check if supplied version string is below current minimum requirement
//
//////////////////////////////////////////////////////////////////
bool CGame::IsBelowMinimumClient(const SString& strVersion)
bool CGame::IsBelowMinimumClient(const CMtaVersion& strVersion)
{
return strVersion < CalculateMinClientRequirement();
}
@@ -4240,7 +4240,7 @@ bool CGame::IsBelowMinimumClient(const SString& strVersion)
// Check if supplied version string is below recommended
//
//////////////////////////////////////////////////////////////////
bool CGame::IsBelowRecommendedClient(const SString& strVersion)
bool CGame::IsBelowRecommendedClient(const CMtaVersion& strVersion)
{
return strVersion < m_pMainConfig->GetRecommendedClientVersion();
}
@@ -4252,16 +4252,16 @@ bool CGame::IsBelowRecommendedClient(const SString& strVersion)
// Determine min client version setting to apply for connecting players
//
//////////////////////////////////////////////////////////////////
SString CGame::CalculateMinClientRequirement()
CMtaVersion CGame::CalculateMinClientRequirement()
{
if (g_pGame->IsBeingDeleted())
return "";

// Calc effective min client version
SString strMinClientRequirementFromConfig = m_pMainConfig->GetMinClientVersion();
SString strMinClientRequirementFromResources = m_pResourceManager->GetMinClientRequirement();
CMtaVersion strMinClientRequirementFromConfig = m_pMainConfig->GetMinClientVersion();
CMtaVersion strMinClientRequirementFromResources = m_pResourceManager->GetMinClientRequirement();

SString strNewMin;
CMtaVersion strNewMin;

if (strNewMin < strMinClientRequirementFromConfig)
strNewMin = strMinClientRequirementFromConfig;
@@ -4309,7 +4309,7 @@ SString CGame::CalculateMinClientRequirement()

// Do version based kick check as well
{
SString strKickMin;
CMtaVersion strKickMin;

if (g_pGame->IsBulletSyncActive())
{
@@ -447,9 +447,9 @@ class CGame
bool IsBulletSyncActive();
void SendSyncSettings(CPlayer* pPlayer = NULL);

SString CalculateMinClientRequirement();
bool IsBelowMinimumClient(const SString& strVersion);
bool IsBelowRecommendedClient(const SString& strVersion);
CMtaVersion CalculateMinClientRequirement();
bool IsBelowMinimumClient(const CMtaVersion& strVersion);
bool IsBelowRecommendedClient(const CMtaVersion& strVersion);
void ApplyAseSetting();
bool IsUsingMtaServerConf() { return m_bUsingMtaServerConf; }

@@ -637,9 +637,9 @@ class CGame
CLuaMain* m_pLatentSendsLuaMain;
ushort m_usLatentSendsResourceNetId;

SString m_strPrevMinClientKickRequirement;
SString m_strPrevMinClientConnectRequirement;
SString m_strPrevLowestConnectedPlayerVersion;
CMtaVersion m_strPrevMinClientKickRequirement;
CMtaVersion m_strPrevMinClientConnectRequirement;
CMtaVersion m_strPrevLowestConnectedPlayerVersion;

SharedUtil::CAsyncTaskScheduler* m_pAsyncTaskScheduler;

@@ -86,8 +86,8 @@ class CMainConfig : public CXMLConfig
bool GetSerialVerificationEnabled() { return m_bVerifySerials; };
bool IsDisableAC(const char* szTagAC) { return MapContains(m_DisableComboACMap, szTagAC); };
bool IsEnableDiagnostic(const char* szTag) { return MapContains(m_EnableDiagnosticMap, szTag); };
SString GetMinClientVersion() { return m_strMinClientVersion; }
const SString& GetRecommendedClientVersion() { return m_strRecommendedClientVersion; }
CMtaVersion GetMinClientVersion() { return m_strMinClientVersion; }
const CMtaVersion& GetRecommendedClientVersion() { return m_strRecommendedClientVersion; }
int GetMinClientVersionAutoUpdate() { return m_iMinClientVersionAutoUpdate; }
const SString& GetIdFile() { return m_strIdFile; }
bool GetThreadNetEnabled() { return m_bThreadNetEnabled; }
@@ -189,8 +189,8 @@ class CMainConfig : public CXMLConfig
bool m_bAuthSerialHttpEnabled;
std::vector<SString> m_AuthSerialHttpIpExceptionList;
std::vector<SString> m_OwnerEmailAddressList;
SString m_strMinClientVersion;
SString m_strRecommendedClientVersion;
CMtaVersion m_strMinClientVersion;
CMtaVersion m_strRecommendedClientVersion;
SString m_strIdFile;
SString m_strGlobalDatabasesPath;
SString m_strSystemDatabasesPath;
@@ -1098,7 +1098,7 @@ float CPlayer::GetWeaponRangeFromSlot(uint uiSlot)
return m_fWeaponRangeLast;
}

void CPlayer::SetPlayerVersion(const SString& strPlayerVersion)
void CPlayer::SetPlayerVersion(const CMtaVersion& strPlayerVersion)
{
m_strPlayerVersion = strPlayerVersion;
}
@@ -93,8 +93,8 @@ class CPlayer : public CPed, public CClient
void SetMTAVersion(unsigned short usMTAVersion) { m_usMTAVersion = usMTAVersion; };
unsigned short GetBitStreamVersion() { return m_usBitStreamVersion; };
void SetBitStreamVersion(unsigned short usBitStreamVersion) { m_usBitStreamVersion = usBitStreamVersion; };
void SetPlayerVersion(const SString& strPlayerVersion);
const SString& GetPlayerVersion() { return m_strPlayerVersion; };
void SetPlayerVersion(const CMtaVersion& strPlayerVersion);
const CMtaVersion& GetPlayerVersion() { return m_strPlayerVersion; };

bool IsMuted() { return m_bIsMuted; };
void SetMuted(bool bSetMuted) { m_bIsMuted = bSetMuted; };
@@ -351,7 +351,7 @@ class CPlayer : public CPed, public CClient
int m_iGameVersion;
unsigned short m_usMTAVersion;
unsigned short m_usBitStreamVersion;
SString m_strPlayerVersion;
CMtaVersion m_strPlayerVersion;
bool m_bIsMuted;
bool m_bIsLeavingServer;
bool m_bIsJoined;
@@ -56,7 +56,7 @@ class CPlayerManager

void ResetAll();
void OnPlayerJoin(CPlayer* pPlayer);
const SString& GetLowestConnectedPlayerVersion() { return m_strLowestConnectedPlayerVersion; }
const CMtaVersion& GetLowestConnectedPlayerVersion() { return m_strLowestConnectedPlayerVersion; }

private:
void AddToList(CPlayer* pPlayer);
@@ -66,6 +66,6 @@ class CPlayerManager

CMappedList<CPlayer*> m_Players;
std::map<NetServerPlayerID, CPlayer*> m_SocketPlayerMap;
SString m_strLowestConnectedPlayerVersion;
CMtaVersion m_strLowestConnectedPlayerVersion;
CElapsedTime m_ZombieCheckTimer;
};
@@ -660,7 +660,7 @@ bool CResource::GetCompatibilityStatus(SString& strOutStatus)
}

// Check this server can run this resource
SString strServerVersion = CStaticFunctionDefinitions::GetVersionSortable();
CMtaVersion strServerVersion = CStaticFunctionDefinitions::GetVersionSortable();
if (m_strMinServerReqFromMetaXml > strServerVersion)
{
strOutStatus = SString("this server version is too low (%s required)", *m_strMinServerReqFromMetaXml);
@@ -310,8 +310,8 @@ class CResource : public EHS
bool HandleAclRequestChangeCommand(const SString& strRightName, bool bAccess, const SString& strWho);
bool HandleAclRequestChange(const CAclRightName& strRightName, bool bAccess, const SString& strWho);

const SString& GetMinServerReqFromMetaXml() const noexcept { return m_strMinServerReqFromMetaXml; }
const SString& GetMinClientReqFromMetaXml() const noexcept { return m_strMinClientReqFromMetaXml; }
const CMtaVersion& GetMinServerReqFromMetaXml() const noexcept { return m_strMinServerReqFromMetaXml; }
const CMtaVersion& GetMinClientReqFromMetaXml() const noexcept { return m_strMinClientReqFromMetaXml; }

bool IsOOPEnabledInMetaXml() const noexcept { return m_bOOPEnabledInMetaXml; }

@@ -425,10 +425,10 @@ class CResource : public EHS
CXMLNode* m_pNodeSettings = nullptr; // Settings XML node, read from meta.xml and copied into it's own instance
CXMLNode* m_pNodeStorage = nullptr; // Dummy XML node used for temporary storage of stuff returned by CSettings::Get

SString m_strMinClientReqFromMetaXml; // Min MTA client version as declared in meta.xml
SString m_strMinServerReqFromMetaXml; // Min MTA server version as declared in meta.xml
SString m_strMinClientReqFromSource; // Min MTA client version as calculated by scanning the script source
SString m_strMinServerReqFromSource; // Min MTA server version as calculated by scanning the script source
CMtaVersion m_strMinClientReqFromMetaXml; // Min MTA client version as declared in meta.xml
CMtaVersion m_strMinServerReqFromMetaXml; // Min MTA server version as declared in meta.xml
CMtaVersion m_strMinClientReqFromSource; // Min MTA client version as calculated by scanning the script source
CMtaVersion m_strMinServerReqFromSource; // Min MTA server version as calculated by scanning the script source
SString m_strMinClientReason;
SString m_strMinServerReason;

0 comments on commit 4244ec5

Please sign in to comment.
You can’t perform that action at this time.