2020-08-18 20:42:30 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include "settings.hpp"
|
2020-08-22 02:03:12 +00:00
|
|
|
#include "contrib/INIReader.hpp"
|
2020-08-18 20:42:30 +00:00
|
|
|
|
|
|
|
// defaults :)
|
2020-08-22 17:39:13 +00:00
|
|
|
bool settings::VERBOSE = false;
|
|
|
|
|
2020-08-18 20:42:30 +00:00
|
|
|
int settings::LOGINPORT = 8001;
|
|
|
|
bool settings::LOGINRANDCHARACTERS = false;
|
|
|
|
|
|
|
|
int settings::SHARDPORT = 8002;
|
|
|
|
std::string settings::SHARDSERVERIP = "127.0.0.1";
|
2020-08-19 01:34:39 +00:00
|
|
|
int settings::VIEWDISTANCE = 20000;
|
2020-08-18 20:42:30 +00:00
|
|
|
|
|
|
|
// default spawn point is city hall
|
|
|
|
int settings::SPAWN_X = 179213;
|
|
|
|
int settings::SPAWN_Y = 268451;
|
|
|
|
int settings::SPAWN_Z = -4210;
|
2020-08-21 20:09:52 +00:00
|
|
|
std::string settings::GMPASS = "pass";
|
2020-08-21 22:14:11 +00:00
|
|
|
std::string settings::NPCJSON = "NPCs.json";
|
2020-08-20 15:43:37 +00:00
|
|
|
std::string settings::MOTDSTRING = "Welcome to OpenFusion!";
|
2020-08-18 20:42:30 +00:00
|
|
|
|
|
|
|
void settings::init() {
|
|
|
|
INIReader reader("config.ini");
|
|
|
|
|
|
|
|
if (reader.ParseError() != 0) {
|
|
|
|
if (reader.ParseError() == -1)
|
|
|
|
std::cerr << "[WARN] Settings: missing config.ini file!" << std::endl;
|
|
|
|
else
|
|
|
|
std::cerr << "[WARN] Settings: invalid config.ini syntax at line " << reader.ParseError() << std::endl;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-08-22 17:39:13 +00:00
|
|
|
VERBOSE = reader.GetBoolean("", "verbose", VERBOSE);
|
2020-08-18 20:42:30 +00:00
|
|
|
LOGINPORT = reader.GetInteger("login", "port", LOGINPORT);
|
|
|
|
LOGINRANDCHARACTERS = reader.GetBoolean("login", "randomcharacters", LOGINRANDCHARACTERS);
|
|
|
|
SHARDPORT = reader.GetInteger("shard", "port", SHARDPORT);
|
|
|
|
SHARDSERVERIP = reader.Get("shard", "ip", "127.0.0.1");
|
|
|
|
VIEWDISTANCE = reader.GetInteger("shard", "view", VIEWDISTANCE);
|
|
|
|
SPAWN_X = reader.GetInteger("shard", "spawnx", SPAWN_X);
|
|
|
|
SPAWN_Y = reader.GetInteger("shard", "spawny", SPAWN_Y);
|
|
|
|
SPAWN_Z = reader.GetInteger("shard", "spawnz", SPAWN_Z);
|
2020-08-21 22:14:11 +00:00
|
|
|
GMPASS = reader.Get("login", "pass", GMPASS);
|
|
|
|
NPCJSON = reader.Get("shard", "npcdata", NPCJSON);
|
|
|
|
MOTDSTRING = reader.Get("shard", "motd", MOTDSTRING);
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-08-19 17:22:54 +00:00
|
|
|
}
|