Application::TSettings: Improve default initialisation

This commit is contained in:
Lion Kortlepel
2021-12-06 09:00:57 +01:00
parent 9d283738aa
commit bd41382233
+16 -31
View File
@@ -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()>;