mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 10:41:01 +00:00
Server config now uses json
This commit is contained in:
@@ -17,18 +17,26 @@ class Application final {
|
||||
public:
|
||||
// types
|
||||
struct TSettings {
|
||||
TSettings() noexcept
|
||||
: DebugModeEnabled(true) { }
|
||||
TSettings() noexcept :
|
||||
ServerName("BeamMP Server"),
|
||||
ServerDesc("BeamMP Default Description"),
|
||||
Resource("Resources"),
|
||||
MapName("/levels/gridmap/info.json"),
|
||||
MaxPlayers(10),
|
||||
Private(true),
|
||||
MaxCars(1),
|
||||
DebugModeEnabled(false),
|
||||
Port(30814){}
|
||||
std::string ServerName;
|
||||
std::string ServerDesc;
|
||||
std::string Resource;
|
||||
std::string MapName;
|
||||
std::string Key;
|
||||
int MaxPlayers {};
|
||||
bool Private {};
|
||||
int MaxCars {};
|
||||
int MaxPlayers;
|
||||
bool Private;
|
||||
int MaxCars;
|
||||
bool DebugModeEnabled;
|
||||
int Port {};
|
||||
int Port;
|
||||
std::string CustomIP;
|
||||
[[nodiscard]] bool HasCustomIP() const { return !CustomIP.empty(); }
|
||||
};
|
||||
|
||||
9
include/Json.h
Normal file
9
include/Json.h
Normal file
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// Created by anon on 4/21/21.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include "rapidjson/stringbuffer.h"
|
||||
#include "rapidjson/prettywriter.h"
|
||||
#include "rapidjson/document.h"
|
||||
#include "rapidjson/writer.h"
|
||||
@@ -7,6 +7,9 @@ public:
|
||||
explicit TConfig(const std::string& ConfigFile);
|
||||
|
||||
private:
|
||||
static void ReadJson();
|
||||
static void PrintDebug();
|
||||
static void ManageJson();
|
||||
static std::string RemoveComments(const std::string& Line);
|
||||
static void SetValues(const std::string& Line, int Index);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user