Skip to content

Commit aa0a0f1

Browse files
committed
Make suggested changes
1 parent f81609e commit aa0a0f1

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

Client/mods/deathmatch/logic/CPacketHandler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ class CPacketHandler
3838
ELEMENT_FAILURE,
3939
GENERAL_REFUSED,
4040
SERIAL_VERIFICATION,
41-
SERIAL_DUPLICATE,
4241
CONNECTION_DESYNC,
4342
BAN,
4443
KICK,
4544
CUSTOM,
46-
SHUTDOWN
45+
SHUTDOWN,
46+
SERIAL_DUPLICATE
4747
};
4848

4949
struct SEntityDependantStuff

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,11 @@ void CGame::Packet_PlayerJoinData(CPlayerJoinDataPacket& Packet)
18051805
CLogger::LogPrintf("CONNECT: %s failed to connect (Serial already in use) (%s)\n", szNick, strIPAndSerial.c_str());
18061806

18071807
// Tell the player the problem
1808-
DisconnectPlayer(this, *pPlayer, CPlayerDisconnectedPacket::SERIAL_DUPLICATE);
1808+
if (pPlayer->CanBitStream(eBitStreamVersion::CheckDuplicateSerials))
1809+
DisconnectPlayer(this, *pPlayer, CPlayerDisconnectedPacket::SERIAL_DUPLICATE);
1810+
else
1811+
DisconnectPlayer(this, *pPlayer, CPlayerDisconnectedPacket::KICK);
1812+
18091813
return;
18101814
}
18111815

Server/mods/deathmatch/logic/CPlayerManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ CPlayer* CPlayerManager::Get(const char* szNick, bool bCaseSensitive)
138138
return NULL;
139139
}
140140

141-
const CPlayer* CPlayerManager::GetBySerial(const std::string serial) const noexcept
141+
CPlayer* CPlayerManager::GetBySerial(const std::string_view serial) const noexcept
142142
{
143143
for (const auto& player : m_Players)
144144
{

Server/mods/deathmatch/logic/CPlayerManager.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class CPlayerManager;
1717
#include "packets/CPacket.h"
1818
#include "CPlayer.h"
1919
#include "../Config.h"
20-
#include <string>
2120

2221
class CPlayerManager
2322
{
@@ -41,7 +40,7 @@ class CPlayerManager
4140

4241
CPlayer* Get(const NetServerPlayerID& PlayerSocket);
4342
CPlayer* Get(const char* szNick, bool bCaseSensitive = false);
44-
const CPlayer* GetBySerial(const std::string serial) const noexcept;
43+
CPlayer* GetBySerial(const std::string_view serial) const noexcept;
4544

4645
std::list<CPlayer*>::const_iterator IterBegin() { return m_Players.begin(); };
4746
std::list<CPlayer*>::const_iterator IterEnd() { return m_Players.end(); };

Server/mods/deathmatch/logic/packets/CPlayerDisconnectedPacket.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ class CPlayerDisconnectedPacket final : public CPacket
3535
ELEMENT_FAILURE,
3636
GENERAL_REFUSED,
3737
SERIAL_VERIFICATION,
38-
SERIAL_DUPLICATE,
3938
CONNECTION_DESYNC,
4039
BAN,
4140
KICK,
4241
CUSTOM,
43-
SHUTDOWN
42+
SHUTDOWN,
43+
SERIAL_DUPLICATE
4444
};
4545

4646
CPlayerDisconnectedPacket(const char* szReason);

Shared/sdk/net/bitstream.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ enum class eBitStreamVersion : unsigned short
572572
// 2024-09-04
573573
RespawnObject_Serverside,
574574

575+
// Add check_duplicate_serials
576+
// 2024-09-04
577+
CheckDuplicateSerials,
578+
575579
// This allows us to automatically increment the BitStreamVersion when things are added to this enum.
576580
// Make sure you only add things above this comment.
577581
Next,

0 commit comments

Comments
 (0)