Code Search for Developers
 
 
  

Common.h from MaNGOS at Krugle


Show Common.h syntax highlighted

/* 
 * Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/>
 *
 * 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 2 of the License, or
 * (at your option) 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, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef MANGOSSERVER_COMMON_H
#define MANGOSSERVER_COMMON_H

#include "Platform/Define.h"

#if COMPILER == COMPILER_MICROSOFT

#pragma warning(disable:4996)

#ifndef __SHOW_STUPID_WARNINGS__

#pragma warning(disable:4244)

#pragma warning(disable:4267)

#pragma warning(disable:4800)

#pragma warning(disable:4018)

#pragma warning(disable:4311)

#pragma warning(disable:4305)

#pragma warning(disable:4005)
#endif                                                      // __SHOW_STUPID_WARNINGS__
#endif                                                      // __GNUC__

// we need to stick to 1 version or half of the stuff will work for someone
// others will not and opposite
// will only support WoW and WoW:TBC 2.1.3 client build 6898...

#define EXPECTED_MANGOS_CLIENT_BUILD        {6898, 0}

// must be the first thing to include for it to work
#include "MemoryLeaks.h"

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include "Utilities/HashMap.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <errno.h>
#include <signal.h>

#if PLATFORM == PLATFORM_WIN32
#define STRCASECMP stricmp
#else
#define STRCASECMP strcasecmp
#endif

#include <set>
#include <list>
#include <string>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

#include <zthread/FastMutex.h>
#include <zthread/LockedQueue.h>
#include <zthread/Runnable.h>
#include <zthread/Thread.h>

#if PLATFORM == PLATFORM_WIN32
#  define FD_SETSIZE 1024
#  include <winsock2.h>
// XP winver - needed to compile with standard leak check in MemoryLeaks.h
// uncomment later if needed
//#define _WIN32_WINNT 0x0501
#  include <ws2tcpip.h>
//#undef WIN32_WINNT
#else
#  include <sys/types.h>
#  include <sys/ioctl.h>
#  include <sys/socket.h>
#  include <netinet/in.h>
#  include <unistd.h>
#  include <netdb.h>
#endif

#if COMPILER == COMPILER_MICROSOFT

#include <float.h>

#define I64FMT "%016I64X"
#define I64FMTD "%I64u"
#define SI64FMTD "%I64d"
#define snprintf _snprintf
#define atoll __atoi64
#define vsnprintf _vsnprintf
#define strdup _strdup
#define finite(X) _finite(X)

#else

#define stricmp strcasecmp
#define strnicmp strncasecmp
#define I64FMT "%016llX"
#define I64FMTD "%llu"
#define SI64FMTD "%lld"
#endif

#define GUID_HIPART(x)   (uint32)((x) >> 32)
#define GUID_LOPART(x)   (uint32)((x) & 0xFFFFFFFFULL)
#define MAKE_GUID(l, h)  uint64( uint32(l) | ( uint64(h) << 32 ) )

#define atol(a) strtoul( a, NULL, 10)

#define STRINGIZE(a) #a

#define for if(true) for

enum TimeConstants
{
    MINUTE = 60,
    HOUR   = MINUTE*60,
    DAY    = HOUR*24,
    MONTH  = DAY*30
};

#if PLATFORM == PLATFORM_WIN32
#  define MANGOS_DLL_SPEC __declspec(dllexport)
#else
#  define MANGOS_DLL_SPEC
#endif

// we always use stdlibc++ std::max/std::min, undefine some not C++ standart defines (Win API and some pother platforms)
#ifdef max
#undef max
#endif

#ifdef min
#undef min
#endif
#endif




See more files for this project here

MaNGOS

MaNGOS is an object-oriented Massively Multiplayer Online Role-Playing Game Server (MMORPGS). It\'s an educational project, to help developers get familar with large scale C++ and C# development projects.

Project homepage: http://sourceforge.net/projects/mangos
Programming language(s): C,C++,SQL
License: gpl2

  Auth/
    AuthCrypt.cpp
    AuthCrypt.h
    BigNumber.cpp
    BigNumber.h
    Sha1.cpp
    Sha1.h
    md5.c
    md5.h
  Config/
    dotconfpp/
      dotconfpp.cpp
      dotconfpp.h
      mempool.cpp
      mempool.h
    Config.cpp
    Config.h
    ConfigEnv.h
    ConfigLibrary.vcproj
  Database/
    DBCStores.cpp
    DBCStores.h
    DBCStructure.h
    DBCfmt.cpp
    Database.cpp
    Database.h
    DatabaseEnv.h
    DatabaseImpl.h
    DatabaseMysql.cpp
    DatabaseMysql.h
    DatabasePostgre.cpp
    DatabasePostgre.h
    DatabaseSqlite.cpp
    DatabaseSqlite.h
    Field.cpp
    Field.h
    MySQLDelayThread.h
    QueryResult.h
    QueryResultMysql.cpp
    QueryResultMysql.h
    QueryResultPostgre.cpp
    QueryResultPostgre.h
    QueryResultSqlite.cpp
    QueryResultSqlite.h
    SQLStorage.cpp
    SQLStorage.h
    SqlDelayThread.cpp
    SqlDelayThread.h
    SqlOperations.cpp
    SqlOperations.h
    dbcfile.cpp
    dbcfile.h
  Network/
    Base64.cpp
    Base64.h
    CircularBuffer.cpp
    CircularBuffer.h
    IFile.h
    ISocketHandler.cpp
    ISocketHandler.h
    Ipv4Address.cpp
    Ipv4Address.h
    Ipv6Address.cpp
    Ipv6Address.h
    ListenSocket.h
    Mutex.cpp
    Mutex.h
    Parse.cpp
    Parse.h
    RandomNumber.cpp
    RandomNumber.h
    ResolvServer.cpp
    ResolvServer.h
    ResolvSocket.cpp
    ResolvSocket.h
    SctpSocket.h
    Socket.cpp
    Socket.h
    SocketAddress.h
    SocketHandler.cpp
    SocketHandler.h
    StdLog.h
    StdoutLog.cpp
    StdoutLog.h
    TcpSocket.cpp
  vmap/
  Base.cpp
  Base.h
  ByteBuffer.h
  Common.h
  Errors.h
  Log.cpp
  Log.h
  Makefile.am
  MemoryLeaks.cpp
  MemoryLeaks.h
  Mthread.cpp
  Mthread.h
  PacketLog.cpp
  PacketLog.h
  ProgressBar.cpp
  ProgressBar.h
  SystemConfig.h.in
  Timer.h
  Util.cpp
  Util.h
  WorldPacket.h