Skip to content

Commit 20a5659

Browse files
authored
Merge branch 'master' into feature/DeviceSelectionFixes
2 parents 479f0f7 + f095410 commit 20a5659

29 files changed

+189
-27
lines changed

Client/core/CConsole.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class CConsole : public CConsoleInterface
4141
bool IsInputActive();
4242
void ActivateInput();
4343

44-
void HandleTextAccepted(bool bHandled);
4544
void GetCommandInfo(const std::string& strIn, std::string& strCmdOut, std::string& strCmdLineOut);
4645

4746
void ResetHistoryChanges();

Client/mods/deathmatch/logic/CPacketHandler.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ void CPacketHandler::Packet_ServerDisconnected(NetBitStreamInterface& bitStream)
572572
strReason = _("Disconnected: Serial verification failed");
573573
strErrorCode = _E("CD44");
574574
break;
575+
case ePlayerDisconnectType::SERIAL_DUPLICATE:
576+
strReason = _("Disconnected: Serial already in use");
577+
strErrorCode = _E("CD50");
578+
break;
575579
case ePlayerDisconnectType::CONNECTION_DESYNC:
576580
strReason = _("Disconnected: Connection desync %s");
577581
strErrorCode = _E("CD45");

Client/mods/deathmatch/logic/CPacketHandler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class CPacketHandler
4242
BAN,
4343
KICK,
4444
CUSTOM,
45-
SHUTDOWN
45+
SHUTDOWN,
46+
SERIAL_DUPLICATE
4647
};
4748

4849
struct SEntityDependantStuff

Client/mods/deathmatch/logic/rpc/CWorldRPCs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ void CWorldRPCs::SetSyncIntervals(NetBitStreamInterface& bitStream)
619619
bitStream.Read(g_TickRateSettings.iObjectSync);
620620
bitStream.Read(g_TickRateSettings.iKeySyncRotation);
621621
bitStream.Read(g_TickRateSettings.iKeySyncAnalogMove);
622+
bitStream.Read(g_TickRateSettings.iPedSyncerDistance);
623+
bitStream.Read(g_TickRateSettings.iUnoccupiedVehicleSyncerDistance);
622624
}
623625

624626
void CWorldRPCs::SetMoonSize(NetBitStreamInterface& bitStream)

Server/mods/deathmatch/StdInc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <bochs_internal/bochs_crc32.h>
5050
#include <pcrecpp.h>
5151
#include <pthread.h>
52+
#include "version.h"
5253

5354
extern class CNetServer* g_pRealNetServer;
5455
extern class CGame* g_pGame;

Server/mods/deathmatch/editor.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@
268268
Values: 0 - Off, 1 - Enabled. Default - 1 -->
269269
<resource_client_file_checks>1</resource_client_file_checks>
270270

271+
<!-- This parameter determines that the server checks when the players connect that there are no other players with the same serial number.
272+
Note that this may break compatibility with virtual machines.
273+
Not guarantees that the player cannot manipulate their serial.
274+
Values: 0 - Off, 1 - Enabled. Default - 1 -->
275+
<check_duplicate_serials>1</check_duplicate_serials>
276+
271277
<!-- Specifies the module(s) which are loaded with the server. To load several modules, add more <module>
272278
parameter(s). Optional parameter. -->
273279
<!-- <module src="sample_win32.dll"/> -->

Server/mods/deathmatch/local.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,18 @@
268268
Values: 0 - Off, 1 - Enabled. Default - 1 -->
269269
<resource_client_file_checks>1</resource_client_file_checks>
270270

271+
<!-- Enables extra protection for element data.
272+
When this option is enabled, the server ignores element data sync packets from the client,
273+
except for allowed keys.
274+
Values: 0 - Off, 1 - Enabled. Default - 0 -->
275+
<elementdata_whitelisted>0</elementdata_whitelisted>
276+
277+
<!-- This parameter determines that the server checks when the players connect that there are no other players with the same serial number.
278+
Note that this may break compatibility with virtual machines.
279+
Not guarantees that the player cannot manipulate their serial.
280+
Values: 0 - Off, 1 - Enabled. Default - 1 -->
281+
<check_duplicate_serials>1</check_duplicate_serials>
282+
271283
<!-- Specifies the module(s) which are loaded with the server. To load several modules, add more <module>
272284
parameter(s). Optional parameter. -->
273285
<!-- <module src="sample_win32.dll"/> -->

