mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-06-19 01:40:52 +00:00
Application::TSettings: Improve default initialisation
This commit is contained in:
+17
-32
@@ -35,38 +35,23 @@ class Application final {
|
|||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
struct TSettings {
|
struct TSettings {
|
||||||
TSettings() noexcept
|
std::string ServerName { "BeamMP Server" };
|
||||||
: ServerName("BeamMP Server")
|
std::string ServerDesc { "BeamMP Default Description" };
|
||||||
, ServerDesc("BeamMP Default Description")
|
std::string Resource { "Resources" };
|
||||||
, Resource("Resources")
|
std::string MapName { "/levels/gridmap_v2/info.json" };
|
||||||
, MapName("/levels/gridmap_v2/info.json")
|
std::string Key {};
|
||||||
, SSLKeyPath("./.ssl/HttpServer/key.pem")
|
std::string SSLKeyPath { "./.ssl/HttpServer/key.pem" };
|
||||||
, SSLCertPath("./.ssl/HttpServer/cert.pem")
|
std::string SSLCertPath { "./.ssl/HttpServer/cert.pem" };
|
||||||
, HTTPServerPort(8080)
|
int MaxPlayers { 10 };
|
||||||
, MaxPlayers(10)
|
bool Private { true };
|
||||||
, Private(true)
|
int MaxCars { 1 };
|
||||||
, MaxCars(1)
|
bool DebugModeEnabled { false };
|
||||||
, DebugModeEnabled(false)
|
int Port { 30814 };
|
||||||
, Port(30814)
|
std::string CustomIP {};
|
||||||
, SendErrors(true)
|
bool SendErrors { true };
|
||||||
, SendErrorsMessageEnabled(true) { }
|
bool SendErrorsMessageEnabled { true };
|
||||||
std::string ServerName;
|
int HTTPServerPort { 8080 };
|
||||||
std::string ServerDesc;
|
|
||||||
std::string Resource;
|
|
||||||
std::string MapName;
|
|
||||||
std::string Key;
|
|
||||||
std::string SSLKeyPath;
|
|
||||||
std::string SSLCertPath;
|
|
||||||
int MaxPlayers;
|
|
||||||
bool Private;
|
|
||||||
int MaxCars;
|
|
||||||
bool DebugModeEnabled;
|
|
||||||
int Port;
|
|
||||||
std::string CustomIP;
|
|
||||||
bool SendErrors;
|
|
||||||
bool SendErrorsMessageEnabled;
|
|
||||||
[[nodiscard]] bool HasCustomIP() const { return !CustomIP.empty(); }
|
[[nodiscard]] bool HasCustomIP() const { return !CustomIP.empty(); }
|
||||||
int HTTPServerPort;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using TShutdownHandler = std::function<void()>;
|
using TShutdownHandler = std::function<void()>;
|
||||||
@@ -173,7 +158,7 @@ void RegisterThread(const std::string& str);
|
|||||||
if (Application::Settings.DebugModeEnabled) { \
|
if (Application::Settings.DebugModeEnabled) { \
|
||||||
Application::Console().Write(_this_location + std::string("[EVENT] ") + (x)); \
|
Application::Console().Write(_this_location + std::string("[EVENT] ") + (x)); \
|
||||||
} \
|
} \
|
||||||
}while(false)
|
} while (false)
|
||||||
// for those times when you just need to ignore something :^)
|
// for those times when you just need to ignore something :^)
|
||||||
// explicity disables a [[nodiscard]] warning
|
// explicity disables a [[nodiscard]] warning
|
||||||
#define beammp_ignore(x) (void)x
|
#define beammp_ignore(x) (void)x
|
||||||
|
|||||||
Reference in New Issue
Block a user