/*
* Ascent MMORPG Server
* Copyright (C) 2005-2007 Ascent Team
*
* 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 3 of the License, or
* 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 .
*
*/
#ifndef WOWSERVER_COMMON_H
#define WOWSERVER_COMMON_H
#ifdef WIN32
#pragma warning(disable:4996)
#endif
enum TimeVariables
{
TIME_SECOND = 1,
TIME_MINUTE = TIME_SECOND * 60,
TIME_HOUR = TIME_MINUTE * 60,
TIME_DAY = TIME_HOUR * 24,
};
enum MsTimeVariables
{
MSTIME_SECOND = 1000,
MSTIME_MINUTE = MSTIME_SECOND * 60,
MSTIME_HOUR = MSTIME_MINUTE * 60,
MSTIME_DAY = MSTIME_HOUR * 24,
};
#ifdef HAVE_CONFIG_H
# include
#endif
/* Define this if you're using a big-endian machine */
#ifndef WIN32
#ifdef HAVE_DARWIN
#if BYTE_ORDER == BIG_ENDIAN
#define USING_BIG_ENDIAN 1
#include
#define bswap_16(x) NXSwapShort(x)
#define bswap_32(x) NXSwapInt(x)
#define bswap_64(x) NXSwapLongLong(x)
#endif
#endif
#endif
#include
#include
#include
#include
#include
#include
// current platform and compiler
#define PLATFORM_WIN32 0
#define PLATFORM_UNIX 1
#define PLATFORM_APPLE 2
#define UNIX_FLAVOUR_LINUX 1
#define UNIX_FLAVOUR_BSD 2
#define UNIX_FLAVOUR_OTHER 3
#define UNIX_FLAVOUR_OSX 4
#if defined( __WIN32__ ) || defined( WIN32 ) || defined( _WIN32 )
# define PLATFORM PLATFORM_WIN32
#elif defined( __APPLE_CC__ )
# define PLATFORM PLATFORM_APPLE
#else
# define PLATFORM PLATFORM_UNIX
#endif
#define COMPILER_MICROSOFT 0
#define COMPILER_GNU 1
#define COMPILER_BORLAND 2
#ifdef _MSC_VER
# define COMPILER COMPILER_MICROSOFT
#elif defined( __BORLANDC__ )
# define COMPILER COMPILER_BORLAND
#elif defined( __GNUC__ )
# define COMPILER COMPILER_GNU
#else
# pragma error "FATAL ERROR: Unknown compiler."
#endif
#if PLATFORM == PLATFORM_UNIX || PLATFORM == PLATFORM_APPLE
#ifdef HAVE_DARWIN
#define PLATFORM_TEXT "MacOSX"
#define UNIX_FLAVOUR UNIX_FLAVOUR_OSX
#else
#ifdef USE_KQUEUE
#define PLATFORM_TEXT "FreeBSD"
#define UNIX_FLAVOUR UNIX_FLAVOUR_BSD
#else
#define PLATFORM_TEXT "Linux"
#define UNIX_FLAVOUR UNIX_FLAVOUR_LINUX
#endif
#endif
#endif
#if PLATFORM == PLATFORM_WIN32
#define PLATFORM_TEXT "Win32"
#endif
#ifdef _DEBUG
#define CONFIG "Debug"
#else
#define CONFIG "Release"
#endif
#ifdef USING_BIG_ENDIAN
#define ARCH "PPC"
#else
#define ARCH "X86"
#endif
#if COMPILER == COMPILER_MICROSOFT
# pragma warning( disable : 4267 ) // conversion from 'size_t' to 'int', possible loss of data
# pragma warning( disable : 4311 ) // 'type cast': pointer truncation from HMODULE to uint32
# pragma warning( disable : 4786 ) // identifier was truncated to '255' characters in the debug information
# pragma warning( disable : 4146 )
# pragma warning( disable : 4800 )
#endif
#if PLATFORM == PLATFORM_WIN32
#define STRCASECMP stricmp
#define _WIN32_WINNT 0x0500
#else
#define STRCASECMP strcasecmp
#endif
#if PLATFORM == PLATFORM_WIN32
#define ASYNC_NET
#endif
#ifdef USE_EPOLL
#define CONFIG_USE_EPOLL
#endif
#ifdef USE_KQUEUE
#define CONFIG_USE_KQUEUE
#endif
#ifdef USE_SELECT
#define CONFIG_USE_SELECT
#endif
#ifdef USE_POLL
#define CONFIG_USE_POLL
#endif
#include
#include
#include
#include