Skip to content

Commit 09d08c7

Browse files
committed
refactor(network): use NetPacketFieldType typedef
1 parent 7a593b9 commit 09d08c7

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
#include <Utility/CppMacros.h>
3535

3636
// TheSuperHackers @refactor BobTista 10/06/2025 Extract magic character literals into named constants for improved readability
37+
typedef UnsignedByte NetPacketFieldType;
38+
3739
namespace NetPacketFieldTypes {
38-
constexpr const char CommandType = 'T'; // NetCommandType field
39-
constexpr const char Relay = 'R'; // Relay field
40-
constexpr const char PlayerId = 'P'; // Player ID field
41-
constexpr const char CommandId = 'C'; // Command ID field
42-
constexpr const char Frame = 'F'; // Frame field
43-
constexpr const char Data = 'D'; // Data payload field
40+
constexpr const NetPacketFieldType CommandType = 'T'; // NetCommandType field
41+
constexpr const NetPacketFieldType Relay = 'R'; // Relay field
42+
constexpr const NetPacketFieldType PlayerId = 'P'; // Player ID field
43+
constexpr const NetPacketFieldType CommandId = 'C'; // Command ID field
44+
constexpr const NetPacketFieldType Frame = 'F'; // Frame field
45+
constexpr const NetPacketFieldType Data = 'D'; // Data payload field
4446
}
4547

4648
// This function assumes that all of the fields are either of default value or are

GeneralsMD/Code/GameEngine/Source/GameNetwork/NetPacket.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
#include <Utility/CppMacros.h>
3535

3636
// TheSuperHackers @refactor BobTista 10/06/2025 Extract magic character literals into named constants for improved readability
37+
typedef UnsignedByte NetPacketFieldType;
38+
3739
namespace NetPacketFieldTypes {
38-
constexpr const char CommandType = 'T'; // NetCommandType field
39-
constexpr const char Relay = 'R'; // Relay field
40-
constexpr const char PlayerId = 'P'; // Player ID field
41-
constexpr const char CommandId = 'C'; // Command ID field
42-
constexpr const char Frame = 'F'; // Frame field
43-
constexpr const char Data = 'D'; // Data payload field
40+
constexpr const NetPacketFieldType CommandType = 'T'; // NetCommandType field
41+
constexpr const NetPacketFieldType Relay = 'R'; // Relay field
42+
constexpr const NetPacketFieldType PlayerId = 'P'; // Player ID field
43+
constexpr const NetPacketFieldType CommandId = 'C'; // Command ID field
44+
constexpr const NetPacketFieldType Frame = 'F'; // Frame field
45+
constexpr const NetPacketFieldType Data = 'D'; // Data payload field
4446
}
4547

4648
// This function assumes that all of the fields are either of default value or are

0 commit comments

Comments
 (0)