diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/macros/GroupSources.cmake | 46 | ||||
-rw-r--r-- | cmake/options.cmake | 2 | ||||
-rw-r--r-- | cmake/showoptions.cmake | 23 | ||||
-rw-r--r-- | src/server/bnetserver/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/server/collision/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/server/game/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.h | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 3 | ||||
-rw-r--r-- | src/server/scripts/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp | 1 | ||||
-rw-r--r-- | src/server/shared/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/server/shared/Database/MySQLConnection.cpp | 16 | ||||
-rw-r--r-- | src/server/worldserver/CMakeLists.txt | 2 |
15 files changed, 100 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 56ea65e5d7a..90922cd77e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,8 @@ endif() include(CheckPlatform) +include(GroupSources) + # basic packagesearching and setup (further support will be needed, this is a preliminary release!) set(OPENSSL_EXPECTED_VERSION 1.0.0) diff --git a/cmake/macros/GroupSources.cmake b/cmake/macros/GroupSources.cmake new file mode 100644 index 00000000000..3acb03e7b4c --- /dev/null +++ b/cmake/macros/GroupSources.cmake @@ -0,0 +1,46 @@ +# Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/> +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +macro(GroupSources dir) + # Skip this if WITH_SOURCE_TREE is not set (empty string). + if (NOT ${_WITH_SOURCE_TREE} STREQUAL "") + # Include all header and c files + file(GLOB_RECURSE elements RELATIVE ${dir} *.h *.hpp *.c *.cpp *.cc) + + foreach(element ${elements}) + # Extract filename and directory + get_filename_component(element_name ${element} NAME) + get_filename_component(element_dir ${element} DIRECTORY) + + if (NOT ${element_dir} STREQUAL "") + # If the file is in a subdirectory use it as source group. + if (${_WITH_SOURCE_TREE} STREQUAL "flat") + # Build flat structure by using only the first subdirectory. + string(FIND ${element_dir} "/" delemiter_pos) + if (NOT ${delemiter_pos} EQUAL -1) + string(SUBSTRING ${element_dir} 0 ${delemiter_pos} group_name) + source_group("${group_name}" FILES ${dir}/${element}) + else() + # Build hierarchical structure. + # File is in root directory. + source_group("${element_dir}" FILES ${dir}/${element}) + endif() + else() + # Use the full hierarchical structure to build source_groups. + string(REPLACE "/" "\\" group_name ${element_dir}) + source_group("${group_name}" FILES ${dir}/${element}) + endif() + else() + # If the file is in the root directory, place it in the root source_group. + source_group("\\" FILES ${dir}/${element}) + endif() + endforeach() + endif() +endmacro() diff --git a/cmake/options.cmake b/cmake/options.cmake index 9b0e663d0a9..0bc7c84e66f 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -15,4 +15,6 @@ option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" option(USE_COREPCH "Use precompiled headers when compiling servers" 1) option(WITH_WARNINGS "Show all warnings during compile" 0) option(WITH_COREDEBUG "Include additional debug-code in core" 0) +set(WITH_SOURCE_TREE "no" CACHE STRING "Build the source tree for IDE's.") +set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical) option(WITHOUT_GIT "Disable the GIT testing routines" 0) diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake index 44d161cab8d..87a372260a0 100644 --- a/cmake/showoptions.cmake +++ b/cmake/showoptions.cmake @@ -62,6 +62,29 @@ else() message("* Use coreside debug : No (default)") endif() +if( WITH_SOURCE_TREE STREQUAL "flat" OR WITH_SOURCE_TREE STREQUAL "hierarchical" ) + # TODO: Remove this after Debian 8 is released and set general required version to 2.8.12 + # Debian 7 is shipped with CMake 2.8.9 . But DIRECTORY flag of get_filename_component requires 2.8.12 . + if (NOT CMAKE_VERSION VERSION_LESS 2.8.12) + message("* Show source tree : Yes - ${WITH_SOURCE_TREE}") + set(_WITH_SOURCE_TREE ${WITH_SOURCE_TREE} CACHE INTERNAL "WITH_SOURCE_TREE support enabled.") + else() + message("* Show source tree : No (default)") + + message("") + message(" *** WITH_SOURCE_TREE - WARNING!") + message(" *** This functionality is ONLY supported on CMake 2.8.12 or higher.") + message(" *** You are running ${CMAKE_VERSION}, which does not have the functions needed") + message(" *** to create a sourcetree - this option is thus forced to disabled!") + message("") + + set(_WITH_SOURCE_TREE "" CACHE INTERNAL "WITH_SOURCE_TREE support disabled.") + endif() +else() + message("* Show source tree : No (default)") + set(_WITH_SOURCE_TREE "" CACHE INTERNAL "WITH_SOURCE_TREE support disabled.") +endif() + if ( WITHOUT_GIT ) message("* Use GIT revision hash : No") message("") diff --git a/src/server/bnetserver/CMakeLists.txt b/src/server/bnetserver/CMakeLists.txt index 4ea4f697cf7..e80e99cdda7 100644 --- a/src/server/bnetserver/CMakeLists.txt +++ b/src/server/bnetserver/CMakeLists.txt @@ -73,6 +73,8 @@ include_directories( ${ZMQ_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_executable(bnetserver ${bnetserver_SRCS} ${bnetserver_PCH_SRC} diff --git a/src/server/collision/CMakeLists.txt b/src/server/collision/CMakeLists.txt index 84f7de76543..f0f5cef5985 100644 --- a/src/server/collision/CMakeLists.txt +++ b/src/server/collision/CMakeLists.txt @@ -81,6 +81,8 @@ include_directories( ${VALGRIND_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_library(collision STATIC ${collision_STAT_SRCS} ${collision_STAT_PCH_SRC} diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt index 55792856eb4..caa75c24121 100644 --- a/src/server/game/CMakeLists.txt +++ b/src/server/game/CMakeLists.txt @@ -214,6 +214,8 @@ include_directories( ${ZMQ_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_library(game STATIC ${game_STAT_SRCS} ${game_STAT_PCH_SRC} diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 0f853a2a161..5c844f1e3aa 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -1512,7 +1512,7 @@ void OpcodeTable::Initialize() DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_CLEAR_SPELLS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_DISMISS_SOUND, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_GOD_MODE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); - DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_GUI_DS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); + DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_GUIDS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_LEARNED_SPELLS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_MODE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_NAME_INVALID, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index b79c78d8878..8f652d76a43 100644 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -1419,7 +1419,7 @@ enum OpcodeServer : uint32 SMSG_PET_CLEAR_SPELLS = 0x193A, SMSG_PET_DISMISS_SOUND = 0x0237, SMSG_PET_GOD_MODE = 0x1C66, - SMSG_PET_GUI_DS = 0x0245, + SMSG_PET_GUIDS = 0x0245, SMSG_PET_LEARNED_SPELLS = 0x1099, SMSG_PET_MODE = 0x1F0B, SMSG_PET_NAME_INVALID = 0x0975, diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index e85d38ee30c..9e6f103be0d 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -332,9 +332,6 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint32 effMask, WorldObject* own else casterGUID = caster->GetGUID(); - // at this point of Aura::Create() there MUST be a valid caster - ASSERT(caster); - // check if aura can be owned by owner if (owner->isType(TYPEMASK_UNIT)) if (!owner->IsInWorld() || ((Unit*)owner)->IsDuringRemoveFromWorld()) diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index 79d3cea0868..694a36cb229 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -151,6 +151,8 @@ include_directories( ${VALGRIND_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_library(scripts STATIC ${scripts_STAT_SRCS} ${scripts_STAT_PCH_SRC} diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp index 3bd4abd899f..82ee9626e27 100644 --- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp @@ -34,6 +34,7 @@ EndContentData */ #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "PassiveAI.h" +#include "CellImpl.h" /*###### ## npc_webbed_creature diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt index 657b3fde349..f91c684110a 100644 --- a/src/server/shared/CMakeLists.txt +++ b/src/server/shared/CMakeLists.txt @@ -87,6 +87,8 @@ include_directories( ${VALGRIND_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_library(shared STATIC ${shared_STAT_SRCS} ${shared_STAT_PCH_SRC} diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 5a98757abb5..a16559a55dc 100644 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -79,7 +79,7 @@ uint32 MySQLConnection::Open() if (!mysqlInit) { TC_LOG_ERROR("sql.sql", "Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str()); - return false; + return CR_UNKNOWN_ERROR; } int port; @@ -492,9 +492,17 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) uint64 oldThreadId = mysql_thread_id(GetHandle()); mysql_close(GetHandle()); - // Don't remove 'this' pointer unless you want to skip loading all prepared statements.... - if (this->Open() && this->PrepareStatements()) + uint32 const lErrno = Open(); + if (!lErrno) { + // Don't remove 'this' pointer unless you want to skip loading all prepared statements... + if (!this->PrepareStatements()) + { + TC_LOG_ERROR("sql.sql", "Could not re-prepare statements!"); + Close(); + return false; + } + TC_LOG_INFO("sql.sql", "Connection to the MySQL server is active."); if (oldThreadId != mysql_thread_id(GetHandle())) TC_LOG_INFO("sql.sql", "Successfully reconnected to %s @%s:%s (%s).", @@ -505,7 +513,7 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) return true; } - uint32 lErrno = mysql_errno(GetHandle()); // It's possible this attempted reconnect throws 2006 at us. To prevent crazy recursive calls, sleep here. + // It's possible this attempted reconnect throws 2006 at us. To prevent crazy recursive calls, sleep here. std::this_thread::sleep_for(std::chrono::seconds(3)); // Sleep 3 seconds return _HandleMySQLErrno(lErrno); // Call self (recursive) } diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index 63da20df2c7..f76da8e87fa 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -149,6 +149,8 @@ include_directories( ${ZMQ_INCLUDE_DIR} ) +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + add_executable(worldserver ${worldserver_SRCS} ${worldserver_PCH_SRC} |