mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-11 04:42:26 +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>
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,8 @@ struct LoginConfig {
|
|||||||
uint16 LoginPort;
|
uint16 LoginPort;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EQEmuConfig : public XMLParser {
|
class EQEmuConfig : public XMLParser
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
virtual std::string GetByName(const std::string &var_name) const;
|
virtual std::string GetByName(const std::string &var_name) const;
|
||||||
|
|
||||||
@ -115,18 +116,16 @@ protected:
|
|||||||
#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
|
// Set sane defaults
|
||||||
|
|
||||||
// Login server
|
// Login server
|
||||||
LoginHost = "eqemulator.net";
|
LoginHost = "eqemulator.net";
|
||||||
LoginPort = 5998;
|
LoginPort = 5998;
|
||||||
|
|
||||||
// World
|
// World
|
||||||
Locked = false;
|
Locked = false;
|
||||||
WorldTCPPort = 9000;
|
WorldTCPPort = 9000;
|
||||||
@ -135,40 +134,33 @@ protected:
|
|||||||
WorldHTTPPort = 9080;
|
WorldHTTPPort = 9080;
|
||||||
WorldHTTPMimeFile = "mime.types";
|
WorldHTTPMimeFile = "mime.types";
|
||||||
SharedKey = ""; //blank disables authentication
|
SharedKey = ""; //blank disables authentication
|
||||||
|
|
||||||
// Mail
|
// Mail
|
||||||
ChatHost = "eqchat.eqemulator.net";
|
ChatHost = "eqchat.eqemulator.net";
|
||||||
ChatPort = 7778;
|
ChatPort = 7778;
|
||||||
|
|
||||||
// Mail
|
// Mail
|
||||||
MailHost = "eqmail.eqemulator.net";
|
MailHost = "eqmail.eqemulator.net";
|
||||||
MailPort = 7779;
|
MailPort = 7779;
|
||||||
|
|
||||||
// Mysql
|
// Mysql
|
||||||
DatabaseHost = "localhost";
|
DatabaseHost = "localhost";
|
||||||
DatabasePort = 3306;
|
DatabasePort = 3306;
|
||||||
DatabaseUsername = "eq";
|
DatabaseUsername = "eq";
|
||||||
DatabasePassword = "eq";
|
DatabasePassword = "eq";
|
||||||
DatabaseDB = "eq";
|
DatabaseDB = "eq";
|
||||||
|
|
||||||
// QueryServ Database
|
// QueryServ Database
|
||||||
QSDatabaseHost = "localhost";
|
QSDatabaseHost = "localhost";
|
||||||
QSDatabasePort = 3306;
|
QSDatabasePort = 3306;
|
||||||
QSDatabaseUsername = "eq";
|
QSDatabaseUsername = "eq";
|
||||||
QSDatabasePassword = "eq";
|
QSDatabasePassword = "eq";
|
||||||
QSDatabaseDB = "eq";
|
QSDatabaseDB = "eq";
|
||||||
|
|
||||||
// Files
|
// Files
|
||||||
SpellsFile = "spells_us.txt";
|
SpellsFile = "spells_us.txt";
|
||||||
OpCodesFile = "opcodes.conf";
|
OpCodesFile = "opcodes.conf";
|
||||||
EQTimeFile = "eqtime.cfg";
|
EQTimeFile = "eqtime.cfg";
|
||||||
LogSettingsFile = "log.ini";
|
LogSettingsFile = "log.ini";
|
||||||
|
|
||||||
// Dirs
|
// Dirs
|
||||||
MapDir = "Maps";
|
MapDir = "Maps";
|
||||||
QuestDir = "quests";
|
QuestDir = "quests";
|
||||||
PluginDir = "plugins";
|
PluginDir = "plugins";
|
||||||
|
|
||||||
// Launcher
|
// Launcher
|
||||||
LogPrefix = "logs/zone-";
|
LogPrefix = "logs/zone-";
|
||||||
LogSuffix = ".log";
|
LogSuffix = ".log";
|
||||||
@ -181,43 +173,43 @@ protected:
|
|||||||
#else
|
#else
|
||||||
ZoneExe = "./zone";
|
ZoneExe = "./zone";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Zones
|
// Zones
|
||||||
ZonePortLow = 7000;
|
ZonePortLow = 7000;
|
||||||
ZonePortHigh = 7999;
|
ZonePortHigh = 7999;
|
||||||
DefaultStatus = 0;
|
DefaultStatus = 0;
|
||||||
|
|
||||||
// For where zones need to connect to.
|
// For where zones need to connect to.
|
||||||
WorldIP = "127.0.0.1";
|
WorldIP = "127.0.0.1";
|
||||||
|
|
||||||
// Dynamics to start
|
// Dynamics to start
|
||||||
//DynamicCount=5;
|
//DynamicCount=5;
|
||||||
|
|
||||||
MaxClients = -1;
|
MaxClients = -1;
|
||||||
|
|
||||||
LoginCount = 0;
|
LoginCount = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual ~EQEmuConfig() {}
|
virtual ~EQEmuConfig() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Produce a const singleton
|
// Produce a const singleton
|
||||||
static const EQEmuConfig *get() {
|
static const EQEmuConfig *get()
|
||||||
if (_config == nullptr)
|
{
|
||||||
|
if (_config == nullptr) {
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
|
}
|
||||||
return (_config);
|
return (_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the use to set the conf file to be used.
|
// Allow the use to set the conf file to be used.
|
||||||
static void SetConfigFile(std::string file) { EQEmuConfig::ConfigFile = file; }
|
static void SetConfigFile(std::string file)
|
||||||
|
{
|
||||||
|
EQEmuConfig::ConfigFile = file;
|
||||||
|
}
|
||||||
|
|
||||||
// Load the config
|
// Load the config
|
||||||
static bool LoadConfig() {
|
static bool LoadConfig()
|
||||||
if (_config != nullptr)
|
{
|
||||||
|
if (_config != nullptr) {
|
||||||
delete _config;
|
delete _config;
|
||||||
|
}
|
||||||
_config = new EQEmuConfig;
|
_config = new EQEmuConfig;
|
||||||
|
|
||||||
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(), "server");
|
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(), "server");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user