2 * Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOSSERVER_COMMON_H
20 #define MANGOSSERVER_COMMON_H
22 #include "Platform/Define.h"
24 #if COMPILER == COMPILER_MICROSOFT
26 #pragma warning(disable:4996)
28 #ifndef __SHOW_STUPID_WARNINGS__
30 #pragma warning(disable:4244)
32 #pragma warning(disable:4267)
34 #pragma warning(disable:4800)
36 #pragma warning(disable:4018)
38 #pragma warning(disable:4311)
40 #pragma warning(disable:4305)
42 #pragma warning(disable:4005)
43 #endif // __SHOW_STUPID_WARNINGS__
46 // we need to stick to 1 version or half of the stuff will work for someone
47 // others will not and opposite
48 // will only support WoW and WoW:TBC 2.1.3 client build 6898...
50 #define EXPECTED_MANGOS_CLIENT_BUILD {6898, 0}
52 // must be the first thing to include for it to work
53 #include "MemoryLeaks.h"
59 #include "Utilities/HashMap.h"
68 #if PLATFORM == PLATFORM_WIN32
69 #define STRCASECMP stricmp
71 #define STRCASECMP strcasecmp
82 #include <zthread/FastMutex.h>
83 #include <zthread/LockedQueue.h>
84 #include <zthread/Runnable.h>
85 #include <zthread/Thread.h>
87 #if PLATFORM == PLATFORM_WIN32
88 # define FD_SETSIZE 1024
89 # include <winsock2.h>
90 // XP winver - needed to compile with standard leak check in MemoryLeaks.h
91 // uncomment later if needed
92 //#define _WIN32_WINNT 0x0501
93 # include <ws2tcpip.h>
96 # include <sys/types.h>
97 # include <sys/ioctl.h>
98 # include <sys/socket.h>
99 # include <netinet/in.h>
104 #if COMPILER == COMPILER_MICROSOFT
108 #define I64FMT "%016I64X"
109 #define I64FMTD "%I64u"
110 #define SI64FMTD "%I64d"
111 #define snprintf _snprintf
112 #define atoll __atoi64
113 #define vsnprintf _vsnprintf
114 #define strdup _strdup
115 #define finite(X) _finite(X)
119 #define stricmp strcasecmp
120 #define strnicmp strncasecmp
121 #define I64FMT "%016llX"
122 #define I64FMTD "%llu"
123 #define SI64FMTD "%lld"
126 #define GUID_HIPART(x) (uint32)((x) >> 32)
127 #define GUID_LOPART(x) (uint32)((x) & 0xFFFFFFFFULL)
128 #define MAKE_GUID(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) )
130 #define atol(a) strtoul( a, NULL, 10)
132 #define STRINGIZE(a) #a
134 #define for if(true) for
144 #if PLATFORM == PLATFORM_WIN32
145 # define MANGOS_DLL_SPEC __declspec(dllexport)
147 # define MANGOS_DLL_SPEC
150 // we always use stdlibc++ std::max/std::min, undefine some not C++ standart defines (Win API and some pother platforms)