From 49fd11ab5aebcbce86ca2ee48711287cf020d798 Mon Sep 17 00:00:00 2001 From: Nefarion Date: Fri, 8 Mar 2013 21:41:30 +0100 Subject: First step of comment style refactoring to doxygen-style. --- src/server/shared/Common.h | 2 +- src/server/shared/Database/DatabaseWorkerPool.h | 2 +- src/server/shared/Database/MySQLConnection.cpp | 4 ++-- src/server/shared/Packets/ByteBuffer.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/server/shared') diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h index 44a7749334d..70ee32d2868 100644 --- a/src/server/shared/Common.h +++ b/src/server/shared/Common.h @@ -20,7 +20,7 @@ #define TRINITYCORE_COMMON_H // config.h needs to be included 1st -// TODO this thingy looks like hack, but its not, need to +/// @todo this thingy looks like hack, but its not, need to // make separate header however, because It makes mess here. #ifdef HAVE_CONFIG_H // Remove Some things that we will define diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index c43cc8fab82..524a3de2628 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -388,7 +388,7 @@ class DatabaseWorkerPool } //! Handle MySQL Errno 1213 without extending deadlock to the core itself - //! TODO: More elegant way + /// @todo More elegant way if (con->GetLastError() == 1213) { uint8 loopBreaker = 5; diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index ce23f4ca4f6..a5bcac7eeef 100644 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -188,7 +188,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) MySQLPreparedStatement* m_mStmt = GetPreparedStatement(index); ASSERT(m_mStmt); // Can only be null if preparation failed, server side error or bad query m_mStmt->m_stmt = stmt; // Cross reference them for debug output - stmt->m_stmt = m_mStmt; // TODO: Cleaner way + stmt->m_stmt = m_mStmt; /// @todo Cleaner way stmt->BindParameters(); @@ -238,7 +238,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 MySQLPreparedStatement* m_mStmt = GetPreparedStatement(index); ASSERT(m_mStmt); // Can only be null if preparation failed, server side error or bad query m_mStmt->m_stmt = stmt; // Cross reference them for debug output - stmt->m_stmt = m_mStmt; // TODO: Cleaner way + stmt->m_stmt = m_mStmt; /// @todo Cleaner way stmt->BindParameters(); diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index bf2980aa45d..ceab4ca442e 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -626,7 +626,7 @@ inline ByteBuffer &operator>>(ByteBuffer &b, std::map &m) return b; } -// TODO: Make a ByteBuffer.cpp and move all this inlining to it. +/// @todo Make a ByteBuffer.cpp and move all this inlining to it. template<> inline std::string ByteBuffer::read() { std::string tmp; -- cgit v1.2.3 From c7463c5f6cd3d882a960eff2cbd414f33ddf0b32 Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 9 Mar 2013 00:12:50 +0000 Subject: Buildsystem: Add support for compiling with MinGW on Windows Tested with: - Windows 8 x64 - MySQL 5.5.30 win32 - OpenSSL 1.0.1c (32 bits) - No PCH - MinGW with GCC 4.7.0 TODO: - Fix compile/link with PCH enabled - Fix compile with WheatyExceptonionReport enabled (ignored for now) - Fix compile of .rc files (ignored for now) - Test with more platforms --- cmake/compiler/mingw/settings.cmake | 27 ++ cmake/platform/win/settings.cmake | 6 +- cmake/stack_direction.c | 31 ++ dep/acelite/6.1.4_tc_changes.diff | 418 --------------------- dep/acelite/ace-v6.1.4_hotfix1.diff | 418 +++++++++++++++++++++ dep/acelite/ace-v6.1.4_hotfix2.diff | 15 + dep/acelite/ace/CMakeLists.txt | 4 + dep/g3dlite/G3D-v8.0_hotfix6.diff | 103 +++++ dep/g3dlite/include/G3D/platform.h | 5 + dep/g3dlite/source/FileSystem.cpp | 7 +- dep/g3dlite/source/RegistryUtil.cpp | 9 + dep/g3dlite/source/System.cpp | 10 +- dep/recastnavigation/Detour/DetourNavMesh.h | 2 +- dep/recastnavigation/recast_hotfix1.diff | 13 + src/server/CMakeLists.txt | 2 +- src/server/authserver/CMakeLists.txt | 30 +- src/server/collision/BoundingIntervalHierarchy.cpp | 8 +- .../shared/Debugging/WheatyExceptionReport.cpp | 2 +- .../shared/Debugging/WheatyExceptionReport.h | 2 +- src/server/worldserver/CMakeLists.txt | 32 +- 20 files changed, 692 insertions(+), 452 deletions(-) create mode 100644 cmake/compiler/mingw/settings.cmake create mode 100644 cmake/stack_direction.c delete mode 100644 dep/acelite/6.1.4_tc_changes.diff create mode 100644 dep/acelite/ace-v6.1.4_hotfix1.diff create mode 100644 dep/acelite/ace-v6.1.4_hotfix2.diff create mode 100644 dep/g3dlite/G3D-v8.0_hotfix6.diff create mode 100644 dep/recastnavigation/recast_hotfix1.diff (limited to 'src/server/shared') diff --git a/cmake/compiler/mingw/settings.cmake b/cmake/compiler/mingw/settings.cmake new file mode 100644 index 00000000000..68156bd0b6b --- /dev/null +++ b/cmake/compiler/mingw/settings.cmake @@ -0,0 +1,27 @@ +# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# Set build-directive (used in core to tell which buildtype we used) +add_definitions(-D_BUILD_DIRECTIVE=\\"${CMAKE_BUILD_TYPE}\\") + +if(PLATFORM EQUAL 32) + # Required on 32-bit systems to enable SSE2 (standard on x64) + set(SSE_FLAGS "-msse2 -mfpmath=sse") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SSE_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SSE_FLAGS}") +endif() +add_definitions(-DHAVE_SSE2 -D__SSE2__) +message(STATUS "GCC: SFMT enabled, SSE2 flags forced") + +if( WITH_WARNINGS ) + set(WARNING_FLAGS "-W -Wall -Wextra -Winit-self -Winvalid-pch -Wfatal-errors") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -Woverloaded-virtual") + message(STATUS "GCC: All warnings enabled") +endif() + +if( WITH_COREDEBUG ) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") + message(STATUS "GCC: Debug-flags set (-g3)") +endif() diff --git a/cmake/platform/win/settings.cmake b/cmake/platform/win/settings.cmake index b66eb2da7bb..c0f724922e3 100644 --- a/cmake/platform/win/settings.cmake +++ b/cmake/platform/win/settings.cmake @@ -25,4 +25,8 @@ endif() # endif() #endif() -include(${CMAKE_SOURCE_DIR}/cmake/compiler/msvc/settings.cmake) +if ( MSVC ) + include(${CMAKE_SOURCE_DIR}/cmake/compiler/msvc/settings.cmake) +elseif ( MINGW ) + include(${CMAKE_SOURCE_DIR}/cmake/compiler/mingw/settings.cmake) +endif() diff --git a/cmake/stack_direction.c b/cmake/stack_direction.c new file mode 100644 index 00000000000..11bcf803bfa --- /dev/null +++ b/cmake/stack_direction.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2009 Sun Microsystems, Inc + + 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; 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* Check stack direction (0-down, 1-up) */ +int f(int *a) +{ + int b; + return(&b > a)?1:0; +} +/* + Prevent compiler optimizations by calling function + through pointer. +*/ +volatile int (*ptr_f)(int *) = f; +int main() +{ + int a; + return ptr_f(&a); +} \ No newline at end of file diff --git a/dep/acelite/6.1.4_tc_changes.diff b/dep/acelite/6.1.4_tc_changes.diff deleted file mode 100644 index 15b76eb29ce..00000000000 --- a/dep/acelite/6.1.4_tc_changes.diff +++ /dev/null @@ -1,418 +0,0 @@ -diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt -new file mode 100644 -index 0000000..acd3d5a ---- /dev/null -+++ b/dep/acelite/ace/CMakeLists.txt -@@ -0,0 +1,348 @@ -+# Copyright (C) 2008-2013 TrinityCore -+# -+# 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. -+ -+# NOTE: Do not use glob here, it would include files we don't want -+set(ace_STAT_SRCS -+ PrecompiledHeaders/WinAcePCH.cpp -+ ACE.cpp -+ ACE_crc32.cpp -+ ACE_crc_ccitt.cpp -+ ace_wchar.cpp -+ Activation_Queue.cpp -+ Active_Map_Manager.cpp -+ Addr.cpp -+ Argv_Type_Converter.cpp -+ Assert.cpp -+ Asynch_IO.cpp -+ Asynch_IO_Impl.cpp -+ Asynch_Pseudo_Task.cpp -+ ATM_Acceptor.cpp -+ ATM_Addr.cpp -+ ATM_Connector.cpp -+ ATM_Params.cpp -+ ATM_QoS.cpp -+ ATM_Stream.cpp -+ Atomic_Op.cpp -+ Atomic_Op_Sparc.c -+ Auto_Event.cpp -+ Barrier.cpp -+ Base_Thread_Adapter.cpp -+ Based_Pointer_Repository.cpp -+ Basic_Stats.cpp -+ Basic_Types.cpp -+ Capabilities.cpp -+ CDR_Base.cpp -+ CDR_Size.cpp -+ CDR_Stream.cpp -+ Cleanup.cpp -+ Codecs.cpp -+ Codeset_IBM1047.cpp -+ Codeset_Registry.cpp -+ Codeset_Registry_db.cpp -+ Condition_Recursive_Thread_Mutex.cpp -+ Condition_Thread_Mutex.cpp -+ Configuration.cpp -+ Configuration_Import_Export.cpp -+ Connection_Recycling_Strategy.cpp -+ Containers.cpp -+ Copy_Disabled.cpp -+ Date_Time.cpp -+ DEV.cpp -+ DEV_Addr.cpp -+ DEV_Connector.cpp -+ DEV_IO.cpp -+ Dev_Poll_Reactor.cpp -+ Dirent.cpp -+ Dirent_Selector.cpp -+ DLL.cpp -+ DLL_Manager.cpp -+ Dump.cpp -+ Dynamic.cpp -+ Dynamic_Message_Strategy.cpp -+ Dynamic_Service_Base.cpp -+ Dynamic_Service_Dependency.cpp -+ Encoding_Converter.cpp -+ Encoding_Converter_Factory.cpp -+ Event.cpp -+ Event_Handler.cpp -+ Event_Handler_Handle_Timeout_Upcall.cpp -+ FIFO.cpp -+ FIFO_Recv.cpp -+ FIFO_Recv_Msg.cpp -+ FIFO_Send.cpp -+ FIFO_Send_Msg.cpp -+ FILE.cpp -+ FILE_Addr.cpp -+ FILE_Connector.cpp -+ FILE_IO.cpp -+ File_Lock.cpp -+ Filecache.cpp -+ Flag_Manip.cpp -+ Framework_Component.cpp -+ Functor.cpp -+ Functor_String.cpp -+ Get_Opt.cpp -+ Handle_Ops.cpp -+ Handle_Set.cpp -+ Hashable.cpp -+ High_Res_Timer.cpp -+ ICMP_Socket.cpp -+ INET_Addr.cpp -+ Init_ACE.cpp -+ IO_Cntl_Msg.cpp -+ IO_SAP.cpp -+ IOStream.cpp -+ IPC_SAP.cpp -+ Lib_Find.cpp -+ Local_Memory_Pool.cpp -+ Local_Name_Space.cpp -+ Local_Tokens.cpp -+ Lock.cpp -+ Log_Msg.cpp -+ Log_Msg_Backend.cpp -+ Log_Msg_Callback.cpp -+ Log_Msg_IPC.cpp -+ Log_Msg_NT_Event_Log.cpp -+ Log_Msg_UNIX_Syslog.cpp -+ Log_Record.cpp -+ Logging_Strategy.cpp -+ LSOCK.cpp -+ LSOCK_Acceptor.cpp -+ LSOCK_CODgram.cpp -+ LSOCK_Connector.cpp -+ LSOCK_Dgram.cpp -+ LSOCK_Stream.cpp -+ Malloc.cpp -+ Malloc_Allocator.cpp -+ Manual_Event.cpp -+ MEM_Acceptor.cpp -+ MEM_Addr.cpp -+ MEM_Connector.cpp -+ MEM_IO.cpp -+ Mem_Map.cpp -+ MEM_SAP.cpp -+ MEM_Stream.cpp -+ Message_Block.cpp -+ Message_Queue.cpp -+ Message_Queue_NT.cpp -+ Message_Queue_Vx.cpp -+ Method_Request.cpp -+ MMAP_Memory_Pool.cpp -+ Monitor_Admin.cpp -+ Monitor_Admin_Manager.cpp -+ Monitor_Base.cpp -+ Monitor_Control_Action.cpp -+ Monitor_Control_Types.cpp -+ Monitor_Point_Registry.cpp -+ Monitor_Size.cpp -+ Msg_WFMO_Reactor.cpp -+ Multihomed_INET_Addr.cpp -+ Mutex.cpp -+ Name_Proxy.cpp -+ Name_Request_Reply.cpp -+ Name_Space.cpp -+ Naming_Context.cpp -+ Netlink_Addr.cpp -+ Notification_Queue.cpp -+ Notification_Strategy.cpp -+ NT_Service.cpp -+ Obchunk.cpp -+ Object_Manager.cpp -+ Object_Manager_Base.cpp -+ OS_Errno.cpp -+ OS_Log_Msg_Attributes.cpp -+ OS_main.cpp -+ OS_NS_arpa_inet.cpp -+ OS_NS_ctype.cpp -+ OS_NS_dirent.cpp -+ OS_NS_dlfcn.cpp -+ OS_NS_errno.cpp -+ OS_NS_fcntl.cpp -+ OS_NS_math.cpp -+ OS_NS_netdb.cpp -+ OS_NS_poll.cpp -+ OS_NS_pwd.cpp -+ OS_NS_regex.cpp -+ OS_NS_signal.cpp -+ OS_NS_stdio.cpp -+ OS_NS_stdlib.cpp -+ OS_NS_string.cpp -+ OS_NS_strings.cpp -+ OS_NS_stropts.cpp -+ OS_NS_sys_mman.cpp -+ OS_NS_sys_msg.cpp -+ OS_NS_sys_resource.cpp -+ OS_NS_sys_select.cpp -+ OS_NS_sys_sendfile.cpp -+ OS_NS_sys_shm.cpp -+ OS_NS_sys_socket.cpp -+ OS_NS_sys_stat.cpp -+ OS_NS_sys_time.cpp -+ OS_NS_sys_uio.cpp -+ OS_NS_sys_utsname.cpp -+ OS_NS_sys_wait.cpp -+ OS_NS_Thread.cpp -+ OS_NS_time.cpp -+ OS_NS_unistd.cpp -+ OS_NS_wchar.cpp -+ OS_QoS.cpp -+ OS_Thread_Adapter.cpp -+ OS_TLI.cpp -+ Pagefile_Memory_Pool.cpp -+ Parse_Node.cpp -+ PI_Malloc.cpp -+ Ping_Socket.cpp -+ Pipe.cpp -+ POSIX_Asynch_IO.cpp -+ POSIX_CB_Proactor.cpp -+ POSIX_Proactor.cpp -+ Priority_Reactor.cpp -+ Proactor.cpp -+ Proactor_Impl.cpp -+ Process.cpp -+ Process_Manager.cpp -+ Process_Mutex.cpp -+ Process_Semaphore.cpp -+ Profile_Timer.cpp -+ Reactor.cpp -+ Reactor_Impl.cpp -+ Reactor_Notification_Strategy.cpp -+ Reactor_Timer_Interface.cpp -+ Read_Buffer.cpp -+ Recursive_Thread_Mutex.cpp -+ Recyclable.cpp -+ Registry.cpp -+ Registry_Name_Space.cpp -+ Remote_Name_Space.cpp -+ Remote_Tokens.cpp -+ Rtems_init.c -+ RW_Mutex.cpp -+ RW_Process_Mutex.cpp -+ RW_Thread_Mutex.cpp -+ Sample_History.cpp -+ Sbrk_Memory_Pool.cpp -+ Sched_Params.cpp -+ Select_Reactor_Base.cpp -+ Semaphore.cpp -+ Service_Config.cpp -+ Service_Gestalt.cpp -+ Service_Manager.cpp -+ Service_Object.cpp -+ Service_Repository.cpp -+ Service_Types.cpp -+ Shared_Memory.cpp -+ Shared_Memory_MM.cpp -+ Shared_Memory_Pool.cpp -+ Shared_Memory_SV.cpp -+ Shared_Object.cpp -+ Sig_Adapter.cpp -+ Sig_Handler.cpp -+ Signal.cpp -+ SOCK.cpp -+ SOCK_Acceptor.cpp -+ SOCK_CODgram.cpp -+ Sock_Connect.cpp -+ SOCK_Connector.cpp -+ SOCK_Dgram.cpp -+ SOCK_Dgram_Bcast.cpp -+ SOCK_Dgram_Mcast.cpp -+ SOCK_IO.cpp -+ SOCK_Netlink.cpp -+ SOCK_SEQPACK_Acceptor.cpp -+ SOCK_SEQPACK_Association.cpp -+ SOCK_SEQPACK_Connector.cpp -+ SOCK_Stream.cpp -+ SPIPE.cpp -+ SPIPE_Acceptor.cpp -+ SPIPE_Addr.cpp -+ SPIPE_Connector.cpp -+ SPIPE_Stream.cpp -+ SString.cpp -+ Stack_Trace.cpp -+ Stats.cpp -+ String_Base_Const.cpp -+ SUN_Proactor.cpp -+ SV_Message.cpp -+ SV_Message_Queue.cpp -+ SV_Semaphore_Complex.cpp -+ SV_Semaphore_Simple.cpp -+ SV_Shared_Memory.cpp -+ Svc_Conf_Lexer.cpp -+ Svc_Conf_y.cpp -+ Synch_Options.cpp -+ System_Time.cpp -+ Task.cpp -+ Thread.cpp -+ Thread_Adapter.cpp -+ Thread_Control.cpp -+ Thread_Exit.cpp -+ Thread_Hook.cpp -+ Thread_Manager.cpp -+ Thread_Mutex.cpp -+ Thread_Semaphore.cpp -+ Throughput_Stats.cpp -+ Time_Policy.cpp -+ Time_Value.cpp -+ Timeprobe.cpp -+ TLI.cpp -+ TLI_Acceptor.cpp -+ TLI_Connector.cpp -+ TLI_Stream.cpp -+ Token.cpp -+ Token_Collection.cpp -+ Token_Invariants.cpp -+ Token_Manager.cpp -+ Token_Request_Reply.cpp -+ TP_Reactor.cpp -+ Trace.cpp -+ TSS_Adapter.cpp -+ TTY_IO.cpp -+ UNIX_Addr.cpp -+ UPIPE_Acceptor.cpp -+ UPIPE_Connector.cpp -+ UPIPE_Stream.cpp -+ UTF16_Encoding_Converter.cpp -+ UTF32_Encoding_Converter.cpp -+ UTF8_Encoding_Converter.cpp -+ UUID.cpp -+ WFMO_Reactor.cpp -+ WIN32_Asynch_IO.cpp -+ WIN32_Proactor.cpp -+ XML_Svc_Conf.cpp -+ XTI_ATM_Mcast.cpp -+) -+ -+if (USE_COREPCH) -+ set(ace_PCH_HDR PrecompiledHeaders/WinAcePCH.h) -+ set(ace_PCH_SRC PrecompiledHeaders/WinAcePCH.cpp) -+endif() -+ -+include_directories( -+ ${CMAKE_SOURCE_DIR}/dep/acelite -+ ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders -+ ${CMAKE_SOURCE_DIR}/dep/zlib -+) -+ -+# Needed for PCH support -+set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX) -+ -+add_definitions(-DACE_BUILD_DLL) -+ -+add_library(ace SHARED -+ ${ace_STAT_SRCS} -+ ${ace_PCH_SRC} -+) -+ -+# Generate precompiled header -+if( USE_COREPCH ) -+ add_cxx_pch(ace ${ace_PCH_HDR} ${ace_PCH_SRC}) -+endif() -+ -+install(TARGETS ace RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") -diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp -new file mode 100644 -index 0000000..139597f ---- /dev/null -+++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp -@@ -0,0 +1,2 @@ -+ -+ -diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h -new file mode 100644 -index 0000000..6ff97bf ---- /dev/null -+++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h -@@ -0,0 +1,17 @@ -+ -+#ifndef WIN_ACE_PCH -+#define WIN_ACE_PCH -+ -+#include "ace/ACE.h" -+ -+#include "ace/Synch_Traits.h" -+#include "ace/Svc_Handler.h" -+#include "ace/SOCK_Stream.h" -+#include "ace/SOCK_Acceptor.h" -+#include "ace/Acceptor.h" -+#include "ace/Thread_Mutex.h" -+#include "ace/Guard_T.h" -+#include "ace/Unbounded_Queue.h" -+#include "ace/Message_Block.h" -+ -+#endif -diff --git a/dep/acelite/ace/config-macros.h b/dep/acelite/ace/config-macros.h -index f18c8e0..32e5894 100644 ---- a/dep/acelite/ace/config-macros.h -+++ b/dep/acelite/ace/config-macros.h -@@ -21,7 +21,11 @@ - #ifndef ACE_CONFIG_MACROS_H - #define ACE_CONFIG_MACROS_H - --#include "ace/config.h" -+#ifdef _WIN32 -+ #include "ace/config-win32.h" -+#else -+ #include "ace/config.h" -+#endif - - #include "ace/Version.h" - #include "ace/Versioned_Namespace.h" -diff --git a/dep/acelite/ace/config-win32-common.h b/dep/acelite/ace/config-win32-common.h -index 50645a1..098ddbd 100644 ---- a/dep/acelite/ace/config-win32-common.h -+++ b/dep/acelite/ace/config-win32-common.h -@@ -527,9 +527,9 @@ - # else - # pragma comment(lib, "ws2_32.lib") - # pragma comment(lib, "mswsock.lib") --# if defined (ACE_HAS_IPV6) -+// # if defined (ACE_HAS_IPV6) - # pragma comment(lib, "iphlpapi.lib") --# endif -+// # endif - # endif /* ACE_HAS_WINCE */ - # endif /* _MSC_VER */ - diff --git a/dep/acelite/ace-v6.1.4_hotfix1.diff b/dep/acelite/ace-v6.1.4_hotfix1.diff new file mode 100644 index 00000000000..15b76eb29ce --- /dev/null +++ b/dep/acelite/ace-v6.1.4_hotfix1.diff @@ -0,0 +1,418 @@ +diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt +new file mode 100644 +index 0000000..acd3d5a +--- /dev/null ++++ b/dep/acelite/ace/CMakeLists.txt +@@ -0,0 +1,348 @@ ++# Copyright (C) 2008-2013 TrinityCore ++# ++# 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. ++ ++# NOTE: Do not use glob here, it would include files we don't want ++set(ace_STAT_SRCS ++ PrecompiledHeaders/WinAcePCH.cpp ++ ACE.cpp ++ ACE_crc32.cpp ++ ACE_crc_ccitt.cpp ++ ace_wchar.cpp ++ Activation_Queue.cpp ++ Active_Map_Manager.cpp ++ Addr.cpp ++ Argv_Type_Converter.cpp ++ Assert.cpp ++ Asynch_IO.cpp ++ Asynch_IO_Impl.cpp ++ Asynch_Pseudo_Task.cpp ++ ATM_Acceptor.cpp ++ ATM_Addr.cpp ++ ATM_Connector.cpp ++ ATM_Params.cpp ++ ATM_QoS.cpp ++ ATM_Stream.cpp ++ Atomic_Op.cpp ++ Atomic_Op_Sparc.c ++ Auto_Event.cpp ++ Barrier.cpp ++ Base_Thread_Adapter.cpp ++ Based_Pointer_Repository.cpp ++ Basic_Stats.cpp ++ Basic_Types.cpp ++ Capabilities.cpp ++ CDR_Base.cpp ++ CDR_Size.cpp ++ CDR_Stream.cpp ++ Cleanup.cpp ++ Codecs.cpp ++ Codeset_IBM1047.cpp ++ Codeset_Registry.cpp ++ Codeset_Registry_db.cpp ++ Condition_Recursive_Thread_Mutex.cpp ++ Condition_Thread_Mutex.cpp ++ Configuration.cpp ++ Configuration_Import_Export.cpp ++ Connection_Recycling_Strategy.cpp ++ Containers.cpp ++ Copy_Disabled.cpp ++ Date_Time.cpp ++ DEV.cpp ++ DEV_Addr.cpp ++ DEV_Connector.cpp ++ DEV_IO.cpp ++ Dev_Poll_Reactor.cpp ++ Dirent.cpp ++ Dirent_Selector.cpp ++ DLL.cpp ++ DLL_Manager.cpp ++ Dump.cpp ++ Dynamic.cpp ++ Dynamic_Message_Strategy.cpp ++ Dynamic_Service_Base.cpp ++ Dynamic_Service_Dependency.cpp ++ Encoding_Converter.cpp ++ Encoding_Converter_Factory.cpp ++ Event.cpp ++ Event_Handler.cpp ++ Event_Handler_Handle_Timeout_Upcall.cpp ++ FIFO.cpp ++ FIFO_Recv.cpp ++ FIFO_Recv_Msg.cpp ++ FIFO_Send.cpp ++ FIFO_Send_Msg.cpp ++ FILE.cpp ++ FILE_Addr.cpp ++ FILE_Connector.cpp ++ FILE_IO.cpp ++ File_Lock.cpp ++ Filecache.cpp ++ Flag_Manip.cpp ++ Framework_Component.cpp ++ Functor.cpp ++ Functor_String.cpp ++ Get_Opt.cpp ++ Handle_Ops.cpp ++ Handle_Set.cpp ++ Hashable.cpp ++ High_Res_Timer.cpp ++ ICMP_Socket.cpp ++ INET_Addr.cpp ++ Init_ACE.cpp ++ IO_Cntl_Msg.cpp ++ IO_SAP.cpp ++ IOStream.cpp ++ IPC_SAP.cpp ++ Lib_Find.cpp ++ Local_Memory_Pool.cpp ++ Local_Name_Space.cpp ++ Local_Tokens.cpp ++ Lock.cpp ++ Log_Msg.cpp ++ Log_Msg_Backend.cpp ++ Log_Msg_Callback.cpp ++ Log_Msg_IPC.cpp ++ Log_Msg_NT_Event_Log.cpp ++ Log_Msg_UNIX_Syslog.cpp ++ Log_Record.cpp ++ Logging_Strategy.cpp ++ LSOCK.cpp ++ LSOCK_Acceptor.cpp ++ LSOCK_CODgram.cpp ++ LSOCK_Connector.cpp ++ LSOCK_Dgram.cpp ++ LSOCK_Stream.cpp ++ Malloc.cpp ++ Malloc_Allocator.cpp ++ Manual_Event.cpp ++ MEM_Acceptor.cpp ++ MEM_Addr.cpp ++ MEM_Connector.cpp ++ MEM_IO.cpp ++ Mem_Map.cpp ++ MEM_SAP.cpp ++ MEM_Stream.cpp ++ Message_Block.cpp ++ Message_Queue.cpp ++ Message_Queue_NT.cpp ++ Message_Queue_Vx.cpp ++ Method_Request.cpp ++ MMAP_Memory_Pool.cpp ++ Monitor_Admin.cpp ++ Monitor_Admin_Manager.cpp ++ Monitor_Base.cpp ++ Monitor_Control_Action.cpp ++ Monitor_Control_Types.cpp ++ Monitor_Point_Registry.cpp ++ Monitor_Size.cpp ++ Msg_WFMO_Reactor.cpp ++ Multihomed_INET_Addr.cpp ++ Mutex.cpp ++ Name_Proxy.cpp ++ Name_Request_Reply.cpp ++ Name_Space.cpp ++ Naming_Context.cpp ++ Netlink_Addr.cpp ++ Notification_Queue.cpp ++ Notification_Strategy.cpp ++ NT_Service.cpp ++ Obchunk.cpp ++ Object_Manager.cpp ++ Object_Manager_Base.cpp ++ OS_Errno.cpp ++ OS_Log_Msg_Attributes.cpp ++ OS_main.cpp ++ OS_NS_arpa_inet.cpp ++ OS_NS_ctype.cpp ++ OS_NS_dirent.cpp ++ OS_NS_dlfcn.cpp ++ OS_NS_errno.cpp ++ OS_NS_fcntl.cpp ++ OS_NS_math.cpp ++ OS_NS_netdb.cpp ++ OS_NS_poll.cpp ++ OS_NS_pwd.cpp ++ OS_NS_regex.cpp ++ OS_NS_signal.cpp ++ OS_NS_stdio.cpp ++ OS_NS_stdlib.cpp ++ OS_NS_string.cpp ++ OS_NS_strings.cpp ++ OS_NS_stropts.cpp ++ OS_NS_sys_mman.cpp ++ OS_NS_sys_msg.cpp ++ OS_NS_sys_resource.cpp ++ OS_NS_sys_select.cpp ++ OS_NS_sys_sendfile.cpp ++ OS_NS_sys_shm.cpp ++ OS_NS_sys_socket.cpp ++ OS_NS_sys_stat.cpp ++ OS_NS_sys_time.cpp ++ OS_NS_sys_uio.cpp ++ OS_NS_sys_utsname.cpp ++ OS_NS_sys_wait.cpp ++ OS_NS_Thread.cpp ++ OS_NS_time.cpp ++ OS_NS_unistd.cpp ++ OS_NS_wchar.cpp ++ OS_QoS.cpp ++ OS_Thread_Adapter.cpp ++ OS_TLI.cpp ++ Pagefile_Memory_Pool.cpp ++ Parse_Node.cpp ++ PI_Malloc.cpp ++ Ping_Socket.cpp ++ Pipe.cpp ++ POSIX_Asynch_IO.cpp ++ POSIX_CB_Proactor.cpp ++ POSIX_Proactor.cpp ++ Priority_Reactor.cpp ++ Proactor.cpp ++ Proactor_Impl.cpp ++ Process.cpp ++ Process_Manager.cpp ++ Process_Mutex.cpp ++ Process_Semaphore.cpp ++ Profile_Timer.cpp ++ Reactor.cpp ++ Reactor_Impl.cpp ++ Reactor_Notification_Strategy.cpp ++ Reactor_Timer_Interface.cpp ++ Read_Buffer.cpp ++ Recursive_Thread_Mutex.cpp ++ Recyclable.cpp ++ Registry.cpp ++ Registry_Name_Space.cpp ++ Remote_Name_Space.cpp ++ Remote_Tokens.cpp ++ Rtems_init.c ++ RW_Mutex.cpp ++ RW_Process_Mutex.cpp ++ RW_Thread_Mutex.cpp ++ Sample_History.cpp ++ Sbrk_Memory_Pool.cpp ++ Sched_Params.cpp ++ Select_Reactor_Base.cpp ++ Semaphore.cpp ++ Service_Config.cpp ++ Service_Gestalt.cpp ++ Service_Manager.cpp ++ Service_Object.cpp ++ Service_Repository.cpp ++ Service_Types.cpp ++ Shared_Memory.cpp ++ Shared_Memory_MM.cpp ++ Shared_Memory_Pool.cpp ++ Shared_Memory_SV.cpp ++ Shared_Object.cpp ++ Sig_Adapter.cpp ++ Sig_Handler.cpp ++ Signal.cpp ++ SOCK.cpp ++ SOCK_Acceptor.cpp ++ SOCK_CODgram.cpp ++ Sock_Connect.cpp ++ SOCK_Connector.cpp ++ SOCK_Dgram.cpp ++ SOCK_Dgram_Bcast.cpp ++ SOCK_Dgram_Mcast.cpp ++ SOCK_IO.cpp ++ SOCK_Netlink.cpp ++ SOCK_SEQPACK_Acceptor.cpp ++ SOCK_SEQPACK_Association.cpp ++ SOCK_SEQPACK_Connector.cpp ++ SOCK_Stream.cpp ++ SPIPE.cpp ++ SPIPE_Acceptor.cpp ++ SPIPE_Addr.cpp ++ SPIPE_Connector.cpp ++ SPIPE_Stream.cpp ++ SString.cpp ++ Stack_Trace.cpp ++ Stats.cpp ++ String_Base_Const.cpp ++ SUN_Proactor.cpp ++ SV_Message.cpp ++ SV_Message_Queue.cpp ++ SV_Semaphore_Complex.cpp ++ SV_Semaphore_Simple.cpp ++ SV_Shared_Memory.cpp ++ Svc_Conf_Lexer.cpp ++ Svc_Conf_y.cpp ++ Synch_Options.cpp ++ System_Time.cpp ++ Task.cpp ++ Thread.cpp ++ Thread_Adapter.cpp ++ Thread_Control.cpp ++ Thread_Exit.cpp ++ Thread_Hook.cpp ++ Thread_Manager.cpp ++ Thread_Mutex.cpp ++ Thread_Semaphore.cpp ++ Throughput_Stats.cpp ++ Time_Policy.cpp ++ Time_Value.cpp ++ Timeprobe.cpp ++ TLI.cpp ++ TLI_Acceptor.cpp ++ TLI_Connector.cpp ++ TLI_Stream.cpp ++ Token.cpp ++ Token_Collection.cpp ++ Token_Invariants.cpp ++ Token_Manager.cpp ++ Token_Request_Reply.cpp ++ TP_Reactor.cpp ++ Trace.cpp ++ TSS_Adapter.cpp ++ TTY_IO.cpp ++ UNIX_Addr.cpp ++ UPIPE_Acceptor.cpp ++ UPIPE_Connector.cpp ++ UPIPE_Stream.cpp ++ UTF16_Encoding_Converter.cpp ++ UTF32_Encoding_Converter.cpp ++ UTF8_Encoding_Converter.cpp ++ UUID.cpp ++ WFMO_Reactor.cpp ++ WIN32_Asynch_IO.cpp ++ WIN32_Proactor.cpp ++ XML_Svc_Conf.cpp ++ XTI_ATM_Mcast.cpp ++) ++ ++if (USE_COREPCH) ++ set(ace_PCH_HDR PrecompiledHeaders/WinAcePCH.h) ++ set(ace_PCH_SRC PrecompiledHeaders/WinAcePCH.cpp) ++endif() ++ ++include_directories( ++ ${CMAKE_SOURCE_DIR}/dep/acelite ++ ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders ++ ${CMAKE_SOURCE_DIR}/dep/zlib ++) ++ ++# Needed for PCH support ++set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX) ++ ++add_definitions(-DACE_BUILD_DLL) ++ ++add_library(ace SHARED ++ ${ace_STAT_SRCS} ++ ${ace_PCH_SRC} ++) ++ ++# Generate precompiled header ++if( USE_COREPCH ) ++ add_cxx_pch(ace ${ace_PCH_HDR} ${ace_PCH_SRC}) ++endif() ++ ++install(TARGETS ace RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") +diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp +new file mode 100644 +index 0000000..139597f +--- /dev/null ++++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp +@@ -0,0 +1,2 @@ ++ ++ +diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h +new file mode 100644 +index 0000000..6ff97bf +--- /dev/null ++++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h +@@ -0,0 +1,17 @@ ++ ++#ifndef WIN_ACE_PCH ++#define WIN_ACE_PCH ++ ++#include "ace/ACE.h" ++ ++#include "ace/Synch_Traits.h" ++#include "ace/Svc_Handler.h" ++#include "ace/SOCK_Stream.h" ++#include "ace/SOCK_Acceptor.h" ++#include "ace/Acceptor.h" ++#include "ace/Thread_Mutex.h" ++#include "ace/Guard_T.h" ++#include "ace/Unbounded_Queue.h" ++#include "ace/Message_Block.h" ++ ++#endif +diff --git a/dep/acelite/ace/config-macros.h b/dep/acelite/ace/config-macros.h +index f18c8e0..32e5894 100644 +--- a/dep/acelite/ace/config-macros.h ++++ b/dep/acelite/ace/config-macros.h +@@ -21,7 +21,11 @@ + #ifndef ACE_CONFIG_MACROS_H + #define ACE_CONFIG_MACROS_H + +-#include "ace/config.h" ++#ifdef _WIN32 ++ #include "ace/config-win32.h" ++#else ++ #include "ace/config.h" ++#endif + + #include "ace/Version.h" + #include "ace/Versioned_Namespace.h" +diff --git a/dep/acelite/ace/config-win32-common.h b/dep/acelite/ace/config-win32-common.h +index 50645a1..098ddbd 100644 +--- a/dep/acelite/ace/config-win32-common.h ++++ b/dep/acelite/ace/config-win32-common.h +@@ -527,9 +527,9 @@ + # else + # pragma comment(lib, "ws2_32.lib") + # pragma comment(lib, "mswsock.lib") +-# if defined (ACE_HAS_IPV6) ++// # if defined (ACE_HAS_IPV6) + # pragma comment(lib, "iphlpapi.lib") +-# endif ++// # endif + # endif /* ACE_HAS_WINCE */ + # endif /* _MSC_VER */ + diff --git a/dep/acelite/ace-v6.1.4_hotfix2.diff b/dep/acelite/ace-v6.1.4_hotfix2.diff new file mode 100644 index 00000000000..4eeca2d1912 --- /dev/null +++ b/dep/acelite/ace-v6.1.4_hotfix2.diff @@ -0,0 +1,15 @@ +diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt +index eb0f6dd..1f9ffa6 100644 +--- a/dep/acelite/ace/CMakeLists.txt ++++ b/dep/acelite/ace/CMakeLists.txt +@@ -341,6 +341,10 @@ add_library(ace SHARED + ${ace_PCH_SRC} + ) + ++if (MINGW) # GCC ignores "#prama comment" ++ target_link_libraries(ace ws2_32 iphlpapi netapi32 mswsock) ++endif() ++ + # Generate precompiled header + if( USE_COREPCH ) + add_cxx_pch(ace ${ace_PCH_HDR} ${ace_PCH_SRC}) diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt index eb0f6dda5a7..1f9ffa622a0 100644 --- a/dep/acelite/ace/CMakeLists.txt +++ b/dep/acelite/ace/CMakeLists.txt @@ -341,6 +341,10 @@ add_library(ace SHARED ${ace_PCH_SRC} ) +if (MINGW) # GCC ignores "#prama comment" + target_link_libraries(ace ws2_32 iphlpapi netapi32 mswsock) +endif() + # Generate precompiled header if( USE_COREPCH ) add_cxx_pch(ace ${ace_PCH_HDR} ${ace_PCH_SRC}) diff --git a/dep/g3dlite/G3D-v8.0_hotfix6.diff b/dep/g3dlite/G3D-v8.0_hotfix6.diff new file mode 100644 index 00000000000..f22c26d4a7e --- /dev/null +++ b/dep/g3dlite/G3D-v8.0_hotfix6.diff @@ -0,0 +1,103 @@ +diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h +index 614c0ed..65616f0 100644 +--- a/dep/g3dlite/include/G3D/platform.h ++++ b/dep/g3dlite/include/G3D/platform.h +@@ -51,6 +51,11 @@ + + #ifdef _MSC_VER + #define G3D_WIN32 ++#elif defined(__MINGW32__) ++ #define G3D_WIN32 ++ #undef __MSVCRT_VERSION__ ++ #define __MSVCRT_VERSION__ 0x0601 ++ #include + #elif defined(__FreeBSD__) || defined(__OpenBSD__) + #define G3D_FREEBSD + #define G3D_LINUX +diff --git a/dep/g3dlite/source/FileSystem.cpp b/dep/g3dlite/source/FileSystem.cpp +index 76a3611..f082937 100644 +--- a/dep/g3dlite/source/FileSystem.cpp ++++ b/dep/g3dlite/source/FileSystem.cpp +@@ -25,8 +25,11 @@ + + // Needed for _findfirst + # include +- +-#define stat64 _stat64 ++# ifdef __MINGW32__ ++# define stat64 stat ++# else ++# define stat64 _stat64 ++# endif + #else + # include + # include +diff --git a/dep/g3dlite/source/RegistryUtil.cpp b/dep/g3dlite/source/RegistryUtil.cpp +index fc4cebc..7c9e56f 100644 +--- a/dep/g3dlite/source/RegistryUtil.cpp ++++ b/dep/g3dlite/source/RegistryUtil.cpp +@@ -16,6 +16,15 @@ + #include "G3D/RegistryUtil.h" + #include "G3D/System.h" + ++#ifdef __MINGW32__ ++# ifndef HKEY_PERFORMANCE_TEXT ++# define HKEY_PERFORMANCE_TEXT ((HKEY)((LONG)0x80000050)) ++# endif ++# ifndef HKEY_PERFORMANCE_NLSTEXT ++# define HKEY_PERFORMANCE_NLSTEXT ((HKEY)((LONG)0x80000060)) ++# endif ++#endif ++ + namespace G3D { + + // static helpers +diff --git a/dep/g3dlite/source/System.cpp b/dep/g3dlite/source/System.cpp +index f6b0e03..281104d 100644 +--- a/dep/g3dlite/source/System.cpp ++++ b/dep/g3dlite/source/System.cpp +@@ -564,7 +564,7 @@ void System::getStandardProcessorExtensions() { + #endif + } + +-#if defined(G3D_WIN32) && !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit Windows platforms */ ++#if defined(G3D_WIN32) && !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit Windows platforms or using MinGW */ + #pragma message("Port System::memcpy SIMD to all platforms") + /** Michael Herf's fast memcpy */ + void memcpyMMX(void* dst, const void* src, int nbytes) { +@@ -615,7 +615,7 @@ void memcpyMMX(void* dst, const void* src, int nbytes) { + #endif + + void System::memcpy(void* dst, const void* src, size_t numBytes) { +-#if defined(G3D_WIN32) && !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit Windows platforms */ ++#if defined(G3D_WIN32) && !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit Windows platforms or using MinGW */ + memcpyMMX(dst, src, numBytes); + #else + ::memcpy(dst, src, numBytes); +@@ -625,7 +625,7 @@ void System::memcpy(void* dst, const void* src, size_t numBytes) { + + /** Michael Herf's fastest memset. n32 must be filled with the same + character repeated. */ +-#if defined(G3D_WIN32) && !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit Windows platforms */ ++#if defined(G3D_WIN32) && !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit Windows platforms or using MinGW */ + #pragma message("Port System::memfill SIMD to all platforms") + + // On x86 processors, use MMX +@@ -664,7 +664,7 @@ void memfill(void *dst, int n32, unsigned long i) { + + + void System::memset(void* dst, uint8 value, size_t numBytes) { +-#if defined(G3D_WIN32) && !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit Windows platforms */ ++#if defined(G3D_WIN32) && !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit Windows platforms or using MinGW */ + uint32 v = value; + v = v + (v << 8) + (v << 16) + (v << 24); + G3D::memfill(dst, v, numBytes); +@@ -1696,7 +1696,7 @@ std::string System::currentDateString() { + + // VC on Intel + void System::cpuid(CPUIDFunction func, uint32& areg, uint32& breg, uint32& creg, uint32& dreg) { +-#if !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit platform */ ++#if !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit platforms or using MinGW */ + // Can't copy from assembler direct to a function argument (which is on the stack) in VC. + uint32 a,b,c,d; + diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h index 614c0ed7cad..65616f0b53e 100644 --- a/dep/g3dlite/include/G3D/platform.h +++ b/dep/g3dlite/include/G3D/platform.h @@ -51,6 +51,11 @@ #ifdef _MSC_VER #define G3D_WIN32 +#elif defined(__MINGW32__) + #define G3D_WIN32 + #undef __MSVCRT_VERSION__ + #define __MSVCRT_VERSION__ 0x0601 + #include #elif defined(__FreeBSD__) || defined(__OpenBSD__) #define G3D_FREEBSD #define G3D_LINUX diff --git a/dep/g3dlite/source/FileSystem.cpp b/dep/g3dlite/source/FileSystem.cpp index 76a361162c9..f082937a908 100644 --- a/dep/g3dlite/source/FileSystem.cpp +++ b/dep/g3dlite/source/FileSystem.cpp @@ -25,8 +25,11 @@ // Needed for _findfirst # include - -#define stat64 _stat64 +# ifdef __MINGW32__ +# define stat64 stat +# else +# define stat64 _stat64 +# endif #else # include # include diff --git a/dep/g3dlite/source/RegistryUtil.cpp b/dep/g3dlite/source/RegistryUtil.cpp index fc4cebc2ee5..7c9e56f79ae 100644 --- a/dep/g3dlite/source/RegistryUtil.cpp +++ b/dep/g3dlite/source/RegistryUtil.cpp @@ -16,6 +16,15 @@ #include "G3D/RegistryUtil.h" #include "G3D/System.h" +#ifdef __MINGW32__ +# ifndef HKEY_PERFORMANCE_TEXT +# define HKEY_PERFORMANCE_TEXT ((HKEY)((LONG)0x80000050)) +# endif +# ifndef HKEY_PERFORMANCE_NLSTEXT +# define HKEY_PERFORMANCE_NLSTEXT ((HKEY)((LONG)0x80000060)) +# endif +#endif + namespace G3D { // static helpers diff --git a/dep/g3dlite/source/System.cpp b/dep/g3dlite/source/System.cpp index f6b0e038f27..281104d39f1 100644 --- a/dep/g3dlite/source/System.cpp +++ b/dep/g3dlite/source/System.cpp @@ -564,7 +564,7 @@ void System::getStandardProcessorExtensions() { #endif } -#if defined(G3D_WIN32) && !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit Windows platforms */ +#if defined(G3D_WIN32) && !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit Windows platforms or using MinGW */ #pragma message("Port System::memcpy SIMD to all platforms") /** Michael Herf's fast memcpy */ void memcpyMMX(void* dst, const void* src, int nbytes) { @@ -615,7 +615,7 @@ void memcpyMMX(void* dst, const void* src, int nbytes) { #endif void System::memcpy(void* dst, const void* src, size_t numBytes) { -#if defined(G3D_WIN32) && !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit Windows platforms */ +#if defined(G3D_WIN32) && !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit Windows platforms or using MinGW */ memcpyMMX(dst, src, numBytes); #else ::memcpy(dst, src, numBytes); @@ -625,7 +625,7 @@ void System::memcpy(void* dst, const void* src, size_t numBytes) { /** Michael Herf's fastest memset. n32 must be filled with the same character repeated. */ -#if defined(G3D_WIN32) && !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit Windows platforms */ +#if defined(G3D_WIN32) && !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit Windows platforms or using MinGW */ #pragma message("Port System::memfill SIMD to all platforms") // On x86 processors, use MMX @@ -664,7 +664,7 @@ void memfill(void *dst, int n32, unsigned long i) { void System::memset(void* dst, uint8 value, size_t numBytes) { -#if defined(G3D_WIN32) && !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit Windows platforms */ +#if defined(G3D_WIN32) && !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit Windows platforms or using MinGW */ uint32 v = value; v = v + (v << 8) + (v << 16) + (v << 24); G3D::memfill(dst, v, numBytes); @@ -1696,7 +1696,7 @@ std::string System::currentDateString() { // VC on Intel void System::cpuid(CPUIDFunction func, uint32& areg, uint32& breg, uint32& creg, uint32& dreg) { -#if !defined(G3D_64BIT) /* G3DFIX: Don't check if on 64-bit platform */ +#if !defined(G3D_64BIT) && !defined(__MINGW32__) /* G3DFIX: Don't check if on 64-bit platforms or using MinGW */ // Can't copy from assembler direct to a function argument (which is on the stack) in VC. uint32 a,b,c,d; diff --git a/dep/recastnavigation/Detour/DetourNavMesh.h b/dep/recastnavigation/Detour/DetourNavMesh.h index 52d2c505ec9..99e30c75142 100644 --- a/dep/recastnavigation/Detour/DetourNavMesh.h +++ b/dep/recastnavigation/Detour/DetourNavMesh.h @@ -21,7 +21,7 @@ #include "DetourAlloc.h" -#ifdef WIN32 +#if defined(WIN32) && not defined(__MINGW32__) typedef unsigned __int64 uint64; #else #include diff --git a/dep/recastnavigation/recast_hotfix1.diff b/dep/recastnavigation/recast_hotfix1.diff new file mode 100644 index 00000000000..6e8fc3397e3 --- /dev/null +++ b/dep/recastnavigation/recast_hotfix1.diff @@ -0,0 +1,13 @@ +diff --git a/dep/recastnavigation/Detour/DetourNavMesh.h b/dep/recastnavigation/Detour/DetourNavMesh.h +index 52d2c50..99e30c7 100644 +--- a/dep/recastnavigation/Detour/DetourNavMesh.h ++++ b/dep/recastnavigation/Detour/DetourNavMesh.h +@@ -21,7 +21,7 @@ + + #include "DetourAlloc.h" + +-#ifdef WIN32 ++#if defined(WIN32) && not defined(__MINGW32__) + typedef unsigned __int64 uint64; + #else + #include diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index e8816ea8816..02fca56340f 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -12,7 +12,7 @@ # This to stop a few silly crashes that could have been avoided IF people # weren't doing some -O3 psychooptimizations etc. -if(CMAKE_COMPILER_IS_GNUCXX) +if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW) add_definitions(-fno-delete-null-pointer-checks) endif() diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt index 328369cb908..f7c4b9cb8ca 100644 --- a/src/server/authserver/CMakeLists.txt +++ b/src/server/authserver/CMakeLists.txt @@ -29,11 +29,18 @@ set(authserver_SRCS ) if( WIN32 ) -set(authserver_SRCS - ${authserver_SRCS} - ${sources_Debugging} + if ( MSVC ) + set(authserver_SRCS + ${authserver_SRCS} + ${sources_Debugging} authserver.rc -) + ) + else ( ) + set(authserver_SRCS + ${authserver_SRCS} + ${sources_Debugging} + ) + endif () endif() include_directories( @@ -76,10 +83,17 @@ target_link_libraries(authserver ) if( WIN32 ) - add_custom_command(TARGET authserver - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/authserver.conf.dist ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/ - ) + if ( MSVC ) + add_custom_command(TARGET authserver + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/authserver.conf.dist ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/ + ) + elseif ( MINGW ) + add_custom_command(TARGET authserver + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/authserver.conf.dist ${CMAKE_BINARY_DIR}/bin/ + ) + endif() endif() if( UNIX ) diff --git a/src/server/collision/BoundingIntervalHierarchy.cpp b/src/server/collision/BoundingIntervalHierarchy.cpp index 4c1f449da25..340d66ddaf0 100644 --- a/src/server/collision/BoundingIntervalHierarchy.cpp +++ b/src/server/collision/BoundingIntervalHierarchy.cpp @@ -18,12 +18,10 @@ #include "BoundingIntervalHierarchy.h" -#if defined __APPLE__ - #define isnan std::isnan -#elif defined __CYGWIN__ - #define isnan std::isnan -#elif defined _MSC_VER +#ifdef _MSC_VER #define isnan _isnan +#else + #define isnan std::isnan #endif void BIH::buildHierarchy(std::vector &tempTree, buildData &dat, BuildStats &stats) diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp index ea9ab096dcd..19db228913b 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.cpp +++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp @@ -3,7 +3,7 @@ // MSDN Magazine, 2002 // FILE: WheatyExceptionReport.CPP //========================================== -#if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS && not defined(__MINGW32__) #define WIN32_LEAN_AND_MEAN #pragma warning(disable:4996) #pragma warning(disable:4312) diff --git a/src/server/shared/Debugging/WheatyExceptionReport.h b/src/server/shared/Debugging/WheatyExceptionReport.h index 8ade80ca47b..684b10e9b9a 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.h +++ b/src/server/shared/Debugging/WheatyExceptionReport.h @@ -1,7 +1,7 @@ #ifndef _WHEATYEXCEPTIONREPORT_ #define _WHEATYEXCEPTIONREPORT_ -#if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS && not defined(__MINGW32__) #include diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index 8c1350a7ca0..b7097be8e2a 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -29,11 +29,18 @@ set(worldserver_SRCS ) if( WIN32 ) - set(worldserver_SRCS - ${worldserver_SRCS} - ${sources_Debugging} - worldserver.rc - ) + if ( MSVC ) + set(worldserver_SRCS + ${worldserver_SRCS} + ${sources_Debugging} + worldserver.rc + ) + else ( ) + set(worldserver_SRCS + ${worldserver_SRCS} + ${sources_Debugging} + ) + endif () endif() include_directories( @@ -175,10 +182,17 @@ target_link_libraries(worldserver ) if( WIN32 ) - add_custom_command(TARGET worldserver - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/worldserver.conf.dist ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/ - ) + if ( MSVC ) + add_custom_command(TARGET worldserver + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/worldserver.conf.dist ${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/ + ) + elseif ( MINGW ) + add_custom_command(TARGET worldserver + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/worldserver.conf.dist ${CMAKE_BINARY_DIR}/bin/ + ) + endif() endif() if( UNIX ) -- cgit v1.2.3 From 8aaaaedbdd409188158e1517c9a9056022e850e9 Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Sat, 9 Mar 2013 01:47:46 +0100 Subject: Core: Fix warnings for msvc --- dep/recastnavigation/Detour/DetourNavMesh.h | 2 +- dep/recastnavigation/recast_hotfix1.diff | 2 +- src/server/shared/Debugging/WheatyExceptionReport.cpp | 2 +- src/server/shared/Debugging/WheatyExceptionReport.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/server/shared') diff --git a/dep/recastnavigation/Detour/DetourNavMesh.h b/dep/recastnavigation/Detour/DetourNavMesh.h index 99e30c75142..b146631127a 100644 --- a/dep/recastnavigation/Detour/DetourNavMesh.h +++ b/dep/recastnavigation/Detour/DetourNavMesh.h @@ -21,7 +21,7 @@ #include "DetourAlloc.h" -#if defined(WIN32) && not defined(__MINGW32__) +#if defined(WIN32) && !defined(__MINGW32__) typedef unsigned __int64 uint64; #else #include diff --git a/dep/recastnavigation/recast_hotfix1.diff b/dep/recastnavigation/recast_hotfix1.diff index 6e8fc3397e3..d370b0a68c8 100644 --- a/dep/recastnavigation/recast_hotfix1.diff +++ b/dep/recastnavigation/recast_hotfix1.diff @@ -7,7 +7,7 @@ index 52d2c50..99e30c7 100644 #include "DetourAlloc.h" -#ifdef WIN32 -+#if defined(WIN32) && not defined(__MINGW32__) ++#if defined(WIN32) && !defined(__MINGW32__) typedef unsigned __int64 uint64; #else #include diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp index 19db228913b..d07e579ab5d 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.cpp +++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp @@ -3,7 +3,7 @@ // MSDN Magazine, 2002 // FILE: WheatyExceptionReport.CPP //========================================== -#if PLATFORM == PLATFORM_WINDOWS && not defined(__MINGW32__) +#if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__) #define WIN32_LEAN_AND_MEAN #pragma warning(disable:4996) #pragma warning(disable:4312) diff --git a/src/server/shared/Debugging/WheatyExceptionReport.h b/src/server/shared/Debugging/WheatyExceptionReport.h index 684b10e9b9a..582f1f157b8 100644 --- a/src/server/shared/Debugging/WheatyExceptionReport.h +++ b/src/server/shared/Debugging/WheatyExceptionReport.h @@ -1,7 +1,7 @@ #ifndef _WHEATYEXCEPTIONREPORT_ #define _WHEATYEXCEPTIONREPORT_ -#if PLATFORM == PLATFORM_WINDOWS && not defined(__MINGW32__) +#if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__) #include -- cgit v1.2.3 From 4e789d4c5c83dd6f0f582fe24e9d49b39950fffe Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Sat, 9 Mar 2013 23:05:27 +0100 Subject: Core/Commands: Optimize for command .npc near --- src/server/scripts/Commands/cs_npc.cpp | 42 ++++++++-------------- .../Database/Implementation/WorldDatabase.cpp | 1 - .../shared/Database/Implementation/WorldDatabase.h | 1 - 3 files changed, 14 insertions(+), 30 deletions(-) (limited to 'src/server/shared') diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 79a74b0823d..f640d257a3a 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -665,43 +665,29 @@ public: static bool HandleNpcNearCommand(ChatHandler* handler, char const* args) { + WorldObject* object = handler->GetSession()->GetPlayer(); float distance = (!*args) ? 10.0f : float((atof(args))); uint32 count = 0; - Player* player = handler->GetSession()->GetPlayer(); + CellCoord pair(Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY())); + Cell cell(pair); + cell.SetNoCreate(); + + std::list creatureList; + Trinity::AnyUnitInObjectRangeCheck check(object, distance); + Trinity::CreatureListSearcher search(object, creatureList, check); + TypeContainerVisitor, GridTypeMapContainer> visit(search); - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_NEAREST); - stmt->setFloat(0, player->GetPositionX()); - stmt->setFloat(1, player->GetPositionY()); - stmt->setFloat(2, player->GetPositionZ()); - stmt->setUInt32(3, player->GetMapId()); - stmt->setFloat(4, player->GetPositionX()); - stmt->setFloat(5, player->GetPositionY()); - stmt->setFloat(6, player->GetPositionZ()); - stmt->setFloat(7, distance * distance); - PreparedQueryResult result = WorldDatabase.Query(stmt); + cell.Visit(pair, visit, *(object->GetMap()), *object, distance); - if (result) + if (!creatureList.empty()) { - do + for (std::list::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) { - Field* fields = result->Fetch(); - uint32 guid = fields[0].GetUInt32(); - uint32 entry = fields[1].GetUInt32(); - float x = fields[2].GetFloat(); - float y = fields[3].GetFloat(); - float z = fields[4].GetFloat(); - uint16 mapId = fields[5].GetUInt16(); - - CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(entry); - if (!creatureTemplate) - continue; - - handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, creatureTemplate->Name.c_str(), x, y, z, mapId); - + handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, (*itr)->GetGUIDLow(), (*itr)->GetGUIDLow(), (*itr)->GetName().c_str(), + (*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ(), (*itr)->GetMapId()); ++count; } - while (result->NextRow()); } handler->PSendSysMessage(LANG_COMMAND_NEAR_NPC_MESSAGE, distance, count); diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index 89f3cf8fdce..94060330d82 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -84,7 +84,6 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); - PrepareStatement(WORLD_SEL_CREATURE_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, phaseMask, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index 032baf29dd9..f6fd92b11cd 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -104,7 +104,6 @@ enum WorldDatabaseStatements WORLD_SEL_ITEM_TEMPLATE_BY_NAME, WORLD_SEL_CREATURE_BY_ID, WORLD_SEL_GAMEOBJECT_NEAREST, - WORLD_SEL_CREATURE_NEAREST, WORLD_SEL_GAMEOBJECT_TARGET, WORLD_INS_CREATURE, WORLD_DEL_GAME_EVENT_CREATURE, -- cgit v1.2.3 From 4ee0a4a4460ff0a44f39a5359c6e234c9d31fc6b Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Sat, 9 Mar 2013 23:28:32 +0100 Subject: Revert "Core/Commands: Optimize for command .npc near" This reverts commit 4e789d4c5c83dd6f0f582fe24e9d49b39950fffe. --- src/server/scripts/Commands/cs_npc.cpp | 42 ++++++++++++++-------- .../Database/Implementation/WorldDatabase.cpp | 1 + .../shared/Database/Implementation/WorldDatabase.h | 1 + 3 files changed, 30 insertions(+), 14 deletions(-) (limited to 'src/server/shared') diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index f640d257a3a..79a74b0823d 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -665,29 +665,43 @@ public: static bool HandleNpcNearCommand(ChatHandler* handler, char const* args) { - WorldObject* object = handler->GetSession()->GetPlayer(); float distance = (!*args) ? 10.0f : float((atof(args))); uint32 count = 0; - CellCoord pair(Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY())); - Cell cell(pair); - cell.SetNoCreate(); - - std::list creatureList; - Trinity::AnyUnitInObjectRangeCheck check(object, distance); - Trinity::CreatureListSearcher search(object, creatureList, check); - TypeContainerVisitor, GridTypeMapContainer> visit(search); + Player* player = handler->GetSession()->GetPlayer(); - cell.Visit(pair, visit, *(object->GetMap()), *object, distance); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_NEAREST); + stmt->setFloat(0, player->GetPositionX()); + stmt->setFloat(1, player->GetPositionY()); + stmt->setFloat(2, player->GetPositionZ()); + stmt->setUInt32(3, player->GetMapId()); + stmt->setFloat(4, player->GetPositionX()); + stmt->setFloat(5, player->GetPositionY()); + stmt->setFloat(6, player->GetPositionZ()); + stmt->setFloat(7, distance * distance); + PreparedQueryResult result = WorldDatabase.Query(stmt); - if (!creatureList.empty()) + if (result) { - for (std::list::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) + do { - handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, (*itr)->GetGUIDLow(), (*itr)->GetGUIDLow(), (*itr)->GetName().c_str(), - (*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ(), (*itr)->GetMapId()); + Field* fields = result->Fetch(); + uint32 guid = fields[0].GetUInt32(); + uint32 entry = fields[1].GetUInt32(); + float x = fields[2].GetFloat(); + float y = fields[3].GetFloat(); + float z = fields[4].GetFloat(); + uint16 mapId = fields[5].GetUInt16(); + + CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(entry); + if (!creatureTemplate) + continue; + + handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, creatureTemplate->Name.c_str(), x, y, z, mapId); + ++count; } + while (result->NextRow()); } handler->PSendSysMessage(LANG_COMMAND_NEAR_NPC_MESSAGE, distance, count); diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index 94060330d82..89f3cf8fdce 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -84,6 +84,7 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); + PrepareStatement(WORLD_SEL_CREATURE_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, phaseMask, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index f6fd92b11cd..032baf29dd9 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -104,6 +104,7 @@ enum WorldDatabaseStatements WORLD_SEL_ITEM_TEMPLATE_BY_NAME, WORLD_SEL_CREATURE_BY_ID, WORLD_SEL_GAMEOBJECT_NEAREST, + WORLD_SEL_CREATURE_NEAREST, WORLD_SEL_GAMEOBJECT_TARGET, WORLD_INS_CREATURE, WORLD_DEL_GAME_EVENT_CREATURE, -- cgit v1.2.3