diff --git a/src/common/Collision/Models/GameObjectModel.h b/src/common/Collision/Models/GameObjectModel.h index 9d8687233c1..7834f53c63a 100644 --- a/src/common/Collision/Models/GameObjectModel.h +++ b/src/common/Collision/Models/GameObjectModel.h @@ -84,4 +84,6 @@ private: std::unique_ptr owner; }; +void LoadGameObjectModelList(std::string const& dataPath); + #endif // _GAMEOBJECT_MODEL_H diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp index 5db333c8aff..fba438dbd33 100644 --- a/src/common/Configuration/Config.cpp +++ b/src/common/Configuration/Config.cpp @@ -56,6 +56,12 @@ bool ConfigMgr::LoadInitial(std::string const& file, std::string& error) return true; } +ConfigMgr* ConfigMgr::instance() +{ + static ConfigMgr instance; + return &instance; +} + bool ConfigMgr::Reload(std::string& error) { return LoadInitial(_filename, error); diff --git a/src/common/Configuration/Config.h b/src/common/Configuration/Config.h index ada910d8fcc..6882517b509 100644 --- a/src/common/Configuration/Config.h +++ b/src/common/Configuration/Config.h @@ -33,11 +33,7 @@ public: /// Method used only for loading main configuration files (authserver.conf and worldserver.conf) bool LoadInitial(std::string const& file, std::string& error); - static ConfigMgr* instance() - { - static ConfigMgr instance; - return &instance; - } + static ConfigMgr* instance(); bool Reload(std::string& error); diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index a80a4671822..de2c02bf2ed 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -320,6 +320,12 @@ void Log::Close() appenders.clear(); } +Log* Log::instance() +{ + static Log instance; + return &instance; +} + void Log::Initialize(boost::asio::io_service* ioService) { if (ioService) diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index a90481ad5d2..6f9c5600775 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -44,11 +44,7 @@ class Log public: - static Log* instance() - { - static Log instance; - return &instance; - } + static Log* instance(); void Initialize(boost::asio::io_service* ioService); void LoadFromConfig(); diff --git a/src/server/shared/Service/ServiceWin32.cpp b/src/common/Platform/ServiceWin32.cpp similarity index 99% rename from src/server/shared/Service/ServiceWin32.cpp rename to src/common/Platform/ServiceWin32.cpp index b6a1682993b..3c34f3e322c 100644 --- a/src/server/shared/Service/ServiceWin32.cpp +++ b/src/common/Platform/ServiceWin32.cpp @@ -261,4 +261,3 @@ bool WinServiceRun() return true; } #endif - diff --git a/src/server/shared/Service/ServiceWin32.h b/src/common/Platform/ServiceWin32.h similarity index 99% rename from src/server/shared/Service/ServiceWin32.h rename to src/common/Platform/ServiceWin32.h index 3d67bfe5445..b892ba4e3b6 100644 --- a/src/server/shared/Service/ServiceWin32.h +++ b/src/common/Platform/ServiceWin32.h @@ -26,4 +26,3 @@ bool WinServiceRun(); #endif // _WIN32_SERVICE_ #endif // _WIN32 - diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 891d529df72..e4efe0eae83 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -18,10 +18,15 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW) add_definitions(-fno-delete-null-pointer-checks) endif() -set(sources_windows_Debugging - ${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.cpp - ${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.h -) +if(WIN32) + set(sources_windows + ${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.cpp + ${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.h + ${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp + ${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.h + ) +endif(WIN32) + add_subdirectory(database) add_subdirectory(shared) add_subdirectory(game) diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt index 34e7ed8a43f..04212a97c3e 100644 --- a/src/server/authserver/CMakeLists.txt +++ b/src/server/authserver/CMakeLists.txt @@ -31,7 +31,7 @@ set(authserver_SRCS if( WIN32 ) set(authserver_SRCS ${authserver_SRCS} - ${sources_windows_Debugging} + ${sources_windows} ) if ( MSVC ) set(authserver_SRCS @@ -54,9 +54,11 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/common/Logging ${CMAKE_SOURCE_DIR}/src/common/Threading ${CMAKE_SOURCE_DIR}/src/common/Utilities + ${CMAKE_SOURCE_DIR}/src/common/Platform ${CMAKE_SOURCE_DIR}/src/server/database ${CMAKE_SOURCE_DIR}/src/server/database/Database ${CMAKE_SOURCE_DIR}/src/server/database/Logging + ${CMAKE_SOURCE_DIR}/src/server/database/Updater ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Networking ${CMAKE_SOURCE_DIR}/src/server/shared/Packets diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 939d15ceca8..1a6d9831b9a 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -76,7 +76,6 @@ boost::asio::deadline_timer* _dbPingTimer; uint32 _dbPingInterval; boost::asio::deadline_timer* _banExpiryCheckTimer; uint32 _banExpiryCheckInterval; -LoginDatabaseWorkerPool LoginDatabase; int main(int argc, char** argv) { diff --git a/src/server/database/Database/DatabaseEnv.cpp b/src/server/database/Database/DatabaseEnv.cpp new file mode 100644 index 00000000000..3b2e632e4fb --- /dev/null +++ b/src/server/database/Database/DatabaseEnv.cpp @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2008-2016 TrinityCore + * + * 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; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; 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, see . + */ + +#include "DatabaseEnv.h" + +WorldDatabaseWorkerPool WorldDatabase; +CharacterDatabaseWorkerPool CharacterDatabase; +LoginDatabaseWorkerPool LoginDatabase; diff --git a/src/server/database/Database/DatabaseEnv.h b/src/server/database/Database/DatabaseEnv.h index cc8355a1302..c9a7672ac57 100644 --- a/src/server/database/Database/DatabaseEnv.h +++ b/src/server/database/Database/DatabaseEnv.h @@ -38,9 +38,11 @@ #include "Implementation/CharacterDatabase.h" #include "Implementation/WorldDatabase.h" +/// Accessor to the world database extern WorldDatabaseWorkerPool WorldDatabase; +/// Accessor to the character database extern CharacterDatabaseWorkerPool CharacterDatabase; +/// Accessor to the realm/login database extern LoginDatabaseWorkerPool LoginDatabase; #endif - diff --git a/src/server/database/Database/DatabaseLoader.h b/src/server/database/Database/DatabaseLoader.h index ec390a427ad..d3812eb060d 100644 --- a/src/server/database/Database/DatabaseLoader.h +++ b/src/server/database/Database/DatabaseLoader.h @@ -19,7 +19,7 @@ #define DatabaseLoader_h__ #include "DatabaseWorkerPool.h" -#include "DatabaseEnv.h" +#include "DBUpdater.h" #include #include diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 69116de30f3..06a76e8a5b6 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -38,6 +38,7 @@ #include "DatabaseEnv.h" #include "DisableMgr.h" #include "GameEventMgr.h" +#include "GameObjectModel.h" #include "GridNotifiersImpl.h" #include "GroupMgr.h" #include "GuildFinderMgr.h" @@ -1347,8 +1348,6 @@ void World::LoadConfigSettings(bool reload) sScriptMgr->OnConfigLoad(reload); } -extern void LoadGameObjectModelList(std::string const& dataPath); - /// Initialize the World void World::SetInitialWorldSettings() { diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt index a4dc65bfc15..2e24a452453 100644 --- a/src/server/shared/CMakeLists.txt +++ b/src/server/shared/CMakeLists.txt @@ -18,9 +18,6 @@ file(GLOB_RECURSE sources_Dynamic Dynamic/*.cpp Dynamic/*.h) file(GLOB_RECURSE sources_Networking Networking/*.cpp Networking/*.h) file(GLOB_RECURSE sources_Packets Packets/*.cpp Packets/*.h) file(GLOB_RECURSE sources_Realm Realm/*.cpp Realm/*.h) -if( WIN32 ) - file(GLOB_RECURSE sources_Service Service/*.cpp Service/*.h) -endif( WIN32 ) file(GLOB sources_localdir *.cpp *.h) # diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index 54ab4a180ce..15a60bd2f7a 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -29,7 +29,7 @@ set(worldserver_SRCS if( WIN32 ) set(worldserver_SRCS ${worldserver_SRCS} - ${sources_windows_Debugging} + ${sources_windows} ) if ( MSVC ) set(worldserver_SRCS @@ -60,10 +60,12 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/common/Logging ${CMAKE_SOURCE_DIR}/src/common/Threading ${CMAKE_SOURCE_DIR}/src/common/Utilities + ${CMAKE_SOURCE_DIR}/src/common/Platform ${CMAKE_SOURCE_DIR}/src/server/authserver/Realms ${CMAKE_SOURCE_DIR}/src/server/database/ ${CMAKE_SOURCE_DIR}/src/server/database/Database ${CMAKE_SOURCE_DIR}/src/server/database/Logging + ${CMAKE_SOURCE_DIR}/src/server/database/Updater ${CMAKE_SOURCE_DIR}/src/server/ipc ${CMAKE_SOURCE_DIR}/src/server/game ${CMAKE_SOURCE_DIR}/src/server/game/Accounts diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 134b94c464e..f7128bf3152 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -79,9 +79,6 @@ uint32 _worldLoopCounter(0); uint32 _lastChangeMsTime(0); uint32 _maxCoreStuckTimeInMs(0); -WorldDatabaseWorkerPool WorldDatabase; ///< Accessor to the world database -CharacterDatabaseWorkerPool CharacterDatabase; ///< Accessor to the character database -LoginDatabaseWorkerPool LoginDatabase; ///< Accessor to the realm/login database Realm realm; void SignalHandler(const boost::system::error_code& error, int signalNumber);