root/trunk/src/shared/Common.h @ 6

Revision 6, 4.5 kB (checked in by yumileroy, 17 years ago)

[svn] * Added ACE for Linux and Windows (Thanks Derex for Linux part and partial Windows part)
* Updated to 6721 and 676
* Fixed TrinityScript? logo
* Version updated to 0.2.6721.676

Original author: Neo2003
Date: 2008-10-04 06:17:19-05:00

Line 
1/*
2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
3 *
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.
8 *
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.
13 *
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
17 */
18
19#ifndef MANGOSSERVER_COMMON_H
20#define MANGOSSERVER_COMMON_H
21
22// config.h needs to be included 1st
23// TODO this thingy looks like hack ,but its not, need to
24// make separate header however, because It makes mess here.
25#ifdef HAVE_CONFIG_H
26// Remove Some things that we will define
27// This is in case including another config.h
28// before trinity config.h
29#ifdef PACKAGE
30#undef PACKAGE
31#endif //PACKAGE
32#ifdef PACKAGE_BUGREPORT
33#undef PACKAGE_BUGREPORT
34#endif //PACKAGE_BUGREPORT
35#ifdef PACKAGE_NAME
36#undef PACKAGE_NAME
37#endif //PACKAGE_NAME
38#ifdef PACKAGE_STRING
39#undef PACKAGE_STRING
40#endif //PACKAGE_STRING
41#ifdef PACKAGE_TARNAME
42#undef PACKAGE_TARNAME
43#endif //PACKAGE_TARNAME
44#ifdef PACKAGE_VERSION
45#undef PACKAGE_VERSION
46#endif //PACKAGE_VERSION
47#ifdef VERSION
48#undef VERSION
49#endif //VERSION
50# include "config.h"
51#undef PACKAGE
52#undef PACKAGE_BUGREPORT
53#undef PACKAGE_NAME
54#undef PACKAGE_STRING
55#undef PACKAGE_TARNAME
56#undef PACKAGE_VERSION
57#undef VERSION
58#endif //HAVE_CONFIG_H
59
60#include "Platform/Define.h"
61
62#if COMPILER == COMPILER_MICROSOFT
63
64#pragma warning(disable:4996)
65
66#ifndef __SHOW_STUPID_WARNINGS__
67
68#pragma warning(disable:4244)
69
70#pragma warning(disable:4267)
71
72#pragma warning(disable:4800)
73
74#pragma warning(disable:4018)
75
76#pragma warning(disable:4311)
77
78#pragma warning(disable:4305)
79
80#pragma warning(disable:4005)
81#endif                                                      // __SHOW_STUPID_WARNINGS__
82#endif                                                      // __GNUC__
83
84#include "Utilities/HashMap.h"
85#include <stdio.h>
86#include <stdlib.h>
87#include <string.h>
88#include <time.h>
89#include <math.h>
90#include <errno.h>
91#include <signal.h>
92
93#if PLATFORM == PLATFORM_WINDOWS
94#define STRCASECMP stricmp
95#else
96#define STRCASECMP strcasecmp
97#endif
98
99#include <set>
100#include <list>
101#include <string>
102#include <map>
103#include <queue>
104#include <sstream>
105#include <algorithm>
106
107#include <zthread/FastMutex.h>
108#include <zthread/LockedQueue.h>
109#include <zthread/Runnable.h>
110#include <zthread/Thread.h>
111
112#if PLATFORM == PLATFORM_WINDOWS
113#  define FD_SETSIZE 4096
114#  include <ace/config-all.h>
115// XP winver - needed to compile with standard leak check in MemoryLeaks.h
116// uncomment later if needed
117//#define _WIN32_WINNT 0x0501
118#  include <ws2tcpip.h>
119//#undef WIN32_WINNT
120#else
121#  include <sys/types.h>
122#  include <sys/ioctl.h>
123#  include <sys/socket.h>
124#  include <netinet/in.h>
125#  include <unistd.h>
126#  include <netdb.h>
127#endif
128
129#if COMPILER == COMPILER_MICROSOFT
130
131#include <float.h>
132
133#define I64FMT "%016I64X"
134#define I64FMTD "%I64u"
135#define SI64FMTD "%I64d"
136#define snprintf _snprintf
137#define atoll __atoi64
138#define vsnprintf _vsnprintf
139#define strdup _strdup
140#define finite(X) _finite(X)
141
142#else
143
144#define stricmp strcasecmp
145#define strnicmp strncasecmp
146#define I64FMT "%016llX"
147#define I64FMTD "%llu"
148#define SI64FMTD "%lld"
149#endif
150
151inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; }
152
153#define atol(a) strtoul( a, NULL, 10)
154
155#define STRINGIZE(a) #a
156
157enum TimeConstants
158{
159    MINUTE = 60,
160    HOUR   = MINUTE*60,
161    DAY    = HOUR*24,
162    MONTH  = DAY*30
163};
164
165enum AccountTypes
166{
167    SEC_PLAYER         = 0,
168    SEC_MODERATOR      = 1,
169    SEC_GAMEMASTER     = 2,
170    SEC_ADMINISTRATOR  = 3
171};
172
173enum LocaleConstant
174{
175    LOCALE_enUS = 0,
176    LOCALE_koKR = 1,
177    LOCALE_frFR = 2,
178    LOCALE_deDE = 3,
179    LOCALE_zhCN = 4,
180    LOCALE_zhTW = 5,
181    LOCALE_esES = 6,
182    LOCALE_esMX = 7,
183    LOCALE_ruRU = 8
184};
185
186#define MAX_LOCALE 9
187
188extern char const* localeNames[MAX_LOCALE];
189
190LocaleConstant GetLocaleByName(std::string name);
191
192// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some pother platforms)
193#ifdef max
194#undef max
195#endif
196
197#ifdef min
198#undef min
199#endif
200
201#ifndef M_PI
202#define M_PI            3.14159265358979323846
203#endif
204
205#endif
Note: See TracBrowser for help on using the browser.