add GetServerVersion

This commit is contained in:
Lion Kortlepel
2021-07-15 00:04:44 +02:00
parent e3b6fd7998
commit ba3fd0e144
6 changed files with 39 additions and 10 deletions

View File

@@ -12,6 +12,14 @@ extern TSentry Sentry;
#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
@@ -44,6 +52,7 @@ public:
std::string CustomIP;
[[nodiscard]] bool HasCustomIP() const { return !CustomIP.empty(); }
};
using TShutdownHandler = std::function<void()>;
// methods
@@ -54,9 +63,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.3.1"; }
#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(const std::string& NewPPS) { mPPS = NewPPS; }
@@ -76,6 +85,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(bool DebugModeOverride = false);
@@ -146,4 +157,4 @@ void LogChatMessage(const std::string& name, int id, const std::string& msg);
#define Biggest 30000
std::string Comp(std::string Data);
std::string DeComp(std::string Compressed);
std::string DeComp(std::string Compressed);