mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
eqemu_config.cpp & .h header cleanup, code style cleanup of eqemu_config.h
This commit is contained in:
parent
e048c5cf17
commit
bbea7f4f53
@ -15,9 +15,11 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../common/debug.h"
|
#include "../common/debug.h"
|
||||||
#include "eqemu_config.h"
|
#include "eqemu_config.h"
|
||||||
#include "misc_functions.h"
|
#include "misc_functions.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* EQEMu: Everquest Server Emulator
|
/* EQEMu: Everquest Server Emulator
|
||||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@ -28,200 +28,192 @@ struct LoginConfig {
|
|||||||
uint16 LoginPort;
|
uint16 LoginPort;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EQEmuConfig : public XMLParser {
|
class EQEmuConfig : public XMLParser
|
||||||
public:
|
{
|
||||||
virtual std::string GetByName(const std::string &var_name) const;
|
public:
|
||||||
|
virtual std::string GetByName(const std::string &var_name) const;
|
||||||
|
|
||||||
// From <world/>
|
// From <world/>
|
||||||
std::string ShortName;
|
std::string ShortName;
|
||||||
std::string LongName;
|
std::string LongName;
|
||||||
std::string WorldAddress;
|
std::string WorldAddress;
|
||||||
std::string LocalAddress;
|
std::string LocalAddress;
|
||||||
std::string LoginHost;
|
std::string LoginHost;
|
||||||
std::string LoginAccount;
|
std::string LoginAccount;
|
||||||
std::string LoginPassword;
|
std::string LoginPassword;
|
||||||
uint16 LoginPort;
|
uint16 LoginPort;
|
||||||
uint32 LoginCount;
|
uint32 LoginCount;
|
||||||
LinkedList<LoginConfig*> loginlist;
|
LinkedList<LoginConfig*> loginlist;
|
||||||
bool Locked;
|
bool Locked;
|
||||||
uint16 WorldTCPPort;
|
uint16 WorldTCPPort;
|
||||||
std::string WorldIP;
|
std::string WorldIP;
|
||||||
bool TelnetEnabled;
|
bool TelnetEnabled;
|
||||||
int32 MaxClients;
|
int32 MaxClients;
|
||||||
bool WorldHTTPEnabled;
|
bool WorldHTTPEnabled;
|
||||||
uint16 WorldHTTPPort;
|
uint16 WorldHTTPPort;
|
||||||
std::string WorldHTTPMimeFile;
|
std::string WorldHTTPMimeFile;
|
||||||
std::string SharedKey;
|
std::string SharedKey;
|
||||||
|
|
||||||
// From <chatserver/>
|
// From <chatserver/>
|
||||||
std::string ChatHost;
|
std::string ChatHost;
|
||||||
uint16 ChatPort;
|
uint16 ChatPort;
|
||||||
|
|
||||||
// From <mailserver/>
|
// From <mailserver/>
|
||||||
std::string MailHost;
|
std::string MailHost;
|
||||||
uint16 MailPort;
|
uint16 MailPort;
|
||||||
|
|
||||||
// From <database/>
|
// From <database/>
|
||||||
std::string DatabaseHost;
|
std::string DatabaseHost;
|
||||||
std::string DatabaseUsername;
|
std::string DatabaseUsername;
|
||||||
std::string DatabasePassword;
|
std::string DatabasePassword;
|
||||||
std::string DatabaseDB;
|
std::string DatabaseDB;
|
||||||
uint16 DatabasePort;
|
uint16 DatabasePort;
|
||||||
|
|
||||||
// From <qsdatabase> // QueryServ
|
// From <qsdatabase> // QueryServ
|
||||||
std::string QSDatabaseHost;
|
std::string QSDatabaseHost;
|
||||||
std::string QSDatabaseUsername;
|
std::string QSDatabaseUsername;
|
||||||
std::string QSDatabasePassword;
|
std::string QSDatabasePassword;
|
||||||
std::string QSDatabaseDB;
|
std::string QSDatabaseDB;
|
||||||
uint16 QSDatabasePort;
|
uint16 QSDatabasePort;
|
||||||
|
|
||||||
// From <files/>
|
// From <files/>
|
||||||
std::string SpellsFile;
|
std::string SpellsFile;
|
||||||
std::string OpCodesFile;
|
std::string OpCodesFile;
|
||||||
std::string EQTimeFile;
|
std::string EQTimeFile;
|
||||||
std::string LogSettingsFile;
|
std::string LogSettingsFile;
|
||||||
|
|
||||||
// From <directories/>
|
// From <directories/>
|
||||||
std::string MapDir;
|
std::string MapDir;
|
||||||
std::string QuestDir;
|
std::string QuestDir;
|
||||||
std::string PluginDir;
|
std::string PluginDir;
|
||||||
|
|
||||||
// From <launcher/>
|
// From <launcher/>
|
||||||
std::string LogPrefix;
|
std::string LogPrefix;
|
||||||
std::string LogSuffix;
|
std::string LogSuffix;
|
||||||
std::string ZoneExe;
|
std::string ZoneExe;
|
||||||
uint32 RestartWait;
|
uint32 RestartWait;
|
||||||
uint32 TerminateWait;
|
uint32 TerminateWait;
|
||||||
uint32 InitialBootWait;
|
uint32 InitialBootWait;
|
||||||
uint32 ZoneBootInterval;
|
uint32 ZoneBootInterval;
|
||||||
|
|
||||||
// From <zones/>
|
// From <zones/>
|
||||||
uint16 ZonePortLow;
|
uint16 ZonePortLow;
|
||||||
uint16 ZonePortHigh;
|
uint16 ZonePortHigh;
|
||||||
uint8 DefaultStatus;
|
uint8 DefaultStatus;
|
||||||
|
|
||||||
// uint16 DynamicCount;
|
// uint16 DynamicCount;
|
||||||
|
|
||||||
// map<string,uint16> StaticZones;
|
// map<string,uint16> StaticZones;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static EQEmuConfig *_config;
|
static EQEmuConfig *_config;
|
||||||
|
|
||||||
static std::string ConfigFile;
|
static std::string ConfigFile;
|
||||||
|
|
||||||
#define ELEMENT(name) \
|
#define ELEMENT(name) \
|
||||||
void do_##name(TiXmlElement *ele);
|
void do_##name(TiXmlElement *ele);
|
||||||
#include "eqemu_config_elements.h"
|
#include "eqemu_config_elements.h"
|
||||||
|
|
||||||
|
|
||||||
EQEmuConfig() {
|
EQEmuConfig()
|
||||||
// import the needed handler prototypes
|
{
|
||||||
|
// import the needed handler prototypes
|
||||||
#define ELEMENT(name) \
|
#define ELEMENT(name) \
|
||||||
Handlers[#name]=(ElementHandler)&EQEmuConfig::do_##name;
|
Handlers[#name]=(ElementHandler)&EQEmuConfig::do_##name;
|
||||||
#include "eqemu_config_elements.h"
|
#include "eqemu_config_elements.h"
|
||||||
|
// Set sane defaults
|
||||||
|
// Login server
|
||||||
|
LoginHost = "eqemulator.net";
|
||||||
|
LoginPort = 5998;
|
||||||
|
// World
|
||||||
|
Locked = false;
|
||||||
|
WorldTCPPort = 9000;
|
||||||
|
TelnetEnabled = false;
|
||||||
|
WorldHTTPEnabled = false;
|
||||||
|
WorldHTTPPort = 9080;
|
||||||
|
WorldHTTPMimeFile = "mime.types";
|
||||||
|
SharedKey = ""; //blank disables authentication
|
||||||
|
// Mail
|
||||||
|
ChatHost = "eqchat.eqemulator.net";
|
||||||
|
ChatPort = 7778;
|
||||||
|
// Mail
|
||||||
|
MailHost = "eqmail.eqemulator.net";
|
||||||
|
MailPort = 7779;
|
||||||
|
// Mysql
|
||||||
|
DatabaseHost = "localhost";
|
||||||
|
DatabasePort = 3306;
|
||||||
|
DatabaseUsername = "eq";
|
||||||
|
DatabasePassword = "eq";
|
||||||
|
DatabaseDB = "eq";
|
||||||
|
// QueryServ Database
|
||||||
|
QSDatabaseHost = "localhost";
|
||||||
|
QSDatabasePort = 3306;
|
||||||
|
QSDatabaseUsername = "eq";
|
||||||
|
QSDatabasePassword = "eq";
|
||||||
|
QSDatabaseDB = "eq";
|
||||||
|
// Files
|
||||||
|
SpellsFile = "spells_us.txt";
|
||||||
|
OpCodesFile = "opcodes.conf";
|
||||||
|
EQTimeFile = "eqtime.cfg";
|
||||||
|
LogSettingsFile = "log.ini";
|
||||||
|
// Dirs
|
||||||
|
MapDir = "Maps";
|
||||||
|
QuestDir = "quests";
|
||||||
|
PluginDir = "plugins";
|
||||||
|
// Launcher
|
||||||
|
LogPrefix = "logs/zone-";
|
||||||
|
LogSuffix = ".log";
|
||||||
|
RestartWait = 10000; //milliseconds
|
||||||
|
TerminateWait = 10000; //milliseconds
|
||||||
|
InitialBootWait = 20000; //milliseconds
|
||||||
|
ZoneBootInterval = 2000; //milliseconds
|
||||||
|
#ifdef WIN32
|
||||||
|
ZoneExe = "zone.exe";
|
||||||
|
#else
|
||||||
|
ZoneExe = "./zone";
|
||||||
|
#endif
|
||||||
|
// Zones
|
||||||
|
ZonePortLow = 7000;
|
||||||
|
ZonePortHigh = 7999;
|
||||||
|
DefaultStatus = 0;
|
||||||
|
// For where zones need to connect to.
|
||||||
|
WorldIP = "127.0.0.1";
|
||||||
|
// Dynamics to start
|
||||||
|
//DynamicCount=5;
|
||||||
|
MaxClients = -1;
|
||||||
|
LoginCount = 0;
|
||||||
|
}
|
||||||
|
virtual ~EQEmuConfig() {}
|
||||||
|
|
||||||
// Set sane defaults
|
public:
|
||||||
|
|
||||||
// Login server
|
// Produce a const singleton
|
||||||
LoginHost="eqemulator.net";
|
static const EQEmuConfig *get()
|
||||||
LoginPort=5998;
|
{
|
||||||
|
if (_config == nullptr) {
|
||||||
|
LoadConfig();
|
||||||
|
}
|
||||||
|
return (_config);
|
||||||
|
}
|
||||||
|
|
||||||
// World
|
// Allow the use to set the conf file to be used.
|
||||||
Locked=false;
|
static void SetConfigFile(std::string file)
|
||||||
WorldTCPPort=9000;
|
{
|
||||||
TelnetEnabled=false;
|
EQEmuConfig::ConfigFile = file;
|
||||||
WorldHTTPEnabled=false;
|
}
|
||||||
WorldHTTPPort=9080;
|
|
||||||
WorldHTTPMimeFile="mime.types";
|
|
||||||
SharedKey = ""; //blank disables authentication
|
|
||||||
|
|
||||||
// Mail
|
// Load the config
|
||||||
ChatHost="eqchat.eqemulator.net";
|
static bool LoadConfig()
|
||||||
ChatPort=7778;
|
{
|
||||||
|
if (_config != nullptr) {
|
||||||
|
delete _config;
|
||||||
|
}
|
||||||
|
_config = new EQEmuConfig;
|
||||||
|
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(), "server");
|
||||||
|
}
|
||||||
|
|
||||||
// Mail
|
void Dump() const;
|
||||||
MailHost="eqmail.eqemulator.net";
|
|
||||||
MailPort=7779;
|
|
||||||
|
|
||||||
// Mysql
|
|
||||||
DatabaseHost="localhost";
|
|
||||||
DatabasePort=3306;
|
|
||||||
DatabaseUsername="eq";
|
|
||||||
DatabasePassword="eq";
|
|
||||||
DatabaseDB="eq";
|
|
||||||
|
|
||||||
// QueryServ Database
|
|
||||||
QSDatabaseHost="localhost";
|
|
||||||
QSDatabasePort=3306;
|
|
||||||
QSDatabaseUsername="eq";
|
|
||||||
QSDatabasePassword="eq";
|
|
||||||
QSDatabaseDB="eq";
|
|
||||||
|
|
||||||
// Files
|
|
||||||
SpellsFile="spells_us.txt";
|
|
||||||
OpCodesFile="opcodes.conf";
|
|
||||||
EQTimeFile="eqtime.cfg";
|
|
||||||
LogSettingsFile="log.ini";
|
|
||||||
|
|
||||||
// Dirs
|
|
||||||
MapDir="Maps";
|
|
||||||
QuestDir="quests";
|
|
||||||
PluginDir="plugins";
|
|
||||||
|
|
||||||
// Launcher
|
|
||||||
LogPrefix = "logs/zone-";
|
|
||||||
LogSuffix = ".log";
|
|
||||||
RestartWait = 10000; //milliseconds
|
|
||||||
TerminateWait = 10000; //milliseconds
|
|
||||||
InitialBootWait = 20000; //milliseconds
|
|
||||||
ZoneBootInterval = 2000; //milliseconds
|
|
||||||
#ifdef WIN32
|
|
||||||
ZoneExe = "zone.exe";
|
|
||||||
#else
|
|
||||||
ZoneExe = "./zone";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Zones
|
|
||||||
ZonePortLow=7000;
|
|
||||||
ZonePortHigh=7999;
|
|
||||||
DefaultStatus=0;
|
|
||||||
|
|
||||||
// For where zones need to connect to.
|
|
||||||
WorldIP="127.0.0.1";
|
|
||||||
|
|
||||||
// Dynamics to start
|
|
||||||
//DynamicCount=5;
|
|
||||||
|
|
||||||
MaxClients=-1;
|
|
||||||
|
|
||||||
LoginCount=0;
|
|
||||||
|
|
||||||
}
|
|
||||||
virtual ~EQEmuConfig() {}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Produce a const singleton
|
|
||||||
static const EQEmuConfig *get() {
|
|
||||||
if (_config == nullptr)
|
|
||||||
LoadConfig();
|
|
||||||
return(_config);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow the use to set the conf file to be used.
|
|
||||||
static void SetConfigFile(std::string file) { EQEmuConfig::ConfigFile = file; }
|
|
||||||
|
|
||||||
// Load the config
|
|
||||||
static bool LoadConfig() {
|
|
||||||
if (_config != nullptr)
|
|
||||||
delete _config;
|
|
||||||
_config=new EQEmuConfig;
|
|
||||||
|
|
||||||
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(),"server");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Dump() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user