add GetServerVersion

This commit is contained in:
Lion Kortlepel
2021-07-15 00:04:44 +02:00
parent 9595ef164e
commit e11211f201
6 changed files with 42 additions and 7 deletions

View File

@@ -8,6 +8,14 @@
#include "TConsole.h"
struct Version {
uint8_t major;
uint8_t minor;
uint8_t patch;
Version(uint8_t major, uint8_t minor, uint8_t patch);
std::string AsString();
};
// static class handling application start, shutdown, etc.
// yes, static classes, singletons, globals are all pretty
// bad idioms. In this case we need a central way to access
@@ -40,6 +48,7 @@ public:
std::string CustomIP;
[[nodiscard]] bool HasCustomIP() const { return !CustomIP.empty(); }
};
using TShutdownHandler = std::function<void()>;
// methods
@@ -50,9 +59,9 @@ public:
// Causes all threads to finish up and exit gracefull gracefully
static void GracefullyShutdown();
static TConsole& Console() { return *mConsole; }
static std::string ServerVersion() { return "2.2.0"; }
#warning "change version from 2.2.0 to real version"
static std::string ClientVersion() { return "2.0"; }
static std::string ServerVersionString();
static const Version& ServerVersion() { return mVersion; }
static std::string ClientVersionString() { return "2.0"; }
static std::string PPS() { return mPPS; }
static void SetPPS(std::string NewPPS) { mPPS = NewPPS; }
@@ -67,6 +76,8 @@ private:
static std::unique_ptr<TConsole> mConsole;
static inline std::mutex mShutdownHandlersMutex {};
static inline std::deque<TShutdownHandler> mShutdownHandlers {};
static inline Version mVersion { 2, 2, 0 };
};
std::string ThreadName();