Server/mods/deathmatch/logic/CCustomData.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void CCustomData::Copy(CCustomData* pCustomData)
2121
}
2222
}
2323

24-
SCustomData* CCustomData::Get(const char* szName)
24+
SCustomData* CCustomData::Get(const char* szName) const
2525
{
2626
assert(szName);
2727

@@ -100,6 +100,7 @@ void CCustomData::Set(const char* szName, const CLuaArgument& Variable, ESyncTyp
100100
SCustomData newData;
101101
newData.Variable = Variable;
102102
newData.syncType = syncType;
103+
newData.clientChangesMode = eCustomDataClientTrust::UNSET;
103104
m_Data[szName] = newData;
104105
UpdateSynced(szName, Variable, syncType);
105106
}
@@ -120,6 +121,12 @@ bool CCustomData::Delete(const char* szName)
120121
return false;
121122
}
122123

124+
void CCustomData::SetClientChangesMode(const char* szName, eCustomDataClientTrust mode)
125+
{
126+
SCustomData& pData = m_Data[szName];
127+
pData.clientChangesMode = mode;
128+
}
129+
123130
CXMLNode* CCustomData::OutputToXML(CXMLNode* pNode)
124131
{
125132
std::map<std::string, SCustomData>::const_iterator iter = m_Data.begin();

Server/mods/deathmatch/logic/CCustomData.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,33 @@ enum class ESyncType
2525
SUBSCRIBE,
2626
};
2727

28+
enum class eCustomDataClientTrust : std::uint8_t
29+
{
30+
UNSET,
31+
ALLOW,
32+
DENY,
33+
};
34+
2835
struct SCustomData
2936
{
30-
CLuaArgument Variable;
31-
ESyncType syncType;
37+
CLuaArgument Variable;
38+
ESyncType syncType;
39+
eCustomDataClientTrust clientChangesMode;
3240
};
3341

3442
class CCustomData
3543
{
3644
public:
3745
void Copy(CCustomData* pCustomData);
3846

39-
SCustomData* Get(const char* szName);
47+
SCustomData* Get(const char* szName) const;
4048
SCustomData* GetSynced(const char* szName);
4149
void Set(const char* szName, const CLuaArgument& Variable, ESyncType syncType = ESyncType::BROADCAST);
4250

4351
bool Delete(const char* szName);
4452

53+
void SetClientChangesMode(const char* szName, eCustomDataClientTrust mode);
54+
4555
unsigned short CountOnlySynchronized();
4656

4757
CXMLNode* OutputToXML(CXMLNode* pNode);

Server/mods/deathmatch/logic/CElement.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ void CElement::ReadCustomData(CEvents* pEvents, CXMLNode& Node)
508508
}
509509
}
510510

511-
CLuaArgument* CElement::GetCustomData(const char* szName, bool bInheritData, ESyncType* pSyncType)
511+
CLuaArgument* CElement::GetCustomData(const char* szName, bool bInheritData, ESyncType* pSyncType, eCustomDataClientTrust* clientChangesMode)
512512
{
513513
assert(szName);
514514

@@ -518,13 +518,17 @@ CLuaArgument* CElement::GetCustomData(const char* szName, bool bInheritData, ESy
518518
{
519519
if (pSyncType)
520520
*pSyncType = pData->syncType;
521+
522+
if (clientChangesMode)
523+
*clientChangesMode = pData->clientChangesMode;
524+
521525
return &pData->Variable;
522526
}
523527

524528
// If none, try returning parent's custom data
525529
if (bInheritData && m_pParent)
526530
{
527-
return m_pParent->GetCustomData(szName, true, pSyncType);
531+
return m_pParent->GetCustomData(szName, true, pSyncType, clientChangesMode);
528532
}
529533

530534
// None available

0 commit comments

Comments
 (0)