diff --git a/client_files/export/main.cpp b/client_files/export/main.cpp index 65023d9ce..2eda87411 100644 --- a/client_files/export/main.cpp +++ b/client_files/export/main.cpp @@ -27,7 +27,6 @@ #include "../../common/rulesys.h" #include "../../common/string_util.h" -const EQEmuConfig *Config; EQEmuLogSys Log; void ExportSpells(SharedDatabase *db); @@ -46,7 +45,7 @@ int main(int argc, char **argv) { return 1; } - Config = EQEmuConfig::get(); + auto Config = EQEmuConfig::get(); SharedDatabase database; Log.Out(Logs::General, Logs::Status, "Connecting to database..."); diff --git a/client_files/import/main.cpp b/client_files/import/main.cpp index 254d25c42..defd64f98 100644 --- a/client_files/import/main.cpp +++ b/client_files/import/main.cpp @@ -25,7 +25,6 @@ #include "../../common/rulesys.h" #include "../../common/string_util.h" -const EQEmuConfig *Config; EQEmuLogSys Log; void ImportSpells(SharedDatabase *db); @@ -44,7 +43,7 @@ int main(int argc, char **argv) { return 1; } - Config = EQEmuConfig::get(); + auto Config = EQEmuConfig::get(); SharedDatabase database; Log.Out(Logs::General, Logs::Status, "Connecting to database..."); diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 5bd3e0d27..5c4f364a9 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -132,7 +132,6 @@ SET(common_headers eqemu_exception.h eqemu_config.h eqemu_config_elements.h - eqemu_config_extern.h eqemu_logsys.h eq_limits.h eq_packet.h diff --git a/common/eqemu_config_extern.h b/common/eqemu_config_extern.h deleted file mode 100644 index 6282f2738..000000000 --- a/common/eqemu_config_extern.h +++ /dev/null @@ -1,26 +0,0 @@ -/* 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 -*/ - -#ifndef EQEMU_CONFIG_EXTERN -#define EQEMU_CONFIG_EXTERN - -#include "eqemu_config.h" - -extern const EQEmuConfig *Config; - -#endif \ No newline at end of file diff --git a/common/ipc_mutex.cpp b/common/ipc_mutex.cpp index c4a8a90c8..0c92e2410 100644 --- a/common/ipc_mutex.cpp +++ b/common/ipc_mutex.cpp @@ -29,7 +29,7 @@ #endif #include "types.h" #include "eqemu_exception.h" -#include "eqemu_config_extern.h" +#include "eqemu_config.h" namespace EQEmu { struct IPCMutex::Implementation { @@ -43,6 +43,7 @@ namespace EQEmu { IPCMutex::IPCMutex(std::string name) : locked_(false) { imp_ = new Implementation; #ifdef _WINDOWS + auto Config = EQEmuConfig::get(); std::string final_name = Config->SharedMemDir + "EQEmuMutex_"; final_name += name; diff --git a/common/patches/rof.cpp b/common/patches/rof.cpp index 856e311a1..0674f06c1 100644 --- a/common/patches/rof.cpp +++ b/common/patches/rof.cpp @@ -31,6 +31,7 @@ #include "../item.h" #include "rof_structs.h" #include "../rulesys.h" +#include "../eqemu_config.h" #include #include @@ -67,6 +68,7 @@ namespace RoF //create our opcode manager if we havent already if (opcodes == nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; @@ -98,9 +100,6 @@ namespace RoF signature.first_length = sizeof(structs::ClientZoneEntry_Struct); signature.first_eq_opcode = opcodes->EmuToEQ(OP_ZoneEntry); into.RegisterPatch(signature, pname.c_str(), &opcodes, &struct_strategy); - - - Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Registered patch %s", name); } @@ -112,6 +111,7 @@ namespace RoF if (opcodes != nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; diff --git a/common/patches/rof.h b/common/patches/rof.h index 31c81fbf7..205998b32 100644 --- a/common/patches/rof.h +++ b/common/patches/rof.h @@ -21,8 +21,6 @@ #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 b4576ed44..cdb5d6c2e 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -31,6 +31,7 @@ #include "../item.h" #include "rof2_structs.h" #include "../rulesys.h" +#include "../eqemu_config.h" #include #include @@ -67,6 +68,7 @@ namespace RoF2 //create our opcode manager if we havent already if (opcodes == nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; @@ -112,6 +114,7 @@ namespace RoF2 if (opcodes != nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; diff --git a/common/patches/rof2.h b/common/patches/rof2.h index 911286977..9eef8e596 100644 --- a/common/patches/rof2.h +++ b/common/patches/rof2.h @@ -21,8 +21,6 @@ #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 1f1edaf79..a6ecb80a9 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -31,6 +31,7 @@ #include "../item.h" #include "sod_structs.h" #include "../rulesys.h" +#include "../eqemu_config.h" #include #include @@ -63,6 +64,7 @@ namespace SoD //create our opcode manager if we havent already if (opcodes == nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; @@ -108,6 +110,7 @@ namespace SoD if (opcodes != nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; diff --git a/common/patches/sod.h b/common/patches/sod.h index bcd788112..977645231 100644 --- a/common/patches/sod.h +++ b/common/patches/sod.h @@ -21,8 +21,6 @@ #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 debf75621..187d841b0 100644 --- a/common/patches/sof.cpp +++ b/common/patches/sof.cpp @@ -31,6 +31,7 @@ #include "../item.h" #include "sof_structs.h" #include "../rulesys.h" +#include "../eqemu_config.h" #include #include @@ -63,6 +64,7 @@ namespace SoF //create our opcode manager if we havent already if (opcodes == nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; @@ -108,6 +110,7 @@ namespace SoF if (opcodes != nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; diff --git a/common/patches/sof.h b/common/patches/sof.h index 8d8ff287b..dde55f9a3 100644 --- a/common/patches/sof.h +++ b/common/patches/sof.h @@ -21,8 +21,6 @@ #define COMMON_SOF_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 6dcca92f5..67c745c78 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -30,6 +30,7 @@ #include "../misc_functions.h" #include "../string_util.h" #include "../item.h" +#include "../eqemu_config.h" #include "titanium_structs.h" #include @@ -59,6 +60,7 @@ namespace Titanium void Register(EQStreamIdentifier &into) { + auto Config = EQEmuConfig::get(); //create our opcode manager if we havent already if (opcodes == nullptr) { //TODO: get this file name from the config file @@ -107,6 +109,7 @@ namespace Titanium if (opcodes != nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; diff --git a/common/patches/titanium.h b/common/patches/titanium.h index ba30712be..2f063c9ad 100644 --- a/common/patches/titanium.h +++ b/common/patches/titanium.h @@ -21,8 +21,6 @@ #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 1baf306c7..9142385ed 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -31,6 +31,7 @@ #include "../item.h" #include "uf_structs.h" #include "../rulesys.h" +#include "../eqemu_config.h" #include #include @@ -63,6 +64,7 @@ namespace UF //create our opcode manager if we havent already if (opcodes == nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; @@ -108,6 +110,7 @@ namespace UF if (opcodes != nullptr) { //TODO: get this file name from the config file + auto Config = EQEmuConfig::get(); std::string opfile = Config->PatchDir; opfile += "patch_"; opfile += name; diff --git a/common/patches/uf.h b/common/patches/uf.h index 8c244367b..c36d9e851 100644 --- a/common/patches/uf.h +++ b/common/patches/uf.h @@ -21,8 +21,6 @@ #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 26156a895..968002baa 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -35,8 +35,8 @@ #include "mysql.h" #include "rulesys.h" #include "shareddb.h" -#include "eqemu_config_extern.h" #include "string_util.h" +#include "eqemu_config.h" SharedDatabase::SharedDatabase() : Database() @@ -811,6 +811,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) { items_mmf.reset(nullptr); try { + auto Config = EQEmuConfig::get(); EQEmu::IPCMutex mutex("items"); mutex.Lock(); std::string file_name = Config->SharedMemDir + prefix + std::string("items"); @@ -1234,6 +1235,7 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) { faction_hash.reset(nullptr); try { + auto Config = EQEmuConfig::get(); EQEmu::IPCMutex mutex("faction"); mutex.Lock(); std::string file_name = Config->SharedMemDir + prefix + std::string("faction"); @@ -1385,6 +1387,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) { uint32 size = (class_count * skill_count * level_count * sizeof(uint16)); try { + auto Config = EQEmuConfig::get(); EQEmu::IPCMutex mutex("skill_caps"); mutex.Lock(); std::string file_name = Config->SharedMemDir + prefix + std::string("skill_caps"); @@ -1540,6 +1543,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const spells_mmf.reset(nullptr); try { + auto Config = EQEmuConfig::get(); EQEmu::IPCMutex mutex("spells"); mutex.Lock(); @@ -1743,6 +1747,7 @@ bool SharedDatabase::LoadBaseData(const std::string &prefix) { base_data_mmf.reset(nullptr); try { + auto Config = EQEmuConfig::get(); EQEmu::IPCMutex mutex("base_data"); mutex.Lock(); @@ -1982,6 +1987,7 @@ bool SharedDatabase::LoadLoot(const std::string &prefix) { loot_drop_mmf.reset(nullptr); try { + auto Config = EQEmuConfig::get(); EQEmu::IPCMutex mutex("loot"); mutex.Lock(); std::string file_name_lt = Config->SharedMemDir + prefix + std::string("loot_table"); diff --git a/eqlaunch/eqlaunch.cpp b/eqlaunch/eqlaunch.cpp index e4b63c6c1..da37b9d3b 100644 --- a/eqlaunch/eqlaunch.cpp +++ b/eqlaunch/eqlaunch.cpp @@ -32,7 +32,6 @@ #include EQEmuLogSys Log; -const EQEmuConfig *Config; bool RunLoops = false; @@ -57,7 +56,7 @@ int main(int argc, char *argv[]) { Log.Out(Logs::Detail, Logs::Launcher, "Loading server configuration failed."); return 1; } - Config = EQEmuConfig::get(); + auto Config = EQEmuConfig::get(); /* * Setup nice signal handlers diff --git a/shared_memory/base_data.cpp b/shared_memory/base_data.cpp index 6c43f4493..557d13ce5 100644 --- a/shared_memory/base_data.cpp +++ b/shared_memory/base_data.cpp @@ -33,6 +33,7 @@ void LoadBaseData(SharedDatabase *database, const std::string &prefix) { uint32 size = records * 16 * sizeof(BaseDataStruct); + auto Config = EQEmuConfig::get(); 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 401b57bd2..81cd8dd1b 100644 --- a/shared_memory/base_data.h +++ b/shared_memory/base_data.h @@ -22,8 +22,6 @@ #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 886050d13..e2fb98f16 100644 --- a/shared_memory/items.cpp +++ b/shared_memory/items.cpp @@ -37,6 +37,7 @@ void LoadItems(SharedDatabase *database, const std::string &prefix) { uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(items, max_item)); + auto Config = EQEmuConfig::get(); 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 1d34c9467..47dcbaac9 100644 --- a/shared_memory/items.h +++ b/shared_memory/items.h @@ -22,8 +22,6 @@ #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 a659b05a5..742f373bf 100644 --- a/shared_memory/loot.cpp +++ b/shared_memory/loot.cpp @@ -44,6 +44,7 @@ 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 + auto Config = EQEmuConfig::get(); std::string file_name_lt = Config->SharedMemDir + prefix + std::string("loot_table"); std::string file_name_ld = Config->SharedMemDir + prefix + std::string("loot_drop"); diff --git a/shared_memory/loot.h b/shared_memory/loot.h index c9c55895b..694bba7ca 100644 --- a/shared_memory/loot.h +++ b/shared_memory/loot.h @@ -22,8 +22,6 @@ #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 d37d23bd4..79824251f 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,7 +47,7 @@ int main(int argc, char **argv) { return 1; } - Config = EQEmuConfig::get(); + auto Config = EQEmuConfig::get(); SharedDatabase database; Log.Out(Logs::General, Logs::Status, "Connecting to database..."); diff --git a/shared_memory/npc_faction.cpp b/shared_memory/npc_faction.cpp index 5e8f86cfd..2c6ab0098 100644 --- a/shared_memory/npc_faction.cpp +++ b/shared_memory/npc_faction.cpp @@ -34,6 +34,7 @@ void LoadFactions(SharedDatabase *database, const std::string &prefix) { uint32 size = static_cast(EQEmu::FixedMemoryHashSet::estimated_size(lists, max_list)); + auto Config = EQEmuConfig::get(); 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 598f8f01b..0b8a047f0 100644 --- a/shared_memory/npc_faction.h +++ b/shared_memory/npc_faction.h @@ -22,8 +22,6 @@ #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 6712d75c6..bd8eabb5a 100644 --- a/shared_memory/skill_caps.cpp +++ b/shared_memory/skill_caps.cpp @@ -34,6 +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)); + auto Config = EQEmuConfig::get(); 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 6e35d6fb5..da2cebc51 100644 --- a/shared_memory/skill_caps.h +++ b/shared_memory/skill_caps.h @@ -22,8 +22,6 @@ #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 2cb3d846e..c653e26f5 100644 --- a/shared_memory/spells.cpp +++ b/shared_memory/spells.cpp @@ -34,6 +34,7 @@ void LoadSpells(SharedDatabase *database, const std::string &prefix) { uint32 size = records * sizeof(SPDat_Spell_Struct) + sizeof(uint32); + auto Config = EQEmuConfig::get(); 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 230e3779f..bdda1eac4 100644 --- a/shared_memory/spells.h +++ b/shared_memory/spells.h @@ -22,8 +22,6 @@ #include #include "../common/eqemu_config.h" -extern const EQEmuConfig *Config; - class SharedDatabase; void LoadSpells(SharedDatabase *database, const std::string &prefix);