diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp
index 708d48456..65023d9ce 100644
--- a/client_files/export/main.cpp
+++ b/client_files/export/main.cpp
@@ -27,6 +27,7 @@
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
+const EQEmuConfig *Config;
EQEmuLogSys Log;
void ExportSpells(SharedDatabase *db);
@@ -45,12 +46,12 @@ int main(int argc, char **argv) {
return 1;
}
- const EQEmuConfig *config = EQEmuConfig::get();
+ Config = EQEmuConfig::get();
SharedDatabase database;
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
- if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
- config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
+ if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
+ Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
"database connection");
return 1;
diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp
index 72ae6fd5d..254d25c42 100644
--- a/client_files/import/main.cpp
+++ b/client_files/import/main.cpp
@@ -25,6 +25,7 @@
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
+const EQEmuConfig *Config;
EQEmuLogSys Log;
void ImportSpells(SharedDatabase *db);
@@ -43,12 +44,12 @@ int main(int argc, char **argv) {
return 1;
}
- const EQEmuConfig *config = EQEmuConfig::get();
+ Config = EQEmuConfig::get();
SharedDatabase database;
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
- if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
- config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
+ if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
+ Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
"database connection");
return 1;
diff --git a/common/eqemu_config.cpp b/common/eqemu_config.cpp
index fb295cec1..977593291 100644
--- a/common/eqemu_config.cpp
+++ b/common/eqemu_config.cpp
@@ -254,6 +254,10 @@ void EQEmuConfig::do_files(TiXmlElement *ele)
if (text) {
OpCodesFile = text;
}
+ text = ParseTextBlock(ele, "plugin.pl", true);
+ if (text) {
+ PluginPlFile = text;
+ }
}
void EQEmuConfig::do_directories(TiXmlElement *ele)
@@ -262,14 +266,45 @@ void EQEmuConfig::do_directories(TiXmlElement *ele)
text = ParseTextBlock(ele, "maps", true);
if (text) {
MapDir = text;
+ if ( MapDir.back() != '/' )
+ MapDir += '/';
}
text = ParseTextBlock(ele, "quests", true);
if (text) {
QuestDir = text;
+ if ( QuestDir.back() != '/' )
+ QuestDir += '/';
}
text = ParseTextBlock(ele, "plugins", true);
if (text) {
PluginDir = text;
+ if ( PluginDir.back() != '/' )
+ PluginDir += '/';
+ }
+ text = ParseTextBlock(ele, "lua_modules", true);
+ if (text) {
+ LuaModuleDir = text;
+ if ( LuaModuleDir.back() != '/' )
+ LuaModuleDir += '/';
+ }
+ text = ParseTextBlock(ele, "patches", true);
+ if (text) {
+ PatchDir = text;
+ if ( PatchDir.back() != '/' )
+ PatchDir += '/';
+ }
+ text = ParseTextBlock(ele, "shared_memory", true);
+ if (text) {
+ SharedMemDir = text;
+ if ( SharedMemDir.back() != '/' )
+ SharedMemDir += '/';
+ }
+ //Not Fully Implemented yet LogDir
+ text = ParseTextBlock(ele, "logs", true);
+ if (text) {
+ LogDir = text;
+ if ( LogDir.back() != '/' )
+ LogDir += '/';
}
}
@@ -404,6 +439,9 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
if (var_name == "OpCodesFile") {
return (OpCodesFile);
}
+ if (var_name == "PluginPlFile") {
+ return (PluginPlFile);
+ }
if (var_name == "MapDir") {
return (MapDir);
}
@@ -413,6 +451,18 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
if (var_name == "PluginDir") {
return (PluginDir);
}
+ if (var_name == "LuaModuleDir") {
+ return (LuaModuleDir);
+ }
+ if (var_name == "PatchDir") {
+ return (PatchDir);
+ }
+ if (var_name == "SharedMemDir") {
+ return (SharedMemDir);
+ }
+ if (var_name == "LogDir") {
+ return (LogDir);
+ }
if (var_name == "LogPrefix") {
return (LogPrefix);
}
@@ -468,9 +518,14 @@ void EQEmuConfig::Dump() const
std::cout << "QSDatabasePort = " << QSDatabasePort << std::endl;
std::cout << "SpellsFile = " << SpellsFile << std::endl;
std::cout << "OpCodesFile = " << OpCodesFile << std::endl;
+ std::cout << "PluginPlFile = " << PluginPlFile << std::endl;
std::cout << "MapDir = " << MapDir << std::endl;
std::cout << "QuestDir = " << QuestDir << std::endl;
std::cout << "PluginDir = " << PluginDir << std::endl;
+ std::cout << "LuaModuleDir = " << LuaModuleDir << std::endl;
+ std::cout << "PatchDir = " << PatchDir << std::endl;
+ std::cout << "SharedMemDir = " << SharedMemDir << std::endl;
+ std::cout << "LogDir = " << LogDir << std::endl;
std::cout << "ZonePortLow = " << ZonePortLow << std::endl;
std::cout << "ZonePortHigh = " << ZonePortHigh << std::endl;
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
diff --git a/common/eqemu_config.h b/common/eqemu_config.h
index 039b6c327..58b1bee9b 100644
--- a/common/eqemu_config.h
+++ b/common/eqemu_config.h
@@ -79,11 +79,16 @@ class EQEmuConfig : public XMLParser
// From
std::string SpellsFile;
std::string OpCodesFile;
+ std::string PluginPlFile;
// From
std::string MapDir;
std::string QuestDir;
std::string PluginDir;
+ std::string LuaModuleDir;
+ std::string PatchDir;
+ std::string SharedMemDir;
+ std::string LogDir;
// From
std::string LogPrefix;
@@ -153,10 +158,16 @@ class EQEmuConfig : public XMLParser
// Files
SpellsFile = "spells_us.txt";
OpCodesFile = "opcodes.conf";
+ PluginPlFile = "plugin.pl";
// Dirs
- MapDir = "Maps";
- QuestDir = "quests";
- PluginDir = "plugins";
+ MapDir = "Maps/";
+ QuestDir = "quests/";
+ PluginDir = "plugins/";
+ LuaModuleDir = "lua_modules/";
+ PatchDir = "./";
+ SharedMemDir = "shared/";
+ LogDir = "logs/";
+
// Launcher
LogPrefix = "logs/zone-";
LogSuffix = ".log";
diff --git a/common/eqemu_config_extern.h b/common/eqemu_config_extern.h
new file mode 100644
index 000000000..1943c5d61
--- /dev/null
+++ b/common/eqemu_config_extern.h
@@ -0,0 +1,22 @@
+/* EQEMu: Everquest Server Emulator
+ Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.org)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY except by those people which sell it, which
+ are required to give you total support for your newly bought product;
+ without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "eqemu_config.h"
+
+extern const EQEmuConfig *Config;
+
diff --git a/common/ipc_mutex.cpp b/common/ipc_mutex.cpp
index c05fb072c..13efd8b0b 100644
--- a/common/ipc_mutex.cpp
+++ b/common/ipc_mutex.cpp
@@ -27,7 +27,7 @@
#endif
#include "types.h"
#include "eqemu_exception.h"
-
+#include "eqemu_config_extern.h"
namespace EQEmu {
struct IPCMutex::Implementation {
@@ -41,7 +41,7 @@ namespace EQEmu {
IPCMutex::IPCMutex(std::string name) : locked_(false) {
imp_ = new Implementation;
#ifdef _WINDOWS
- std::string final_name = "EQEmuMutex_";
+ std::string final_name = Config->SharedMemDir + "EQEmuMutex_";
final_name += name;
imp_->mut_ = CreateMutex(nullptr,
@@ -52,7 +52,7 @@ namespace EQEmu {
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
}
#else
- std::string final_name = name;
+ std::string final_name = Config->SharedMemDir + name;
final_name += ".lock";
#ifdef __DARWIN
diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp
index 8f64ecade..856e311a1 100644
--- a/common/patches/rof.cpp
+++ b/common/patches/rof.cpp
@@ -67,7 +67,8 @@ namespace RoF
//create our opcode manager if we havent already
if (opcodes == nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
//load up the opcode manager.
@@ -111,7 +112,8 @@ namespace RoF
if (opcodes != nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
diff --git a/common/patches/rof.h b/common/patches/rof.h
index 42d8c08ef..31c81fbf7 100644
--- a/common/patches/rof.h
+++ b/common/patches/rof.h
@@ -21,6 +21,7 @@
#define COMMON_ROF_H
#include "../struct_strategy.h"
+#include "../eqemu_config_extern.h"
class EQStreamIdentifier;
diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp
index 2ecffbabe..b4576ed44 100644
--- a/common/patches/rof2.cpp
+++ b/common/patches/rof2.cpp
@@ -67,7 +67,8 @@ namespace RoF2
//create our opcode manager if we havent already
if (opcodes == nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
//load up the opcode manager.
@@ -111,7 +112,8 @@ namespace RoF2
if (opcodes != nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
diff --git a/common/patches/rof2.h b/common/patches/rof2.h
index af0b6f55d..911286977 100644
--- a/common/patches/rof2.h
+++ b/common/patches/rof2.h
@@ -21,6 +21,7 @@
#define COMMON_ROF2_H
#include "../struct_strategy.h"
+#include "../eqemu_config_extern.h"
class EQStreamIdentifier;
diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp
index ed42dd330..1f1edaf79 100644
--- a/common/patches/sod.cpp
+++ b/common/patches/sod.cpp
@@ -63,7 +63,8 @@ namespace SoD
//create our opcode manager if we havent already
if (opcodes == nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
//load up the opcode manager.
@@ -107,7 +108,8 @@ namespace SoD
if (opcodes != nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
diff --git a/common/patches/sod.h b/common/patches/sod.h
index be5843ead..bcd788112 100644
--- a/common/patches/sod.h
+++ b/common/patches/sod.h
@@ -21,6 +21,7 @@
#define COMMON_SOD_H
#include "../struct_strategy.h"
+#include "../eqemu_config_extern.h"
class EQStreamIdentifier;
diff --git a/common/patches/sof.cpp b/common/patches/sof.cpp
index 51a1f7435..debf75621 100644
--- a/common/patches/sof.cpp
+++ b/common/patches/sof.cpp
@@ -63,7 +63,8 @@ namespace SoF
//create our opcode manager if we havent already
if (opcodes == nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
//load up the opcode manager.
@@ -107,7 +108,8 @@ namespace SoF
if (opcodes != nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
diff --git a/common/patches/sof.h b/common/patches/sof.h
index 095c9dd4a..8d8ff287b 100644
--- a/common/patches/sof.h
+++ b/common/patches/sof.h
@@ -21,6 +21,7 @@
#define COMMON_SOF_H
#include "../struct_strategy.h"
+#include "../eqemu_config_extern.h"
class EQStreamIdentifier;
diff --git a/common/patches/template.cpp b/common/patches/template.cpp
index 5120a2ef2..5e075ea8a 100644
--- a/common/patches/template.cpp
+++ b/common/patches/template.cpp
@@ -16,7 +16,8 @@ static Strategy struct_strategy;
void Register(EQStreamIdentifier &into) {
//create our opcode manager if we havent already
if(opcodes == NULL) {
- string opfile = "patch_";
+ string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
//load up the opcode manager.
@@ -51,7 +52,8 @@ void Reload() {
if(opcodes != NULL) {
//TODO: get this file name from the config file
- string opfile = "patch_";
+ string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
if(!opcodes->ReloadOpcodes(opfile.c_str())) {
diff --git a/common/patches/template.h b/common/patches/template.h
index 1391516b1..f264cf3fd 100644
--- a/common/patches/template.h
+++ b/common/patches/template.h
@@ -2,6 +2,7 @@
#define TEMPLATE_H_
#include "../struct_strategy.h"
+#include "../eqemu_config_extern.h"
class EQStreamIdentifier;
diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp
index f0698ac29..6dcca92f5 100644
--- a/common/patches/titanium.cpp
+++ b/common/patches/titanium.cpp
@@ -31,6 +31,7 @@
#include "../string_util.h"
#include "../item.h"
#include "titanium_structs.h"
+
#include
@@ -61,7 +62,8 @@ namespace Titanium
//create our opcode manager if we havent already
if (opcodes == nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
//load up the opcode manager.
@@ -105,7 +107,8 @@ namespace Titanium
if (opcodes != nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
diff --git a/common/patches/titanium.h b/common/patches/titanium.h
index eb193c872..ba30712be 100644
--- a/common/patches/titanium.h
+++ b/common/patches/titanium.h
@@ -21,6 +21,7 @@
#define COMMON_TITANIUM_H
#include "../struct_strategy.h"
+#include "../eqemu_config_extern.h"
class EQStreamIdentifier;
diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp
index 2cdf96b46..1baf306c7 100644
--- a/common/patches/uf.cpp
+++ b/common/patches/uf.cpp
@@ -63,7 +63,8 @@ namespace UF
//create our opcode manager if we havent already
if (opcodes == nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
//load up the opcode manager.
@@ -107,7 +108,8 @@ namespace UF
if (opcodes != nullptr) {
//TODO: get this file name from the config file
- std::string opfile = "patch_";
+ std::string opfile = Config->PatchDir;
+ opfile += "patch_";
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
diff --git a/common/patches/uf.h b/common/patches/uf.h
index 59c332bdc..8c244367b 100644
--- a/common/patches/uf.h
+++ b/common/patches/uf.h
@@ -21,6 +21,7 @@
#define COMMON_UF_H
#include "../struct_strategy.h"
+#include "../eqemu_config_extern.h"
class EQStreamIdentifier;
diff --git a/common/shareddb.cpp b/common/shareddb.cpp
index ac0805978..26156a895 100644
--- a/common/shareddb.cpp
+++ b/common/shareddb.cpp
@@ -35,6 +35,7 @@
#include "mysql.h"
#include "rulesys.h"
#include "shareddb.h"
+#include "eqemu_config_extern.h"
#include "string_util.h"
SharedDatabase::SharedDatabase()
@@ -812,7 +813,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
try {
EQEmu::IPCMutex mutex("items");
mutex.Lock();
- std::string file_name = std::string("shared/") + prefix + std::string("items");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("items");
items_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name));
items_hash = std::unique_ptr>(new EQEmu::FixedMemoryHashSet(reinterpret_cast(items_mmf->Get()), items_mmf->Size()));
mutex.Unlock();
@@ -1235,7 +1236,7 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
try {
EQEmu::IPCMutex mutex("faction");
mutex.Lock();
- std::string file_name = std::string("shared/") + prefix + std::string("faction");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("faction");
faction_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name));
faction_hash = std::unique_ptr>(new EQEmu::FixedMemoryHashSet(reinterpret_cast(faction_mmf->Get()), faction_mmf->Size()));
mutex.Unlock();
@@ -1386,7 +1387,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) {
try {
EQEmu::IPCMutex mutex("skill_caps");
mutex.Lock();
- std::string file_name = std::string("shared/") + prefix + std::string("skill_caps");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("skill_caps");
skill_caps_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name));
mutex.Unlock();
} catch(std::exception &ex) {
@@ -1542,7 +1543,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
EQEmu::IPCMutex mutex("spells");
mutex.Lock();
- std::string file_name = std::string("shared/") + prefix + std::string("spells");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("spells");
spells_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name));
*records = *reinterpret_cast(spells_mmf->Get());
*sp = reinterpret_cast((char*)spells_mmf->Get() + 4);
@@ -1745,7 +1746,7 @@ bool SharedDatabase::LoadBaseData(const std::string &prefix) {
EQEmu::IPCMutex mutex("base_data");
mutex.Lock();
- std::string file_name = std::string("shared/") + prefix + std::string("base_data");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("base_data");
base_data_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name));
mutex.Unlock();
} catch(std::exception& ex) {
@@ -1983,12 +1984,12 @@ bool SharedDatabase::LoadLoot(const std::string &prefix) {
try {
EQEmu::IPCMutex mutex("loot");
mutex.Lock();
- std::string file_name_lt = std::string("shared/") + prefix + std::string("loot_table");
+ std::string file_name_lt = Config->SharedMemDir + prefix + std::string("loot_table");
loot_table_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name_lt));
loot_table_hash = std::unique_ptr>(new EQEmu::FixedMemoryVariableHashSet(
reinterpret_cast(loot_table_mmf->Get()),
loot_table_mmf->Size()));
- std::string file_name_ld = std::string("shared/") + prefix + std::string("loot_drop");
+ std::string file_name_ld = Config->SharedMemDir + prefix + std::string("loot_drop");
loot_drop_mmf = std::unique_ptr(new EQEmu::MemoryMappedFile(file_name_ld));
loot_drop_hash = std::unique_ptr>(new EQEmu::FixedMemoryVariableHashSet(
reinterpret_cast(loot_drop_mmf->Get()),
diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp
index 952b6198b..e4b63c6c1 100644
--- a/eqlaunch/eqlaunch.cpp
+++ b/eqlaunch/eqlaunch.cpp
@@ -32,6 +32,7 @@
#include
EQEmuLogSys Log;
+const EQEmuConfig *Config;
bool RunLoops = false;
@@ -56,7 +57,7 @@ int main(int argc, char *argv[]) {
Log.Out(Logs::Detail, Logs::Launcher, "Loading server configuration failed.");
return 1;
}
- const EQEmuConfig *Config = EQEmuConfig::get();
+ Config = EQEmuConfig::get();
/*
* Setup nice signal handlers
diff --git a/shared_memory/base_data.cpp b/shared_memory/base_data.cpp
index e82c5a2c1..6c43f4493 100644
--- a/shared_memory/base_data.cpp
+++ b/shared_memory/base_data.cpp
@@ -33,7 +33,7 @@ void LoadBaseData(SharedDatabase *database, const std::string &prefix) {
uint32 size = records * 16 * sizeof(BaseDataStruct);
- std::string file_name = std::string("shared/") + prefix + std::string("base_data");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("base_data");
EQEmu::MemoryMappedFile mmf(file_name, size);
mmf.ZeroFile();
diff --git a/shared_memory/base_data.h b/shared_memory/base_data.h
index afa799eea..401b57bd2 100644
--- a/shared_memory/base_data.h
+++ b/shared_memory/base_data.h
@@ -20,6 +20,10 @@
#define __EQEMU_SHARED_MEMORY_BASE_DATA_H
#include
+#include "../common/eqemu_config.h"
+
+extern const EQEmuConfig *Config;
+
class SharedDatabase;
void LoadBaseData(SharedDatabase *database, const std::string &prefix);
diff --git a/shared_memory/items.cpp b/shared_memory/items.cpp
index a88717f74..886050d13 100644
--- a/shared_memory/items.cpp
+++ b/shared_memory/items.cpp
@@ -37,7 +37,7 @@ void LoadItems(SharedDatabase *database, const std::string &prefix) {
uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item));
- std::string file_name = std::string("shared/") + prefix + std::string("items");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("items");
EQEmu::MemoryMappedFile mmf(file_name, size);
mmf.ZeroFile();
diff --git a/shared_memory/items.h b/shared_memory/items.h
index cff9794fd..1d34c9467 100644
--- a/shared_memory/items.h
+++ b/shared_memory/items.h
@@ -20,6 +20,9 @@
#define __EQEMU_SHARED_MEMORY_ITEMS_H
#include
+#include "../common/eqemu_config.h"
+
+extern const EQEmuConfig *Config;
class SharedDatabase;
void LoadItems(SharedDatabase *database, const std::string &prefix);
diff --git a/shared_memory/loot.cpp b/shared_memory/loot.cpp
index 956383cd3..a659b05a5 100644
--- a/shared_memory/loot.cpp
+++ b/shared_memory/loot.cpp
@@ -44,8 +44,8 @@ void LoadLoot(SharedDatabase *database, const std::string &prefix) {
(loot_drop_count * sizeof(LootDrop_Struct)) + //loot table headers
(loot_drop_entries_count * sizeof(LootDropEntries_Struct)); //number of loot table entries
- std::string file_name_lt = std::string("shared/") + prefix + std::string("loot_table");
- std::string file_name_ld = std::string("shared/") + prefix + std::string("loot_drop");
+ std::string file_name_lt = Config->SharedMemDir + prefix + std::string("loot_table");
+ std::string file_name_ld = Config->SharedMemDir + prefix + std::string("loot_drop");
EQEmu::MemoryMappedFile mmf_loot_table(file_name_lt, loot_table_size);
EQEmu::MemoryMappedFile mmf_loot_drop(file_name_ld, loot_drop_size);
diff --git a/shared_memory/loot.h b/shared_memory/loot.h
index 27e812185..c9c55895b 100644
--- a/shared_memory/loot.h
+++ b/shared_memory/loot.h
@@ -20,6 +20,9 @@
#define __EQEMU_SHARED_MEMORY_LOOT_H
#include
+#include "../common/eqemu_config.h"
+
+extern const EQEmuConfig *Config;
class SharedDatabase;
void LoadLoot(SharedDatabase *database, const std::string &prefix);
diff --git a/shared_memory/main.cpp b/shared_memory/main.cpp
index 8ad2b42ae..d37d23bd4 100644
--- a/shared_memory/main.cpp
+++ b/shared_memory/main.cpp
@@ -35,7 +35,7 @@
#include "base_data.h"
EQEmuLogSys Log;
-
+const EQEmuConfig *Config;
int main(int argc, char **argv) {
RegisterExecutablePlatform(ExePlatformSharedMemory);
Log.LoadLogSettingsDefaults();
@@ -47,12 +47,12 @@ int main(int argc, char **argv) {
return 1;
}
- const EQEmuConfig *config = EQEmuConfig::get();
+ Config = EQEmuConfig::get();
SharedDatabase database;
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
- if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
- config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
+ if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
+ Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
"database connection");
return 1;
diff --git a/shared_memory/npc_faction.cpp b/shared_memory/npc_faction.cpp
index 9ac8510bd..5e8f86cfd 100644
--- a/shared_memory/npc_faction.cpp
+++ b/shared_memory/npc_faction.cpp
@@ -34,7 +34,7 @@ void LoadFactions(SharedDatabase *database, const std::string &prefix) {
uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(lists, max_list));
- std::string file_name = std::string("shared/") + prefix + std::string("faction");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("faction");
EQEmu::MemoryMappedFile mmf(file_name, size);
mmf.ZeroFile();
diff --git a/shared_memory/npc_faction.h b/shared_memory/npc_faction.h
index 8fe5dbadb..598f8f01b 100644
--- a/shared_memory/npc_faction.h
+++ b/shared_memory/npc_faction.h
@@ -20,6 +20,9 @@
#define __EQEMU_SHARED_MEMORY_NPC_FACTION_H
#include
+#include "../common/eqemu_config.h"
+
+extern const EQEmuConfig *Config;
class SharedDatabase;
void LoadFactions(SharedDatabase *database, const std::string &prefix);
diff --git a/shared_memory/skill_caps.cpp b/shared_memory/skill_caps.cpp
index 153d06e13..6712d75c6 100644
--- a/shared_memory/skill_caps.cpp
+++ b/shared_memory/skill_caps.cpp
@@ -34,7 +34,7 @@ void LoadSkillCaps(SharedDatabase *database, const std::string &prefix) {
uint32 level_count = HARD_LEVEL_CAP + 1;
uint32 size = (class_count * skill_count * level_count * sizeof(uint16));
- std::string file_name = std::string("shared/") + prefix + std::string("skill_caps");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("skill_caps");
EQEmu::MemoryMappedFile mmf(file_name, size);
mmf.ZeroFile();
diff --git a/shared_memory/skill_caps.h b/shared_memory/skill_caps.h
index 90ae5733c..6e35d6fb5 100644
--- a/shared_memory/skill_caps.h
+++ b/shared_memory/skill_caps.h
@@ -20,6 +20,9 @@
#define __EQEMU_SHARED_MEMORY_SKILL_CAPS_H
#include
+#include "../common/eqemu_config.h"
+
+extern const EQEmuConfig *Config;
class SharedDatabase;
void LoadSkillCaps(SharedDatabase *database, const std::string &prefix);
diff --git a/shared_memory/spells.cpp b/shared_memory/spells.cpp
index 34cce35bc..2cb3d846e 100644
--- a/shared_memory/spells.cpp
+++ b/shared_memory/spells.cpp
@@ -34,7 +34,7 @@ void LoadSpells(SharedDatabase *database, const std::string &prefix) {
uint32 size = records * sizeof(SPDat_Spell_Struct) + sizeof(uint32);
- std::string file_name = std::string("shared/") + prefix + std::string("spells");
+ std::string file_name = Config->SharedMemDir + prefix + std::string("spells");
EQEmu::MemoryMappedFile mmf(file_name, size);
mmf.ZeroFile();
diff --git a/shared_memory/spells.h b/shared_memory/spells.h
index bde0f8233..230e3779f 100644
--- a/shared_memory/spells.h
+++ b/shared_memory/spells.h
@@ -20,6 +20,9 @@
#define __EQEMU_SHARED_MEMORY_SPELLS_H
#include
+#include "../common/eqemu_config.h"
+
+extern const EQEmuConfig *Config;
class SharedDatabase;
void LoadSpells(SharedDatabase *database, const std::string &prefix);
diff --git a/tests/ipc_mutex_test.h b/tests/ipc_mutex_test.h
index 69c70ca93..d465f869c 100644
--- a/tests/ipc_mutex_test.h
+++ b/tests/ipc_mutex_test.h
@@ -21,6 +21,9 @@
#include "cppunit/cpptest.h"
#include "../common/ipc_mutex.h"
+#include "../common/eqemu_config.h"
+
+extern const EQEmuConfig *Config;
class IPCMutexTest : public Test::Suite {
typedef void(IPCMutexTest::*TestFunction)(void);
diff --git a/tests/main.cpp b/tests/main.cpp
index d64dfead4..9d72da520 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -29,8 +29,13 @@
#include "string_util_test.h"
#include "data_verification_test.h"
#include "skills_util_test.h"
+#include "../common/eqemu_config.h"
+
+const EQEmuConfig *Config;
int main() {
+ auto ConfigLoadResult = EQEmuConfig::LoadConfig();
+ Config = EQEmuConfig::get();
try {
std::ofstream outfile("test_output.txt");
std::unique_ptr output(new Test::TextOutput(Test::TextOutput::Verbose, outfile));
diff --git a/utils/defaults/eqemu_config.xml.full b/utils/defaults/eqemu_config.xml.full
index ed1cc6002..3195352c5 100644
--- a/utils/defaults/eqemu_config.xml.full
+++ b/utils/defaults/eqemu_config.xml.full
@@ -68,7 +68,7 @@
-
+
@@ -80,11 +80,16 @@
+
-
-
-
+
+
+
+
+
+
+
diff --git a/world/net.cpp b/world/net.cpp
index 90fb3e680..ee335aa7c 100644
--- a/world/net.cpp
+++ b/world/net.cpp
@@ -104,7 +104,7 @@ volatile bool RunLoops = true;
uint32 numclients = 0;
uint32 numzones = 0;
bool holdzones = false;
-
+const WorldConfig *Config;
EQEmuLogSys Log;
extern ConsoleList console_list;
@@ -135,7 +135,7 @@ int main(int argc, char** argv) {
Log.Out(Logs::General, Logs::World_Server, "Loading server configuration failed.");
return 1;
}
- const WorldConfig *Config=WorldConfig::get();
+ Config=WorldConfig::get();
Log.Out(Logs::General, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
diff --git a/zone/embperl.cpp b/zone/embperl.cpp
index 4d27d1269..834a5f0b9 100644
--- a/zone/embperl.cpp
+++ b/zone/embperl.cpp
@@ -173,25 +173,27 @@ void Embperl::DoInit() {
Log.Out(Logs::General, Logs::Quests, "Loading perlemb plugins.");
try
{
- eval_pv("main::eval_file('plugin', 'plugin.pl');", FALSE);
+ std::string perl_command;
+ perl_command = "main::eval_file('plugin', '" + Config->PluginPlFile + "');";
+ eval_pv(perl_command.c_str(), FALSE);
}
catch(const char *err)
{
- Log.Out(Logs::General, Logs::Quests, "Warning - plugin.pl: %s", err);
+ Log.Out(Logs::General, Logs::Quests, "Warning - %s: %s", Config->PluginPlFile.c_str(), err);
}
try
{
//should probably read the directory in c, instead, so that
//I can echo filenames as I do it, but c'mon... I'm lazy and this 1 line reads in all the plugins
- eval_pv(
- "if(opendir(D,'plugins')) { "
+ std::string perl_command =
+ "if(opendir(D,'" + Config->PluginDir +"')) { "
" my @d = readdir(D);"
" closedir(D);"
" foreach(@d){ "
- " main::eval_file('plugin','plugins/'.$_)if/\\.pl$/;"
+ " main::eval_file('plugin','" + Config->PluginDir + "/'.$_)if/\\.pl$/;"
" }"
- "}"
- ,FALSE);
+ "}";
+ eval_pv(perl_command.c_str(),FALSE);
}
catch(const char *err)
{
diff --git a/zone/embperl.h b/zone/embperl.h
index 919664d0a..e5d07a3d8 100644
--- a/zone/embperl.h
+++ b/zone/embperl.h
@@ -10,6 +10,8 @@ Eglin
#ifdef EMBPERL
+#include "zone_config.h"
+
#include
#include
#include