Consolidate serviceID enums into one enum (#1855)

* merge ServerType and ServiceID enums

* rename eConnectionType to ServiceType in preparation for enum unification

* unify ServiceID and ServiceType enums

* shrink ServiceType to an 8-bit integer

* fix linux compilation error and update gamemsg test

* return to uint16_t

* Update dNet/AuthPackets.cpp

Use cast instead of padding

Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com>

* Add default case to MasterServer.cpp

* move ref back to type

* Another formatting fix

* Fix comment to be more accurate

---------

Co-authored-by: jadebenn <9892985+jadebenn@users.noreply.github.com>
Co-authored-by: David Markowitz <39972741+EmosewaMC@users.noreply.github.com>
This commit is contained in:
jadebenn
2025-08-20 22:26:48 -05:00
committed by GitHub
parent 3890c0a86c
commit 3364884126
37 changed files with 188 additions and 202 deletions

View File

@@ -9,21 +9,7 @@
class Logger;
class dConfig;
enum class eServerDisconnectIdentifiers : uint32_t;
enum class ServerType : uint32_t {
Master,
Auth,
Chat,
World
};
enum class ServiceId : uint32_t{
General = 0,
Auth = 1,
Chat = 2,
World = 4,
Client = 5,
};
enum class ServiceType : uint16_t;
namespace Game {
using signal_t = volatile std::sig_atomic_t;
@@ -43,7 +29,7 @@ public:
Logger* logger,
const std::string masterIP,
int masterPort,
ServerType serverType,
ServiceType serverType,
dConfig* config,
Game::signal_t* shouldShutdown,
const std::string& masterPassword,
@@ -80,7 +66,7 @@ public:
NetworkIDManager* GetNetworkIDManager() { return mNetIDManager; }
const ServerType GetServerType() const { return mServerType; }
ServiceType GetServerType() const { return mServerType; }
[[nodiscard]]
std::chrono::steady_clock::duration GetUptime() const {
@@ -114,7 +100,7 @@ protected:
bool mIsInternal;
bool mIsOkay;
bool mMasterConnectionActive;
ServerType mServerType;
ServiceType mServerType;
RakPeerInterface* mMasterPeer = nullptr;
SocketDescriptor mMasterSocketDescriptor;