Moved common, config and mapcache to C++ (#3200)
Dropped BETA_THREAD_TEST and everything around it Dropped mt19937 Replaced msinttypes with cinttypes Removed IRC link and updated README name
This commit is contained in:
8
.gitignore
vendored
8
.gitignore
vendored
@@ -46,10 +46,6 @@ Thumbs.db
|
|||||||
/3rdparty/libconfig/*.o
|
/3rdparty/libconfig/*.o
|
||||||
/3rdparty/libconfig/obj
|
/3rdparty/libconfig/obj
|
||||||
|
|
||||||
# /3rdparty/mt19937ar/
|
|
||||||
/3rdparty/mt19937ar/Makefile
|
|
||||||
/3rdparty/mt19937ar/*.o
|
|
||||||
|
|
||||||
# /3rdparty/yaml-cpp/
|
# /3rdparty/yaml-cpp/
|
||||||
/3rdparty/yaml-cpp/Makefile
|
/3rdparty/yaml-cpp/Makefile
|
||||||
|
|
||||||
@@ -86,10 +82,6 @@ Thumbs.db
|
|||||||
/src/map/obj_sql
|
/src/map/obj_sql
|
||||||
/src/map/pcre.h
|
/src/map/pcre.h
|
||||||
|
|
||||||
# /src/test/
|
|
||||||
/src/test/Makefile
|
|
||||||
/src/test/obj
|
|
||||||
|
|
||||||
# /src/tool/
|
# /src/tool/
|
||||||
/src/tool/Makefile
|
/src/tool/Makefile
|
||||||
/src/tool/obj_all
|
/src/tool/obj_all
|
||||||
|
|||||||
2
3rdparty/CMakeLists.txt
vendored
2
3rdparty/CMakeLists.txt
vendored
@@ -48,8 +48,6 @@ endmacro( CONFIGURE_WITH_LOCAL_OR_SYSTEM )
|
|||||||
|
|
||||||
|
|
||||||
add_subdirectory( libconfig )
|
add_subdirectory( libconfig )
|
||||||
add_subdirectory( msinttypes )
|
|
||||||
add_subdirectory( mt19937ar )
|
|
||||||
add_subdirectory( mysql )
|
add_subdirectory( mysql )
|
||||||
add_subdirectory( pcre )
|
add_subdirectory( pcre )
|
||||||
add_subdirectory( zlib )
|
add_subdirectory( zlib )
|
||||||
|
|||||||
2
3rdparty/README.txt
vendored
2
3rdparty/README.txt
vendored
@@ -2,8 +2,6 @@ This folder contains everything related to 3rdparty code or tools.
|
|||||||
|
|
||||||
cmake - scripts for the cmake build system (http://www.cmake.org)
|
cmake - scripts for the cmake build system (http://www.cmake.org)
|
||||||
libconfig - library for processing structured configuration files (http://www.hyperrealm.com/libconfig/)
|
libconfig - library for processing structured configuration files (http://www.hyperrealm.com/libconfig/)
|
||||||
msinttypes - standard headers missing from Microsoft Visual Studio (http://code.google.com/p/msinttypes)
|
|
||||||
mt19937ar - code for Mersenne Twister pseudorandom number generator
|
|
||||||
mysql - library for MySQL Community Server (http://www.mysql.com)
|
mysql - library for MySQL Community Server (http://www.mysql.com)
|
||||||
pcre - library for Perl Compatible Regular Expressions (http://www.pcre.org)
|
pcre - library for Perl Compatible Regular Expressions (http://www.pcre.org)
|
||||||
zlib - library for DEFLATE lossless compression algorithm (http://www.zlib.net)
|
zlib - library for DEFLATE lossless compression algorithm (http://www.zlib.net)
|
||||||
|
|||||||
9
3rdparty/msinttypes/CMakeLists.txt
vendored
9
3rdparty/msinttypes/CMakeLists.txt
vendored
@@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
if( MSVC )
|
|
||||||
find_path( MSINTTYPES_INCLUDE_DIRS "inttypes.h"
|
|
||||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
||||||
NO_DEFAULT_PATH )
|
|
||||||
mark_as_advanced( MSINTTYPES_INCLUDE_DIRS )
|
|
||||||
message( STATUS "Adding global include directory: ${MSINTTYPES_INCLUDE_DIRS}" )
|
|
||||||
set_property( CACHE GLOBAL_INCLUDE_DIRS PROPERTY VALUE ${GLOBAL_INCLUDE_DIRS} ${MSINTTYPES_INCLUDE_DIRS} )
|
|
||||||
endif()
|
|
||||||
305
3rdparty/msinttypes/include/inttypes.h
vendored
305
3rdparty/msinttypes/include/inttypes.h
vendored
@@ -1,305 +0,0 @@
|
|||||||
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
|
|
||||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
|
||||||
//
|
|
||||||
// Copyright (c) 2006 Alexander Chemeris
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer in the
|
|
||||||
// documentation and/or other materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// 3. The name of the author may be used to endorse or promote products
|
|
||||||
// derived from this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
||||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef _MSC_VER // [
|
|
||||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
|
||||||
#endif // _MSC_VER ]
|
|
||||||
|
|
||||||
#ifndef _MSC_INTTYPES_H_ // [
|
|
||||||
#define _MSC_INTTYPES_H_
|
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
|
|
||||||
// 7.8 Format conversion of integer types
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
intmax_t quot;
|
|
||||||
intmax_t rem;
|
|
||||||
} imaxdiv_t;
|
|
||||||
|
|
||||||
// 7.8.1 Macros for format specifiers
|
|
||||||
|
|
||||||
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
|
|
||||||
|
|
||||||
// The fprintf macros for signed integers are:
|
|
||||||
#define PRId8 "d"
|
|
||||||
#define PRIi8 "i"
|
|
||||||
#define PRIdLEAST8 "d"
|
|
||||||
#define PRIiLEAST8 "i"
|
|
||||||
#define PRIdFAST8 "d"
|
|
||||||
#define PRIiFAST8 "i"
|
|
||||||
|
|
||||||
#define PRId16 "hd"
|
|
||||||
#define PRIi16 "hi"
|
|
||||||
#define PRIdLEAST16 "hd"
|
|
||||||
#define PRIiLEAST16 "hi"
|
|
||||||
#define PRIdFAST16 "hd"
|
|
||||||
#define PRIiFAST16 "hi"
|
|
||||||
|
|
||||||
#define PRId32 "I32d"
|
|
||||||
#define PRIi32 "I32i"
|
|
||||||
#define PRIdLEAST32 "I32d"
|
|
||||||
#define PRIiLEAST32 "I32i"
|
|
||||||
#define PRIdFAST32 "I32d"
|
|
||||||
#define PRIiFAST32 "I32i"
|
|
||||||
|
|
||||||
#define PRId64 "I64d"
|
|
||||||
#define PRIi64 "I64i"
|
|
||||||
#define PRIdLEAST64 "I64d"
|
|
||||||
#define PRIiLEAST64 "I64i"
|
|
||||||
#define PRIdFAST64 "I64d"
|
|
||||||
#define PRIiFAST64 "I64i"
|
|
||||||
|
|
||||||
#define PRIdMAX "I64d"
|
|
||||||
#define PRIiMAX "I64i"
|
|
||||||
|
|
||||||
#define PRIdPTR "Id"
|
|
||||||
#define PRIiPTR "Ii"
|
|
||||||
|
|
||||||
// The fprintf macros for unsigned integers are:
|
|
||||||
#define PRIo8 "o"
|
|
||||||
#define PRIu8 "u"
|
|
||||||
#define PRIx8 "x"
|
|
||||||
#define PRIX8 "X"
|
|
||||||
#define PRIoLEAST8 "o"
|
|
||||||
#define PRIuLEAST8 "u"
|
|
||||||
#define PRIxLEAST8 "x"
|
|
||||||
#define PRIXLEAST8 "X"
|
|
||||||
#define PRIoFAST8 "o"
|
|
||||||
#define PRIuFAST8 "u"
|
|
||||||
#define PRIxFAST8 "x"
|
|
||||||
#define PRIXFAST8 "X"
|
|
||||||
|
|
||||||
#define PRIo16 "ho"
|
|
||||||
#define PRIu16 "hu"
|
|
||||||
#define PRIx16 "hx"
|
|
||||||
#define PRIX16 "hX"
|
|
||||||
#define PRIoLEAST16 "ho"
|
|
||||||
#define PRIuLEAST16 "hu"
|
|
||||||
#define PRIxLEAST16 "hx"
|
|
||||||
#define PRIXLEAST16 "hX"
|
|
||||||
#define PRIoFAST16 "ho"
|
|
||||||
#define PRIuFAST16 "hu"
|
|
||||||
#define PRIxFAST16 "hx"
|
|
||||||
#define PRIXFAST16 "hX"
|
|
||||||
|
|
||||||
#define PRIo32 "I32o"
|
|
||||||
#define PRIu32 "I32u"
|
|
||||||
#define PRIx32 "I32x"
|
|
||||||
#define PRIX32 "I32X"
|
|
||||||
#define PRIoLEAST32 "I32o"
|
|
||||||
#define PRIuLEAST32 "I32u"
|
|
||||||
#define PRIxLEAST32 "I32x"
|
|
||||||
#define PRIXLEAST32 "I32X"
|
|
||||||
#define PRIoFAST32 "I32o"
|
|
||||||
#define PRIuFAST32 "I32u"
|
|
||||||
#define PRIxFAST32 "I32x"
|
|
||||||
#define PRIXFAST32 "I32X"
|
|
||||||
|
|
||||||
#define PRIo64 "I64o"
|
|
||||||
#define PRIu64 "I64u"
|
|
||||||
#define PRIx64 "I64x"
|
|
||||||
#define PRIX64 "I64X"
|
|
||||||
#define PRIoLEAST64 "I64o"
|
|
||||||
#define PRIuLEAST64 "I64u"
|
|
||||||
#define PRIxLEAST64 "I64x"
|
|
||||||
#define PRIXLEAST64 "I64X"
|
|
||||||
#define PRIoFAST64 "I64o"
|
|
||||||
#define PRIuFAST64 "I64u"
|
|
||||||
#define PRIxFAST64 "I64x"
|
|
||||||
#define PRIXFAST64 "I64X"
|
|
||||||
|
|
||||||
#define PRIoMAX "I64o"
|
|
||||||
#define PRIuMAX "I64u"
|
|
||||||
#define PRIxMAX "I64x"
|
|
||||||
#define PRIXMAX "I64X"
|
|
||||||
|
|
||||||
#define PRIoPTR "Io"
|
|
||||||
#define PRIuPTR "Iu"
|
|
||||||
#define PRIxPTR "Ix"
|
|
||||||
#define PRIXPTR "IX"
|
|
||||||
|
|
||||||
// The fscanf macros for signed integers are:
|
|
||||||
#define SCNd8 "d"
|
|
||||||
#define SCNi8 "i"
|
|
||||||
#define SCNdLEAST8 "d"
|
|
||||||
#define SCNiLEAST8 "i"
|
|
||||||
#define SCNdFAST8 "d"
|
|
||||||
#define SCNiFAST8 "i"
|
|
||||||
|
|
||||||
#define SCNd16 "hd"
|
|
||||||
#define SCNi16 "hi"
|
|
||||||
#define SCNdLEAST16 "hd"
|
|
||||||
#define SCNiLEAST16 "hi"
|
|
||||||
#define SCNdFAST16 "hd"
|
|
||||||
#define SCNiFAST16 "hi"
|
|
||||||
|
|
||||||
#define SCNd32 "ld"
|
|
||||||
#define SCNi32 "li"
|
|
||||||
#define SCNdLEAST32 "ld"
|
|
||||||
#define SCNiLEAST32 "li"
|
|
||||||
#define SCNdFAST32 "ld"
|
|
||||||
#define SCNiFAST32 "li"
|
|
||||||
|
|
||||||
#define SCNd64 "I64d"
|
|
||||||
#define SCNi64 "I64i"
|
|
||||||
#define SCNdLEAST64 "I64d"
|
|
||||||
#define SCNiLEAST64 "I64i"
|
|
||||||
#define SCNdFAST64 "I64d"
|
|
||||||
#define SCNiFAST64 "I64i"
|
|
||||||
|
|
||||||
#define SCNdMAX "I64d"
|
|
||||||
#define SCNiMAX "I64i"
|
|
||||||
|
|
||||||
#ifdef _WIN64 // [
|
|
||||||
# define SCNdPTR "I64d"
|
|
||||||
# define SCNiPTR "I64i"
|
|
||||||
#else // _WIN64 ][
|
|
||||||
# define SCNdPTR "ld"
|
|
||||||
# define SCNiPTR "li"
|
|
||||||
#endif // _WIN64 ]
|
|
||||||
|
|
||||||
// The fscanf macros for unsigned integers are:
|
|
||||||
#define SCNo8 "o"
|
|
||||||
#define SCNu8 "u"
|
|
||||||
#define SCNx8 "x"
|
|
||||||
#define SCNX8 "X"
|
|
||||||
#define SCNoLEAST8 "o"
|
|
||||||
#define SCNuLEAST8 "u"
|
|
||||||
#define SCNxLEAST8 "x"
|
|
||||||
#define SCNXLEAST8 "X"
|
|
||||||
#define SCNoFAST8 "o"
|
|
||||||
#define SCNuFAST8 "u"
|
|
||||||
#define SCNxFAST8 "x"
|
|
||||||
#define SCNXFAST8 "X"
|
|
||||||
|
|
||||||
#define SCNo16 "ho"
|
|
||||||
#define SCNu16 "hu"
|
|
||||||
#define SCNx16 "hx"
|
|
||||||
#define SCNX16 "hX"
|
|
||||||
#define SCNoLEAST16 "ho"
|
|
||||||
#define SCNuLEAST16 "hu"
|
|
||||||
#define SCNxLEAST16 "hx"
|
|
||||||
#define SCNXLEAST16 "hX"
|
|
||||||
#define SCNoFAST16 "ho"
|
|
||||||
#define SCNuFAST16 "hu"
|
|
||||||
#define SCNxFAST16 "hx"
|
|
||||||
#define SCNXFAST16 "hX"
|
|
||||||
|
|
||||||
#define SCNo32 "lo"
|
|
||||||
#define SCNu32 "lu"
|
|
||||||
#define SCNx32 "lx"
|
|
||||||
#define SCNX32 "lX"
|
|
||||||
#define SCNoLEAST32 "lo"
|
|
||||||
#define SCNuLEAST32 "lu"
|
|
||||||
#define SCNxLEAST32 "lx"
|
|
||||||
#define SCNXLEAST32 "lX"
|
|
||||||
#define SCNoFAST32 "lo"
|
|
||||||
#define SCNuFAST32 "lu"
|
|
||||||
#define SCNxFAST32 "lx"
|
|
||||||
#define SCNXFAST32 "lX"
|
|
||||||
|
|
||||||
#define SCNo64 "I64o"
|
|
||||||
#define SCNu64 "I64u"
|
|
||||||
#define SCNx64 "I64x"
|
|
||||||
#define SCNX64 "I64X"
|
|
||||||
#define SCNoLEAST64 "I64o"
|
|
||||||
#define SCNuLEAST64 "I64u"
|
|
||||||
#define SCNxLEAST64 "I64x"
|
|
||||||
#define SCNXLEAST64 "I64X"
|
|
||||||
#define SCNoFAST64 "I64o"
|
|
||||||
#define SCNuFAST64 "I64u"
|
|
||||||
#define SCNxFAST64 "I64x"
|
|
||||||
#define SCNXFAST64 "I64X"
|
|
||||||
|
|
||||||
#define SCNoMAX "I64o"
|
|
||||||
#define SCNuMAX "I64u"
|
|
||||||
#define SCNxMAX "I64x"
|
|
||||||
#define SCNXMAX "I64X"
|
|
||||||
|
|
||||||
#ifdef _WIN64 // [
|
|
||||||
# define SCNoPTR "I64o"
|
|
||||||
# define SCNuPTR "I64u"
|
|
||||||
# define SCNxPTR "I64x"
|
|
||||||
# define SCNXPTR "I64X"
|
|
||||||
#else // _WIN64 ][
|
|
||||||
# define SCNoPTR "lo"
|
|
||||||
# define SCNuPTR "lu"
|
|
||||||
# define SCNxPTR "lx"
|
|
||||||
# define SCNXPTR "lX"
|
|
||||||
#endif // _WIN64 ]
|
|
||||||
|
|
||||||
#endif // __STDC_FORMAT_MACROS ]
|
|
||||||
|
|
||||||
// 7.8.2 Functions for greatest-width integer types
|
|
||||||
|
|
||||||
// 7.8.2.1 The imaxabs function
|
|
||||||
#define imaxabs _abs64
|
|
||||||
|
|
||||||
// 7.8.2.2 The imaxdiv function
|
|
||||||
|
|
||||||
// This is modified version of div() function from Microsoft's div.c found
|
|
||||||
// in %MSVC.NET%\crt\src\div.c
|
|
||||||
#ifdef STATIC_IMAXDIV // [
|
|
||||||
static
|
|
||||||
#else // STATIC_IMAXDIV ][
|
|
||||||
_inline
|
|
||||||
#endif // STATIC_IMAXDIV ]
|
|
||||||
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
|
|
||||||
{
|
|
||||||
imaxdiv_t result;
|
|
||||||
|
|
||||||
result.quot = numer / denom;
|
|
||||||
result.rem = numer % denom;
|
|
||||||
|
|
||||||
if (numer < 0 && result.rem > 0) {
|
|
||||||
// did division wrong; must fix up
|
|
||||||
++result.quot;
|
|
||||||
result.rem -= denom;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 7.8.2.3 The strtoimax and strtoumax functions
|
|
||||||
#define strtoimax _strtoi64
|
|
||||||
#define strtoumax _strtoui64
|
|
||||||
|
|
||||||
// 7.8.2.4 The wcstoimax and wcstoumax functions
|
|
||||||
#define wcstoimax _wcstoi64
|
|
||||||
#define wcstoumax _wcstoui64
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _MSC_INTTYPES_H_ ]
|
|
||||||
251
3rdparty/msinttypes/include/stdint.h
vendored
251
3rdparty/msinttypes/include/stdint.h
vendored
@@ -1,251 +0,0 @@
|
|||||||
// ISO C9x compliant stdint.h for Microsoft Visual Studio
|
|
||||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
|
||||||
//
|
|
||||||
// Copyright (c) 2006-2008 Alexander Chemeris
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer in the
|
|
||||||
// documentation and/or other materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// 3. The name of the author may be used to endorse or promote products
|
|
||||||
// derived from this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
||||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
||||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
||||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
||||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef _MSC_VER // [
|
|
||||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
|
||||||
#endif // _MSC_VER ]
|
|
||||||
|
|
||||||
#ifndef _MSC_STDINT_H_ // [
|
|
||||||
#define _MSC_STDINT_H_
|
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
|
|
||||||
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
|
|
||||||
// or compiler give many errors like this:
|
|
||||||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#if _MSC_VER < 1300
|
|
||||||
extern "C++" {
|
|
||||||
#else
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
# include <wchar.h>
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Define _W64 macros to mark types changing their size, like intptr_t.
|
|
||||||
#ifndef _W64
|
|
||||||
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
|
||||||
# define _W64 __w64
|
|
||||||
# else
|
|
||||||
# define _W64
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// 7.18.1 Integer types
|
|
||||||
|
|
||||||
// 7.18.1.1 Exact-width integer types
|
|
||||||
|
|
||||||
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
|
|
||||||
// realize that, e.g. char has the same size as __int8
|
|
||||||
// so we give up on __intX for them.
|
|
||||||
#if (_MSC_VER < 1300)
|
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef signed short int16_t;
|
|
||||||
typedef signed int int32_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
#else
|
|
||||||
typedef signed __int8 int8_t;
|
|
||||||
typedef signed __int16 int16_t;
|
|
||||||
typedef signed __int32 int32_t;
|
|
||||||
typedef unsigned __int8 uint8_t;
|
|
||||||
typedef unsigned __int16 uint16_t;
|
|
||||||
typedef unsigned __int32 uint32_t;
|
|
||||||
#endif
|
|
||||||
typedef signed __int64 int64_t;
|
|
||||||
typedef unsigned __int64 uint64_t;
|
|
||||||
|
|
||||||
|
|
||||||
// 7.18.1.2 Minimum-width integer types
|
|
||||||
typedef int8_t int_least8_t;
|
|
||||||
typedef int16_t int_least16_t;
|
|
||||||
typedef int32_t int_least32_t;
|
|
||||||
typedef int64_t int_least64_t;
|
|
||||||
typedef uint8_t uint_least8_t;
|
|
||||||
typedef uint16_t uint_least16_t;
|
|
||||||
typedef uint32_t uint_least32_t;
|
|
||||||
typedef uint64_t uint_least64_t;
|
|
||||||
|
|
||||||
// 7.18.1.3 Fastest minimum-width integer types
|
|
||||||
typedef int8_t int_fast8_t;
|
|
||||||
typedef int16_t int_fast16_t;
|
|
||||||
typedef int32_t int_fast32_t;
|
|
||||||
typedef int64_t int_fast64_t;
|
|
||||||
typedef uint8_t uint_fast8_t;
|
|
||||||
typedef uint16_t uint_fast16_t;
|
|
||||||
typedef uint32_t uint_fast32_t;
|
|
||||||
typedef uint64_t uint_fast64_t;
|
|
||||||
|
|
||||||
// 7.18.1.4 Integer types capable of holding object pointers
|
|
||||||
#ifdef _WIN64 // [
|
|
||||||
typedef signed __int64 intptr_t;
|
|
||||||
typedef unsigned __int64 uintptr_t;
|
|
||||||
#else // _WIN64 ][
|
|
||||||
typedef _W64 signed int intptr_t;
|
|
||||||
typedef _W64 unsigned int uintptr_t;
|
|
||||||
#endif // _WIN64 ]
|
|
||||||
|
|
||||||
// 7.18.1.5 Greatest-width integer types
|
|
||||||
typedef int64_t intmax_t;
|
|
||||||
typedef uint64_t uintmax_t;
|
|
||||||
|
|
||||||
|
|
||||||
// 7.18.2 Limits of specified-width integer types
|
|
||||||
|
|
||||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
|
||||||
|
|
||||||
// 7.18.2.1 Limits of exact-width integer types
|
|
||||||
#define INT8_MIN ((int8_t)_I8_MIN)
|
|
||||||
#define INT8_MAX _I8_MAX
|
|
||||||
#define INT16_MIN ((int16_t)_I16_MIN)
|
|
||||||
#define INT16_MAX _I16_MAX
|
|
||||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
|
||||||
#define INT32_MAX _I32_MAX
|
|
||||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
|
||||||
#define INT64_MAX _I64_MAX
|
|
||||||
#define UINT8_MAX _UI8_MAX
|
|
||||||
#define UINT16_MAX _UI16_MAX
|
|
||||||
#define UINT32_MAX _UI32_MAX
|
|
||||||
#define UINT64_MAX _UI64_MAX
|
|
||||||
|
|
||||||
// 7.18.2.2 Limits of minimum-width integer types
|
|
||||||
#define INT_LEAST8_MIN INT8_MIN
|
|
||||||
#define INT_LEAST8_MAX INT8_MAX
|
|
||||||
#define INT_LEAST16_MIN INT16_MIN
|
|
||||||
#define INT_LEAST16_MAX INT16_MAX
|
|
||||||
#define INT_LEAST32_MIN INT32_MIN
|
|
||||||
#define INT_LEAST32_MAX INT32_MAX
|
|
||||||
#define INT_LEAST64_MIN INT64_MIN
|
|
||||||
#define INT_LEAST64_MAX INT64_MAX
|
|
||||||
#define UINT_LEAST8_MAX UINT8_MAX
|
|
||||||
#define UINT_LEAST16_MAX UINT16_MAX
|
|
||||||
#define UINT_LEAST32_MAX UINT32_MAX
|
|
||||||
#define UINT_LEAST64_MAX UINT64_MAX
|
|
||||||
|
|
||||||
// 7.18.2.3 Limits of fastest minimum-width integer types
|
|
||||||
#define INT_FAST8_MIN INT8_MIN
|
|
||||||
#define INT_FAST8_MAX INT8_MAX
|
|
||||||
#define INT_FAST16_MIN INT16_MIN
|
|
||||||
#define INT_FAST16_MAX INT16_MAX
|
|
||||||
#define INT_FAST32_MIN INT32_MIN
|
|
||||||
#define INT_FAST32_MAX INT32_MAX
|
|
||||||
#define INT_FAST64_MIN INT64_MIN
|
|
||||||
#define INT_FAST64_MAX INT64_MAX
|
|
||||||
#define UINT_FAST8_MAX UINT8_MAX
|
|
||||||
#define UINT_FAST16_MAX UINT16_MAX
|
|
||||||
#define UINT_FAST32_MAX UINT32_MAX
|
|
||||||
#define UINT_FAST64_MAX UINT64_MAX
|
|
||||||
|
|
||||||
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
|
||||||
#ifdef _WIN64 // [
|
|
||||||
# define INTPTR_MIN INT64_MIN
|
|
||||||
# define INTPTR_MAX INT64_MAX
|
|
||||||
# define UINTPTR_MAX UINT64_MAX
|
|
||||||
#else // _WIN64 ][
|
|
||||||
# define INTPTR_MIN INT32_MIN
|
|
||||||
# define INTPTR_MAX INT32_MAX
|
|
||||||
# define UINTPTR_MAX UINT32_MAX
|
|
||||||
#endif // _WIN64 ]
|
|
||||||
|
|
||||||
// 7.18.2.5 Limits of greatest-width integer types
|
|
||||||
#define INTMAX_MIN INT64_MIN
|
|
||||||
#define INTMAX_MAX INT64_MAX
|
|
||||||
#define UINTMAX_MAX UINT64_MAX
|
|
||||||
|
|
||||||
// 7.18.3 Limits of other integer types
|
|
||||||
|
|
||||||
#ifdef _WIN64 // [
|
|
||||||
# define PTRDIFF_MIN _I64_MIN
|
|
||||||
# define PTRDIFF_MAX _I64_MAX
|
|
||||||
#else // _WIN64 ][
|
|
||||||
# define PTRDIFF_MIN _I32_MIN
|
|
||||||
# define PTRDIFF_MAX _I32_MAX
|
|
||||||
#endif // _WIN64 ]
|
|
||||||
|
|
||||||
#define SIG_ATOMIC_MIN INT_MIN
|
|
||||||
#define SIG_ATOMIC_MAX INT_MAX
|
|
||||||
|
|
||||||
#ifndef SIZE_MAX // [
|
|
||||||
# ifdef _WIN64 // [
|
|
||||||
# define SIZE_MAX _UI64_MAX
|
|
||||||
# else // _WIN64 ][
|
|
||||||
# define SIZE_MAX _UI32_MAX
|
|
||||||
# endif // _WIN64 ]
|
|
||||||
#endif // SIZE_MAX ]
|
|
||||||
|
|
||||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
|
||||||
#ifndef WCHAR_MIN // [
|
|
||||||
# define WCHAR_MIN 0
|
|
||||||
#endif // WCHAR_MIN ]
|
|
||||||
#ifndef WCHAR_MAX // [
|
|
||||||
# define WCHAR_MAX _UI16_MAX
|
|
||||||
#endif // WCHAR_MAX ]
|
|
||||||
|
|
||||||
#define WINT_MIN 0
|
|
||||||
#define WINT_MAX _UI16_MAX
|
|
||||||
|
|
||||||
#endif // __STDC_LIMIT_MACROS ]
|
|
||||||
|
|
||||||
|
|
||||||
// 7.18.4 Limits of other integer types
|
|
||||||
|
|
||||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
|
||||||
|
|
||||||
// 7.18.4.1 Macros for minimum-width integer constants
|
|
||||||
|
|
||||||
#define INT8_C(val) val##i8
|
|
||||||
#define INT16_C(val) val##i16
|
|
||||||
#define INT32_C(val) val##i32
|
|
||||||
#define INT64_C(val) val##i64
|
|
||||||
|
|
||||||
#define UINT8_C(val) val##ui8
|
|
||||||
#define UINT16_C(val) val##ui16
|
|
||||||
#define UINT32_C(val) val##ui32
|
|
||||||
#define UINT64_C(val) val##ui64
|
|
||||||
|
|
||||||
// 7.18.4.2 Macros for greatest-width integer constants
|
|
||||||
#define INTMAX_C INT64_C
|
|
||||||
#define UINTMAX_C UINT64_C
|
|
||||||
|
|
||||||
#endif // __STDC_CONSTANT_MACROS ]
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _MSC_STDINT_H_ ]
|
|
||||||
16
3rdparty/mt19937ar/CMakeLists.txt
vendored
16
3rdparty/mt19937ar/CMakeLists.txt
vendored
@@ -1,16 +0,0 @@
|
|||||||
|
|
||||||
find_path( MT19937AR_INCLUDE_DIRS "mt19937ar.h"
|
|
||||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
NO_DEFAULT_PATH )
|
|
||||||
find_path( MT19937AR_SOURCE_DIR "mt19937ar.c"
|
|
||||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
NO_DEFAULT_PATH )
|
|
||||||
mark_as_advanced( MT19937AR_INCLUDE_DIRS )
|
|
||||||
mark_as_advanced( MT19937AR_SOURCE_DIR )
|
|
||||||
|
|
||||||
set( MT19937AR_HEADERS
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/mt19937ar.h"
|
|
||||||
CACHE INTERNAL "mt19937ar headers" )
|
|
||||||
set( MT19937AR_SOURCES
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/mt19937ar.c"
|
|
||||||
CACHE INTERNAL "mt19937ar sources" )
|
|
||||||
26
3rdparty/mt19937ar/Makefile.in
vendored
26
3rdparty/mt19937ar/Makefile.in
vendored
@@ -1,26 +0,0 @@
|
|||||||
|
|
||||||
MT19937AR_OBJ = mt19937ar.o
|
|
||||||
MT19937AR_H = mt19937ar.h
|
|
||||||
|
|
||||||
@SET_MAKE@
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
.PHONY : all clean help
|
|
||||||
|
|
||||||
all: $(MT19937AR_OBJ)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
@echo " CLEAN mt19937ar"
|
|
||||||
@rm -rf *.o
|
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "possible targets are 'all' 'clean' 'help'"
|
|
||||||
@echo "'all' - builds $(MT19937AR_OBJ)"
|
|
||||||
@echo "'clean' - deletes $(MT19937AR_OBJ)"
|
|
||||||
@echo "'help' - outputs this message"
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
%.o: %.c $(MT19937AR_H)
|
|
||||||
@echo " CC $<"
|
|
||||||
@@CC@ @CFLAGS_AR@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
|
||||||
175
3rdparty/mt19937ar/mt19937ar.c
vendored
175
3rdparty/mt19937ar/mt19937ar.c
vendored
@@ -1,175 +0,0 @@
|
|||||||
/*
|
|
||||||
A C-program for MT19937, with initialization improved 2002/1/26.
|
|
||||||
Coded by Takuji Nishimura and Makoto Matsumoto.
|
|
||||||
|
|
||||||
Before using, initialize the state by using init_genrand(seed)
|
|
||||||
or init_by_array(init_key, key_length).
|
|
||||||
|
|
||||||
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
|
||||||
All rights reserved.
|
|
||||||
Copyright (C) 2005, Mutsuo Saito,
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. The names of its contributors may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
|
|
||||||
Any feedback is very welcome.
|
|
||||||
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
|
|
||||||
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "mt19937ar.h"
|
|
||||||
|
|
||||||
/* Period parameters */
|
|
||||||
#define N 624
|
|
||||||
#define M 397
|
|
||||||
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
|
|
||||||
#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
|
|
||||||
#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
|
|
||||||
|
|
||||||
static unsigned long mt[N]; /* the array for the state vector */
|
|
||||||
static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */
|
|
||||||
|
|
||||||
/* initializes mt[N] with a seed */
|
|
||||||
void init_genrand(unsigned long s)
|
|
||||||
{
|
|
||||||
mt[0]= s & 0xffffffffUL;
|
|
||||||
for (mti=1; mti<N; mti++) {
|
|
||||||
mt[mti] =
|
|
||||||
(1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
|
|
||||||
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
|
|
||||||
/* In the previous versions, MSBs of the seed affect */
|
|
||||||
/* only MSBs of the array mt[]. */
|
|
||||||
/* 2002/01/09 modified by Makoto Matsumoto */
|
|
||||||
mt[mti] &= 0xffffffffUL;
|
|
||||||
/* for >32 bit machines */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize by an array with array-length */
|
|
||||||
/* init_key is the array for initializing keys */
|
|
||||||
/* key_length is its length */
|
|
||||||
/* slight change for C++, 2004/2/26 */
|
|
||||||
void init_by_array(unsigned long init_key[], int key_length)
|
|
||||||
{
|
|
||||||
int i, j, k;
|
|
||||||
init_genrand(19650218UL);
|
|
||||||
i=1; j=0;
|
|
||||||
k = (N>key_length ? N : key_length);
|
|
||||||
for (; k; k--) {
|
|
||||||
mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))
|
|
||||||
+ init_key[j] + j; /* non linear */
|
|
||||||
mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
|
|
||||||
i++; j++;
|
|
||||||
if (i>=N) { mt[0] = mt[N-1]; i=1; }
|
|
||||||
if (j>=key_length) j=0;
|
|
||||||
}
|
|
||||||
for (k=N-1; k; k--) {
|
|
||||||
mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL))
|
|
||||||
- i; /* non linear */
|
|
||||||
mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
|
|
||||||
i++;
|
|
||||||
if (i>=N) { mt[0] = mt[N-1]; i=1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* generates a random number on [0,0xffffffff]-interval */
|
|
||||||
unsigned long genrand_int32(void)
|
|
||||||
{
|
|
||||||
unsigned long y;
|
|
||||||
static unsigned long mag01[2]={0x0UL, MATRIX_A};
|
|
||||||
/* mag01[x] = x * MATRIX_A for x=0,1 */
|
|
||||||
|
|
||||||
if (mti >= N) { /* generate N words at one time */
|
|
||||||
int kk;
|
|
||||||
|
|
||||||
if (mti == N+1) /* if init_genrand() has not been called, */
|
|
||||||
init_genrand(5489UL); /* a default initial seed is used */
|
|
||||||
|
|
||||||
for (kk=0;kk<N-M;kk++) {
|
|
||||||
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
|
|
||||||
mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
|
||||||
}
|
|
||||||
for (;kk<N-1;kk++) {
|
|
||||||
y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
|
|
||||||
mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
|
||||||
}
|
|
||||||
y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
|
|
||||||
mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
|
|
||||||
|
|
||||||
mti = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
y = mt[mti++];
|
|
||||||
|
|
||||||
/* Tempering */
|
|
||||||
y ^= (y >> 11);
|
|
||||||
y ^= (y << 7) & 0x9d2c5680UL;
|
|
||||||
y ^= (y << 15) & 0xefc60000UL;
|
|
||||||
y ^= (y >> 18);
|
|
||||||
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* generates a random number on [0,0x7fffffff]-interval */
|
|
||||||
long genrand_int31(void)
|
|
||||||
{
|
|
||||||
return (long)(genrand_int32()>>1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* generates a random number on [0,1]-real-interval */
|
|
||||||
double genrand_real1(void)
|
|
||||||
{
|
|
||||||
return genrand_int32()*(1.0/4294967295.0);
|
|
||||||
/* divided by 2^32-1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* generates a random number on [0,1)-real-interval */
|
|
||||||
double genrand_real2(void)
|
|
||||||
{
|
|
||||||
return genrand_int32()*(1.0/4294967296.0);
|
|
||||||
/* divided by 2^32 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* generates a random number on (0,1)-real-interval */
|
|
||||||
double genrand_real3(void)
|
|
||||||
{
|
|
||||||
return (((double)genrand_int32()) + 0.5)*(1.0/4294967296.0);
|
|
||||||
/* divided by 2^32 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* generates a random number on [0,1) with 53-bit resolution*/
|
|
||||||
double genrand_res53(void)
|
|
||||||
{
|
|
||||||
unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
|
|
||||||
return(a*67108864.0+b)*(1.0/9007199254740992.0);
|
|
||||||
}
|
|
||||||
/* These real versions are due to Isaku Wada, 2002/01/09 added */
|
|
||||||
82
3rdparty/mt19937ar/mt19937ar.h
vendored
82
3rdparty/mt19937ar/mt19937ar.h
vendored
@@ -1,82 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
/*
|
|
||||||
A C-program for MT19937, with initialization improved 2002/1/26.
|
|
||||||
Coded by Takuji Nishimura and Makoto Matsumoto.
|
|
||||||
|
|
||||||
Before using, initialize the state by using init_genrand(seed)
|
|
||||||
or init_by_array(init_key, key_length).
|
|
||||||
|
|
||||||
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
|
||||||
All rights reserved.
|
|
||||||
Copyright (C) 2005, Mutsuo Saito
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. The names of its contributors may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
|
|
||||||
Any feedback is very welcome.
|
|
||||||
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
|
|
||||||
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* initializes mt[N] with a seed */
|
|
||||||
void init_genrand(unsigned long s);
|
|
||||||
|
|
||||||
/* initialize by an array with array-length */
|
|
||||||
/* init_key is the array for initializing keys */
|
|
||||||
/* key_length is its length */
|
|
||||||
/* slight change for C++, 2004/2/26 */
|
|
||||||
void init_by_array(unsigned long init_key[], int key_length);
|
|
||||||
|
|
||||||
/* generates a random number on [0,0xffffffff]-interval */
|
|
||||||
unsigned long genrand_int32(void);
|
|
||||||
|
|
||||||
/* generates a random number on [0,0x7fffffff]-interval */
|
|
||||||
long genrand_int31(void);
|
|
||||||
|
|
||||||
/* These real versions are due to Isaku Wada, 2002/01/09 added */
|
|
||||||
/* generates a random number on [0,1]-real-interval */
|
|
||||||
double genrand_real1(void);
|
|
||||||
|
|
||||||
/* generates a random number on [0,1)-real-interval */
|
|
||||||
double genrand_real2(void);
|
|
||||||
|
|
||||||
/* generates a random number on (0,1)-real-interval */
|
|
||||||
double genrand_real3(void);
|
|
||||||
|
|
||||||
/* generates a random number on [0,1) with 53-bit resolution*/
|
|
||||||
double genrand_res53(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
403
3rdparty/mt19937ar/mt19937ar.out
vendored
403
3rdparty/mt19937ar/mt19937ar.out
vendored
@@ -1,403 +0,0 @@
|
|||||||
1000 outputs of genrand_int32()
|
|
||||||
1067595299 955945823 477289528 4107218783 4228976476
|
|
||||||
3344332714 3355579695 227628506 810200273 2591290167
|
|
||||||
2560260675 3242736208 646746669 1479517882 4245472273
|
|
||||||
1143372638 3863670494 3221021970 1773610557 1138697238
|
|
||||||
1421897700 1269916527 2859934041 1764463362 3874892047
|
|
||||||
3965319921 72549643 2383988930 2600218693 3237492380
|
|
||||||
2792901476 725331109 605841842 271258942 715137098
|
|
||||||
3297999536 1322965544 4229579109 1395091102 3735697720
|
|
||||||
2101727825 3730287744 2950434330 1661921839 2895579582
|
|
||||||
2370511479 1004092106 2247096681 2111242379 3237345263
|
|
||||||
4082424759 219785033 2454039889 3709582971 835606218
|
|
||||||
2411949883 2735205030 756421180 2175209704 1873865952
|
|
||||||
2762534237 4161807854 3351099340 181129879 3269891896
|
|
||||||
776029799 2218161979 3001745796 1866825872 2133627728
|
|
||||||
34862734 1191934573 3102311354 2916517763 1012402762
|
|
||||||
2184831317 4257399449 2899497138 3818095062 3030756734
|
|
||||||
1282161629 420003642 2326421477 2741455717 1278020671
|
|
||||||
3744179621 271777016 2626330018 2560563991 3055977700
|
|
||||||
4233527566 1228397661 3595579322 1077915006 2395931898
|
|
||||||
1851927286 3013683506 1999971931 3006888962 1049781534
|
|
||||||
1488758959 3491776230 104418065 2448267297 3075614115
|
|
||||||
3872332600 891912190 3936547759 2269180963 2633455084
|
|
||||||
1047636807 2604612377 2709305729 1952216715 207593580
|
|
||||||
2849898034 670771757 2210471108 467711165 263046873
|
|
||||||
3569667915 1042291111 3863517079 1464270005 2758321352
|
|
||||||
3790799816 2301278724 3106281430 7974801 2792461636
|
|
||||||
555991332 621766759 1322453093 853629228 686962251
|
|
||||||
1455120532 957753161 1802033300 1021534190 3486047311
|
|
||||||
1902128914 3701138056 4176424663 1795608698 560858864
|
|
||||||
3737752754 3141170998 1553553385 3367807274 711546358
|
|
||||||
2475125503 262969859 251416325 2980076994 1806565895
|
|
||||||
969527843 3529327173 2736343040 2987196734 1649016367
|
|
||||||
2206175811 3048174801 3662503553 3138851612 2660143804
|
|
||||||
1663017612 1816683231 411916003 3887461314 2347044079
|
|
||||||
1015311755 1203592432 2170947766 2569420716 813872093
|
|
||||||
1105387678 1431142475 220570551 4243632715 4179591855
|
|
||||||
2607469131 3090613241 282341803 1734241730 1391822177
|
|
||||||
1001254810 827927915 1886687171 3935097347 2631788714
|
|
||||||
3905163266 110554195 2447955646 3717202975 3304793075
|
|
||||||
3739614479 3059127468 953919171 2590123714 1132511021
|
|
||||||
3795593679 2788030429 982155079 3472349556 859942552
|
|
||||||
2681007391 2299624053 647443547 233600422 608168955
|
|
||||||
3689327453 1849778220 1608438222 3968158357 2692977776
|
|
||||||
2851872572 246750393 3582818628 3329652309 4036366910
|
|
||||||
1012970930 950780808 3959768744 2538550045 191422718
|
|
||||||
2658142375 3276369011 2927737484 1234200027 1920815603
|
|
||||||
3536074689 1535612501 2184142071 3276955054 428488088
|
|
||||||
2378411984 4059769550 3913744741 2732139246 64369859
|
|
||||||
3755670074 842839565 2819894466 2414718973 1010060670
|
|
||||||
1839715346 2410311136 152774329 3485009480 4102101512
|
|
||||||
2852724304 879944024 1785007662 2748284463 1354768064
|
|
||||||
3267784736 2269127717 3001240761 3179796763 895723219
|
|
||||||
865924942 4291570937 89355264 1471026971 4114180745
|
|
||||||
3201939751 2867476999 2460866060 3603874571 2238880432
|
|
||||||
3308416168 2072246611 2755653839 3773737248 1709066580
|
|
||||||
4282731467 2746170170 2832568330 433439009 3175778732
|
|
||||||
26248366 2551382801 183214346 3893339516 1928168445
|
|
||||||
1337157619 3429096554 3275170900 1782047316 4264403756
|
|
||||||
1876594403 4289659572 3223834894 1728705513 4068244734
|
|
||||||
2867840287 1147798696 302879820 1730407747 1923824407
|
|
||||||
1180597908 1569786639 198796327 560793173 2107345620
|
|
||||||
2705990316 3448772106 3678374155 758635715 884524671
|
|
||||||
486356516 1774865603 3881226226 2635213607 1181121587
|
|
||||||
1508809820 3178988241 1594193633 1235154121 326117244
|
|
||||||
2304031425 937054774 2687415945 3192389340 2003740439
|
|
||||||
1823766188 2759543402 10067710 1533252662 4132494984
|
|
||||||
82378136 420615890 3467563163 541562091 3535949864
|
|
||||||
2277319197 3330822853 3215654174 4113831979 4204996991
|
|
||||||
2162248333 3255093522 2219088909 2978279037 255818579
|
|
||||||
2859348628 3097280311 2569721123 1861951120 2907080079
|
|
||||||
2719467166 998319094 2521935127 2404125338 259456032
|
|
||||||
2086860995 1839848496 1893547357 2527997525 1489393124
|
|
||||||
2860855349 76448234 2264934035 744914583 2586791259
|
|
||||||
1385380501 66529922 1819103258 1899300332 2098173828
|
|
||||||
1793831094 276463159 360132945 4178212058 595015228
|
|
||||||
177071838 2800080290 1573557746 1548998935 378454223
|
|
||||||
1460534296 1116274283 3112385063 3709761796 827999348
|
|
||||||
3580042847 1913901014 614021289 4278528023 1905177404
|
|
||||||
45407939 3298183234 1184848810 3644926330 3923635459
|
|
||||||
1627046213 3677876759 969772772 1160524753 1522441192
|
|
||||||
452369933 1527502551 832490847 1003299676 1071381111
|
|
||||||
2891255476 973747308 4086897108 1847554542 3895651598
|
|
||||||
2227820339 1621250941 2881344691 3583565821 3510404498
|
|
||||||
849362119 862871471 797858058 2867774932 2821282612
|
|
||||||
3272403146 3997979905 209178708 1805135652 6783381
|
|
||||||
2823361423 792580494 4263749770 776439581 3798193823
|
|
||||||
2853444094 2729507474 1071873341 1329010206 1289336450
|
|
||||||
3327680758 2011491779 80157208 922428856 1158943220
|
|
||||||
1667230961 2461022820 2608845159 387516115 3345351910
|
|
||||||
1495629111 4098154157 3156649613 3525698599 4134908037
|
|
||||||
446713264 2137537399 3617403512 813966752 1157943946
|
|
||||||
3734692965 1680301658 3180398473 3509854711 2228114612
|
|
||||||
1008102291 486805123 863791847 3189125290 1050308116
|
|
||||||
3777341526 4291726501 844061465 1347461791 2826481581
|
|
||||||
745465012 2055805750 4260209475 2386693097 2980646741
|
|
||||||
447229436 2077782664 1232942813 4023002732 1399011509
|
|
||||||
3140569849 2579909222 3794857471 900758066 2887199683
|
|
||||||
1720257997 3367494931 2668921229 955539029 3818726432
|
|
||||||
1105704962 3889207255 2277369307 2746484505 1761846513
|
|
||||||
2413916784 2685127085 4240257943 1166726899 4215215715
|
|
||||||
3082092067 3960461946 1663304043 2087473241 4162589986
|
|
||||||
2507310778 1579665506 767234210 970676017 492207530
|
|
||||||
1441679602 1314785090 3262202570 3417091742 1561989210
|
|
||||||
3011406780 1146609202 3262321040 1374872171 1634688712
|
|
||||||
1280458888 2230023982 419323804 3262899800 39783310
|
|
||||||
1641619040 1700368658 2207946628 2571300939 2424079766
|
|
||||||
780290914 2715195096 3390957695 163151474 2309534542
|
|
||||||
1860018424 555755123 280320104 1604831083 2713022383
|
|
||||||
1728987441 3639955502 623065489 3828630947 4275479050
|
|
||||||
3516347383 2343951195 2430677756 635534992 3868699749
|
|
||||||
808442435 3070644069 4282166003 2093181383 2023555632
|
|
||||||
1568662086 3422372620 4134522350 3016979543 3259320234
|
|
||||||
2888030729 3185253876 4258779643 1267304371 1022517473
|
|
||||||
815943045 929020012 2995251018 3371283296 3608029049
|
|
||||||
2018485115 122123397 2810669150 1411365618 1238391329
|
|
||||||
1186786476 3155969091 2242941310 1765554882 279121160
|
|
||||||
4279838515 1641578514 3796324015 13351065 103516986
|
|
||||||
1609694427 551411743 2493771609 1316337047 3932650856
|
|
||||||
4189700203 463397996 2937735066 1855616529 2626847990
|
|
||||||
55091862 3823351211 753448970 4045045500 1274127772
|
|
||||||
1124182256 92039808 2126345552 425973257 386287896
|
|
||||||
2589870191 1987762798 4084826973 2172456685 3366583455
|
|
||||||
3602966653 2378803535 2901764433 3716929006 3710159000
|
|
||||||
2653449155 3469742630 3096444476 3932564653 2595257433
|
|
||||||
318974657 3146202484 853571438 144400272 3768408841
|
|
||||||
782634401 2161109003 570039522 1886241521 14249488
|
|
||||||
2230804228 1604941699 3928713335 3921942509 2155806892
|
|
||||||
134366254 430507376 1924011722 276713377 196481886
|
|
||||||
3614810992 1610021185 1785757066 851346168 3761148643
|
|
||||||
2918835642 3364422385 3012284466 3735958851 2643153892
|
|
||||||
3778608231 1164289832 205853021 2876112231 3503398282
|
|
||||||
3078397001 3472037921 1748894853 2740861475 316056182
|
|
||||||
1660426908 168885906 956005527 3984354789 566521563
|
|
||||||
1001109523 1216710575 2952284757 3834433081 3842608301
|
|
||||||
2467352408 3974441264 3256601745 1409353924 1329904859
|
|
||||||
2307560293 3125217879 3622920184 3832785684 3882365951
|
|
||||||
2308537115 2659155028 1450441945 3532257603 3186324194
|
|
||||||
1225603425 1124246549 175808705 3009142319 2796710159
|
|
||||||
3651990107 160762750 1902254979 1698648476 1134980669
|
|
||||||
497144426 3302689335 4057485630 3603530763 4087252587
|
|
||||||
427812652 286876201 823134128 1627554964 3745564327
|
|
||||||
2589226092 4202024494 62878473 3275585894 3987124064
|
|
||||||
2791777159 1916869511 2585861905 1375038919 1403421920
|
|
||||||
60249114 3811870450 3021498009 2612993202 528933105
|
|
||||||
2757361321 3341402964 2621861700 273128190 4015252178
|
|
||||||
3094781002 1621621288 2337611177 1796718448 1258965619
|
|
||||||
4241913140 2138560392 3022190223 4174180924 450094611
|
|
||||||
3274724580 617150026 2704660665 1469700689 1341616587
|
|
||||||
356715071 1188789960 2278869135 1766569160 2795896635
|
|
||||||
57824704 2893496380 1235723989 1630694347 3927960522
|
|
||||||
428891364 1814070806 2287999787 4125941184 3968103889
|
|
||||||
3548724050 1025597707 1404281500 2002212197 92429143
|
|
||||||
2313943944 2403086080 3006180634 3561981764 1671860914
|
|
||||||
1768520622 1803542985 844848113 3006139921 1410888995
|
|
||||||
1157749833 2125704913 1789979528 1799263423 741157179
|
|
||||||
2405862309 767040434 2655241390 3663420179 2172009096
|
|
||||||
2511931187 1680542666 231857466 1154981000 157168255
|
|
||||||
1454112128 3505872099 1929775046 2309422350 2143329496
|
|
||||||
2960716902 407610648 2938108129 2581749599 538837155
|
|
||||||
2342628867 430543915 740188568 1937713272 3315215132
|
|
||||||
2085587024 4030765687 766054429 3517641839 689721775
|
|
||||||
1294158986 1753287754 4202601348 1974852792 33459103
|
|
||||||
3568087535 3144677435 1686130825 4134943013 3005738435
|
|
||||||
3599293386 426570142 754104406 3660892564 1964545167
|
|
||||||
829466833 821587464 1746693036 1006492428 1595312919
|
|
||||||
1256599985 1024482560 1897312280 2902903201 691790057
|
|
||||||
1037515867 3176831208 1968401055 2173506824 1089055278
|
|
||||||
1748401123 2941380082 968412354 1818753861 2973200866
|
|
||||||
3875951774 1119354008 3988604139 1647155589 2232450826
|
|
||||||
3486058011 3655784043 3759258462 847163678 1082052057
|
|
||||||
989516446 2871541755 3196311070 3929963078 658187585
|
|
||||||
3664944641 2175149170 2203709147 2756014689 2456473919
|
|
||||||
3890267390 1293787864 2830347984 3059280931 4158802520
|
|
||||||
1561677400 2586570938 783570352 1355506163 31495586
|
|
||||||
3789437343 3340549429 2092501630 896419368 671715824
|
|
||||||
3530450081 3603554138 1055991716 3442308219 1499434728
|
|
||||||
3130288473 3639507000 17769680 2259741420 487032199
|
|
||||||
4227143402 3693771256 1880482820 3924810796 381462353
|
|
||||||
4017855991 2452034943 2736680833 2209866385 2128986379
|
|
||||||
437874044 595759426 641721026 1636065708 3899136933
|
|
||||||
629879088 3591174506 351984326 2638783544 2348444281
|
|
||||||
2341604660 2123933692 143443325 1525942256 364660499
|
|
||||||
599149312 939093251 1523003209 106601097 376589484
|
|
||||||
1346282236 1297387043 764598052 3741218111 933457002
|
|
||||||
1886424424 3219631016 525405256 3014235619 323149677
|
|
||||||
2038881721 4100129043 2851715101 2984028078 1888574695
|
|
||||||
2014194741 3515193880 4180573530 3461824363 2641995497
|
|
||||||
3179230245 2902294983 2217320456 4040852155 1784656905
|
|
||||||
3311906931 87498458 2752971818 2635474297 2831215366
|
|
||||||
3682231106 2920043893 3772929704 2816374944 309949752
|
|
||||||
2383758854 154870719 385111597 1191604312 1840700563
|
|
||||||
872191186 2925548701 1310412747 2102066999 1504727249
|
|
||||||
3574298750 1191230036 3330575266 3180292097 3539347721
|
|
||||||
681369118 3305125752 3648233597 950049240 4173257693
|
|
||||||
1760124957 512151405 681175196 580563018 1169662867
|
|
||||||
4015033554 2687781101 699691603 2673494188 1137221356
|
|
||||||
123599888 472658308 1053598179 1012713758 3481064843
|
|
||||||
3759461013 3981457956 3830587662 1877191791 3650996736
|
|
||||||
988064871 3515461600 4089077232 2225147448 1249609188
|
|
||||||
2643151863 3896204135 2416995901 1397735321 3460025646
|
|
||||||
|
|
||||||
1000 outputs of genrand_real2()
|
|
||||||
0.76275443 0.99000644 0.98670464 0.10143112 0.27933125
|
|
||||||
0.69867227 0.94218740 0.03427201 0.78842173 0.28180608
|
|
||||||
0.92179002 0.20785655 0.54534773 0.69644020 0.38107718
|
|
||||||
0.23978165 0.65286910 0.07514568 0.22765211 0.94872929
|
|
||||||
0.74557914 0.62664415 0.54708246 0.90959343 0.42043116
|
|
||||||
0.86334511 0.19189126 0.14718544 0.70259889 0.63426346
|
|
||||||
0.77408121 0.04531601 0.04605807 0.88595519 0.69398270
|
|
||||||
0.05377184 0.61711170 0.05565708 0.10133577 0.41500776
|
|
||||||
0.91810699 0.22320679 0.23353705 0.92871862 0.98897234
|
|
||||||
0.19786706 0.80558809 0.06961067 0.55840445 0.90479405
|
|
||||||
0.63288060 0.95009721 0.54948447 0.20645042 0.45000959
|
|
||||||
0.87050869 0.70806991 0.19406895 0.79286390 0.49332866
|
|
||||||
0.78483914 0.75145146 0.12341941 0.42030252 0.16728160
|
|
||||||
0.59906494 0.37575460 0.97815160 0.39815952 0.43595080
|
|
||||||
0.04952478 0.33917805 0.76509902 0.61034321 0.90654701
|
|
||||||
0.92915732 0.85365931 0.18812377 0.65913428 0.28814566
|
|
||||||
0.59476081 0.27835931 0.60722542 0.68310435 0.69387186
|
|
||||||
0.03699800 0.65897714 0.17527003 0.02889304 0.86777366
|
|
||||||
0.12352068 0.91439461 0.32022990 0.44445731 0.34903686
|
|
||||||
0.74639273 0.65918367 0.92492794 0.31872642 0.77749724
|
|
||||||
0.85413832 0.76385624 0.32744211 0.91326300 0.27458185
|
|
||||||
0.22190155 0.19865383 0.31227402 0.85321225 0.84243342
|
|
||||||
0.78544200 0.71854080 0.92503892 0.82703064 0.88306297
|
|
||||||
0.47284073 0.70059042 0.48003761 0.38671694 0.60465770
|
|
||||||
0.41747204 0.47163243 0.72750808 0.65830223 0.10955369
|
|
||||||
0.64215401 0.23456345 0.95944940 0.72822249 0.40888451
|
|
||||||
0.69980355 0.26677428 0.57333635 0.39791582 0.85377858
|
|
||||||
0.76962816 0.72004885 0.90903087 0.51376506 0.37732665
|
|
||||||
0.12691640 0.71249738 0.81217908 0.37037313 0.32772374
|
|
||||||
0.14238259 0.05614811 0.74363008 0.39773267 0.94859135
|
|
||||||
0.31452454 0.11730313 0.62962618 0.33334237 0.45547255
|
|
||||||
0.10089665 0.56550662 0.60539371 0.16027624 0.13245301
|
|
||||||
0.60959939 0.04671662 0.99356286 0.57660859 0.40269560
|
|
||||||
0.45274629 0.06699735 0.85064246 0.87742744 0.54508392
|
|
||||||
0.87242982 0.29321385 0.67660627 0.68230715 0.79052073
|
|
||||||
0.48592054 0.25186266 0.93769755 0.28565487 0.47219067
|
|
||||||
0.99054882 0.13155240 0.47110470 0.98556600 0.84397623
|
|
||||||
0.12875246 0.90953202 0.49129015 0.23792727 0.79481194
|
|
||||||
0.44337770 0.96564297 0.67749118 0.55684872 0.27286897
|
|
||||||
0.79538393 0.61965356 0.22487929 0.02226018 0.49248200
|
|
||||||
0.42247006 0.91797788 0.99250134 0.23449967 0.52531508
|
|
||||||
0.10246337 0.78685622 0.34310922 0.89892996 0.40454552
|
|
||||||
0.68608407 0.30752487 0.83601319 0.54956031 0.63777550
|
|
||||||
0.82199797 0.24890696 0.48801123 0.48661910 0.51223987
|
|
||||||
0.32969635 0.31075073 0.21393155 0.73453207 0.15565705
|
|
||||||
0.58584522 0.28976728 0.97621478 0.61498701 0.23891470
|
|
||||||
0.28518540 0.46809591 0.18371914 0.37597910 0.13492176
|
|
||||||
0.66849449 0.82811466 0.56240330 0.37548956 0.27562998
|
|
||||||
0.27521910 0.74096121 0.77176757 0.13748143 0.99747138
|
|
||||||
0.92504502 0.09175241 0.21389176 0.21766512 0.31183245
|
|
||||||
0.23271221 0.21207367 0.57903312 0.77523344 0.13242613
|
|
||||||
0.31037988 0.01204835 0.71652949 0.84487594 0.14982178
|
|
||||||
0.57423142 0.45677888 0.48420169 0.53465428 0.52667473
|
|
||||||
0.46880526 0.49849733 0.05670710 0.79022476 0.03872047
|
|
||||||
0.21697212 0.20443086 0.28949326 0.81678186 0.87629474
|
|
||||||
0.92297064 0.27373097 0.84625273 0.51505586 0.00582792
|
|
||||||
0.33295971 0.91848412 0.92537226 0.91760033 0.07541125
|
|
||||||
0.71745848 0.61158698 0.00941650 0.03135554 0.71527471
|
|
||||||
0.24821915 0.63636652 0.86159918 0.26450229 0.60160194
|
|
||||||
0.35557725 0.24477500 0.07186456 0.51757096 0.62120362
|
|
||||||
0.97981062 0.69954667 0.21065616 0.13382753 0.27693186
|
|
||||||
0.59644095 0.71500764 0.04110751 0.95730081 0.91600724
|
|
||||||
0.47704678 0.26183479 0.34706971 0.07545431 0.29398385
|
|
||||||
0.93236070 0.60486023 0.48015011 0.08870451 0.45548581
|
|
||||||
0.91872718 0.38142712 0.10668643 0.01397541 0.04520355
|
|
||||||
0.93822273 0.18011940 0.57577277 0.91427606 0.30911399
|
|
||||||
0.95853475 0.23611214 0.69619891 0.69601980 0.76765372
|
|
||||||
0.58515930 0.49479057 0.11288752 0.97187699 0.32095365
|
|
||||||
0.57563608 0.40760618 0.78703383 0.43261152 0.90877651
|
|
||||||
0.84686346 0.10599030 0.72872803 0.19315490 0.66152912
|
|
||||||
0.10210518 0.06257876 0.47950688 0.47062066 0.72701157
|
|
||||||
0.48915116 0.66110261 0.60170685 0.24516994 0.12726050
|
|
||||||
0.03451185 0.90864994 0.83494878 0.94800035 0.91035206
|
|
||||||
0.14480751 0.88458997 0.53498312 0.15963215 0.55378627
|
|
||||||
0.35171349 0.28719791 0.09097957 0.00667896 0.32309622
|
|
||||||
0.87561479 0.42534520 0.91748977 0.73908457 0.41793223
|
|
||||||
0.99279792 0.87908370 0.28458072 0.59132853 0.98672190
|
|
||||||
0.28547393 0.09452165 0.89910674 0.53681109 0.37931425
|
|
||||||
0.62683489 0.56609740 0.24801549 0.52948179 0.98328855
|
|
||||||
0.66403523 0.55523786 0.75886666 0.84784685 0.86829981
|
|
||||||
0.71448906 0.84670080 0.43922919 0.20771016 0.64157936
|
|
||||||
0.25664246 0.73055695 0.86395782 0.65852932 0.99061803
|
|
||||||
0.40280575 0.39146298 0.07291005 0.97200603 0.20555729
|
|
||||||
0.59616495 0.08138254 0.45796388 0.33681125 0.33989127
|
|
||||||
0.18717090 0.53545811 0.60550838 0.86520709 0.34290701
|
|
||||||
0.72743276 0.73023855 0.34195926 0.65019733 0.02765254
|
|
||||||
0.72575740 0.32709576 0.03420866 0.26061893 0.56997511
|
|
||||||
0.28439072 0.84422744 0.77637570 0.55982168 0.06720327
|
|
||||||
0.58449067 0.71657369 0.15819609 0.58042821 0.07947911
|
|
||||||
0.40193792 0.11376012 0.88762938 0.67532159 0.71223735
|
|
||||||
0.27829114 0.04806073 0.21144026 0.58830274 0.04140071
|
|
||||||
0.43215628 0.12952729 0.94668759 0.87391019 0.98382450
|
|
||||||
0.27750768 0.90849647 0.90962737 0.59269720 0.96102026
|
|
||||||
0.49544979 0.32007095 0.62585546 0.03119821 0.85953001
|
|
||||||
0.22017528 0.05834068 0.80731217 0.53799961 0.74166948
|
|
||||||
0.77426600 0.43938444 0.54862081 0.58575513 0.15886492
|
|
||||||
0.73214332 0.11649057 0.77463977 0.85788827 0.17061997
|
|
||||||
0.66838056 0.96076133 0.07949296 0.68521946 0.89986254
|
|
||||||
0.05667410 0.12741385 0.83470977 0.63969104 0.46612929
|
|
||||||
0.10200126 0.01194925 0.10476340 0.90285217 0.31221221
|
|
||||||
0.32980614 0.46041971 0.52024973 0.05425470 0.28330912
|
|
||||||
0.60426543 0.00598243 0.97244013 0.21135841 0.78561597
|
|
||||||
0.78428734 0.63422849 0.32909934 0.44771136 0.27380750
|
|
||||||
0.14966697 0.18156268 0.65686758 0.28726350 0.97074787
|
|
||||||
0.63676171 0.96649494 0.24526295 0.08297372 0.54257548
|
|
||||||
0.03166785 0.33735355 0.15946671 0.02102971 0.46228045
|
|
||||||
0.11892296 0.33408336 0.29875681 0.29847692 0.73767569
|
|
||||||
0.02080745 0.62980060 0.08082293 0.22993106 0.25031439
|
|
||||||
0.87787525 0.45150053 0.13673441 0.63407612 0.97907688
|
|
||||||
0.52241942 0.50580158 0.06273902 0.05270283 0.77031811
|
|
||||||
0.05113352 0.24393329 0.75036441 0.37436336 0.22877652
|
|
||||||
0.59975358 0.85707591 0.88691457 0.85547165 0.36641027
|
|
||||||
0.58720133 0.45462835 0.09243817 0.32981586 0.07820411
|
|
||||||
0.25421519 0.36004706 0.60092307 0.46192412 0.36758683
|
|
||||||
0.98424170 0.08019934 0.68594024 0.45826386 0.29962317
|
|
||||||
0.79365413 0.89231296 0.49478547 0.87645944 0.23590734
|
|
||||||
0.28106737 0.75026285 0.08136314 0.79582424 0.76010628
|
|
||||||
0.82792971 0.27947652 0.72482861 0.82191216 0.46171689
|
|
||||||
0.79189752 0.96043686 0.51609668 0.88995725 0.28998963
|
|
||||||
0.55191845 0.03934737 0.83033700 0.49553013 0.98009549
|
|
||||||
0.19017594 0.98347750 0.33452066 0.87144372 0.72106301
|
|
||||||
0.71272114 0.71465963 0.88361677 0.85571283 0.73782329
|
|
||||||
0.20920458 0.34855153 0.46766817 0.02780062 0.74898344
|
|
||||||
0.03680650 0.44866557 0.77426312 0.91025891 0.25195236
|
|
||||||
0.87319953 0.63265037 0.25552148 0.27422476 0.95217406
|
|
||||||
0.39281839 0.66441573 0.09158900 0.94515992 0.07800798
|
|
||||||
0.02507888 0.39901462 0.17382573 0.12141278 0.85502334
|
|
||||||
0.19902911 0.02160210 0.44460522 0.14688742 0.68020336
|
|
||||||
0.71323733 0.60922473 0.95400380 0.99611159 0.90897777
|
|
||||||
0.41073520 0.66206647 0.32064685 0.62805003 0.50677209
|
|
||||||
0.52690101 0.87473387 0.73918362 0.39826974 0.43683919
|
|
||||||
0.80459118 0.32422684 0.01958019 0.95319576 0.98326137
|
|
||||||
0.83931735 0.69060863 0.33671416 0.68062550 0.65152380
|
|
||||||
0.33392969 0.03451730 0.95227244 0.68200635 0.85074171
|
|
||||||
0.64721009 0.51234433 0.73402047 0.00969637 0.93835057
|
|
||||||
0.80803854 0.31485260 0.20089527 0.01323282 0.59933780
|
|
||||||
0.31584602 0.20209563 0.33754800 0.68604181 0.24443049
|
|
||||||
0.19952227 0.78162632 0.10336988 0.11360736 0.23536740
|
|
||||||
0.23262256 0.67803776 0.48749791 0.74658435 0.92156640
|
|
||||||
0.56706407 0.36683221 0.99157136 0.23421374 0.45183767
|
|
||||||
0.91609720 0.85573315 0.37706276 0.77042618 0.30891908
|
|
||||||
0.40709595 0.06944866 0.61342849 0.88817388 0.58734506
|
|
||||||
0.98711323 0.14744128 0.63242656 0.87704136 0.68347125
|
|
||||||
0.84446569 0.43265239 0.25146321 0.04130111 0.34259839
|
|
||||||
0.92697368 0.40878778 0.56990338 0.76204273 0.19820348
|
|
||||||
0.66314909 0.02482844 0.06669207 0.50205581 0.26084093
|
|
||||||
0.65139159 0.41650223 0.09733904 0.56344203 0.62651696
|
|
||||||
0.67332139 0.58037374 0.47258086 0.21010758 0.05713135
|
|
||||||
0.89390629 0.10781246 0.32037450 0.07628388 0.34227964
|
|
||||||
0.42190597 0.58201860 0.77363549 0.49595133 0.86031236
|
|
||||||
0.83906769 0.81098161 0.26694195 0.14215941 0.88210306
|
|
||||||
0.53634237 0.12090720 0.82480459 0.75930318 0.31847147
|
|
||||||
0.92768077 0.01037616 0.56201727 0.88107122 0.35925856
|
|
||||||
0.85860762 0.61109408 0.70408301 0.58434977 0.92192494
|
|
||||||
0.62667915 0.75988365 0.06858761 0.36156496 0.58057195
|
|
||||||
0.13636150 0.57719713 0.59340255 0.63530602 0.22976282
|
|
||||||
0.71915530 0.41162531 0.63979565 0.09931342 0.79344045
|
|
||||||
0.10893790 0.84450224 0.23122236 0.99485593 0.73637397
|
|
||||||
0.17276368 0.13357764 0.74965804 0.64991737 0.61990341
|
|
||||||
0.41523170 0.05878239 0.05687301 0.05497131 0.42868366
|
|
||||||
0.42571090 0.25810502 0.89642955 0.30439758 0.39310223
|
|
||||||
0.11357431 0.04288255 0.23397550 0.11200634 0.85621396
|
|
||||||
0.89733974 0.37508865 0.42077265 0.68597384 0.72781399
|
|
||||||
0.19296476 0.61699087 0.31667128 0.67756410 0.00177323
|
|
||||||
0.05725176 0.79474693 0.18885238 0.06724856 0.68193156
|
|
||||||
0.42202167 0.22082041 0.28554673 0.64995708 0.87851940
|
|
||||||
0.29124547 0.61009521 0.87374537 0.05743712 0.69902994
|
|
||||||
0.81925115 0.45653873 0.37236821 0.31118709 0.52734307
|
|
||||||
0.39672836 0.38185294 0.30163915 0.17374510 0.04913278
|
|
||||||
0.90404879 0.25742801 0.58266467 0.97663209 0.79823377
|
|
||||||
0.36437958 0.15206043 0.26529938 0.22690047 0.05839021
|
|
||||||
0.84721160 0.18622435 0.37809403 0.55706977 0.49828704
|
|
||||||
0.47659049 0.24289680 0.88477595 0.07807463 0.56245739
|
|
||||||
0.73490635 0.21099431 0.13164942 0.75840044 0.66877037
|
|
||||||
0.28988183 0.44046090 0.24967434 0.80048356 0.26029740
|
|
||||||
0.30416821 0.64151867 0.52067892 0.12880774 0.85465381
|
|
||||||
0.02690525 0.19149288 0.49630295 0.79682619 0.43566145
|
|
||||||
0.00288078 0.81484193 0.03763639 0.68529083 0.01339574
|
|
||||||
0.38405386 0.30537067 0.22994703 0.44000045 0.27217985
|
|
||||||
0.53831243 0.02870435 0.86282045 0.61831306 0.09164956
|
|
||||||
0.25609707 0.07445781 0.72185784 0.90058883 0.30070608
|
|
||||||
0.94476583 0.56822213 0.21933909 0.96772793 0.80063440
|
|
||||||
0.26307906 0.31183306 0.16501252 0.55436179 0.68562285
|
|
||||||
0.23829083 0.86511559 0.57868991 0.81888344 0.20126869
|
|
||||||
0.93172350 0.66028129 0.21786948 0.78515828 0.10262106
|
|
||||||
0.35390326 0.79303876 0.63427924 0.90479631 0.31024934
|
|
||||||
0.60635447 0.56198079 0.63573813 0.91854197 0.99701497
|
|
||||||
0.83085849 0.31692291 0.01925964 0.97446405 0.98751283
|
|
||||||
0.60944293 0.13751018 0.69519957 0.68956636 0.56969015
|
|
||||||
0.46440193 0.88341765 0.36754434 0.89223647 0.39786427
|
|
||||||
0.85055280 0.12749961 0.79452122 0.89449784 0.14567830
|
|
||||||
0.45716830 0.74822309 0.28200437 0.42546044 0.17464886
|
|
||||||
0.68308746 0.65496587 0.52935411 0.12736159 0.61523955
|
|
||||||
0.81590528 0.63107864 0.39786553 0.20102294 0.53292914
|
|
||||||
0.75485590 0.59847044 0.32861691 0.12125866 0.58917183
|
|
||||||
0.07638293 0.86845380 0.29192617 0.03989733 0.52180460
|
|
||||||
0.32503407 0.64071852 0.69516575 0.74254998 0.54587026
|
|
||||||
0.48713246 0.32920155 0.08719954 0.63497059 0.54328459
|
|
||||||
0.64178757 0.45583809 0.70694291 0.85212760 0.86074305
|
|
||||||
0.33163422 0.85739792 0.59908488 0.74566046 0.72157152
|
|
||||||
158
3rdparty/mt19937ar/mt19937ar.vcxproj
vendored
158
3rdparty/mt19937ar/mt19937ar.vcxproj
vendored
@@ -1,158 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="mt19937ar.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="mt19937ar.c" />
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}</ProjectGuid>
|
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
<RootNamespace>mt19937ar</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<OutDir>$(SolutionDir).vs\build\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<OutDir>$(SolutionDir).vs\build\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<OutDir>$(SolutionDir).vs\build\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<OutDir>$(SolutionDir).vs\build\</OutDir>
|
|
||||||
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
||||||
23
3rdparty/mt19937ar/mt19937ar.vcxproj.filters
vendored
23
3rdparty/mt19937ar/mt19937ar.vcxproj.filters
vendored
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="mt19937ar.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="mt19937ar.c">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
65
3rdparty/mt19937ar/mtTest.c
vendored
65
3rdparty/mt19937ar/mtTest.c
vendored
@@ -1,65 +0,0 @@
|
|||||||
/*
|
|
||||||
A C-program for MT19937, with initialization improved 2002/1/26.
|
|
||||||
Coded by Takuji Nishimura and Makoto Matsumoto.
|
|
||||||
|
|
||||||
Before using, initialize the state by using init_genrand(seed)
|
|
||||||
or init_by_array(init_key, key_length).
|
|
||||||
|
|
||||||
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
|
||||||
All rights reserved.
|
|
||||||
Copyright (C) 2005, Mutsuo Saito,
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. The names of its contributors may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
|
|
||||||
Any feedback is very welcome.
|
|
||||||
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
|
|
||||||
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "mt19937ar.h"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
unsigned long init[4]={0x123, 0x234, 0x345, 0x456}, length=4;
|
|
||||||
init_by_array(init, length);
|
|
||||||
printf("1000 outputs of genrand_int32()\n");
|
|
||||||
for (i=0; i<1000; i++) {
|
|
||||||
printf("%10lu ", genrand_int32());
|
|
||||||
if (i%5==4) printf("\n");
|
|
||||||
}
|
|
||||||
printf("\n1000 outputs of genrand_real2()\n");
|
|
||||||
for (i=0; i<1000; i++) {
|
|
||||||
printf("%10.8f ", genrand_real2());
|
|
||||||
if (i%5==4) printf("\n");
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
79
3rdparty/mt19937ar/readme-mt.txt
vendored
79
3rdparty/mt19937ar/readme-mt.txt
vendored
@@ -1,79 +0,0 @@
|
|||||||
This is a Mersenne Twister pseudorandom number generator
|
|
||||||
with period 2^19937-1 with improved initialization scheme,
|
|
||||||
modified on 2002/1/26 by Takuji Nishimura and Makoto Matsumoto.
|
|
||||||
modified on 2005/4/26 by Mutsuo Saito
|
|
||||||
|
|
||||||
Contents of this tar ball:
|
|
||||||
readme-mt.txt this file
|
|
||||||
mt19937ar.c the C source (ar: initialize by ARray)
|
|
||||||
mt19937ar.h the C header file for mt19937ar
|
|
||||||
mtTest.c the C test main program of mt19937ar.c
|
|
||||||
mt19937ar.out Test outputs of six types generators. 1000 for each
|
|
||||||
|
|
||||||
1. Initialization
|
|
||||||
The initialization scheme for the previous versions of MT
|
|
||||||
(e.g. 1999/10/28 version or earlier) has a tiny problem, that
|
|
||||||
the most significant bits of the seed is not well reflected
|
|
||||||
to the state vector of MT.
|
|
||||||
|
|
||||||
This version (2002/1/26) has two initialization schemes:
|
|
||||||
init_genrand(seed) and init_by_array(init_key, key_length).
|
|
||||||
|
|
||||||
init_genrand(seed) initializes the state vector by using
|
|
||||||
one unsigned 32-bit integer "seed", which may be zero.
|
|
||||||
|
|
||||||
init_by_array(init_key, key_length) initializes the state vector
|
|
||||||
by using an array init_key[] of unsigned 32-bit integers
|
|
||||||
of length key_kength. If key_length is smaller than 624,
|
|
||||||
then each array of 32-bit integers gives distinct initial
|
|
||||||
state vector. This is useful if you want a larger seed space
|
|
||||||
than 32-bit word.
|
|
||||||
|
|
||||||
2. Generation
|
|
||||||
After initialization, the following type of pseudorandom numbers
|
|
||||||
are available.
|
|
||||||
|
|
||||||
genrand_int32() generates unsigned 32-bit integers.
|
|
||||||
genrand_int31() generates unsigned 31-bit integers.
|
|
||||||
genrand_real1() generates uniform real in [0,1] (32-bit resolution).
|
|
||||||
genrand_real2() generates uniform real in [0,1) (32-bit resolution).
|
|
||||||
genrand_real3() generates uniform real in (0,1) (32-bit resolution).
|
|
||||||
genrand_res53() generates uniform real in [0,1) with 53-bit resolution.
|
|
||||||
|
|
||||||
Note: the last five functions call the first one.
|
|
||||||
if you need more speed for these five functions, you may
|
|
||||||
suppress the function call by copying genrand_int32() and
|
|
||||||
replacing the last return(), following to these five functions.
|
|
||||||
|
|
||||||
3. main()
|
|
||||||
main() is an example to initialize with an array of length 4,
|
|
||||||
then 1000 outputs of unsigned 32-bit integers,
|
|
||||||
then 1000 outputs of real [0,1) numbers.
|
|
||||||
|
|
||||||
4. The outputs
|
|
||||||
The output of the mt19937ar.c is in the file mt19937ar.out.
|
|
||||||
If you revise or translate the code, check the output
|
|
||||||
by using this file.
|
|
||||||
|
|
||||||
5. Cryptography
|
|
||||||
This generator is not cryptoraphically secure.
|
|
||||||
You need to use a one-way (or hash) function to obtain
|
|
||||||
a secure random sequence.
|
|
||||||
|
|
||||||
6. Correspondence
|
|
||||||
See:
|
|
||||||
URL http://www.math.keio.ac.jp/matumoto/emt.html
|
|
||||||
email matumoto@math.keio.ac.jp, nisimura@sci.kj.yamagata-u.ac.jp
|
|
||||||
|
|
||||||
7. Reference
|
|
||||||
M. Matsumoto and T. Nishimura,
|
|
||||||
"Mersenne Twister: A 623-Dimensionally Equidistributed Uniform
|
|
||||||
Pseudo-Random Number Generator",
|
|
||||||
ACM Transactions on Modeling and Computer Simulation,
|
|
||||||
Vol. 8, No. 1, January 1998, pp 3--30.
|
|
||||||
|
|
||||||
-------
|
|
||||||
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
|
||||||
All rights reserved.
|
|
||||||
Copyright (C) 2005, Mutsuo Saito
|
|
||||||
All rights reserved.
|
|
||||||
14
Makefile.in
14
Makefile.in
@@ -5,10 +5,10 @@ OMAP=@OMAP@
|
|||||||
ifeq ($(HAVE_MYSQL),yes)
|
ifeq ($(HAVE_MYSQL),yes)
|
||||||
ALL_DEPENDS=server tools
|
ALL_DEPENDS=server tools
|
||||||
SERVER_DEPENDS=common login char map import
|
SERVER_DEPENDS=common login char map import
|
||||||
COMMON_DEPENDS=mt19937ar libconfig yaml-cpp
|
COMMON_DEPENDS=libconfig yaml-cpp
|
||||||
LOGIN_DEPENDS=mt19937ar libconfig common
|
LOGIN_DEPENDS=libconfig common
|
||||||
CHAR_DEPENDS=mt19937ar libconfig common yaml-cpp
|
CHAR_DEPENDS=libconfig common yaml-cpp
|
||||||
MAP_DEPENDS=mt19937ar libconfig common yaml-cpp
|
MAP_DEPENDS=libconfig common yaml-cpp
|
||||||
else
|
else
|
||||||
ALL_DEPENDS=needs_mysql
|
ALL_DEPENDS=needs_mysql
|
||||||
SERVER_DEPENDS=needs_mysql
|
SERVER_DEPENDS=needs_mysql
|
||||||
@@ -22,7 +22,6 @@ endif
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
.PHONY: all server sql \
|
.PHONY: all server sql \
|
||||||
common \
|
common \
|
||||||
mt19937ar \
|
|
||||||
login \
|
login \
|
||||||
char \
|
char \
|
||||||
map \
|
map \
|
||||||
@@ -50,9 +49,6 @@ char: $(CHAR_DEPENDS)
|
|||||||
map: $(MAP_DEPENDS)
|
map: $(MAP_DEPENDS)
|
||||||
@$(MAKE) -C src/map server
|
@$(MAKE) -C src/map server
|
||||||
|
|
||||||
mt19937ar:
|
|
||||||
@$(MAKE) -C 3rdparty/mt19937ar
|
|
||||||
|
|
||||||
libconfig:
|
libconfig:
|
||||||
@$(MAKE) -C 3rdparty/libconfig
|
@$(MAKE) -C 3rdparty/libconfig
|
||||||
|
|
||||||
@@ -79,7 +75,6 @@ import:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
@$(MAKE) -C src/common $@
|
@$(MAKE) -C src/common $@
|
||||||
@$(MAKE) -C 3rdparty/mt19937ar $@
|
|
||||||
@$(MAKE) -C 3rdparty/libconfig $@
|
@$(MAKE) -C 3rdparty/libconfig $@
|
||||||
@$(MAKE) -C 3rdparty/yaml-cpp $@
|
@$(MAKE) -C 3rdparty/yaml-cpp $@
|
||||||
@$(MAKE) -C src/login $@
|
@$(MAKE) -C src/login $@
|
||||||
@@ -91,7 +86,6 @@ help:
|
|||||||
@echo "most common targets are 'all' 'server' 'conf' 'clean' 'help'"
|
@echo "most common targets are 'all' 'server' 'conf' 'clean' 'help'"
|
||||||
@echo "possible targets are:"
|
@echo "possible targets are:"
|
||||||
@echo "'common' - builds object files used for the three servers"
|
@echo "'common' - builds object files used for the three servers"
|
||||||
@echo "'mt19937ar' - builds object file of Mersenne Twister MT19937"
|
|
||||||
@echo "'libconfig' - builds object files of libconfig"
|
@echo "'libconfig' - builds object files of libconfig"
|
||||||
@echo "'yaml-cpp' - builds object files of yaml-cpp"
|
@echo "'yaml-cpp' - builds object files of yaml-cpp"
|
||||||
@echo "'login' - builds login server"
|
@echo "'login' - builds login server"
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ chars_per_account: 0
|
|||||||
// Increase the value of MAX_CHARS if you want to increase vip_char_increase.
|
// Increase the value of MAX_CHARS if you want to increase vip_char_increase.
|
||||||
// Note: The amount of VIP characters = MAX_CHARS - chars_per_account.
|
// Note: The amount of VIP characters = MAX_CHARS - chars_per_account.
|
||||||
// Note 2: This setting must be set after chars_per_account.
|
// Note 2: This setting must be set after chars_per_account.
|
||||||
// -1 will default to MAX_CHAR_VIP (src/config/core.h)
|
// -1 will default to MAX_CHAR_VIP (src/config/core.hpp)
|
||||||
vip_char_increase: -1
|
vip_char_increase: -1
|
||||||
|
|
||||||
// Create accounts with limited time?
|
// Create accounts with limited time?
|
||||||
|
|||||||
5
configure
vendored
5
configure
vendored
@@ -584,7 +584,7 @@ PACKAGE_BUGREPORT=
|
|||||||
PACKAGE_URL=
|
PACKAGE_URL=
|
||||||
|
|
||||||
ac_unique_file="rAthena"
|
ac_unique_file="rAthena"
|
||||||
ac_unique_file="src/common/cbasetypes.h"
|
ac_unique_file="src/common/cbasetypes.hpp"
|
||||||
# Factoring default headers for most tests.
|
# Factoring default headers for most tests.
|
||||||
ac_includes_default="\
|
ac_includes_default="\
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -2736,7 +2736,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
|||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile src/common/Makefile"
|
ac_config_files="$ac_config_files Makefile src/common/Makefile"
|
||||||
|
|
||||||
ac_config_files="$ac_config_files 3rdparty/mt19937ar/Makefile 3rdparty/libconfig/Makefile 3rdparty/yaml-cpp/Makefile"
|
ac_config_files="$ac_config_files 3rdparty/libconfig/Makefile 3rdparty/yaml-cpp/Makefile"
|
||||||
|
|
||||||
ac_config_files="$ac_config_files src/char/Makefile src/login/Makefile"
|
ac_config_files="$ac_config_files src/char/Makefile src/login/Makefile"
|
||||||
|
|
||||||
@@ -7749,7 +7749,6 @@ do
|
|||||||
case $ac_config_target in
|
case $ac_config_target in
|
||||||
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||||
"src/common/Makefile") CONFIG_FILES="$CONFIG_FILES src/common/Makefile" ;;
|
"src/common/Makefile") CONFIG_FILES="$CONFIG_FILES src/common/Makefile" ;;
|
||||||
"3rdparty/mt19937ar/Makefile") CONFIG_FILES="$CONFIG_FILES 3rdparty/mt19937ar/Makefile" ;;
|
|
||||||
"3rdparty/libconfig/Makefile") CONFIG_FILES="$CONFIG_FILES 3rdparty/libconfig/Makefile" ;;
|
"3rdparty/libconfig/Makefile") CONFIG_FILES="$CONFIG_FILES 3rdparty/libconfig/Makefile" ;;
|
||||||
"3rdparty/yaml-cpp/Makefile") CONFIG_FILES="$CONFIG_FILES 3rdparty/yaml-cpp/Makefile" ;;
|
"3rdparty/yaml-cpp/Makefile") CONFIG_FILES="$CONFIG_FILES 3rdparty/yaml-cpp/Makefile" ;;
|
||||||
"src/char/Makefile") CONFIG_FILES="$CONFIG_FILES src/char/Makefile" ;;
|
"src/char/Makefile") CONFIG_FILES="$CONFIG_FILES src/char/Makefile" ;;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ AC_REVISION($Revision$)
|
|||||||
AC_PREREQ([2.59])
|
AC_PREREQ([2.59])
|
||||||
AC_LANG([C++])
|
AC_LANG([C++])
|
||||||
AC_LANG_COMPILER_REQUIRE
|
AC_LANG_COMPILER_REQUIRE
|
||||||
AC_CONFIG_SRCDIR([src/common/cbasetypes.h])
|
AC_CONFIG_SRCDIR([src/common/cbasetypes.hpp])
|
||||||
AC_CONFIG_FILES([Makefile src/common/Makefile])
|
AC_CONFIG_FILES([Makefile src/common/Makefile])
|
||||||
AC_CONFIG_FILES([3rdparty/mt19937ar/Makefile 3rdparty/libconfig/Makefile 3rdparty/yaml-cpp/Makefile])
|
AC_CONFIG_FILES([3rdparty/libconfig/Makefile 3rdparty/yaml-cpp/Makefile])
|
||||||
AC_CONFIG_FILES([src/char/Makefile src/login/Makefile])
|
AC_CONFIG_FILES([src/char/Makefile src/login/Makefile])
|
||||||
AC_CONFIG_FILES([src/map/Makefile src/tool/Makefile])
|
AC_CONFIG_FILES([src/map/Makefile src/tool/Makefile])
|
||||||
|
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ This mapflag can also be used to adjust the damage of one skill by a percentage:
|
|||||||
4 = against other (homunculus, mercenary, pet, elemental)
|
4 = against other (homunculus, mercenary, pet, elemental)
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- You MUST enable ADJUST_SKILL_DAMAGE in 'src/config/core.h' for this mapflag to take effect.
|
- You MUST enable ADJUST_SKILL_DAMAGE in 'src/config/core.hpp' for this mapflag to take effect.
|
||||||
- Each map can contain up to 5 adjustments (MAX_MAP_SKILL_MODIFIER in 'src/map/map.h').
|
- Each map can contain up to 5 adjustments (MAX_MAP_SKILL_MODIFIER in 'src/map/map.h').
|
||||||
|
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ The following list describes each module and its purpose.
|
|||||||
|
|
||||||
Module Description
|
Module Description
|
||||||
------ -----------
|
------ -----------
|
||||||
atomic adapter to atomic operations for Windows API
|
|
||||||
cbasetypes adapter to OS and arch specification (function name, bit representation)
|
cbasetypes adapter to OS and arch specification (function name, bit representation)
|
||||||
cli console Line Interface handling (get arguments from terminal at beginning and runtime)
|
cli console Line Interface handling (get arguments from terminal at beginning and runtime)
|
||||||
conf facade of libconfig api
|
conf facade of libconfig api
|
||||||
@@ -188,26 +187,18 @@ The following list describes each module and its purpose.
|
|||||||
db database module (create, parse, and destroy databases)
|
db database module (create, parse, and destroy databases)
|
||||||
des Data Encryption Standard algorithm modified for rAthena
|
des Data Encryption Standard algorithm modified for rAthena
|
||||||
ers Entry Reusage System to help memory allocation
|
ers Entry Reusage System to help memory allocation
|
||||||
evdp handles events
|
|
||||||
grfio handles *.grf files (searches for files in them and decodes them)
|
grfio handles *.grf files (searches for files in them and decodes them)
|
||||||
malloc handles runtime memory allocation (so that memory manager could check for leaks)
|
malloc handles runtime memory allocation (so that memory manager could check for leaks)
|
||||||
mapindex handles the processing and reading of the mapcache.dat
|
mapindex handles the processing and reading of the mapcache.dat
|
||||||
md5calc offers md5 encryption
|
md5calc offers md5 encryption
|
||||||
mempool handles shared memory pool for thread support
|
|
||||||
mmo.h common structures and defines across serv
|
mmo.h common structures and defines across serv
|
||||||
msg_conf handles msg in src from configuration
|
msg_conf handles msg in src from configuration
|
||||||
mutex handles Mutual exclusion (Mutex) for thread support
|
|
||||||
netbuffer iobuffer initialisation for thread support
|
|
||||||
network updated socket module, with ipv6 and thread support
|
|
||||||
nullpo checks and dumps info for debug mode
|
nullpo checks and dumps info for debug mode
|
||||||
raconf processes the conf files
|
|
||||||
random generation of random numbers
|
random generation of random numbers
|
||||||
showmsg display messages in console with a certain color
|
showmsg display messages in console with a certain color
|
||||||
socket handling of sockets (listening, close, open, etc.)
|
socket handling of sockets (listening, close, open, etc.)
|
||||||
spinlock handles synchronization (waiting loop) for thread support
|
|
||||||
sql.c MySQL database proxy
|
sql.c MySQL database proxy
|
||||||
strlib.c string handling
|
strlib.c string handling
|
||||||
thread.c thread creation and destruction
|
|
||||||
timer.c timer-related functions
|
timer.c timer-related functions
|
||||||
utils.c misc functions
|
utils.c misc functions
|
||||||
winapi.h Windows redefine and include
|
winapi.h Windows redefine and include
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
//= See the mapflag documentation for details about extra
|
//= See the mapflag documentation for details about extra
|
||||||
//= parameters.
|
//= parameters.
|
||||||
//=
|
//=
|
||||||
//= You MUST enable ADJUST_SKILL_DAMAGE in 'src/config/core.h'
|
//= You MUST enable ADJUST_SKILL_DAMAGE in 'src/config/core.hpp'
|
||||||
//= for this mapflag to take effect.
|
//= for this mapflag to take effect.
|
||||||
//===== Additional Comments: =================================
|
//===== Additional Comments: =================================
|
||||||
//= 1.0 Initial script. [Cydh]
|
//= 1.0 Initial script. [Cydh]
|
||||||
|
|||||||
44
rAthena.sln
44
rAthena.sln
@@ -8,27 +8,24 @@ EndProject
|
|||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "src\common\common.vcxproj", "{F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "src\common\common.vcxproj", "{F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD} = {F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}
|
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD} = {F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF} = {7AE31676-6137-4FB3-AE9C-AD47D8A861CF}
|
|
||||||
{61D6A599-6BED-4154-A9FC-40553BD972E0} = {61D6A599-6BED-4154-A9FC-40553BD972E0}
|
{61D6A599-6BED-4154-A9FC-40553BD972E0} = {61D6A599-6BED-4154-A9FC-40553BD972E0}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libconfig", "3rdparty\libconfig\libconfig.vcxproj", "{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libconfig", "3rdparty\libconfig\libconfig.vcxproj", "{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mt19937ar", "3rdparty\mt19937ar\mt19937ar.vcxproj", "{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{60D3315D-FBF4-4FBF-8D44-99D5BED11D32}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{60D3315D-FBF4-4FBF-8D44-99D5BED11D32}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
src\config\const.h = src\config\const.h
|
src\config\const.hpp = src\config\const.hpp
|
||||||
src\config\core.h = src\config\core.h
|
src\config\core.hpp = src\config\core.hpp
|
||||||
src\config\classes\general.h = src\config\classes\general.h
|
src\config\classes\general.hpp = src\config\classes\general.hpp
|
||||||
src\config\packets.h = src\config\packets.h
|
src\config\packets.hpp = src\config\packets.hpp
|
||||||
src\config\renewal.h = src\config\renewal.h
|
src\config\renewal.hpp = src\config\renewal.hpp
|
||||||
src\config\secure.h = src\config\secure.h
|
src\config\secure.hpp = src\config\secure.hpp
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "classes", "classes", "{33B49CB8-CBE3-4ED2-86DD-C9A351AC9026}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "classes", "classes", "{33B49CB8-CBE3-4ED2-86DD-C9A351AC9026}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
src\config\classes\general.h = src\config\classes\general.h
|
src\config\classes\general.hpp = src\config\classes\general.hpp
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Custom", "Custom", "{6513C8D3-D15F-45D4-9AD8-6286CBA7EE36}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Custom", "Custom", "{6513C8D3-D15F-45D4-9AD8-6286CBA7EE36}"
|
||||||
@@ -37,8 +34,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Custom", "Custom", "{6513C8
|
|||||||
src\custom\atcommand_def.inc = src\custom\atcommand_def.inc
|
src\custom\atcommand_def.inc = src\custom\atcommand_def.inc
|
||||||
src\custom\battle_config_init.inc = src\custom\battle_config_init.inc
|
src\custom\battle_config_init.inc = src\custom\battle_config_init.inc
|
||||||
src\custom\battle_config_struct.inc = src\custom\battle_config_struct.inc
|
src\custom\battle_config_struct.inc = src\custom\battle_config_struct.inc
|
||||||
src\custom\defines_post.h = src\custom\defines_post.h
|
src\custom\defines_post.hpp = src\custom\defines_post.hpp
|
||||||
src\custom\defines_pre.h = src\custom\defines_pre.h
|
src\custom\defines_pre.hpp = src\custom\defines_pre.hpp
|
||||||
src\custom\script.inc = src\custom\script.inc
|
src\custom\script.inc = src\custom\script.inc
|
||||||
src\custom\script_def.inc = src\custom\script_def.inc
|
src\custom\script_def.inc = src\custom\script_def.inc
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
@@ -74,11 +71,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mapcache", "src\tool\mapcac
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yaml-cpp", "3rdparty\yaml-cpp\yaml-cpp.vcxproj", "{61D6A599-6BED-4154-A9FC-40553BD972E0}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yaml-cpp", "3rdparty\yaml-cpp\yaml-cpp.vcxproj", "{61D6A599-6BED-4154-A9FC-40553BD972E0}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basic_test", "src\test\basic_test.vcxproj", "{99B4DF6A-6180-4E7F-9227-F812FF30414A}"
|
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559} = {F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
@@ -103,14 +95,6 @@ Global
|
|||||||
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Release|Win32.Build.0 = Release|Win32
|
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Release|Win32.Build.0 = Release|Win32
|
||||||
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Release|x64.ActiveCfg = Release|x64
|
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Release|x64.ActiveCfg = Release|x64
|
||||||
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Release|x64.Build.0 = Release|x64
|
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Release|x64.Build.0 = Release|x64
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Release|x64.Build.0 = Release|x64
|
|
||||||
{864805EA-FD39-453D-9248-C581951BA058}.Debug|Win32.ActiveCfg = Debug|Win32
|
{864805EA-FD39-453D-9248-C581951BA058}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{864805EA-FD39-453D-9248-C581951BA058}.Debug|Win32.Build.0 = Debug|Win32
|
{864805EA-FD39-453D-9248-C581951BA058}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{864805EA-FD39-453D-9248-C581951BA058}.Debug|x64.ActiveCfg = Debug|x64
|
{864805EA-FD39-453D-9248-C581951BA058}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
@@ -159,14 +143,6 @@ Global
|
|||||||
{61D6A599-6BED-4154-A9FC-40553BD972E0}.Release|Win32.Build.0 = Release|Win32
|
{61D6A599-6BED-4154-A9FC-40553BD972E0}.Release|Win32.Build.0 = Release|Win32
|
||||||
{61D6A599-6BED-4154-A9FC-40553BD972E0}.Release|x64.ActiveCfg = Release|x64
|
{61D6A599-6BED-4154-A9FC-40553BD972E0}.Release|x64.ActiveCfg = Release|x64
|
||||||
{61D6A599-6BED-4154-A9FC-40553BD972E0}.Release|x64.Build.0 = Release|x64
|
{61D6A599-6BED-4154-A9FC-40553BD972E0}.Release|x64.Build.0 = Release|x64
|
||||||
{99B4DF6A-6180-4E7F-9227-F812FF30414A}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{99B4DF6A-6180-4E7F-9227-F812FF30414A}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{99B4DF6A-6180-4E7F-9227-F812FF30414A}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{99B4DF6A-6180-4E7F-9227-F812FF30414A}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{99B4DF6A-6180-4E7F-9227-F812FF30414A}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{99B4DF6A-6180-4E7F-9227-F812FF30414A}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{99B4DF6A-6180-4E7F-9227-F812FF30414A}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{99B4DF6A-6180-4E7F-9227-F812FF30414A}.Release|x64.Build.0 = Release|x64
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -174,7 +150,6 @@ Global
|
|||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559} = {C0A6FC9A-3A5C-48F8-A4B6-8D463C61C021}
|
{F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559} = {C0A6FC9A-3A5C-48F8-A4B6-8D463C61C021}
|
||||||
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD} = {6ABA1767-6242-4CA0-BA22-A30972DC8918}
|
{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD} = {6ABA1767-6242-4CA0-BA22-A30972DC8918}
|
||||||
{7AE31676-6137-4FB3-AE9C-AD47D8A861CF} = {6ABA1767-6242-4CA0-BA22-A30972DC8918}
|
|
||||||
{33B49CB8-CBE3-4ED2-86DD-C9A351AC9026} = {60D3315D-FBF4-4FBF-8D44-99D5BED11D32}
|
{33B49CB8-CBE3-4ED2-86DD-C9A351AC9026} = {60D3315D-FBF4-4FBF-8D44-99D5BED11D32}
|
||||||
{864805EA-FD39-453D-9248-C581951BA058} = {6D9F5D00-2988-4812-844D-D155C4F588DC}
|
{864805EA-FD39-453D-9248-C581951BA058} = {6D9F5D00-2988-4812-844D-D155C4F588DC}
|
||||||
{FED3A941-0AF7-49FE-85CF-E1DFDC0EBB23} = {6D9F5D00-2988-4812-844D-D155C4F588DC}
|
{FED3A941-0AF7-49FE-85CF-E1DFDC0EBB23} = {6D9F5D00-2988-4812-844D-D155C4F588DC}
|
||||||
@@ -182,7 +157,6 @@ Global
|
|||||||
{352B45B3-FE88-4431-9D89-48CF811446DB} = {C0A6FC9A-3A5C-48F8-A4B6-8D463C61C021}
|
{352B45B3-FE88-4431-9D89-48CF811446DB} = {C0A6FC9A-3A5C-48F8-A4B6-8D463C61C021}
|
||||||
{FC4C071B-2C26-4B03-948A-335C94A88B5E} = {9F328FE9-129D-4C0C-820B-BE4AA5996652}
|
{FC4C071B-2C26-4B03-948A-335C94A88B5E} = {9F328FE9-129D-4C0C-820B-BE4AA5996652}
|
||||||
{61D6A599-6BED-4154-A9FC-40553BD972E0} = {6ABA1767-6242-4CA0-BA22-A30972DC8918}
|
{61D6A599-6BED-4154-A9FC-40553BD972E0} = {6ABA1767-6242-4CA0-BA22-A30972DC8918}
|
||||||
{99B4DF6A-6180-4E7F-9227-F812FF30414A} = {9F328FE9-129D-4C0C-820B-BE4AA5996652}
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {026DA20F-820C-40AA-983E-0E231EA90AD5}
|
SolutionGuid = {026DA20F-820C-40AA-983E-0E231EA90AD5}
|
||||||
|
|||||||
@@ -16,6 +16,5 @@ endif()
|
|||||||
add_subdirectory( login )
|
add_subdirectory( login )
|
||||||
add_subdirectory( char )
|
add_subdirectory( char )
|
||||||
add_subdirectory( map )
|
add_subdirectory( map )
|
||||||
add_subdirectory( test )
|
|
||||||
add_subdirectory( tool )
|
add_subdirectory( tool )
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,14 @@
|
|||||||
|
|
||||||
COMMON_H = $(shell ls ../common/*.h)
|
COMMON_H = $(shell ls ../common/*.hpp)
|
||||||
COMMON_AR = ../common/obj/common.a
|
COMMON_AR = ../common/obj/common.a
|
||||||
COMMON_INCLUDE = -I../common/
|
COMMON_INCLUDE = -I../common/
|
||||||
|
|
||||||
MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
|
|
||||||
MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
|
|
||||||
MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar
|
|
||||||
|
|
||||||
LIBCONFIG_H = $(shell ls ../../3rdparty/libconfig/*.h)
|
LIBCONFIG_H = $(shell ls ../../3rdparty/libconfig/*.h)
|
||||||
LIBCONFIG_AR = ../../3rdparty/libconfig/obj/libconfig.a
|
LIBCONFIG_AR = ../../3rdparty/libconfig/obj/libconfig.a
|
||||||
LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
|
LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
|
||||||
|
|
||||||
COMMON_OBJ = ../common/obj/sql.o
|
COMMON_OBJ = ../common/obj/sql.o
|
||||||
COMMON_H = ../common/sql.h
|
COMMON_H = ../common/sql.hpp
|
||||||
|
|
||||||
CHAR_OBJ = $(shell ls *.cpp | sed -e "s/\.cpp/\.o/g")
|
CHAR_OBJ = $(shell ls *.cpp | sed -e "s/\.cpp/\.o/g")
|
||||||
CHAR_DIR_OBJ = $(CHAR_OBJ:%=obj/%)
|
CHAR_DIR_OBJ = $(CHAR_OBJ:%=obj/%)
|
||||||
@@ -57,7 +53,7 @@ help:
|
|||||||
|
|
||||||
char-server: obj $(CHAR_DIR_OBJ) $(LIBCONFIG_AR) $(COMMON_AR) $(YAML_CPP_AR)
|
char-server: obj $(CHAR_DIR_OBJ) $(LIBCONFIG_AR) $(COMMON_AR) $(YAML_CPP_AR)
|
||||||
@echo " LD @OCHR@@EXEEXT@"
|
@echo " LD @OCHR@@EXEEXT@"
|
||||||
@@CXX@ @LDFLAGS@ -o ../../@OCHR@@EXEEXT@ $(CHAR_DIR_OBJ) $(LIBCONFIG_AR) $(COMMON_AR) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) $(YAML_CPP_AR) @LIBS@ @MYSQL_LIBS@
|
@@CXX@ @LDFLAGS@ -o ../../@OCHR@@EXEEXT@ $(CHAR_DIR_OBJ) $(LIBCONFIG_AR) $(COMMON_AR) $(LIBCONFIG_OBJ) $(YAML_CPP_AR) @LIBS@ @MYSQL_LIBS@
|
||||||
|
|
||||||
needs_mysql:
|
needs_mysql:
|
||||||
@echo "MySQL not found or disabled by the configure script"
|
@echo "MySQL not found or disabled by the configure script"
|
||||||
@@ -66,22 +62,15 @@ needs_mysql:
|
|||||||
obj:
|
obj:
|
||||||
@echo " MKDIR obj"
|
@echo " MKDIR obj"
|
||||||
@-mkdir obj
|
@-mkdir obj
|
||||||
|
|
||||||
obj/%.o: %.c $(CHAR_H) $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H) $(YAML_CPP_H)
|
|
||||||
@echo " CC $<"
|
|
||||||
@@CC@ @CFLAGS@ $(COMMON_INCLUDE) $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
|
||||||
|
|
||||||
obj/%.o: %.cpp $(CHAR_H) $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H) $(YAML_CPP_H)
|
obj/%.o: %.cpp $(CHAR_H) $(COMMON_H) $(LIBCONFIG_H) $(YAML_CPP_H)
|
||||||
@echo " CXX $<"
|
@echo " CXX $<"
|
||||||
@@CXX@ @CXXFLAGS@ $(COMMON_INCLUDE) $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
@@CXX@ @CXXFLAGS@ $(COMMON_INCLUDE) $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
||||||
|
|
||||||
# missing object files
|
# missing object files
|
||||||
$(COMMON_AR):
|
$(COMMON_AR):
|
||||||
@$(MAKE) -C ../common server
|
@$(MAKE) -C ../common server
|
||||||
|
|
||||||
$(MT19937AR_OBJ):
|
|
||||||
@$(MAKE) -C ../../3rdparty/mt19937ar
|
|
||||||
|
|
||||||
$(LIBCONFIG_AR):
|
$(LIBCONFIG_AR):
|
||||||
@$(MAKE) -C ../../3rdparty/libconfig
|
@$(MAKE) -C ../../3rdparty/libconfig
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@@ -155,7 +155,7 @@
|
|||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;$(SolutionDir).vs\build\yaml-cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -10,18 +10,18 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
#include "../common/core.h"
|
#include "../common/core.hpp"
|
||||||
#include "../common/db.h"
|
#include "../common/db.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/mapindex.h"
|
#include "../common/mapindex.hpp"
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/random.h"
|
#include "../common/random.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.hpp"
|
||||||
#include "../common/cli.h"
|
#include "../common/cli.hpp"
|
||||||
|
|
||||||
#include "int_guild.hpp"
|
#include "int_guild.hpp"
|
||||||
#include "int_homun.hpp"
|
#include "int_homun.hpp"
|
||||||
@@ -2737,7 +2737,7 @@ void char_set_defaults(){
|
|||||||
charserv_config.log_inter = 1; // loggin inter or not [devil]
|
charserv_config.log_inter = 1; // loggin inter or not [devil]
|
||||||
charserv_config.char_check_db =1;
|
charserv_config.char_check_db =1;
|
||||||
|
|
||||||
// See const.h to change the default values
|
// See const.hpp to change the default values
|
||||||
charserv_config.start_point[0].map = mapindex_name2id(MAP_DEFAULT_NAME);
|
charserv_config.start_point[0].map = mapindex_name2id(MAP_DEFAULT_NAME);
|
||||||
charserv_config.start_point[0].x = MAP_DEFAULT_X;
|
charserv_config.start_point[0].x = MAP_DEFAULT_X;
|
||||||
charserv_config.start_point[0].y = MAP_DEFAULT_Y;
|
charserv_config.start_point[0].y = MAP_DEFAULT_Y;
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
#ifndef _CHAR_HPP_
|
#ifndef _CHAR_HPP_
|
||||||
#define _CHAR_HPP_
|
#define _CHAR_HPP_
|
||||||
|
|
||||||
#include "../config/core.h"
|
#include "../config/core.hpp"
|
||||||
#include "../common/core.h" // CORE_ST_LAST
|
#include "../common/core.hpp" // CORE_ST_LAST
|
||||||
#include "../common/msg_conf.h"
|
#include "../common/msg_conf.hpp"
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
|
|
||||||
extern int login_fd; //login file descriptor
|
extern int login_fd; //login file descriptor
|
||||||
extern int char_fd; //char file descriptor
|
extern int char_fd; //char file descriptor
|
||||||
|
|||||||
@@ -6,16 +6,16 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
#include "../common/random.h"
|
#include "../common/random.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/mapindex.h"
|
#include "../common/mapindex.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/utils.h"
|
#include "../common/utils.hpp"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.hpp"
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "char_logif.hpp"
|
#include "char_logif.hpp"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#ifndef _CHAR_CLIF_HPP_
|
#ifndef _CHAR_CLIF_HPP_
|
||||||
#define _CHAR_CLIF_HPP_
|
#define _CHAR_CLIF_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
#include "../common/timer.h" //time_t
|
#include "../common/timer.hpp" //time_t
|
||||||
|
|
||||||
struct char_session_data;
|
struct char_session_data;
|
||||||
enum pincode_state : uint8;
|
enum pincode_state : uint8;
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.hpp"
|
||||||
#include "../common/ers.h"
|
#include "../common/ers.hpp"
|
||||||
#include "../common/cli.h"
|
#include "../common/cli.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@
|
|||||||
int cnslif_parse(const char* buf);
|
int cnslif_parse(const char* buf);
|
||||||
void do_init_chcnslif(void);
|
void do_init_chcnslif(void);
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
void display_helpscreen(bool do_exit);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _CHAR_CNSLIF_HPP_ */
|
#endif /* _CHAR_CNSLIF_HPP_ */
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
#include "../common/utils.h"
|
#include "../common/utils.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
|
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
#include "int_guild.hpp"
|
#include "int_guild.hpp"
|
||||||
@@ -349,7 +349,7 @@ int chlogif_parse_reqaccdata(int fd, struct char_session_data* sd){
|
|||||||
sd->group_id = RFIFOB(fd,50);
|
sd->group_id = RFIFOB(fd,50);
|
||||||
sd->char_slots = RFIFOB(fd,51);
|
sd->char_slots = RFIFOB(fd,51);
|
||||||
if( sd->char_slots > MAX_CHARS ) {
|
if( sd->char_slots > MAX_CHARS ) {
|
||||||
ShowError("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n",sd->account_id,sd->char_slots);
|
ShowError("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.hpp! capping to MAX_CHARS...\n",sd->account_id,sd->char_slots);
|
||||||
sd->char_slots = MAX_CHARS;/* cap to maximum */
|
sd->char_slots = MAX_CHARS;/* cap to maximum */
|
||||||
} else if ( !sd->char_slots )/* no value aka 0 in sql */
|
} else if ( !sd->char_slots )/* no value aka 0 in sql */
|
||||||
sd->char_slots = MIN_CHARS;/* cap to minimum */
|
sd->char_slots = MIN_CHARS;/* cap to minimum */
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#ifndef _CHAR_LOGIF_HPP_
|
#ifndef _CHAR_LOGIF_HPP_
|
||||||
#define _CHAR_LOGIF_HPP_
|
#define _CHAR_LOGIF_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
|
|
||||||
struct char_session_data;
|
struct char_session_data;
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h> //memcpy
|
#include <string.h> //memcpy
|
||||||
|
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
|
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#ifndef _CHAR_MAPIF_HPP_
|
#ifndef _CHAR_MAPIF_HPP_
|
||||||
#define _CHAR_MAPIF_HPP_
|
#define _CHAR_MAPIF_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
|
|
||||||
int chmapif_sendall(unsigned char *buf, unsigned int len);
|
int chmapif_sendall(unsigned char *buf, unsigned int len);
|
||||||
int chmapif_sendallwos(int sfd, unsigned char *buf, unsigned int len);
|
int chmapif_sendallwos(int sfd, unsigned char *buf, unsigned int len);
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "../common/db.h"
|
#include "../common/db.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "char_mapif.hpp"
|
#include "char_mapif.hpp"
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h> //memset
|
#include <string.h> //memset
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "char_mapif.hpp"
|
#include "char_mapif.hpp"
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
#define __STDC_WANT_LIB_EXT1__ 1
|
#define __STDC_WANT_LIB_EXT1__ 1
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "char_mapif.hpp"
|
#include "char_mapif.hpp"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#ifndef _INT_GUILD_HPP_
|
#ifndef _INT_GUILD_HPP_
|
||||||
#define _INT_GUILD_HPP_
|
#define _INT_GUILD_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
|
|
||||||
enum e_guild_action : uint32 {
|
enum e_guild_action : uint32 {
|
||||||
GS_BASIC = 0x0001,
|
GS_BASIC = 0x0001,
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/utils.h"
|
#include "../common/utils.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#ifndef _INT_HOMUN_HPP_
|
#ifndef _INT_HOMUN_HPP_
|
||||||
#define _INT_HOMUN_HPP_
|
#define _INT_HOMUN_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
|
|
||||||
struct s_homunculus;
|
struct s_homunculus;
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "char_mapif.hpp"
|
#include "char_mapif.hpp"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#ifndef _INT_MAIL_HPP_
|
#ifndef _INT_MAIL_HPP_
|
||||||
#define _INT_MAIL_HPP_
|
#define _INT_MAIL_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
|
|
||||||
struct mail_message;
|
struct mail_message;
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#ifndef _INT_MERCENARY_HPP_
|
#ifndef _INT_MERCENARY_HPP_
|
||||||
#define _INT_MERCENARY_HPP_
|
#define _INT_MERCENARY_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
|
|
||||||
int inter_mercenary_sql_init(void);
|
int inter_mercenary_sql_init(void);
|
||||||
void inter_mercenary_sql_final(void);
|
void inter_mercenary_sql_final(void);
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/mapindex.h"
|
#include "../common/mapindex.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "char_mapif.hpp"
|
#include "char_mapif.hpp"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#ifndef _INT_PARTY_HPP_
|
#ifndef _INT_PARTY_HPP_
|
||||||
#define _INT_PARTY_HPP_
|
#define _INT_PARTY_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
|
|
||||||
//Party Flags on what to save/delete.
|
//Party Flags on what to save/delete.
|
||||||
enum e_PartySaveWhatFlag {
|
enum e_PartySaveWhatFlag {
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/utils.h"
|
#include "../common/utils.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#ifndef _INT_PET_HPP_
|
#ifndef _INT_PET_HPP_
|
||||||
#define _INT_PET_HPP_
|
#define _INT_PET_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
|
|
||||||
struct s_pet;
|
struct s_pet;
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/mmo.h"
|
#include "../common/mmo.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/strlib.h" // StringBuf
|
#include "../common/strlib.hpp" // StringBuf
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "inter.hpp"
|
#include "inter.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#ifndef _INT_STORAGE_HPP_
|
#ifndef _INT_STORAGE_HPP_
|
||||||
#define _INT_STORAGE_HPP_
|
#define _INT_STORAGE_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
|
|
||||||
struct s_storage;
|
struct s_storage;
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
#include "../common/malloc.h"
|
#include "../common/malloc.hpp"
|
||||||
#include "../common/strlib.h"
|
#include "../common/strlib.hpp"
|
||||||
#include "../common/showmsg.h"
|
#include "../common/showmsg.hpp"
|
||||||
#include "../common/socket.h"
|
#include "../common/socket.hpp"
|
||||||
#include "../common/timer.h"
|
#include "../common/timer.hpp"
|
||||||
|
|
||||||
#include "char.hpp"
|
#include "char.hpp"
|
||||||
#include "char_logif.hpp"
|
#include "char_logif.hpp"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
#ifndef _INTER_HPP_
|
#ifndef _INTER_HPP_
|
||||||
#define _INTER_HPP_
|
#define _INTER_HPP_
|
||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.hpp"
|
||||||
#include "../common/sql.h"
|
#include "../common/sql.hpp"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -41,24 +41,24 @@ mark_as_advanced( COMMON_SOURCE_DIR )
|
|||||||
|
|
||||||
set( COMMON_ALL_HEADERS
|
set( COMMON_ALL_HEADERS
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/svnversion.h"
|
"${CMAKE_CURRENT_BINARY_DIR}/svnversion.h"
|
||||||
"${COMMON_SOURCE_DIR}/cbasetypes.h"
|
"${COMMON_SOURCE_DIR}/cbasetypes.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/mmo.h"
|
"${COMMON_SOURCE_DIR}/mmo.hpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
set( COMMON_MINI_HEADERS
|
set( COMMON_MINI_HEADERS
|
||||||
${COMMON_ALL_HEADERS}
|
${COMMON_ALL_HEADERS}
|
||||||
"${COMMON_SOURCE_DIR}/core.h"
|
"${COMMON_SOURCE_DIR}/core.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/malloc.h"
|
"${COMMON_SOURCE_DIR}/malloc.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/showmsg.h"
|
"${COMMON_SOURCE_DIR}/showmsg.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/strlib.h"
|
"${COMMON_SOURCE_DIR}/strlib.hpp"
|
||||||
${LIBCONFIG_HEADERS} # needed by showmsg.h
|
${LIBCONFIG_HEADERS} # needed by showmsg.hpp
|
||||||
CACHE INTERNAL "" )
|
CACHE INTERNAL "" )
|
||||||
set( COMMON_MINI_SOURCES
|
set( COMMON_MINI_SOURCES
|
||||||
"${COMMON_SOURCE_DIR}/core.cpp"
|
"${COMMON_SOURCE_DIR}/core.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/malloc.c"
|
"${COMMON_SOURCE_DIR}/malloc.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/showmsg.c"
|
"${COMMON_SOURCE_DIR}/showmsg.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/strlib.c"
|
"${COMMON_SOURCE_DIR}/strlib.cpp"
|
||||||
${LIBCONFIG_SOURCES} # needed by showmsg.c
|
${LIBCONFIG_SOURCES} # needed by showmsg.cpp
|
||||||
CACHE INTERNAL "" )
|
CACHE INTERNAL "" )
|
||||||
set( COMMON_MINI_INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIRS} CACHE INTERNAL "" )
|
set( COMMON_MINI_INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIRS} CACHE INTERNAL "" )
|
||||||
set( COMMON_MINI_DEFINITIONS "-DMINICORE ${LIBCONFIG_DEFINITIONS}" CACHE INTERNAL "" )
|
set( COMMON_MINI_DEFINITIONS "-DMINICORE ${LIBCONFIG_DEFINITIONS}" CACHE INTERNAL "" )
|
||||||
@@ -71,60 +71,48 @@ if( WITH_ZLIB )
|
|||||||
message( STATUS "Creating target common_base" )
|
message( STATUS "Creating target common_base" )
|
||||||
set( COMMON_BASE_HEADERS
|
set( COMMON_BASE_HEADERS
|
||||||
${COMMON_ALL_HEADERS}
|
${COMMON_ALL_HEADERS}
|
||||||
"${COMMON_SOURCE_DIR}/conf.h"
|
"${COMMON_SOURCE_DIR}/conf.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/core.h"
|
"${COMMON_SOURCE_DIR}/core.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/db.h"
|
"${COMMON_SOURCE_DIR}/db.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/des.h"
|
"${COMMON_SOURCE_DIR}/des.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/ers.h"
|
"${COMMON_SOURCE_DIR}/ers.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/grfio.h"
|
"${COMMON_SOURCE_DIR}/grfio.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/malloc.h"
|
"${COMMON_SOURCE_DIR}/malloc.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/mapindex.h"
|
"${COMMON_SOURCE_DIR}/mapindex.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/md5calc.h"
|
"${COMMON_SOURCE_DIR}/md5calc.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/nullpo.h"
|
"${COMMON_SOURCE_DIR}/nullpo.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/random.h"
|
"${COMMON_SOURCE_DIR}/random.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/showmsg.h"
|
"${COMMON_SOURCE_DIR}/showmsg.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/socket.h"
|
"${COMMON_SOURCE_DIR}/socket.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/strlib.h"
|
"${COMMON_SOURCE_DIR}/strlib.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/timer.h"
|
"${COMMON_SOURCE_DIR}/timer.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/utils.h"
|
"${COMMON_SOURCE_DIR}/utils.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/atomic.h"
|
"${COMMON_SOURCE_DIR}/msg_conf.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/spinlock.h"
|
"${COMMON_SOURCE_DIR}/cli.hpp"
|
||||||
"${COMMON_SOURCE_DIR}/thread.h"
|
|
||||||
"${COMMON_SOURCE_DIR}/mutex.h"
|
|
||||||
"${COMMON_SOURCE_DIR}/raconf.h"
|
|
||||||
"${COMMON_SOURCE_DIR}/mempool.h"
|
|
||||||
"${COMMON_SOURCE_DIR}/msg_conf.h"
|
|
||||||
"${COMMON_SOURCE_DIR}/cli.h"
|
|
||||||
"${COMMON_SOURCE_DIR}/yamlwrapper.h"
|
|
||||||
"${COMMON_SOURCE_DIR}/utilities.hpp"
|
"${COMMON_SOURCE_DIR}/utilities.hpp"
|
||||||
${LIBCONFIG_HEADERS} # needed by conf.h/showmsg.h
|
${LIBCONFIG_HEADERS} # needed by conf.hpp/showmsg.hpp
|
||||||
CACHE INTERNAL "common_base headers" )
|
CACHE INTERNAL "common_base headers" )
|
||||||
set( COMMON_BASE_SOURCES
|
set( COMMON_BASE_SOURCES
|
||||||
"${COMMON_SOURCE_DIR}/conf.c"
|
"${COMMON_SOURCE_DIR}/conf.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/core.cpp"
|
"${COMMON_SOURCE_DIR}/core.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/db.c"
|
"${COMMON_SOURCE_DIR}/db.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/des.c"
|
"${COMMON_SOURCE_DIR}/des.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/ers.c"
|
"${COMMON_SOURCE_DIR}/ers.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/grfio.c"
|
"${COMMON_SOURCE_DIR}/grfio.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/malloc.c"
|
"${COMMON_SOURCE_DIR}/malloc.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/mapindex.c"
|
"${COMMON_SOURCE_DIR}/mapindex.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/md5calc.c"
|
"${COMMON_SOURCE_DIR}/md5calc.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/nullpo.c"
|
"${COMMON_SOURCE_DIR}/nullpo.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/random.c"
|
"${COMMON_SOURCE_DIR}/random.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/showmsg.c"
|
"${COMMON_SOURCE_DIR}/showmsg.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/socket.c"
|
"${COMMON_SOURCE_DIR}/socket.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/strlib.c"
|
"${COMMON_SOURCE_DIR}/strlib.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/timer.c"
|
"${COMMON_SOURCE_DIR}/timer.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/utils.c"
|
"${COMMON_SOURCE_DIR}/utils.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/thread.c"
|
"${COMMON_SOURCE_DIR}/msg_conf.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/mutex.c"
|
"${COMMON_SOURCE_DIR}/cli.cpp"
|
||||||
"${COMMON_SOURCE_DIR}/mempool.c"
|
|
||||||
"${COMMON_SOURCE_DIR}/raconf.c"
|
|
||||||
"${COMMON_SOURCE_DIR}/msg_conf.c"
|
|
||||||
"${COMMON_SOURCE_DIR}/cli.c"
|
|
||||||
"${COMMON_SOURCE_DIR}/yamlwrapper.cpp"
|
|
||||||
"${COMMON_SOURCE_DIR}/utilities.cpp"
|
"${COMMON_SOURCE_DIR}/utilities.cpp"
|
||||||
${LIBCONFIG_SOURCES} # needed by conf.c/showmsg.c
|
${LIBCONFIG_SOURCES} # needed by conf.cpp/showmsg.cpp
|
||||||
CACHE INTERNAL "common_base sources" )
|
CACHE INTERNAL "common_base sources" )
|
||||||
set( COMMON_BASE_INCLUDE_DIRS
|
set( COMMON_BASE_INCLUDE_DIRS
|
||||||
${LIBCONFIG_INCLUDE_DIRS}
|
${LIBCONFIG_INCLUDE_DIRS}
|
||||||
@@ -134,10 +122,9 @@ set( COMMON_BASE_DEFINITIONS
|
|||||||
${LIBCONFIG_DEFINITIONS}
|
${LIBCONFIG_DEFINITIONS}
|
||||||
CACHE INTERNAL "common_base definitions" )
|
CACHE INTERNAL "common_base definitions" )
|
||||||
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} yaml-cpp )
|
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} yaml-cpp )
|
||||||
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${YAML_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS}} )
|
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${YAML_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS}} )
|
||||||
set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
|
set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" )
|
||||||
set( SOURCE_FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
|
set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
|
||||||
source_group( mt19937ar FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} )
|
|
||||||
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
|
source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} )
|
||||||
|
|
||||||
add_library( common_base ${SOURCE_FILES} )
|
add_library( common_base ${SOURCE_FILES} )
|
||||||
@@ -162,10 +149,10 @@ if( HAVE_common_base AND WITH_MYSQL )
|
|||||||
message( STATUS "Creating target common" )
|
message( STATUS "Creating target common" )
|
||||||
set( COMMON_HEADERS
|
set( COMMON_HEADERS
|
||||||
${COMMON_ALL_HEADERS}
|
${COMMON_ALL_HEADERS}
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/sql.h"
|
"${CMAKE_CURRENT_SOURCE_DIR}/sql.hpp"
|
||||||
CACHE INTERNAL "common headers" )
|
CACHE INTERNAL "common headers" )
|
||||||
set( COMMON_SOURCES
|
set( COMMON_SOURCES
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/sql.c"
|
"${CMAKE_CURRENT_SOURCE_DIR}/sql.cpp"
|
||||||
CACHE INTERNAL "common sources" )
|
CACHE INTERNAL "common sources" )
|
||||||
set( DEPENDENCIES common_base yaml-cpp )
|
set( DEPENDENCIES common_base yaml-cpp )
|
||||||
set( LIBRARIES ${GLOBAL_LIBRARIES} ${MYSQL_LIBRARIES} )
|
set( LIBRARIES ${GLOBAL_LIBRARIES} ${MYSQL_LIBRARIES} )
|
||||||
|
|||||||
@@ -1,17 +1,11 @@
|
|||||||
|
|
||||||
#COMMON_OBJ = $(ls *.c | grep -viw sql.c | sed -e "s/\.c/\.o/g")
|
|
||||||
COMMON_OBJ = core.o socket.o timer.o db.o nullpo.o malloc.o showmsg.o strlib.o utils.o utilities.o \
|
COMMON_OBJ = core.o socket.o timer.o db.o nullpo.o malloc.o showmsg.o strlib.o utils.o utilities.o \
|
||||||
grfio.o mapindex.o ers.o md5calc.o minicore.o minisocket.o minimalloc.o random.o des.o \
|
grfio.o mapindex.o ers.o md5calc.o minicore.o minisocket.o minimalloc.o random.o des.o \
|
||||||
conf.o thread.o mutex.o raconf.o mempool.o msg_conf.o cli.o sql.o yamlwrapper.o
|
conf.o msg_conf.o cli.o sql.o
|
||||||
COMMON_DIR_OBJ = $(COMMON_OBJ:%=obj/%)
|
COMMON_DIR_OBJ = $(COMMON_OBJ:%=obj/%)
|
||||||
COMMON_H = $(shell ls ../common/*.h)
|
COMMON_H = $(shell ls ../common/*.hpp)
|
||||||
COMMON_H += $(shell ls ../common/*.hpp)
|
|
||||||
COMMON_AR = obj/common.a
|
COMMON_AR = obj/common.a
|
||||||
|
|
||||||
MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
|
|
||||||
MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
|
|
||||||
MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar
|
|
||||||
|
|
||||||
LIBCONFIG_H = $(shell ls ../../3rdparty/libconfig/*.h)
|
LIBCONFIG_H = $(shell ls ../../3rdparty/libconfig/*.h)
|
||||||
LIBCONFIG_AR = ../../3rdparty/libconfig/obj/libconfig.a
|
LIBCONFIG_AR = ../../3rdparty/libconfig/obj/libconfig.a
|
||||||
LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
|
LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
|
||||||
@@ -64,28 +58,17 @@ $(COMMON_AR): $(COMMON_DIR_OBJ)
|
|||||||
@echo " AR $@"
|
@echo " AR $@"
|
||||||
@@AR@ rcs $(COMMON_AR) $(COMMON_DIR_OBJ)
|
@@AR@ rcs $(COMMON_AR) $(COMMON_DIR_OBJ)
|
||||||
|
|
||||||
common: obj $(COMMON_DIR_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_AR) $(YAML_CPP_AR) $(COMMON_AR)
|
common: obj $(COMMON_DIR_OBJ) $(LIBCONFIG_AR) $(YAML_CPP_AR) $(COMMON_AR)
|
||||||
|
|
||||||
obj/%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H) $(YAML_CPP_H)
|
obj/%.o: %.cpp $(COMMON_H) $(LIBCONFIG_H) $(YAML_CPP_H)
|
||||||
@echo " CC $<"
|
|
||||||
@@CC@ @CFLAGS_AR@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
|
||||||
|
|
||||||
obj/%.o: %.cpp $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H) $(YAML_CPP_H)
|
|
||||||
@echo " CXX $<"
|
@echo " CXX $<"
|
||||||
@@CXX@ @CXXFLAGS@ @CFLAGS_AR@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
@@CXX@ @CXXFLAGS@ @CFLAGS_AR@ $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
||||||
|
|
||||||
obj/mini%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H) $(YAML_CPP_H)
|
obj/mini%.o: %.cpp $(COMMON_H) $(LIBCONFIG_H) $(YAML_CPP_H)
|
||||||
@echo " CC $<"
|
|
||||||
@@CC@ @CFLAGS_AR@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @MYSQL_CFLAGS@ -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
|
||||||
|
|
||||||
obj/mini%.o: %.cpp $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H) $(YAML_CPP_H)
|
|
||||||
@echo " CXX $<"
|
@echo " CXX $<"
|
||||||
@@CXX@ @CXXFLAGS@ @CFLAGS_AR@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @MYSQL_CFLAGS@ -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
@@CXX@ @CXXFLAGS@ @CFLAGS_AR@ $(LIBCONFIG_INCLUDE) $(YAML_CPP_INCLUDE) @MYSQL_CFLAGS@ -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
|
||||||
|
|
||||||
# missing object files
|
# missing object files
|
||||||
$(MT19937AR_OBJ):
|
|
||||||
@$(MAKE) -C ../../3rdparty/mt19937ar
|
|
||||||
|
|
||||||
$(LIBCONFIG_AR):
|
$(LIBCONFIG_AR):
|
||||||
@$(MAKE) -C ../../3rdparty/libconfig
|
@$(MAKE) -C ../../3rdparty/libconfig
|
||||||
|
|
||||||
|
|||||||
@@ -1,153 +0,0 @@
|
|||||||
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
|
|
||||||
// For more information, see LICENCE in the main folder
|
|
||||||
|
|
||||||
#ifndef _rA_ATOMIC_H_
|
|
||||||
#define _rA_ATOMIC_H_
|
|
||||||
|
|
||||||
// Atomic Operations
|
|
||||||
// (Interlocked CompareExchange, Add .. and so on ..)
|
|
||||||
//
|
|
||||||
// Implementation varies / depends on:
|
|
||||||
// - Architecture
|
|
||||||
// - Compiler
|
|
||||||
// - Operating System
|
|
||||||
//
|
|
||||||
// our Abstraction is fully API-Compatible to Microsofts implementation @ NT5.0+
|
|
||||||
//
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#include "winapi.hpp"
|
|
||||||
|
|
||||||
// This checks if C/C++ Compiler Version is 18.00 or Windows is older than Vista
|
|
||||||
#if _MSC_VER < 1800 || WINVER < _WIN32_WINNT_VISTA
|
|
||||||
|
|
||||||
#if !defined(_M_X64)
|
|
||||||
// When compiling for windows 32bit, the 8byte interlocked operations are not provided by microsoft
|
|
||||||
// (because they need at least i586 so its not generic enough.. ... )
|
|
||||||
forceinline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 _cmp){
|
|
||||||
_asm{
|
|
||||||
lea esi,_cmp;
|
|
||||||
lea edi,exch;
|
|
||||||
|
|
||||||
mov eax,[esi];
|
|
||||||
mov edx,4[esi];
|
|
||||||
mov ebx,[edi];
|
|
||||||
mov ecx,4[edi];
|
|
||||||
mov esi,dest;
|
|
||||||
|
|
||||||
lock CMPXCHG8B [esi];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
forceinline volatile int64 InterlockedIncrement64(volatile int64 *addend){
|
|
||||||
__int64 old;
|
|
||||||
do{
|
|
||||||
old = *addend;
|
|
||||||
}while(InterlockedCompareExchange64(addend, (old+1), old) != old);
|
|
||||||
|
|
||||||
return (old + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
forceinline volatile int64 InterlockedDecrement64(volatile int64 *addend){
|
|
||||||
__int64 old;
|
|
||||||
|
|
||||||
do{
|
|
||||||
old = *addend;
|
|
||||||
}while(InterlockedCompareExchange64(addend, (old-1), old) != old);
|
|
||||||
|
|
||||||
return (old - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
forceinline volatile int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){
|
|
||||||
__int64 old;
|
|
||||||
|
|
||||||
do{
|
|
||||||
old = *addend;
|
|
||||||
}while(InterlockedCompareExchange64(addend, (old + increment), old) != old);
|
|
||||||
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
forceinline volatile int64 InterlockedExchange64(volatile int64 *target, int64 val){
|
|
||||||
__int64 old;
|
|
||||||
do{
|
|
||||||
old = *target;
|
|
||||||
}while(InterlockedCompareExchange64(target, val, old) != old);
|
|
||||||
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //endif 32bit windows
|
|
||||||
|
|
||||||
#endif //endif _msc_ver check
|
|
||||||
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
|
|
||||||
// The __sync functions are available on x86 or ARMv6+
|
|
||||||
//need to proper dig into arm macro,
|
|
||||||
//see http://sourceforge.net/p/predef/wiki/Architectures/
|
|
||||||
#if !defined(__x86_64__) && !defined(__i386__) \
|
|
||||||
&& ( !defined(__ARM_ARCH_VERSION__) || __ARM_ARCH_VERSION__ < 6 ) \
|
|
||||||
&& ( !defined(__ARM_ARCH) && __ARM_ARCH < 6 )
|
|
||||||
#error Your Target Platfrom is not supported
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){
|
|
||||||
return __sync_fetch_and_add(addend, increment);
|
|
||||||
}//end: InterlockedExchangeAdd64()
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int32 InterlockedExchangeAdd(volatile int32 *addend, int32 increment){
|
|
||||||
return __sync_fetch_and_add(addend, increment);
|
|
||||||
}//end: InterlockedExchangeAdd()
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int64 InterlockedIncrement64(volatile int64 *addend){
|
|
||||||
return __sync_add_and_fetch(addend, 1);
|
|
||||||
}//end: InterlockedIncrement64()
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int32 InterlockedIncrement(volatile int32 *addend){
|
|
||||||
return __sync_add_and_fetch(addend, 1);
|
|
||||||
}//end: InterlockedIncrement()
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int64 InterlockedDecrement64(volatile int64 *addend){
|
|
||||||
return __sync_sub_and_fetch(addend, 1);
|
|
||||||
}//end: InterlockedDecrement64()
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int32 InterlockedDecrement(volatile int32 *addend){
|
|
||||||
return __sync_sub_and_fetch(addend, 1);
|
|
||||||
}//end: InterlockedDecrement()
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int64 InterlockedCompareExchange64(volatile int64 *dest, int64 exch, int64 cmp){
|
|
||||||
return __sync_val_compare_and_swap(dest, cmp, exch);
|
|
||||||
}//end: InterlockedCompareExchange64()
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int32 InterlockedCompareExchange(volatile int32 *dest, int32 exch, int32 cmp){
|
|
||||||
return __sync_val_compare_and_swap(dest, cmp, exch);
|
|
||||||
}//end: InterlockedCompareExchnage()
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int64 InterlockedExchange64(volatile int64 *target, int64 val){
|
|
||||||
return __sync_lock_test_and_set(target, val);
|
|
||||||
}//end: InterlockedExchange64()
|
|
||||||
|
|
||||||
|
|
||||||
static forceinline int32 InterlockedExchange(volatile int32 *target, int32 val){
|
|
||||||
return __sync_lock_test_and_set(target, val);
|
|
||||||
}//end: InterlockedExchange()
|
|
||||||
|
|
||||||
|
|
||||||
#endif //endif compiler decission
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef _CBASETYPES_H_
|
#ifndef _CBASETYPES_HPP_
|
||||||
#define _CBASETYPES_H_
|
#define _CBASETYPES_HPP_
|
||||||
|
|
||||||
/* +--------+-----------+--------+---------+
|
/* +--------+-----------+--------+---------+
|
||||||
* | ILP32 | LP64 | ILP64 | (LL)P64 |
|
* | ILP32 | LP64 | ILP64 | (LL)P64 |
|
||||||
@@ -75,7 +75,6 @@
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// portable printf/scanf format macros and integer definitions
|
// portable printf/scanf format macros and integer definitions
|
||||||
// NOTE: Visual C++ uses <inttypes.h> and <stdint.h> provided in /3rdparty
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define __STDC_CONSTANT_MACROS
|
#define __STDC_CONSTANT_MACROS
|
||||||
@@ -83,8 +82,7 @@
|
|||||||
#define __STDC_LIMIT_MACROS
|
#define __STDC_LIMIT_MACROS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <cinttypes>
|
||||||
#include <stdint.h>
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
// temporary fix for bugreport:4961 (unintended conversion from signed to unsigned)
|
// temporary fix for bugreport:4961 (unintended conversion from signed to unsigned)
|
||||||
@@ -437,4 +435,4 @@ static inline uint32 u32min(uint32 a, uint32 b){ return (a < b) ? a : b; }
|
|||||||
static inline uint64 u64min(uint64 a, uint64 b){ return (a < b) ? a : b; }
|
static inline uint64 u64min(uint64 a, uint64 b){ return (a < b) ? a : b; }
|
||||||
static inline size_t zmin(size_t a, size_t b){ return (a < b) ? a : b; }
|
static inline size_t zmin(size_t a, size_t b){ return (a < b) ? a : b; }
|
||||||
|
|
||||||
#endif /* _CBASETYPES_H_ */
|
#endif /* _CBASETYPES_HPP_ */
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @file cli.c
|
* @file cli.cpp
|
||||||
* Module purpose is to handle the console (cli=console line input) while the servers launch and run.
|
* Module purpose is to handle the console (cli=console line input) while the servers launch and run.
|
||||||
* This contains functions common to all servers, but then dispatches them to a specific parser on each server.
|
* This contains functions common to all servers, but then dispatches them to a specific parser on each server.
|
||||||
* Licensed under GNU GPL.
|
* Licensed under GNU GPL.
|
||||||
@@ -16,10 +16,10 @@
|
|||||||
#include <sys/poll.h>
|
#include <sys/poll.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
#include "cbasetypes.hpp"
|
||||||
#include "showmsg.h"
|
#include "showmsg.hpp"
|
||||||
#include "core.h"
|
#include "core.hpp"
|
||||||
#include "cli.h"
|
#include "cli.hpp"
|
||||||
|
|
||||||
//map confs
|
//map confs
|
||||||
const char* MAP_CONF_NAME;
|
const char* MAP_CONF_NAME;
|
||||||
@@ -67,15 +67,14 @@ void display_versionscreen(bool do_exit)
|
|||||||
{
|
{
|
||||||
const char* svn = get_svn_revision();
|
const char* svn = get_svn_revision();
|
||||||
if( svn[0] != UNKNOWN_VERSION )
|
if( svn[0] != UNKNOWN_VERSION )
|
||||||
ShowInfo("rAthena SVN Revision: '"CL_WHITE"%s"CL_RESET"'\n", svn);
|
ShowInfo("rAthena SVN Revision: '" CL_WHITE "%s" CL_RESET "'\n", svn);
|
||||||
else {
|
else {
|
||||||
const char* git = get_git_hash();
|
const char* git = get_git_hash();
|
||||||
if( git[0] != UNKNOWN_VERSION )
|
if( git[0] != UNKNOWN_VERSION )
|
||||||
ShowInfo("rAthena Git Hash: '"CL_WHITE"%s"CL_RESET"'\n", git);
|
ShowInfo("rAthena Git Hash: '" CL_WHITE "%s" CL_RESET "'\n", git);
|
||||||
}
|
}
|
||||||
ShowInfo(CL_GREEN"Website/Forum:"CL_RESET"\thttp://rathena.org/\n");
|
ShowInfo(CL_GREEN "Website/Forum:" CL_RESET "\thttp://rathena.org/\n");
|
||||||
ShowInfo(CL_GREEN"IRC Channel:"CL_RESET"\tirc://irc.rizon.net/#rathena\n");
|
ShowInfo("Open " CL_WHITE "README.md" CL_RESET " for more information.\n");
|
||||||
ShowInfo("Open "CL_WHITE"readme.txt"CL_RESET" for more information.\n");
|
|
||||||
if (do_exit)
|
if (do_exit)
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @file cli.h
|
* @file cli.hpp
|
||||||
* Module purpose is to handle the console (cli=console line input) while the servers launch and run.
|
* Module purpose is to handle the console (cli=console line input) while the servers launch and run.
|
||||||
* This contains functions common to all servers, but then dispatches them to a specific parser on each server.
|
* This contains functions common to all servers, but then dispatches them to a specific parser on each server.
|
||||||
* Licensed under GNU GPL.
|
* Licensed under GNU GPL.
|
||||||
@@ -7,12 +7,8 @@
|
|||||||
* @author rAthena Dev Team
|
* @author rAthena Dev Team
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CLI_H
|
#ifndef CLI_HPP
|
||||||
#define CLI_H
|
#define CLI_HPP
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_CONSOLE_IN 200 //max is map...
|
#define MAX_CONSOLE_IN 200 //max is map...
|
||||||
#define MIN_CONSOLE_IN 4 //min is help
|
#define MIN_CONSOLE_IN 4 //min is help
|
||||||
@@ -41,9 +37,5 @@ int cli_get_options(int argc, char ** argv);
|
|||||||
int parse_console_timer(int tid, unsigned int tick, int id, intptr_t data);
|
int parse_console_timer(int tid, unsigned int tick, int id, intptr_t data);
|
||||||
extern int parse_console(const char* buf); //particular for each serv
|
extern int parse_console(const char* buf); //particular for each serv
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* CLI_HPP */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* CLI_H */
|
|
||||||
|
|
||||||
@@ -19,43 +19,39 @@
|
|||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="cbasetypes.h" />
|
<ClInclude Include="cbasetypes.hpp" />
|
||||||
<ClInclude Include="cli.h" />
|
<ClInclude Include="cli.hpp" />
|
||||||
<ClInclude Include="conf.h" />
|
<ClInclude Include="conf.hpp" />
|
||||||
<ClInclude Include="core.h" />
|
<ClInclude Include="core.hpp" />
|
||||||
<ClInclude Include="des.h" />
|
<ClInclude Include="des.hpp" />
|
||||||
<ClInclude Include="grfio.h" />
|
<ClInclude Include="grfio.hpp" />
|
||||||
<ClInclude Include="malloc.h" />
|
<ClInclude Include="malloc.hpp" />
|
||||||
<ClInclude Include="mapindex.h" />
|
<ClInclude Include="mapindex.hpp" />
|
||||||
<ClInclude Include="md5calc.h" />
|
<ClInclude Include="md5calc.hpp" />
|
||||||
<ClInclude Include="mmo.h" />
|
<ClInclude Include="mmo.hpp" />
|
||||||
<ClInclude Include="msg_conf.h" />
|
<ClInclude Include="msg_conf.hpp" />
|
||||||
<ClInclude Include="nullpo.h" />
|
<ClInclude Include="nullpo.hpp" />
|
||||||
<ClInclude Include="raconf.h" />
|
<ClInclude Include="random.hpp" />
|
||||||
<ClInclude Include="random.h" />
|
<ClInclude Include="showmsg.hpp" />
|
||||||
<ClInclude Include="showmsg.h" />
|
<ClInclude Include="strlib.hpp" />
|
||||||
<ClInclude Include="strlib.h" />
|
<ClInclude Include="utils.hpp" />
|
||||||
<ClInclude Include="utils.h" />
|
|
||||||
<ClInclude Include="winapi.hpp" />
|
<ClInclude Include="winapi.hpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="cli.c" />
|
<ClCompile Include="cli.cpp" />
|
||||||
<ClCompile Include="conf.c" />
|
<ClCompile Include="conf.cpp" />
|
||||||
<ClCompile Include="core.cpp">
|
<ClCompile Include="core.cpp" />
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<ClCompile Include="des.cpp" />
|
||||||
</ClCompile>
|
<ClCompile Include="grfio.cpp" />
|
||||||
<ClCompile Include="des.c" />
|
<ClCompile Include="malloc.cpp" />
|
||||||
<ClCompile Include="grfio.c" />
|
<ClCompile Include="mapindex.cpp" />
|
||||||
<ClCompile Include="malloc.c" />
|
<ClCompile Include="md5calc.cpp" />
|
||||||
<ClCompile Include="mapindex.c" />
|
<ClCompile Include="msg_conf.cpp" />
|
||||||
<ClCompile Include="md5calc.c" />
|
<ClCompile Include="nullpo.cpp" />
|
||||||
<ClCompile Include="msg_conf.c" />
|
<ClCompile Include="random.cpp" />
|
||||||
<ClCompile Include="nullpo.c" />
|
<ClCompile Include="showmsg.cpp" />
|
||||||
<ClCompile Include="raconf.c" />
|
<ClCompile Include="strlib.cpp" />
|
||||||
<ClCompile Include="random.c" />
|
<ClCompile Include="utils.cpp" />
|
||||||
<ClCompile Include="showmsg.c" />
|
|
||||||
<ClCompile Include="strlib.c" />
|
|
||||||
<ClCompile Include="utils.c" />
|
|
||||||
<ClCompile Include="winapi.cpp" />
|
<ClCompile Include="winapi.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
@@ -130,8 +126,8 @@
|
|||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\libconfig\</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -146,8 +142,8 @@
|
|||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\libconfig\</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -164,8 +160,8 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\libconfig\</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@@ -184,8 +180,8 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>$(DefineConstants);WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;MINICORE;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\libconfig\</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
|||||||
@@ -11,55 +11,52 @@
|
|||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="cbasetypes.h">
|
<ClInclude Include="cbasetypes.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="cli.h">
|
<ClInclude Include="cli.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="conf.h">
|
<ClInclude Include="conf.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="core.h">
|
<ClInclude Include="core.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="des.h">
|
<ClInclude Include="des.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="grfio.h">
|
<ClInclude Include="grfio.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="malloc.h">
|
<ClInclude Include="malloc.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="mapindex.h">
|
<ClInclude Include="mapindex.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="md5calc.h">
|
<ClInclude Include="md5calc.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="mmo.h">
|
<ClInclude Include="mmo.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="msg_conf.h">
|
<ClInclude Include="msg_conf.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="nullpo.h">
|
<ClInclude Include="nullpo.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="raconf.h">
|
<ClInclude Include="random.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="random.h">
|
<ClInclude Include="showmsg.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="showmsg.h">
|
<ClInclude Include="strlib.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="strlib.h">
|
<ClInclude Include="utils.hpp">
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="utils.h">
|
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="winapi.hpp">
|
<ClInclude Include="winapi.hpp">
|
||||||
@@ -67,49 +64,46 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="cli.c">
|
<ClCompile Include="cli.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="conf.c">
|
<ClCompile Include="conf.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="core.cpp">
|
<ClCompile Include="core.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="des.c">
|
<ClCompile Include="des.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="grfio.c">
|
<ClCompile Include="grfio.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="malloc.c">
|
<ClCompile Include="malloc.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="mapindex.c">
|
<ClCompile Include="mapindex.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="md5calc.c">
|
<ClCompile Include="md5calc.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="msg_conf.c">
|
<ClCompile Include="msg_conf.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="nullpo.c">
|
<ClCompile Include="nullpo.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="raconf.c">
|
<ClCompile Include="random.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="random.c">
|
<ClCompile Include="showmsg.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="showmsg.c">
|
<ClCompile Include="strlib.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="strlib.c">
|
<ClCompile Include="utils.cpp">
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="utils.c">
|
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="winapi.cpp">
|
<ClInclude Include="winapi.cpp">
|
||||||
|
|||||||
@@ -19,65 +19,51 @@
|
|||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="atomic.h" />
|
<ClInclude Include="cbasetypes.hpp" />
|
||||||
<ClInclude Include="cbasetypes.h" />
|
<ClInclude Include="cli.hpp" />
|
||||||
<ClInclude Include="cli.h" />
|
<ClInclude Include="conf.hpp" />
|
||||||
<ClInclude Include="conf.h" />
|
<ClInclude Include="core.hpp" />
|
||||||
<ClInclude Include="core.h" />
|
<ClInclude Include="db.hpp" />
|
||||||
<ClInclude Include="db.h" />
|
<ClInclude Include="des.hpp" />
|
||||||
<ClInclude Include="des.h" />
|
<ClInclude Include="ers.hpp" />
|
||||||
<ClInclude Include="ers.h" />
|
<ClInclude Include="grfio.hpp" />
|
||||||
<ClInclude Include="grfio.h" />
|
<ClInclude Include="malloc.hpp" />
|
||||||
<ClInclude Include="malloc.h" />
|
<ClInclude Include="mapindex.hpp" />
|
||||||
<ClInclude Include="mapindex.h" />
|
<ClInclude Include="md5calc.hpp" />
|
||||||
<ClInclude Include="md5calc.h" />
|
<ClInclude Include="mmo.hpp" />
|
||||||
<ClInclude Include="mempool.h" />
|
<ClInclude Include="msg_conf.hpp" />
|
||||||
<ClInclude Include="mmo.h" />
|
<ClInclude Include="nullpo.hpp" />
|
||||||
<ClInclude Include="msg_conf.h" />
|
<ClInclude Include="random.hpp" />
|
||||||
<ClInclude Include="mutex.h" />
|
<ClInclude Include="showmsg.hpp" />
|
||||||
<ClInclude Include="nullpo.h" />
|
<ClInclude Include="socket.hpp" />
|
||||||
<ClInclude Include="raconf.h" />
|
<ClInclude Include="sql.hpp" />
|
||||||
<ClInclude Include="random.h" />
|
<ClInclude Include="strlib.hpp" />
|
||||||
<ClInclude Include="showmsg.h" />
|
<ClInclude Include="timer.hpp" />
|
||||||
<ClInclude Include="socket.h" />
|
<ClInclude Include="utils.hpp" />
|
||||||
<ClInclude Include="spinlock.h" />
|
|
||||||
<ClInclude Include="sql.h" />
|
|
||||||
<ClInclude Include="strlib.h" />
|
|
||||||
<ClInclude Include="thread.h" />
|
|
||||||
<ClInclude Include="timer.h" />
|
|
||||||
<ClInclude Include="utils.h" />
|
|
||||||
<ClInclude Include="winapi.hpp" />
|
<ClInclude Include="winapi.hpp" />
|
||||||
<ClInclude Include="yamlwrapper.h" />
|
|
||||||
<ClInclude Include="utilities.hpp" />
|
<ClInclude Include="utilities.hpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="cli.c" />
|
<ClCompile Include="cli.cpp" />
|
||||||
<ClCompile Include="conf.c" />
|
<ClCompile Include="conf.cpp" />
|
||||||
<ClCompile Include="core.cpp">
|
<ClCompile Include="core.cpp" />
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<ClCompile Include="db.cpp" />
|
||||||
</ClCompile>
|
<ClCompile Include="des.cpp" />
|
||||||
<ClCompile Include="db.c" />
|
<ClCompile Include="ers.cpp" />
|
||||||
<ClCompile Include="des.c" />
|
<ClCompile Include="grfio.cpp" />
|
||||||
<ClCompile Include="ers.c" />
|
<ClCompile Include="malloc.cpp" />
|
||||||
<ClCompile Include="grfio.c" />
|
<ClCompile Include="mapindex.cpp" />
|
||||||
<ClCompile Include="malloc.c" />
|
<ClCompile Include="md5calc.cpp" />
|
||||||
<ClCompile Include="mapindex.c" />
|
<ClCompile Include="msg_conf.cpp" />
|
||||||
<ClCompile Include="md5calc.c" />
|
<ClCompile Include="nullpo.cpp" />
|
||||||
<ClCompile Include="mempool.c" />
|
<ClCompile Include="random.cpp" />
|
||||||
<ClCompile Include="msg_conf.c" />
|
<ClCompile Include="showmsg.cpp" />
|
||||||
<ClCompile Include="mutex.c" />
|
<ClCompile Include="socket.cpp" />
|
||||||
<ClCompile Include="nullpo.c" />
|
<ClCompile Include="sql.cpp" />
|
||||||
<ClCompile Include="raconf.c" />
|
<ClCompile Include="strlib.cpp" />
|
||||||
<ClCompile Include="random.c" />
|
<ClCompile Include="timer.cpp" />
|
||||||
<ClCompile Include="showmsg.c" />
|
<ClCompile Include="utils.cpp" />
|
||||||
<ClCompile Include="socket.c" />
|
|
||||||
<ClCompile Include="sql.c" />
|
|
||||||
<ClCompile Include="strlib.c" />
|
|
||||||
<ClCompile Include="thread.c" />
|
|
||||||
<ClCompile Include="timer.c" />
|
|
||||||
<ClCompile Include="utils.c" />
|
|
||||||
<ClCompile Include="winapi.cpp" />
|
<ClCompile Include="winapi.cpp" />
|
||||||
<ClCompile Include="yamlwrapper.cpp" />
|
|
||||||
<ClCompile Include="utilities.cpp" />
|
<ClCompile Include="utilities.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
@@ -151,7 +137,7 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;FD_SETSIZE=4096;PCRE_SUPPORT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>$(DefineConstants);WIN32;FD_SETSIZE=4096;PCRE_SUPPORT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
@@ -169,7 +155,7 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;FD_SETSIZE=4096;PCRE_SUPPORT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>$(DefineConstants);WIN32;FD_SETSIZE=4096;PCRE_SUPPORT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
@@ -189,7 +175,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;FD_SETSIZE=4096;PCRE_SUPPORT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>$(DefineConstants);WIN32;FD_SETSIZE=4096;PCRE_SUPPORT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
@@ -211,7 +197,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>$(DefineConstants);WIN32;FD_SETSIZE=4096;PCRE_SUPPORT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>$(DefineConstants);WIN32;FD_SETSIZE=4096;PCRE_SUPPORT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;LIBCONFIG_STATIC;YY_USE_CONST;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\mt19937ar\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\zlib\include\;$(SolutionDir)3rdparty\mysql\include\;$(SolutionDir)3rdparty\libconfig\;$(SolutionDir)3rdparty\yaml-cpp\include\</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
|||||||
@@ -11,173 +11,137 @@
|
|||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="atomic.h">
|
<ClInclude Include="cbasetypes.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="cbasetypes.h">
|
<ClInclude Include="cli.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="cli.h">
|
<ClInclude Include="conf.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="conf.h">
|
<ClInclude Include="core.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="core.h">
|
<ClInclude Include="db.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="db.h">
|
<ClInclude Include="des.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="des.h">
|
<ClInclude Include="ers.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="ers.h">
|
<ClInclude Include="grfio.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="grfio.h">
|
<ClInclude Include="malloc.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="malloc.h">
|
<ClInclude Include="mapindex.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="mapindex.h">
|
<ClInclude Include="md5calc.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="md5calc.h">
|
<ClInclude Include="mmo.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="mempool.h">
|
<ClInclude Include="msg_conf.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="mmo.h">
|
<ClInclude Include="nullpo.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="msg_conf.h">
|
<ClInclude Include="random.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="mutex.h">
|
<ClInclude Include="showmsg.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="nullpo.h">
|
<ClInclude Include="socket.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="raconf.h">
|
<ClInclude Include="sql.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="random.h">
|
<ClInclude Include="strlib.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="showmsg.h">
|
<ClInclude Include="timer.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="socket.h">
|
<ClInclude Include="utils.hpp">
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="spinlock.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="sql.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="strlib.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="thread.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="timer.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="utils.h">
|
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="winapi.hpp">
|
<ClInclude Include="winapi.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="yamlwrapper.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="utilities.hpp">
|
<ClInclude Include="utilities.hpp">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="cli.c">
|
<ClCompile Include="cli.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="conf.c">
|
<ClCompile Include="conf.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="core.cpp">
|
<ClCompile Include="core.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="db.c">
|
<ClCompile Include="db.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="des.c">
|
<ClCompile Include="des.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="ers.c">
|
<ClCompile Include="ers.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="grfio.c">
|
<ClCompile Include="grfio.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="malloc.c">
|
<ClCompile Include="malloc.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="mapindex.c">
|
<ClCompile Include="mapindex.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="md5calc.c">
|
<ClCompile Include="md5calc.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="mempool.c">
|
<ClCompile Include="msg_conf.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="msg_conf.c">
|
<ClCompile Include="nullpo.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="mutex.c">
|
<ClCompile Include="random.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="nullpo.c">
|
<ClCompile Include="showmsg.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="raconf.c">
|
<ClCompile Include="socket.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="random.c">
|
<ClCompile Include="sql.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="showmsg.c">
|
<ClCompile Include="strlib.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="socket.c">
|
<ClCompile Include="timer.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="sql.c">
|
<ClCompile Include="utils.cpp">
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="strlib.c">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="thread.c">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="timer.c">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="utils.c">
|
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="winapi.cpp">
|
<ClInclude Include="winapi.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="yamlwrapper.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="utilities.cpp">
|
<ClCompile Include="utilities.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.hpp"
|
||||||
#include "showmsg.h" // ShowError
|
#include "showmsg.hpp" // ShowError
|
||||||
|
|
||||||
int conf_read_file(config_t *config, const char *config_filename)
|
int conf_read_file(config_t *config, const char *config_filename)
|
||||||
{
|
{
|
||||||
@@ -1,21 +1,13 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#ifndef _CONF_H_
|
#ifndef _CONF_HPP_
|
||||||
#define _CONF_H_
|
#define _CONF_HPP_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#include "cbasetypes.hpp"
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
#include "../../3rdparty/libconfig/libconfig.h"
|
#include "../../3rdparty/libconfig/libconfig.h"
|
||||||
|
|
||||||
int conf_read_file(config_t *config, const char *config_filename);
|
int conf_read_file(config_t *config, const char *config_filename);
|
||||||
int config_setting_copy(config_setting_t *parent, const config_setting_t *src);
|
int config_setting_copy(config_setting_t *parent, const config_setting_t *src);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif // _CONF_HPP_
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // _CONF_H_
|
|
||||||
@@ -1,19 +1,17 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#include "mmo.h"
|
#include "mmo.hpp"
|
||||||
#include "cbasetypes.h"
|
#include "cbasetypes.hpp"
|
||||||
#include "showmsg.h"
|
#include "showmsg.hpp"
|
||||||
#include "malloc.h"
|
#include "malloc.hpp"
|
||||||
#include "core.h"
|
#include "core.hpp"
|
||||||
#include "strlib.h"
|
#include "strlib.hpp"
|
||||||
#ifndef MINICORE
|
#ifndef MINICORE
|
||||||
#include "ers.h"
|
#include "ers.hpp"
|
||||||
#include "socket.h"
|
#include "socket.hpp"
|
||||||
#include "timer.h"
|
#include "timer.hpp"
|
||||||
#include "thread.h"
|
#include "sql.hpp"
|
||||||
#include "mempool.h"
|
|
||||||
#include "sql.h"
|
|
||||||
#endif
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -125,7 +123,7 @@ static void sig_proc(int sn) {
|
|||||||
//run_flag = 0; // should we quit?
|
//run_flag = 0; // should we quit?
|
||||||
break;
|
break;
|
||||||
case SIGPIPE:
|
case SIGPIPE:
|
||||||
//ShowInfo ("Broken pipe found... closing socket\n"); // set to eof in socket.c
|
//ShowInfo ("Broken pipe found... closing socket\n"); // set to eof in socket.cpp
|
||||||
break; // does nothing here
|
break; // does nothing here
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -351,8 +349,6 @@ int main (int argc, char **argv)
|
|||||||
usercheck();
|
usercheck();
|
||||||
|
|
||||||
Sql_Init();
|
Sql_Init();
|
||||||
rathread_init();
|
|
||||||
mempool_init();
|
|
||||||
db_init();
|
db_init();
|
||||||
signals_init();
|
signals_init();
|
||||||
|
|
||||||
@@ -376,8 +372,6 @@ int main (int argc, char **argv)
|
|||||||
timer_final();
|
timer_final();
|
||||||
socket_final();
|
socket_final();
|
||||||
db_final();
|
db_final();
|
||||||
mempool_final();
|
|
||||||
rathread_final();
|
|
||||||
ers_final();
|
ers_final();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#ifndef _CORE_H_
|
#ifndef _CORE_HPP_
|
||||||
#define _CORE_H_
|
#define _CORE_HPP_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* so that developers with --enable-debug can raise signals from any section of the code they'd like */
|
/* so that developers with --enable-debug can raise signals from any section of the code they'd like */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -57,8 +53,4 @@ enum E_CORE_ST
|
|||||||
/// If NULL, runflag is set to CORE_ST_STOP instead.
|
/// If NULL, runflag is set to CORE_ST_STOP instead.
|
||||||
extern void (*shutdown_callback)(void);
|
extern void (*shutdown_callback)(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* _CORE_HPP_ */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _CORE_H_ */
|
|
||||||
@@ -65,16 +65,16 @@
|
|||||||
* @version 2006/12/21
|
* @version 2006/12/21
|
||||||
* @author Athena Dev team
|
* @author Athena Dev team
|
||||||
* @encoding US-ASCII
|
* @encoding US-ASCII
|
||||||
* @see #db.h
|
* @see #db.hpp
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
#include "db.h"
|
#include "db.hpp"
|
||||||
|
|
||||||
#include "ers.h"
|
#include "ers.hpp"
|
||||||
#include "malloc.h"
|
#include "malloc.hpp"
|
||||||
#include "mmo.h"
|
#include "mmo.hpp"
|
||||||
#include "showmsg.h"
|
#include "showmsg.hpp"
|
||||||
#include "strlib.h"
|
#include "strlib.hpp"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -2565,7 +2565,7 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt
|
|||||||
db->free_lock = 0;
|
db->free_lock = 0;
|
||||||
/* Other */
|
/* Other */
|
||||||
snprintf(ers_name, 50, "db_alloc:nodes:%s:%s:%d",func,file,line);
|
snprintf(ers_name, 50, "db_alloc:nodes:%s:%s:%d",func,file,line);
|
||||||
db->nodes = ers_new(sizeof(struct dbn),ers_name,ERS_OPT_WAIT|ERS_OPT_FREE_NAME|ERS_OPT_CLEAN);
|
db->nodes = ers_new(sizeof(struct dbn),ers_name,ERS_DBN_OPTIONS);
|
||||||
db->cmp = db_default_cmp(type);
|
db->cmp = db_default_cmp(type);
|
||||||
db->hash = db_default_hash(type);
|
db->hash = db_default_hash(type);
|
||||||
db->release = db_default_release(type, options);
|
db->release = db_default_release(type, options);
|
||||||
@@ -2758,8 +2758,8 @@ void* db_data2ptr(DBData *data)
|
|||||||
* @see #db_final(void)
|
* @see #db_final(void)
|
||||||
*/
|
*/
|
||||||
void db_init(void) {
|
void db_init(void) {
|
||||||
db_iterator_ers = ers_new(sizeof(struct DBIterator_impl),"db.c::db_iterator_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK);
|
db_iterator_ers = ers_new(sizeof(struct DBIterator_impl),"db.cpp::db_iterator_ers",ERS_CACHE_OPTIONS);
|
||||||
db_alloc_ers = ers_new(sizeof(struct DBMap_impl),"db.c::db_alloc_ers",ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK);
|
db_alloc_ers = ers_new(sizeof(struct DBMap_impl),"db.cpp::db_alloc_ers",ERS_CACHE_OPTIONS);
|
||||||
ers_chunk_size(db_alloc_ers, 50);
|
ers_chunk_size(db_alloc_ers, 50);
|
||||||
ers_chunk_size(db_iterator_ers, 10);
|
ers_chunk_size(db_iterator_ers, 10);
|
||||||
DB_COUNTSTAT(db_init);
|
DB_COUNTSTAT(db_init);
|
||||||
@@ -37,18 +37,14 @@
|
|||||||
* @author (Athena build 4859) Flavio @ Amazon Project *
|
* @author (Athena build 4859) Flavio @ Amazon Project *
|
||||||
* @author (up to Athena build 4706) Athena Dev Teams *
|
* @author (up to Athena build 4706) Athena Dev Teams *
|
||||||
* @encoding US-ASCII *
|
* @encoding US-ASCII *
|
||||||
* @see common#db.c *
|
* @see common#db.cpp *
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
#ifndef _DB_H_
|
#ifndef _DB_HPP_
|
||||||
#define _DB_H_
|
#define _DB_HPP_
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
#include "cbasetypes.hpp"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*****************************************************************************\
|
/*****************************************************************************\
|
||||||
* (1) Section with public typedefs, enums, unions, structures and defines. *
|
* (1) Section with public typedefs, enums, unions, structures and defines. *
|
||||||
@@ -1659,8 +1655,4 @@ void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...);
|
|||||||
/// @return negative if v1 is top, positive if v2 is top, 0 if equal
|
/// @return negative if v1 is top, positive if v2 is top, 0 if equal
|
||||||
#define BHEAP_MAXTOPCMP(v1,v2) ( v1 == v2 ? 0 : v1 > v2 ? -1 : 1 )
|
#define BHEAP_MAXTOPCMP(v1,v2) ( v1 == v2 ? 0 : v1 > v2 ? -1 : 1 )
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* _DB_HPP_ */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _DB_H_ */
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
#include "cbasetypes.h"
|
#include "cbasetypes.hpp"
|
||||||
#include "des.h"
|
#include "des.hpp"
|
||||||
|
|
||||||
|
|
||||||
/// DES (Data Encryption Standard) algorithm, modified version.
|
/// DES (Data Encryption Standard) algorithm, modified version.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
#ifndef _DES_H_
|
#ifndef _DES_HPP_
|
||||||
#define _DES_H_
|
#define _DES_HPP_
|
||||||
|
|
||||||
|
|
||||||
/// One 64-bit block.
|
/// One 64-bit block.
|
||||||
@@ -12,4 +12,4 @@ void des_decrypt_block(BIT64* block);
|
|||||||
void des_decrypt(unsigned char* data, size_t size);
|
void des_decrypt(unsigned char* data, size_t size);
|
||||||
|
|
||||||
|
|
||||||
#endif // _DES_H_
|
#endif // _DES_HPP_
|
||||||
@@ -37,15 +37,15 @@
|
|||||||
* @version 1.0 - ERS Rework *
|
* @version 1.0 - ERS Rework *
|
||||||
* @author GreenBox @ rAthena Project *
|
* @author GreenBox @ rAthena Project *
|
||||||
* @encoding US-ASCII *
|
* @encoding US-ASCII *
|
||||||
* @see common#ers.h *
|
* @see common#ers.hpp *
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
#include "cbasetypes.hpp"
|
||||||
#include "ers.h"
|
#include "ers.hpp"
|
||||||
#include "malloc.h" // CREATE, RECREATE, aMalloc, aFree
|
#include "malloc.hpp" // CREATE, RECREATE, aMalloc, aFree
|
||||||
#include "nullpo.h"
|
#include "nullpo.hpp"
|
||||||
#include "showmsg.h" // ShowMessage, ShowError, ShowFatalError, CL_BOLD, CL_NORMAL
|
#include "showmsg.hpp" // ShowMessage, ShowError, ShowFatalError, CL_BOLD, CL_NORMAL
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -141,7 +141,7 @@ static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options) {
|
|||||||
cache->UsedObjs = 0;
|
cache->UsedObjs = 0;
|
||||||
cache->Max = 0;
|
cache->Max = 0;
|
||||||
cache->ChunkSize = ERS_BLOCK_ENTRIES;
|
cache->ChunkSize = ERS_BLOCK_ENTRIES;
|
||||||
cache->Options = (Options & ERS_CACHE_OPTIONS);
|
cache->Options = (enum ERSOptions)(Options & ERS_CACHE_OPTIONS);
|
||||||
|
|
||||||
if (CacheList == NULL)
|
if (CacheList == NULL)
|
||||||
{
|
{
|
||||||
@@ -335,7 +335,7 @@ void ers_report(void) {
|
|||||||
|
|
||||||
for (cache = CacheList; cache; cache = cache->Next) {
|
for (cache = CacheList; cache; cache = cache->Next) {
|
||||||
cache_c++;
|
cache_c++;
|
||||||
ShowMessage(CL_BOLD"[ERS Cache of size '"CL_NORMAL""CL_WHITE"%u"CL_NORMAL""CL_BOLD"' report]\n"CL_NORMAL, cache->ObjectSize);
|
ShowMessage(CL_BOLD"[ERS Cache of size '" CL_NORMAL "" CL_WHITE "%u" CL_NORMAL "" CL_BOLD "' report]\n" CL_NORMAL, cache->ObjectSize);
|
||||||
ShowMessage("\tinstances : %u\n", cache->ReferenceCount);
|
ShowMessage("\tinstances : %u\n", cache->ReferenceCount);
|
||||||
ShowMessage("\tblocks in use : %u/%u\n", cache->UsedObjs, cache->UsedObjs+cache->Free);
|
ShowMessage("\tblocks in use : %u/%u\n", cache->UsedObjs, cache->UsedObjs+cache->Free);
|
||||||
ShowMessage("\tblocks unused : %u\n", cache->Free);
|
ShowMessage("\tblocks unused : %u\n", cache->Free);
|
||||||
@@ -346,9 +346,9 @@ void ers_report(void) {
|
|||||||
memory_b += cache->UsedObjs * cache->ObjectSize;
|
memory_b += cache->UsedObjs * cache->ObjectSize;
|
||||||
memory_t += (cache->UsedObjs+cache->Free) * cache->ObjectSize;
|
memory_t += (cache->UsedObjs+cache->Free) * cache->ObjectSize;
|
||||||
}
|
}
|
||||||
ShowInfo("ers_report: '"CL_WHITE"%u"CL_NORMAL"' caches in use\n",cache_c);
|
ShowInfo("ers_report: '" CL_WHITE "%u" CL_NORMAL "' caches in use\n",cache_c);
|
||||||
ShowInfo("ers_report: '"CL_WHITE"%u"CL_NORMAL"' blocks in use, consuming '"CL_WHITE"%.2f MB"CL_NORMAL"'\n",blocks_u,(double)((memory_b)/1024)/1024);
|
ShowInfo("ers_report: '" CL_WHITE "%u" CL_NORMAL "' blocks in use, consuming '" CL_WHITE "%.2f MB" CL_NORMAL "'\n",blocks_u,(double)((memory_b)/1024)/1024);
|
||||||
ShowInfo("ers_report: '"CL_WHITE"%u"CL_NORMAL"' blocks total, consuming '"CL_WHITE"%.2f MB"CL_NORMAL"' \n",blocks_a,(double)((memory_t)/1024)/1024);
|
ShowInfo("ers_report: '" CL_WHITE "%u" CL_NORMAL "' blocks total, consuming '" CL_WHITE "%.2f MB" CL_NORMAL "' \n",blocks_a,(double)((memory_t)/1024)/1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,14 +37,10 @@
|
|||||||
* @author Flavio @ Amazon Project *
|
* @author Flavio @ Amazon Project *
|
||||||
* @encoding US-ASCII *
|
* @encoding US-ASCII *
|
||||||
\*****************************************************************************/
|
\*****************************************************************************/
|
||||||
#ifndef _ERS_H_
|
#ifndef _ERS_HPP_
|
||||||
#define _ERS_H_
|
#define _ERS_HPP_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#include "cbasetypes.hpp"
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
|
|
||||||
/*****************************************************************************\
|
/*****************************************************************************\
|
||||||
* (1) All public parts of the Entry Reusage System. *
|
* (1) All public parts of the Entry Reusage System. *
|
||||||
@@ -85,6 +81,7 @@ enum ERSOptions {
|
|||||||
/* Compound, is used to determine whether it should be looking for a cache of matching options */
|
/* Compound, is used to determine whether it should be looking for a cache of matching options */
|
||||||
ERS_CACHE_OPTIONS = ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK,
|
ERS_CACHE_OPTIONS = ERS_OPT_CLEAN|ERS_OPT_FLEX_CHUNK,
|
||||||
ERS_CLEAN_OPTIONS = ERS_OPT_CLEAN|ERS_OPT_CLEAR,
|
ERS_CLEAN_OPTIONS = ERS_OPT_CLEAN|ERS_OPT_CLEAR,
|
||||||
|
ERS_DBN_OPTIONS = ERS_OPT_CLEAN|ERS_OPT_WAIT|ERS_OPT_FREE_NAME,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,8 +177,4 @@ void ers_report(void);
|
|||||||
void ers_final(void);
|
void ers_final(void);
|
||||||
#endif /* DISABLE_ERS / not DISABLE_ERS */
|
#endif /* DISABLE_ERS / not DISABLE_ERS */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* _ERS_HPP_ */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _ERS_H_ */
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
#ifndef _rA_EVDP_H_
|
|
||||||
#define _rA_EVDP_H_
|
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
|
|
||||||
typedef struct EVDP_DATA EVDP_DATA;
|
|
||||||
|
|
||||||
|
|
||||||
//#idef EVDP_EPOLL
|
|
||||||
#include <sys/epoll.h>
|
|
||||||
struct EVDP_DATA{
|
|
||||||
struct epoll_event ev_data;
|
|
||||||
bool ev_added;
|
|
||||||
};
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
|
|
||||||
enum EVDP_EVENTFLAGS{
|
|
||||||
EVDP_EVENT_IN = 1, // Incomming data
|
|
||||||
EVDP_EVENT_OUT = 2, // Connection accepts writing.
|
|
||||||
EVDP_EVENT_HUP = 4 // Connection Closed.
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct EVDP_EVENT{
|
|
||||||
int32 events; // due to performance reasons, this should be the first member.
|
|
||||||
int32 fd; // Connection Identifier
|
|
||||||
} EVDP_EVENT;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Network Event Dispatcher Initialization / Finalization routines
|
|
||||||
*/
|
|
||||||
void evdp_init();
|
|
||||||
void evdp_final();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Will Wait for events.
|
|
||||||
*
|
|
||||||
* @param *out_ev pointer to array in size at least of max_events.
|
|
||||||
* @param max_events max no of events to report with this call (coalesc)
|
|
||||||
* @param timeout_ticks max time to wait in ticks (milliseconds)
|
|
||||||
*
|
|
||||||
* @Note:
|
|
||||||
* The function will block until an event has occured on one of the monitored connections
|
|
||||||
* or the timeout of timeout_ticks has passed by.
|
|
||||||
* Upon successfull call (changed connections) this function will write the connection
|
|
||||||
* Identifier & event to the out_fds array.
|
|
||||||
*
|
|
||||||
* @return 0 -> Timeout, > 0 no of changed connections.
|
|
||||||
*/
|
|
||||||
int32 evdp_wait(EVDP_EVENT *out_fds, int32 max_events, int32 timeout_ticks);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applys the given mask on the given connection.
|
|
||||||
*
|
|
||||||
* @param fd connection identifier
|
|
||||||
* @param *ep event data pointer for the connection
|
|
||||||
* @param mask new event mask we're monitoring for.
|
|
||||||
*/
|
|
||||||
//void evdp_apply(int32 fd, EVDP_DATA *ep, int32 mask);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a connection (listner) to the event notification system.
|
|
||||||
*
|
|
||||||
* @param fd connection identifier
|
|
||||||
* @param *ep event data pointer for the connection
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* Listener type sockets are edge triggered, (see epoll manual for more information)
|
|
||||||
* - This basicaly means that youll receive one event, adn you have to accept until accept returns an error (nothing to accept)
|
|
||||||
*
|
|
||||||
* MONITORS by default: IN
|
|
||||||
*
|
|
||||||
* @return success indicator.
|
|
||||||
*/
|
|
||||||
bool evdp_addlistener(int32 fd, EVDP_DATA *ep);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a connection (client connectioN) to the event notification system
|
|
||||||
*
|
|
||||||
* @param fd connection identifier
|
|
||||||
* @param *ep event data pointr for the connection
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
*
|
|
||||||
* MONITORS by default: IN, HUP
|
|
||||||
*
|
|
||||||
* @return success indicator.
|
|
||||||
*/
|
|
||||||
bool evdp_addclient(int32 fd, EVDP_DATA *ep);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a connection (pending / outgoing connection!) to the event notification system.
|
|
||||||
*
|
|
||||||
* @param fd connection identifier
|
|
||||||
* @param *ep event data pointer for the conneciton.
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* Outgoing connection type sockets are getting monitored for connection established
|
|
||||||
* successfull
|
|
||||||
* - if the connection has been established - we're generitng a writable notification .. (send)
|
|
||||||
* this is typical for BSD / posix conform network stacks.
|
|
||||||
* - Additinionally its edge triggered.
|
|
||||||
*
|
|
||||||
* @see evdp_outgoingconnection_established
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return success indicator
|
|
||||||
*/
|
|
||||||
bool evdp_addconnecting(int32 fd, EVDP_DATA *ep);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds an outgoing connection to the normal event notification system after it has been successfully established.
|
|
||||||
*
|
|
||||||
* @param fd connection identifier
|
|
||||||
* @param *ep event data pointer for the conneciton.
|
|
||||||
|
|
||||||
* @note
|
|
||||||
* after this call, its handled like a normal "client" connection (incomming)
|
|
||||||
*
|
|
||||||
* @rturn success indicator
|
|
||||||
*/
|
|
||||||
bool evdp_outgoingconnection_established(int32 fd, EVDP_DATA *ep);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Marks a connection to be monitored for writable.
|
|
||||||
*
|
|
||||||
* @param fd connection identifier
|
|
||||||
* @param *ep event data pointer for the connection
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* the connection must be already added (as client or listener)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return success indicator
|
|
||||||
*/
|
|
||||||
bool evdp_writable_add(int32 fd, EVDP_DATA *ep);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the connection from writable notification monitoring
|
|
||||||
*
|
|
||||||
* @param fd connection identifier
|
|
||||||
* @param *ep event data pointr for the connection
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void evdp_writable_remove(int32 fd, EVDP_DATA *ep);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes an connectio from the event notification system.
|
|
||||||
*
|
|
||||||
* @param fd connection iditentfir
|
|
||||||
* @param *ep event data pointer for th connection
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* this will also clear the given EVENT_DATA block
|
|
||||||
* so the connection slot is in an "initial" blank status / ready to get reused.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void evdp_remove(int32 fd, EVDP_DATA *ep);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
//
|
|
||||||
// Event Dispatcher Abstraction for EPOLL
|
|
||||||
//
|
|
||||||
// Author: Florian Wilkemeyer <fw@f-ws.de>
|
|
||||||
//
|
|
||||||
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
|
|
||||||
// For more information, see LICENCE in the main folder
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#define EPOLL_MAX_PER_CYCLE 10 // Max Events to coalesc. per cycle.
|
|
||||||
|
|
||||||
|
|
||||||
static int epoll_fd = -1;
|
|
||||||
|
|
||||||
|
|
||||||
void evdp_init(){
|
|
||||||
|
|
||||||
epoll_fd = epoll_create( EPOLL_MAX_PER_CYCLE );
|
|
||||||
if(epoll_fd == -1){
|
|
||||||
ShowFatalError("evdp [EPOLL]: Cannot create event dispatcher (errno: %u / %s)\n", errno, strerror(errno) );
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}//end: evdp_init()
|
|
||||||
|
|
||||||
|
|
||||||
void evdp_final(){
|
|
||||||
|
|
||||||
if(epoll_fd != -1){
|
|
||||||
close(epoll_fd);
|
|
||||||
epoll_fd = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}//end: evdp_final()
|
|
||||||
|
|
||||||
|
|
||||||
int32 evdp_wait(EVDP_EVENT *out_fds, int32 max_events, int32 timeout_ticks){
|
|
||||||
struct epoll_event l_events[EPOLL_MAX_PER_CYCLE];
|
|
||||||
register struct epoll_event *ev;
|
|
||||||
register int nfds, n;
|
|
||||||
|
|
||||||
if(max_events > EPOLL_MAX_PER_CYCLE)
|
|
||||||
max_events = EPOLL_MAX_PER_CYCLE;
|
|
||||||
|
|
||||||
nfds = epoll_wait( epoll_fd, l_events, max_events, timeout_ticks);
|
|
||||||
if(nfds == -1){
|
|
||||||
// @TODO: check if core is in shutdown mode. if - ignroe error.
|
|
||||||
|
|
||||||
ShowFatalError("evdp [EPOLL]: epoll_wait returned bad / unexpected status (errno: %u / %s)\n", errno, strerror(errno));
|
|
||||||
exit(1); //..
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop thru all events and copy it to the local ra evdp_event.. struct.
|
|
||||||
for(n = 0; n < nfds; n++){
|
|
||||||
ev = &l_events[n];
|
|
||||||
|
|
||||||
out_fds->fd = ev->data.fd;
|
|
||||||
out_fds->events = 0; // clear
|
|
||||||
|
|
||||||
if(ev->events & EPOLLHUP)
|
|
||||||
out_fds->events |= EVDP_EVENT_HUP;
|
|
||||||
|
|
||||||
if(ev->events & EPOLLIN)
|
|
||||||
out_fds->events |= EVDP_EVENT_IN;
|
|
||||||
|
|
||||||
if(ev->events & EPOLLOUT)
|
|
||||||
out_fds->events |= EVDP_EVENT_OUT;
|
|
||||||
|
|
||||||
out_fds++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nfds; // 0 on timeout or > 0 ..
|
|
||||||
}//end: evdp_wait()
|
|
||||||
|
|
||||||
|
|
||||||
void evdp_remove(int32 fd, EVDP_DATA *ep){
|
|
||||||
|
|
||||||
if(ep->ev_added == true){
|
|
||||||
|
|
||||||
if( epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fd, &ep->ev_data) != 0){
|
|
||||||
ShowError("evdp [EPOLL]: evdp_remove - epoll_ctl (EPOLL_CTL_DEL) failed! fd #%u (errno %u / %s)\n", fd, errno, strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
ep->ev_data.events = 0; // clear struct.
|
|
||||||
ep->ev_data.data.fd = -1; // .. clear struct ..
|
|
||||||
|
|
||||||
ep->ev_added = false; // not added!
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}//end: evdp_remove()
|
|
||||||
|
|
||||||
|
|
||||||
bool evdp_addlistener(int32 fd, EVDP_DATA *ep){
|
|
||||||
|
|
||||||
ep->ev_data.events = EPOLLET|EPOLLIN;
|
|
||||||
ep->ev_data.data.fd = fd;
|
|
||||||
|
|
||||||
// No check here for 'added ?'
|
|
||||||
// listeners cannot be added twice.
|
|
||||||
//
|
|
||||||
if( epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ep->ev_data) != 0 ){
|
|
||||||
ShowError("evdp [EPOLL]: evdp_addlistener - epoll_ctl (EPOLL_CTL_ADD) faield! fd #%u (errno %u / %s)\n", fd, errno, strerror(errno));
|
|
||||||
ep->ev_data.events = 0;
|
|
||||||
ep->ev_data.data.fd = -1;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ep->ev_added = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}//end: evdp_addlistener()
|
|
||||||
|
|
||||||
|
|
||||||
bool evdp_addclient(int32 fd, EVDP_DATA *ep){
|
|
||||||
|
|
||||||
ep->ev_data.events = EPOLLIN | EPOLLHUP;
|
|
||||||
ep->ev_data.data.fd = fd;
|
|
||||||
|
|
||||||
// No check for "added?" here,
|
|
||||||
// this function only gets called upon accpept.
|
|
||||||
//
|
|
||||||
|
|
||||||
if( epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ep->ev_data) != 0){
|
|
||||||
ShowError("evdp [EPOLL]: evdp_addclient - epoll_ctl (EPOLL_CTL_ADD) failed! fd #%u (errno %u / %s)\n", fd, errno, strerror(errno));
|
|
||||||
ep->ev_data.events = 0;
|
|
||||||
ep->ev_data.data.fd = -1;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ep->ev_added = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}//end: evdp_addclient()
|
|
||||||
|
|
||||||
|
|
||||||
bool evdp_addconnecting(int32 fd, EVDP_DATA *ep){
|
|
||||||
|
|
||||||
ep->ev_data.events = EPOLLET | EPOLLOUT | EPOLLHUP;
|
|
||||||
ep->ev_data.data.fd = fd;
|
|
||||||
|
|
||||||
if( epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ep->ev_data) != 0){
|
|
||||||
ShowError("evdp [EPOLL]: evdp_addconnecting - epoll_ctl (EPOLL_CTL_ADD) failed! fd #%u (errno %u / %s)\n", fd, errno, strerror(errno));
|
|
||||||
ep->ev_data.events = 0;
|
|
||||||
ep->ev_data.data.fd = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ep->ev_added = true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}//end: evdp_addconnecting()
|
|
||||||
|
|
||||||
|
|
||||||
bool evdp_outgoingconnection_established(int32 fd, EVDP_DATA *ep){
|
|
||||||
int32 saved_mask;
|
|
||||||
|
|
||||||
if(ep->ev_added != true){
|
|
||||||
// !
|
|
||||||
ShowError("evdp [EPOLL]: evdp_outgoingconnection_established fd #%u is not added to event dispatcher! invalid call.\n", fd);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
saved_mask = ep->ev_data.events;
|
|
||||||
|
|
||||||
ep->ev_data.events = EPOLLIN | EPOLLHUP;
|
|
||||||
|
|
||||||
if( epoll_ctl(epoll_fd, EPOLL_CTL_MOD, fd, &ep->ev_data) != 0){
|
|
||||||
ep->ev_data.events = saved_mask; // restore old mask.
|
|
||||||
ShowError("evdp [EPOLL]: evdp_outgoingconnection_established - epoll_ctl (EPOLL_CTL_MOD) failed! fd #%u (errno %u / %s)\n", fd, errno, strerror(errno));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}//end: evdp_outgoingconnection_established()
|
|
||||||
|
|
||||||
|
|
||||||
bool evdp_writable_add(int32 fd, EVDP_DATA *ep){
|
|
||||||
|
|
||||||
if(ep->ev_added != true){
|
|
||||||
ShowError("evdp [EPOLL]: evdp_writable_add - tried to add not added fd #%u\n",fd);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(! (ep->ev_data.events & EPOLLOUT) ){ //
|
|
||||||
|
|
||||||
ep->ev_data.events |= EPOLLOUT;
|
|
||||||
if( epoll_ctl(epoll_fd, EPOLL_CTL_MOD, fd, &ep->ev_data) != 0 ){
|
|
||||||
ShowError("evdp [EPOLL]: evdp_writable_add - epoll_ctl (EPOLL_CTL_MOD) failed! fd #%u (errno: %u / %s)\n", fd, errno, strerror(errno));
|
|
||||||
ep->ev_data.events &= ~EPOLLOUT; // remove from local flagmask due to failed syscall.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}//end: evdp_writable_add()
|
|
||||||
|
|
||||||
|
|
||||||
void evdp_writable_remove(int32 fd, EVDP_DATA *ep){
|
|
||||||
|
|
||||||
if(ep->ev_added != true){
|
|
||||||
ShowError("evdp [EPOLL]: evdp_writable_remove - tried to remove not added fd #%u\n", fd);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ep->ev_data.events & EPOLLOUT ){
|
|
||||||
|
|
||||||
ep->ev_data.events &= ~EPOLLOUT;
|
|
||||||
if( epoll_ctl(epoll_fd, EPOLL_CTL_MOD, fd, &ep->ev_data) != 0){
|
|
||||||
ShowError("evdp [EPOLL]: evdp_writable_remove - epoll_ctl (EPOLL_CTL_MOD) failed! fd #%u (errno %u / %s)\n", fd, errno, strerror(errno));
|
|
||||||
ep->ev_data.events |= EPOLLOUT; // add back to local flagmask because of failed syscall.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}//end: evdp_writable_remove()
|
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
#include "cbasetypes.hpp"
|
||||||
#include "des.h"
|
#include "des.hpp"
|
||||||
#include "malloc.h"
|
#include "malloc.hpp"
|
||||||
#include "showmsg.h"
|
#include "showmsg.hpp"
|
||||||
#include "strlib.h"
|
#include "strlib.hpp"
|
||||||
#include "utils.h"
|
#include "utils.hpp"
|
||||||
#include "grfio.h"
|
#include "grfio.hpp"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
@@ -395,9 +395,8 @@ void* grfio_reads(const char* fname, int* size)
|
|||||||
|
|
||||||
in = fopen(lfname, "rb");
|
in = fopen(lfname, "rb");
|
||||||
if( in != NULL ) {
|
if( in != NULL ) {
|
||||||
int declen;
|
|
||||||
fseek(in,0,SEEK_END);
|
fseek(in,0,SEEK_END);
|
||||||
declen = ftell(in);
|
size_t declen = ftell(in);
|
||||||
fseek(in,0,SEEK_SET);
|
fseek(in,0,SEEK_SET);
|
||||||
buf2 = (unsigned char *)aMalloc(declen+1); // +1 for resnametable zero-termination
|
buf2 = (unsigned char *)aMalloc(declen+1); // +1 for resnametable zero-termination
|
||||||
if(fread(buf2, 1, declen, in) != declen) ShowError("An error occured in fread grfio_reads, fname=%s \n",fname);
|
if(fread(buf2, 1, declen, in) != declen) ShowError("An error occured in fread grfio_reads, fname=%s \n",fname);
|
||||||
@@ -419,7 +418,7 @@ void* grfio_reads(const char* fname, int* size)
|
|||||||
char* grfname = gentry_table[entry->gentry - 1];
|
char* grfname = gentry_table[entry->gentry - 1];
|
||||||
FILE* in = fopen(grfname, "rb");
|
FILE* in = fopen(grfname, "rb");
|
||||||
if( in != NULL ) {
|
if( in != NULL ) {
|
||||||
int fsize = entry->srclen_aligned;
|
size_t fsize = entry->srclen_aligned;
|
||||||
unsigned char *buf = (unsigned char *)aMalloc(fsize);
|
unsigned char *buf = (unsigned char *)aMalloc(fsize);
|
||||||
fseek(in, entry->srcpos, 0);
|
fseek(in, entry->srcpos, 0);
|
||||||
if(fread(buf, 1, fsize, in) != fsize) ShowError("An error occured in fread in grfio_reads, grfname=%s\n",grfname);
|
if(fread(buf, 1, fsize, in) != fsize) ShowError("An error occured in fread in grfio_reads, grfname=%s\n",grfname);
|
||||||
@@ -515,8 +514,7 @@ static int grfio_entryread(const char* grfname, int gentry)
|
|||||||
grf_version = getlong(grf_header+0x2a) >> 8;
|
grf_version = getlong(grf_header+0x2a) >> 8;
|
||||||
|
|
||||||
if( grf_version == 0x01 ) {// ****** Grf version 01xx ******
|
if( grf_version == 0x01 ) {// ****** Grf version 01xx ******
|
||||||
long list_size;
|
size_t list_size = grf_size - ftell(fp);
|
||||||
list_size = grf_size - ftell(fp);
|
|
||||||
grf_filelist = (unsigned char *) aMalloc(list_size);
|
grf_filelist = (unsigned char *) aMalloc(list_size);
|
||||||
if(fread(grf_filelist,1,list_size,fp) != list_size) { ShowError("Couldn't read all grf_filelist element of %s \n", grfname); }
|
if(fread(grf_filelist,1,list_size,fp) != list_size) { ShowError("Couldn't read all grf_filelist element of %s \n", grfname); }
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@@ -695,7 +693,7 @@ static void grfio_resourcecheck(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, "resnametable.txt");
|
ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", i, "resnametable.txt");
|
||||||
return; // we're done here!
|
return; // we're done here!
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -718,7 +716,7 @@ static void grfio_resourcecheck(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
aFree(buf);
|
aFree(buf);
|
||||||
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, "data\\resnametable.txt");
|
ShowStatus("Done reading '" CL_WHITE "%d" CL_RESET "' entries in '" CL_WHITE "%s" CL_RESET "'.\n", i, "data\\resnametable.txt");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -803,7 +801,7 @@ void grfio_init(const char* fname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(data_conf);
|
fclose(data_conf);
|
||||||
ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n", fname);
|
ShowStatus("Done reading '" CL_WHITE "%s" CL_RESET "'.\n", fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( grf_num == 0 )
|
if( grf_num == 0 )
|
||||||
@@ -1,12 +1,8 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#ifndef _GRFIO_H_
|
#ifndef _GRFIO_HPP_
|
||||||
#define _GRFIO_H_
|
#define _GRFIO_HPP_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void grfio_init(const char* fname);
|
void grfio_init(const char* fname);
|
||||||
void grfio_final(void);
|
void grfio_final(void);
|
||||||
@@ -18,8 +14,4 @@ unsigned long grfio_crc32(const unsigned char *buf, unsigned int len);
|
|||||||
int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
|
int decode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
|
||||||
int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
|
int encode_zip(void* dest, unsigned long* destLen, const void* source, unsigned long sourceLen);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* _GRFIO_HPP_ */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _GRFIO_H_ */
|
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#include "malloc.h"
|
#include "malloc.hpp"
|
||||||
#include "core.h"
|
#include "core.hpp"
|
||||||
#include "showmsg.h"
|
#include "showmsg.hpp"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#define FREED_POINTER 0xdeadbeafL
|
||||||
|
|
||||||
////////////// Memory Libraries //////////////////
|
////////////// Memory Libraries //////////////////
|
||||||
|
|
||||||
#if defined(MEMWATCH)
|
#if defined(MEMWATCH)
|
||||||
@@ -28,7 +30,7 @@
|
|||||||
|
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include "dmalloc.h"
|
# include "dmalloc.hpp"
|
||||||
# define MALLOC(n,file,line,func) dmalloc_malloc((file),(line),(n),DMALLOC_FUNC_MALLOC,0,0)
|
# define MALLOC(n,file,line,func) dmalloc_malloc((file),(line),(n),DMALLOC_FUNC_MALLOC,0,0)
|
||||||
# define CALLOC(m,n,file,line,func) dmalloc_malloc((file),(line),(m)*(n),DMALLOC_FUNC_CALLOC,0,0)
|
# define CALLOC(m,n,file,line,func) dmalloc_malloc((file),(line),(m)*(n),DMALLOC_FUNC_CALLOC,0,0)
|
||||||
# define REALLOC(p,n,file,line,func) dmalloc_realloc((file),(line),(p),(n),DMALLOC_FUNC_REALLOC,0)
|
# define REALLOC(p,n,file,line,func) dmalloc_realloc((file),(line),(p),(n),DMALLOC_FUNC_REALLOC,0)
|
||||||
@@ -255,7 +257,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
|
|||||||
p->next = unit_head_large_first;
|
p->next = unit_head_large_first;
|
||||||
}
|
}
|
||||||
unit_head_large_first = p;
|
unit_head_large_first = p;
|
||||||
*(long*)((char*)p + sizeof(struct unit_head_large) - sizeof(long) + size) = 0xdeadbeaf;
|
*(long*)((char*)p + sizeof(struct unit_head_large) - sizeof(long) + size) = FREED_POINTER;
|
||||||
return (char *)p + sizeof(struct unit_head_large) - sizeof(long);
|
return (char *)p + sizeof(struct unit_head_large) - sizeof(long);
|
||||||
} else {
|
} else {
|
||||||
ShowFatalError("Memory manager::memmgr_alloc failed (allocating %d+%d bytes at %s:%d).\n", sizeof(struct unit_head_large), size, file, line);
|
ShowFatalError("Memory manager::memmgr_alloc failed (allocating %d+%d bytes at %s:%d).\n", sizeof(struct unit_head_large), size, file, line);
|
||||||
@@ -322,7 +324,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
|
|||||||
head->file = file;
|
head->file = file;
|
||||||
head->line = line;
|
head->line = line;
|
||||||
head->size = (unsigned short)size;
|
head->size = (unsigned short)size;
|
||||||
*(long*)((char*)head + sizeof(struct unit_head) - sizeof(long) + size) = 0xdeadbeaf;
|
*(long*)((char*)head + sizeof(struct unit_head) - sizeof(long) + size) = FREED_POINTER;
|
||||||
return (char *)head + sizeof(struct unit_head) - sizeof(long);
|
return (char *)head + sizeof(struct unit_head) - sizeof(long);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +385,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func )
|
|||||||
struct unit_head_large *head_large = (struct unit_head_large *)((char *)ptr - sizeof(struct unit_head_large) + sizeof(long));
|
struct unit_head_large *head_large = (struct unit_head_large *)((char *)ptr - sizeof(struct unit_head_large) + sizeof(long));
|
||||||
if(
|
if(
|
||||||
*(long*)((char*)head_large + sizeof(struct unit_head_large) - sizeof(long) + head_large->size)
|
*(long*)((char*)head_large + sizeof(struct unit_head_large) - sizeof(long) + head_large->size)
|
||||||
!= 0xdeadbeaf)
|
!= FREED_POINTER)
|
||||||
{
|
{
|
||||||
ShowError("Memory manager: args of aFree 0x%p is overflowed pointer %s line %d\n", ptr, file, line);
|
ShowError("Memory manager: args of aFree 0x%p is overflowed pointer %s line %d\n", ptr, file, line);
|
||||||
} else {
|
} else {
|
||||||
@@ -406,11 +408,11 @@ void _mfree(void *ptr, const char *file, int line, const char *func )
|
|||||||
} else {
|
} else {
|
||||||
/* Release unit */
|
/* Release unit */
|
||||||
struct block *block = head->block;
|
struct block *block = head->block;
|
||||||
if( (char*)head - (char*)block > sizeof(struct block) ) {
|
if( (size_t)((char*)head - (char*)block) > sizeof(struct block) ) {
|
||||||
ShowError("Memory manager: args of aFree 0x%p is invalid pointer %s line %d\n", ptr, file, line);
|
ShowError("Memory manager: args of aFree 0x%p is invalid pointer %s line %d\n", ptr, file, line);
|
||||||
} else if(head->block == NULL) {
|
} else if(head->block == NULL) {
|
||||||
ShowError("Memory manager: args of aFree 0x%p is freed pointer %s:%d@%s\n", ptr, file, line, func);
|
ShowError("Memory manager: args of aFree 0x%p is freed pointer %s:%d@%s\n", ptr, file, line, func);
|
||||||
} else if(*(long*)((char*)head + sizeof(struct unit_head) - sizeof(long) + head->size) != 0xdeadbeaf) {
|
} else if(*(long*)((char*)head + sizeof(struct unit_head) - sizeof(long) + head->size) != FREED_POINTER) {
|
||||||
ShowError("Memory manager: args of aFree 0x%p is overflowed pointer %s line %d\n", ptr, file, line);
|
ShowError("Memory manager: args of aFree 0x%p is overflowed pointer %s line %d\n", ptr, file, line);
|
||||||
} else {
|
} else {
|
||||||
memmgr_usage_bytes -= head->size;
|
memmgr_usage_bytes -= head->size;
|
||||||
@@ -656,7 +658,7 @@ static void memmgr_init (void)
|
|||||||
{
|
{
|
||||||
#ifdef LOG_MEMMGR
|
#ifdef LOG_MEMMGR
|
||||||
sprintf(memmer_logfile, "log/%s.leaks", SERVER_NAME);
|
sprintf(memmer_logfile, "log/%s.leaks", SERVER_NAME);
|
||||||
ShowStatus("Memory manager initialised: "CL_WHITE"%s"CL_RESET"\n", memmer_logfile);
|
ShowStatus("Memory manager initialised: " CL_WHITE "%s" CL_RESET "\n", memmer_logfile);
|
||||||
memset(hash_unfill, 0, sizeof(hash_unfill));
|
memset(hash_unfill, 0, sizeof(hash_unfill));
|
||||||
#endif /* LOG_MEMMGR */
|
#endif /* LOG_MEMMGR */
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#ifndef _MALLOC_H_
|
#ifndef _MALLOC_HPP_
|
||||||
#define _MALLOC_H_
|
#define _MALLOC_HPP_
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
#include "cbasetypes.hpp"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ALC_MARK __FILE__, __LINE__, __func__
|
#define ALC_MARK __FILE__, __LINE__, __func__
|
||||||
|
|
||||||
@@ -93,8 +89,4 @@ size_t malloc_usage (void);
|
|||||||
void malloc_init (void);
|
void malloc_init (void);
|
||||||
void malloc_final (void);
|
void malloc_final (void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* _MALLOC_HPP_ */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _MALLOC_H_ */
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#include "mmo.h"
|
#include "mmo.hpp"
|
||||||
#include "core.h"
|
#include "core.hpp"
|
||||||
#include "mapindex.h"
|
#include "mapindex.hpp"
|
||||||
#include "showmsg.h"
|
#include "showmsg.hpp"
|
||||||
#include "strlib.h"
|
#include "strlib.hpp"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@@ -137,12 +137,11 @@ void mapindex_init(void) {
|
|||||||
"map_index.txt",
|
"map_index.txt",
|
||||||
DBIMPORT"/map_index.txt"
|
DBIMPORT"/map_index.txt"
|
||||||
};
|
};
|
||||||
int i;
|
|
||||||
|
|
||||||
memset (&indexes, 0, sizeof (indexes));
|
memset (&indexes, 0, sizeof (indexes));
|
||||||
mapindex_db = strdb_alloc(DB_OPT_DUP_KEY, MAP_NAME_LENGTH);
|
mapindex_db = strdb_alloc(DB_OPT_DUP_KEY, MAP_NAME_LENGTH);
|
||||||
|
|
||||||
for( i = 0; i < ARRAYLENGTH(mapindex_cfgfile); i++ ){
|
for( size_t i = 0; i < ARRAYLENGTH(mapindex_cfgfile); i++ ){
|
||||||
sprintf( path, "%s/%s", db_path, mapindex_cfgfile[i] );
|
sprintf( path, "%s/%s", db_path, mapindex_cfgfile[i] );
|
||||||
|
|
||||||
if( ( fp = fopen( path, "r" ) ) == NULL ){
|
if( ( fp = fopen( path, "r" ) ) == NULL ){
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#ifndef _MAPINDEX_H_
|
#ifndef _MAPINDEX_HPP_
|
||||||
#define _MAPINDEX_H_
|
#define _MAPINDEX_HPP_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#include "../common/mmo.hpp"
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../common/mmo.h"
|
|
||||||
|
|
||||||
#define MAX_MAPINDEX 2000
|
#define MAX_MAPINDEX 2000
|
||||||
|
|
||||||
@@ -73,8 +69,4 @@ void mapindex_check_mapdefault(const char *mapname);
|
|||||||
void mapindex_init(void);
|
void mapindex_init(void);
|
||||||
void mapindex_final(void);
|
void mapindex_final(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* _MAPINDEX_HPP_ */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _MAPINDEX_H_ */
|
|
||||||
@@ -6,8 +6,8 @@
|
|||||||
*
|
*
|
||||||
***********************************************************/
|
***********************************************************/
|
||||||
|
|
||||||
#include "../common/random.h"
|
#include "../common/random.hpp"
|
||||||
#include "md5calc.h"
|
#include "md5calc.hpp"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -1,16 +1,8 @@
|
|||||||
#ifndef _MD5CALC_H_
|
#ifndef _MD5CALC_HPP_
|
||||||
#define _MD5CALC_H_
|
#define _MD5CALC_HPP_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void MD5_String(const char * string, char * output);
|
void MD5_String(const char * string, char * output);
|
||||||
void MD5_Binary(const char * string, unsigned char * output);
|
void MD5_Binary(const char * string, unsigned char * output);
|
||||||
void MD5_Salt(unsigned int len, char * output);
|
void MD5_Salt(unsigned int len, char * output);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* _MD5CALC_HPP_ */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _MD5CALC_H_ */
|
|
||||||
@@ -1,566 +0,0 @@
|
|||||||
|
|
||||||
//
|
|
||||||
// Memory Pool Implementation (Threadsafe)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Author: Florian Wilkemeyer <fw@f-ws.de>
|
|
||||||
//
|
|
||||||
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
|
|
||||||
// For more information, see LICENCE in the main folder
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include "winapi.hpp"
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
#include "showmsg.h"
|
|
||||||
#include "mempool.h"
|
|
||||||
#include "atomic.h"
|
|
||||||
#include "spinlock.h"
|
|
||||||
#include "malloc.h"
|
|
||||||
#include "mutex.h"
|
|
||||||
|
|
||||||
#define ALIGN16 ra_align(16)
|
|
||||||
#define ALIGN_TO(x, a) (x + ( a - ( x % a) ) )
|
|
||||||
#define ALIGN_TO_16(x) ALIGN_TO(x, 16)
|
|
||||||
|
|
||||||
#undef MEMPOOL_DEBUG
|
|
||||||
#define MEMPOOLASSERT
|
|
||||||
|
|
||||||
|
|
||||||
#define NODE_TO_DATA(x) ( ((char*)x) + sizeof(struct node) )
|
|
||||||
#define DATA_TO_NODE(x) ( (struct node*)(((char*)x) - sizeof(struct node)) )
|
|
||||||
struct ra_align(16) node{
|
|
||||||
void *next;
|
|
||||||
void *segment;
|
|
||||||
#ifdef MEMPOOLASSERT
|
|
||||||
bool used;
|
|
||||||
uint64 magic;
|
|
||||||
#define NODE_MAGIC 0xBEEF00EAEACAFE07ll
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// The Pointer to this struct is the base address of the segment itself.
|
|
||||||
struct pool_segment{
|
|
||||||
pMempool pool; // pool, this segment belongs to
|
|
||||||
struct pool_segment *next;
|
|
||||||
int64 num_nodes_total;
|
|
||||||
int64 num_bytes;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct mempool{
|
|
||||||
// Settings
|
|
||||||
char *name;
|
|
||||||
uint64 elem_size;
|
|
||||||
uint64 elem_realloc_step;
|
|
||||||
int64 elem_realloc_thresh;
|
|
||||||
|
|
||||||
// Callbacks that get called for every node that gets allocated
|
|
||||||
// Example usage: initialization of mutex/lock for each node.
|
|
||||||
memPoolOnNodeAllocationProc onalloc;
|
|
||||||
memPoolOnNodeDeallocationProc ondealloc;
|
|
||||||
|
|
||||||
// Locks
|
|
||||||
SPIN_LOCK segmentLock;
|
|
||||||
SPIN_LOCK nodeLock;
|
|
||||||
|
|
||||||
|
|
||||||
// Internal
|
|
||||||
struct pool_segment *segments;
|
|
||||||
struct node *free_list;
|
|
||||||
|
|
||||||
volatile int64 num_nodes_total;
|
|
||||||
volatile int64 num_nodes_free;
|
|
||||||
|
|
||||||
volatile int64 num_segments;
|
|
||||||
volatile int64 num_bytes_total;
|
|
||||||
|
|
||||||
volatile int64 peak_nodes_used; // Peak Node Usage
|
|
||||||
volatile int64 num_realloc_events; // Number of reallocations done. (allocate additional nodes)
|
|
||||||
|
|
||||||
// list (used for global management such as allocator..)
|
|
||||||
struct mempool *next;
|
|
||||||
} ra_align(8); // Dont touch the alignment, otherwise interlocked functions are broken ..
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
// Implementation:
|
|
||||||
//
|
|
||||||
static void segment_allocate_add(pMempool p, uint64 count);
|
|
||||||
|
|
||||||
static SPIN_LOCK l_mempoolListLock;
|
|
||||||
static pMempool l_mempoolList = NULL;
|
|
||||||
static prAthread l_async_thread = NULL;
|
|
||||||
static ramutex l_async_lock = NULL;
|
|
||||||
static racond l_async_cond = NULL;
|
|
||||||
static volatile int32 l_async_terminate = 0;
|
|
||||||
|
|
||||||
static void *mempool_async_allocator(void *x){
|
|
||||||
pMempool p;
|
|
||||||
|
|
||||||
|
|
||||||
while(1){
|
|
||||||
if(l_async_terminate > 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
EnterSpinLock(&l_mempoolListLock);
|
|
||||||
|
|
||||||
for(p = l_mempoolList; p != NULL; p = p->next){
|
|
||||||
|
|
||||||
if(p->num_nodes_free < p->elem_realloc_thresh){
|
|
||||||
// add new segment.
|
|
||||||
segment_allocate_add(p, p->elem_realloc_step);
|
|
||||||
// increase stats counter
|
|
||||||
InterlockedIncrement64(&p->num_realloc_events);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
LeaveSpinLock(&l_mempoolListLock);
|
|
||||||
|
|
||||||
ramutex_lock( l_async_lock );
|
|
||||||
racond_wait( l_async_cond, l_async_lock, -1 );
|
|
||||||
ramutex_unlock( l_async_lock );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}//end: mempool_async_allocator()
|
|
||||||
|
|
||||||
|
|
||||||
void mempool_init(){
|
|
||||||
|
|
||||||
if( rand()%2 + 1 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(sizeof(struct node)%16 != 0 ){
|
|
||||||
ShowFatalError("mempool_init: struct node alignment failure. %u != multiple of 16\n", sizeof(struct node));
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global List start
|
|
||||||
InitializeSpinLock(&l_mempoolListLock);
|
|
||||||
l_mempoolList = NULL;
|
|
||||||
|
|
||||||
// Initialize mutex + stuff needed for async allocator worker.
|
|
||||||
l_async_terminate = 0;
|
|
||||||
l_async_lock = ramutex_create();
|
|
||||||
l_async_cond = racond_create();
|
|
||||||
|
|
||||||
l_async_thread = rathread_createEx(mempool_async_allocator, NULL, 1024*1024, RAT_PRIO_NORMAL);
|
|
||||||
if(l_async_thread == NULL){
|
|
||||||
ShowFatalError("mempool_init: cannot spawn Async Allocator Thread.\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}//end: mempool_init()
|
|
||||||
|
|
||||||
|
|
||||||
void mempool_final(){
|
|
||||||
pMempool p, pn;
|
|
||||||
|
|
||||||
if( rand()%2 + 1 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
ShowStatus("Mempool: Terminating async. allocation worker and remaining pools.\n");
|
|
||||||
|
|
||||||
// Terminate worker / wait until its terminated.
|
|
||||||
InterlockedIncrement(&l_async_terminate);
|
|
||||||
racond_signal(l_async_cond);
|
|
||||||
rathread_wait(l_async_thread, NULL);
|
|
||||||
|
|
||||||
// Destroy cond var and mutex.
|
|
||||||
racond_destroy( l_async_cond );
|
|
||||||
ramutex_destroy( l_async_lock );
|
|
||||||
|
|
||||||
// Free remaining mempools
|
|
||||||
// ((bugged code! this should halppen, every mempool should
|
|
||||||
// be freed by the subsystem that has allocated it.)
|
|
||||||
//
|
|
||||||
EnterSpinLock(&l_mempoolListLock);
|
|
||||||
p = l_mempoolList;
|
|
||||||
while(1){
|
|
||||||
if(p == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
pn = p->next;
|
|
||||||
|
|
||||||
ShowWarning("Mempool [%s] was not properly destroyed - forcing destroy.\n", p->name);
|
|
||||||
mempool_destroy(p);
|
|
||||||
|
|
||||||
p = pn;
|
|
||||||
}
|
|
||||||
LeaveSpinLock(&l_mempoolListLock);
|
|
||||||
|
|
||||||
}//end: mempool_final()
|
|
||||||
|
|
||||||
|
|
||||||
static void segment_allocate_add(pMempool p, uint64 count){
|
|
||||||
|
|
||||||
// Required Memory:
|
|
||||||
// sz( segment )
|
|
||||||
// count * sz( real_node_size )
|
|
||||||
//
|
|
||||||
// where real node size is:
|
|
||||||
// ALIGN_TO_16( sz( node ) ) + p->elem_size
|
|
||||||
// so the nodes usable address is nodebase + ALIGN_TO_16(sz(node))
|
|
||||||
//
|
|
||||||
size_t total_sz;
|
|
||||||
struct pool_segment *seg = NULL;
|
|
||||||
struct node *nodeList = NULL;
|
|
||||||
struct node *node = NULL;
|
|
||||||
char *ptr = NULL;
|
|
||||||
uint64 i;
|
|
||||||
|
|
||||||
total_sz = ALIGN_TO_16( sizeof(struct pool_segment) )
|
|
||||||
+ ( (size_t)count * (sizeof(struct node) + (size_t)p->elem_size) ) ;
|
|
||||||
|
|
||||||
#ifdef MEMPOOL_DEBUG
|
|
||||||
ShowDebug("Mempool [%s] Segment AllocateAdd (num: %u, total size: %0.2fMiB)\n", p->name, count, (float)total_sz/1024.f/1024.f);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// allocate! (spin forever until weve got the memory.)
|
|
||||||
i=0;
|
|
||||||
while(1){
|
|
||||||
ptr = (char*)aMalloc(total_sz);
|
|
||||||
if(ptr != NULL) break;
|
|
||||||
|
|
||||||
i++; // increase failcount.
|
|
||||||
if(!(i & 7)){
|
|
||||||
ShowWarning("Mempool [%s] Segment AllocateAdd => System seems to be Out of Memory (%0.2f MiB). Try #%u\n", (float)total_sz/1024.f/1024.f, i);
|
|
||||||
#ifdef WIN32
|
|
||||||
Sleep(1000);
|
|
||||||
#else
|
|
||||||
sleep(1);
|
|
||||||
#endif
|
|
||||||
}else{
|
|
||||||
rathread_yield(); /// allow/force vuln. ctxswitch
|
|
||||||
}
|
|
||||||
}//endwhile: allocation spinloop.
|
|
||||||
|
|
||||||
// Clear Memory.
|
|
||||||
memset(ptr, 0x00, total_sz);
|
|
||||||
|
|
||||||
// Initialize segment struct.
|
|
||||||
seg = (struct pool_segment*)ptr;
|
|
||||||
ptr += ALIGN_TO_16(sizeof(struct pool_segment));
|
|
||||||
|
|
||||||
seg->pool = p;
|
|
||||||
seg->num_nodes_total = count;
|
|
||||||
seg->num_bytes = total_sz;
|
|
||||||
|
|
||||||
|
|
||||||
// Initialze nodes!
|
|
||||||
nodeList = NULL;
|
|
||||||
for(i = 0; i < count; i++){
|
|
||||||
node = (struct node*)ptr;
|
|
||||||
ptr += sizeof(struct node);
|
|
||||||
ptr += p->elem_size;
|
|
||||||
|
|
||||||
node->segment = seg;
|
|
||||||
#ifdef MEMPOOLASSERT
|
|
||||||
node->used = false;
|
|
||||||
node->magic = NODE_MAGIC;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(p->onalloc != NULL) p->onalloc( NODE_TO_DATA(node) );
|
|
||||||
|
|
||||||
node->next = nodeList;
|
|
||||||
nodeList = node;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Link in Segment.
|
|
||||||
EnterSpinLock(&p->segmentLock);
|
|
||||||
seg->next = p->segments;
|
|
||||||
p->segments = seg;
|
|
||||||
LeaveSpinLock(&p->segmentLock);
|
|
||||||
|
|
||||||
// Link in Nodes
|
|
||||||
EnterSpinLock(&p->nodeLock);
|
|
||||||
nodeList->next = p->free_list;
|
|
||||||
p->free_list = nodeList;
|
|
||||||
LeaveSpinLock(&p->nodeLock);
|
|
||||||
|
|
||||||
|
|
||||||
// Increase Stats:
|
|
||||||
InterlockedExchangeAdd64(&p->num_nodes_total, count);
|
|
||||||
InterlockedExchangeAdd64(&p->num_nodes_free, count);
|
|
||||||
InterlockedIncrement64(&p->num_segments);
|
|
||||||
InterlockedExchangeAdd64(&p->num_bytes_total, total_sz);
|
|
||||||
|
|
||||||
}//end: segment_allocate_add()
|
|
||||||
|
|
||||||
|
|
||||||
pMempool mempool_create(const char *name,
|
|
||||||
uint64 elem_size,
|
|
||||||
uint64 initial_count,
|
|
||||||
uint64 realloc_count,
|
|
||||||
memPoolOnNodeAllocationProc onNodeAlloc,
|
|
||||||
memPoolOnNodeDeallocationProc onNodeDealloc){
|
|
||||||
//..
|
|
||||||
uint64 realloc_thresh;
|
|
||||||
pMempool pool;
|
|
||||||
pool = (pMempool)aCalloc( 1, sizeof(struct mempool) );
|
|
||||||
|
|
||||||
if(pool == NULL){
|
|
||||||
ShowFatalError("mempool_create: Failed to allocate %u bytes memory.\n", sizeof(struct mempool) );
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check minimum initial count / realloc count requirements.
|
|
||||||
if(initial_count < 50)
|
|
||||||
initial_count = 50;
|
|
||||||
if(realloc_count < 50)
|
|
||||||
realloc_count = 50;
|
|
||||||
|
|
||||||
// Set Reallocation threshold to 5% of realloc_count, at least 10.
|
|
||||||
realloc_thresh = (realloc_count/100)*5; //
|
|
||||||
if(realloc_thresh < 10)
|
|
||||||
realloc_thresh = 10;
|
|
||||||
|
|
||||||
// Initialize members..
|
|
||||||
pool->name = aStrdup(name);
|
|
||||||
pool->elem_size = ALIGN_TO_16(elem_size);
|
|
||||||
pool->elem_realloc_step = realloc_count;
|
|
||||||
pool->elem_realloc_thresh = realloc_thresh;
|
|
||||||
pool->onalloc = onNodeAlloc;
|
|
||||||
pool->ondealloc = onNodeDealloc;
|
|
||||||
|
|
||||||
InitializeSpinLock(&pool->segmentLock);
|
|
||||||
InitializeSpinLock(&pool->nodeLock);
|
|
||||||
|
|
||||||
// Initial Statistic values:
|
|
||||||
pool->num_nodes_total = 0;
|
|
||||||
pool->num_nodes_free = 0;
|
|
||||||
pool->num_segments = 0;
|
|
||||||
pool->num_bytes_total = 0;
|
|
||||||
pool->peak_nodes_used = 0;
|
|
||||||
pool->num_realloc_events = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
#ifdef MEMPOOL_DEBUG
|
|
||||||
ShowDebug("Mempool [%s] Init (ElemSize: %u, Initial Count: %u, Realloc Count: %u)\n", pool->name, pool->elem_size, initial_count, pool->elem_realloc_step);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Allocate first segment directly :)
|
|
||||||
segment_allocate_add(pool, initial_count);
|
|
||||||
|
|
||||||
|
|
||||||
// Add Pool to the global pool list
|
|
||||||
EnterSpinLock(&l_mempoolListLock);
|
|
||||||
pool->next = l_mempoolList;
|
|
||||||
l_mempoolList = pool;
|
|
||||||
LeaveSpinLock(&l_mempoolListLock);
|
|
||||||
|
|
||||||
|
|
||||||
return pool;
|
|
||||||
}//end: mempool_create()
|
|
||||||
|
|
||||||
|
|
||||||
void mempool_destroy(pMempool p){
|
|
||||||
struct pool_segment *seg, *segnext;
|
|
||||||
struct node *niter;
|
|
||||||
pMempool piter, pprev;
|
|
||||||
char *ptr;
|
|
||||||
int64 i;
|
|
||||||
|
|
||||||
#ifdef MEMPOOL_DEBUG
|
|
||||||
ShowDebug("Mempool [%s] Destroy\n", p->name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Unlink from global list.
|
|
||||||
EnterSpinLock(&l_mempoolListLock);
|
|
||||||
piter = l_mempoolList;
|
|
||||||
pprev = l_mempoolList;
|
|
||||||
while(1){
|
|
||||||
if(piter == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
if(piter == p){
|
|
||||||
// unlink from list,
|
|
||||||
//
|
|
||||||
if(pprev == l_mempoolList){
|
|
||||||
// this (p) is list begin. so set next as head.
|
|
||||||
l_mempoolList = p->next;
|
|
||||||
}else{
|
|
||||||
// replace prevs next wuth our next.
|
|
||||||
pprev->next = p->next;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pprev = piter;
|
|
||||||
piter = piter->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->next = NULL;
|
|
||||||
LeaveSpinLock(&l_mempoolListLock);
|
|
||||||
|
|
||||||
|
|
||||||
// Get both locks.
|
|
||||||
EnterSpinLock(&p->segmentLock);
|
|
||||||
EnterSpinLock(&p->nodeLock);
|
|
||||||
|
|
||||||
|
|
||||||
if(p->num_nodes_free != p->num_nodes_total)
|
|
||||||
ShowWarning("Mempool [%s] Destroy - %u nodes are not freed properly!\n", p->name, (p->num_nodes_total - p->num_nodes_free) );
|
|
||||||
|
|
||||||
// Free All Segments (this will also free all nodes)
|
|
||||||
// The segment pointer is the base pointer to the whole segment.
|
|
||||||
seg = p->segments;
|
|
||||||
while(1){
|
|
||||||
if(seg == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
segnext = seg->next;
|
|
||||||
|
|
||||||
// ..
|
|
||||||
if(p->ondealloc != NULL){
|
|
||||||
// walk over the segment, and call dealloc callback!
|
|
||||||
ptr = (char*)seg;
|
|
||||||
ptr += ALIGN_TO_16(sizeof(struct pool_segment));
|
|
||||||
for(i = 0; i < seg->num_nodes_total; i++){
|
|
||||||
niter = (struct node*)ptr;
|
|
||||||
ptr += sizeof(struct node);
|
|
||||||
ptr += p->elem_size;
|
|
||||||
#ifdef MEMPOOLASSERT
|
|
||||||
if(niter->magic != NODE_MAGIC){
|
|
||||||
ShowError("Mempool [%s] Destroy - walk over segment - node %p invalid magic!\n", p->name, niter);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
p->ondealloc( NODE_TO_DATA(niter) );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}//endif: ondealloc callback?
|
|
||||||
|
|
||||||
// simple ..
|
|
||||||
aFree(seg);
|
|
||||||
|
|
||||||
seg = segnext;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear node ptr
|
|
||||||
p->free_list = NULL;
|
|
||||||
InterlockedExchange64(&p->num_nodes_free, 0);
|
|
||||||
InterlockedExchange64(&p->num_nodes_total, 0);
|
|
||||||
InterlockedExchange64(&p->num_segments, 0);
|
|
||||||
InterlockedExchange64(&p->num_bytes_total, 0);
|
|
||||||
|
|
||||||
LeaveSpinLock(&p->nodeLock);
|
|
||||||
LeaveSpinLock(&p->segmentLock);
|
|
||||||
|
|
||||||
// Free pool itself :D
|
|
||||||
aFree(p->name);
|
|
||||||
aFree(p);
|
|
||||||
|
|
||||||
}//end: mempool_destroy()
|
|
||||||
|
|
||||||
|
|
||||||
void *mempool_node_get(pMempool p){
|
|
||||||
struct node *node;
|
|
||||||
int64 num_used;
|
|
||||||
|
|
||||||
if(p->num_nodes_free < p->elem_realloc_thresh)
|
|
||||||
racond_signal(l_async_cond);
|
|
||||||
|
|
||||||
while(1){
|
|
||||||
|
|
||||||
EnterSpinLock(&p->nodeLock);
|
|
||||||
|
|
||||||
node = p->free_list;
|
|
||||||
if(node != NULL)
|
|
||||||
p->free_list = node->next;
|
|
||||||
|
|
||||||
LeaveSpinLock(&p->nodeLock);
|
|
||||||
|
|
||||||
if(node != NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
rathread_yield();
|
|
||||||
}
|
|
||||||
|
|
||||||
InterlockedDecrement64(&p->num_nodes_free);
|
|
||||||
|
|
||||||
// Update peak value
|
|
||||||
num_used = (p->num_nodes_total - p->num_nodes_free);
|
|
||||||
if(num_used > p->peak_nodes_used){
|
|
||||||
InterlockedExchange64(&p->peak_nodes_used, num_used);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef MEMPOOLASSERT
|
|
||||||
node->used = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return NODE_TO_DATA(node);
|
|
||||||
}//end: mempool_node_get()
|
|
||||||
|
|
||||||
|
|
||||||
void mempool_node_put(pMempool p, void *data){
|
|
||||||
struct node *node;
|
|
||||||
|
|
||||||
node = DATA_TO_NODE(data);
|
|
||||||
#ifdef MEMPOOLASSERT
|
|
||||||
if(node->magic != NODE_MAGIC){
|
|
||||||
ShowError("Mempool [%s] node_put failed, given address (%p) has invalid magic.\n", p->name, data);
|
|
||||||
return; // lost,
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
struct pool_segment *node_seg = node->segment;
|
|
||||||
if(node_seg->pool != p){
|
|
||||||
ShowError("Mempool [%s] node_put faild, given node (data address %p) doesnt belongs to this pool. ( Node Origin is [%s] )\n", p->name, data, node_seg->pool);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// reset used flag.
|
|
||||||
node->used = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
|
||||||
EnterSpinLock(&p->nodeLock);
|
|
||||||
node->next = p->free_list;
|
|
||||||
p->free_list = node;
|
|
||||||
LeaveSpinLock(&p->nodeLock);
|
|
||||||
|
|
||||||
InterlockedIncrement64(&p->num_nodes_free);
|
|
||||||
|
|
||||||
}//end: mempool_node_put()
|
|
||||||
|
|
||||||
|
|
||||||
mempool_stats mempool_get_stats(pMempool pool){
|
|
||||||
mempool_stats stats;
|
|
||||||
|
|
||||||
// initialize all with zeros
|
|
||||||
memset(&stats, 0x00, sizeof(mempool_stats));
|
|
||||||
|
|
||||||
stats.num_nodes_total = pool->num_nodes_total;
|
|
||||||
stats.num_nodes_free = pool->num_nodes_free;
|
|
||||||
stats.num_nodes_used = (stats.num_nodes_total - stats.num_nodes_free);
|
|
||||||
stats.num_segments = pool->num_segments;
|
|
||||||
stats.num_realloc_events= pool->num_realloc_events;
|
|
||||||
stats.peak_nodes_used = pool->peak_nodes_used;
|
|
||||||
stats.num_bytes_total = pool->num_bytes_total;
|
|
||||||
|
|
||||||
// Pushing such a large block over the stack as return value isnt nice
|
|
||||||
// but lazy :) and should be okay in this case (Stats / Debug..)
|
|
||||||
// if you dont like it - feel free and refactor it.
|
|
||||||
return stats;
|
|
||||||
}//end: mempool_get_stats()
|
|
||||||
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
#ifndef _rA_MEMPOOL_H_
|
|
||||||
#define _rA_MEMPOOL_H_
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
|
|
||||||
typedef struct mempool *pMempool;
|
|
||||||
|
|
||||||
typedef void (*memPoolOnNodeAllocationProc)(void *ptr);
|
|
||||||
typedef void (*memPoolOnNodeDeallocationProc)(void *ptr);
|
|
||||||
|
|
||||||
typedef struct mempool_stats{
|
|
||||||
int64 num_nodes_total;
|
|
||||||
int64 num_nodes_free;
|
|
||||||
int64 num_nodes_used;
|
|
||||||
|
|
||||||
int64 num_segments;
|
|
||||||
int64 num_realloc_events;
|
|
||||||
|
|
||||||
int64 peak_nodes_used;
|
|
||||||
|
|
||||||
int64 num_bytes_total;
|
|
||||||
} mempool_stats;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
void mempool_init();
|
|
||||||
void mempool_final();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new Mempool
|
|
||||||
*
|
|
||||||
* @param name - Name of the pool (used for debug / error messages)
|
|
||||||
* @param elem_size - size of each element
|
|
||||||
* @param initial_count - preallocation count
|
|
||||||
* @param realloc_count - #no of nodes being allocated when pool is running empty.
|
|
||||||
* @param onNodeAlloc - Node Allocation callback (see @note!)
|
|
||||||
* @param onNodeDealloc - Node Deallocation callback (see @note!)
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* The onNode(De)alloc callbacks are only called once during segment allocation
|
|
||||||
* (pool initialization / rallocation )
|
|
||||||
* you can use this callbacks for example to initlaize a mutex or somethingelse
|
|
||||||
* you definitly need during runtime
|
|
||||||
*
|
|
||||||
* @return not NULL
|
|
||||||
*/
|
|
||||||
pMempool mempool_create(const char *name,
|
|
||||||
uint64 elem_size,
|
|
||||||
uint64 initial_count,
|
|
||||||
uint64 realloc_count,
|
|
||||||
|
|
||||||
memPoolOnNodeAllocationProc onNodeAlloc,
|
|
||||||
memPoolOnNodeDeallocationProc onNodeDealloc);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys a Mempool
|
|
||||||
*
|
|
||||||
* @param pool - the mempool to destroy
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* Everything gets deallocated, regardless if everything was freed properly!
|
|
||||||
* So you have to ensure that all references are cleared properly!
|
|
||||||
*/
|
|
||||||
void mempool_destroy(pMempool pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a new / empty node from the given mempool.
|
|
||||||
*
|
|
||||||
* @param pool - the pool to get an empty node from.
|
|
||||||
*
|
|
||||||
* @return Address of empty Node
|
|
||||||
*/
|
|
||||||
void *mempool_node_get(pMempool pool);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the given node to the given mempool
|
|
||||||
*
|
|
||||||
* @param pool - the pool to put the node, to
|
|
||||||
* @param node - the node to return
|
|
||||||
*/
|
|
||||||
void mempool_node_put(pMempool pool, void *node);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns Statistics for the given mempool
|
|
||||||
*
|
|
||||||
* @param pool - the pool to get thats for
|
|
||||||
*
|
|
||||||
* @note: i dont like pushing masses of values over the stack, too - but its lazy and okay for stats. (blacksirius)
|
|
||||||
*
|
|
||||||
* @return stats struct
|
|
||||||
*/
|
|
||||||
mempool_stats mempool_get_stats(pMempool pool);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#ifndef _MMO_H_
|
#ifndef _MMO_HPP_
|
||||||
#define _MMO_H_
|
#define _MMO_HPP_
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
#include "cbasetypes.hpp"
|
||||||
#include "../config/core.h"
|
#include "../config/core.hpp"
|
||||||
#include "db.h"
|
#include "db.hpp"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifndef PACKETVER
|
#ifndef PACKETVER
|
||||||
#error Please define PACKETVER in src/config/packets.h
|
#error Please define PACKETVER in src/config/packets.hpp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
///Remove/Comment this line to disable sc_data saving. [Skotlex]
|
///Remove/Comment this line to disable sc_data saving. [Skotlex]
|
||||||
@@ -1031,4 +1031,4 @@ struct clan{
|
|||||||
#define MAX_CARTS 5
|
#define MAX_CARTS 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _MMO_H_ */
|
#endif /* _MMO_HPP_ */
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "malloc.h"
|
#include "malloc.hpp"
|
||||||
#include "msg_conf.h"
|
#include "msg_conf.hpp"
|
||||||
#include "showmsg.h"
|
#include "showmsg.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the message string of the specified number by [Yor]
|
* Return the message string of the specified number by [Yor]
|
||||||
@@ -62,7 +62,7 @@ int _msg_config_read(const char* cfgName,int size, char ** msg_table)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
ShowInfo("Done reading "CL_WHITE"'%d'"CL_RESET" messages in "CL_WHITE"'%s'"CL_RESET".\n",msg_count,cfgName);
|
ShowInfo("Done reading " CL_WHITE "'%d'" CL_RESET " messages in " CL_WHITE "'%s'" CL_RESET ".\n",msg_count,cfgName);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#ifndef MSG_CONF_H
|
#ifndef MSG_CONF_HPP
|
||||||
#define MSG_CONF_H
|
#define MSG_CONF_HPP
|
||||||
|
|
||||||
#include "../config/core.h"
|
#include "../config/core.hpp"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum lang_types {
|
enum lang_types {
|
||||||
LANG_RUS = 0x01,
|
LANG_RUS = 0x01,
|
||||||
@@ -42,9 +38,5 @@ const char* msg_langtype2langstr(int langtype);
|
|||||||
// Verify that the choosen langtype is enabled.
|
// Verify that the choosen langtype is enabled.
|
||||||
int msg_checklangtype(int lang, bool display);
|
int msg_checklangtype(int lang, bool display);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* MSG_CONF_HPP */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* MSG_CONF_H */
|
|
||||||
|
|
||||||
@@ -1,246 +0,0 @@
|
|||||||
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
|
|
||||||
// For more information, see LICENCE in the main folder
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include "winapi.hpp"
|
|
||||||
#else
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
#include "malloc.h"
|
|
||||||
#include "showmsg.h"
|
|
||||||
#include "timer.h"
|
|
||||||
#include "mutex.h"
|
|
||||||
|
|
||||||
struct ramutex{
|
|
||||||
#ifdef WIN32
|
|
||||||
CRITICAL_SECTION hMutex;
|
|
||||||
#else
|
|
||||||
pthread_mutex_t hMutex;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct racond{
|
|
||||||
#ifdef WIN32
|
|
||||||
HANDLE events[2];
|
|
||||||
ra_align(8) volatile LONG nWaiters;
|
|
||||||
CRITICAL_SECTION waiters_lock;
|
|
||||||
|
|
||||||
#define EVENT_COND_SIGNAL 0
|
|
||||||
#define EVENT_COND_BROADCAST 1
|
|
||||||
|
|
||||||
#else
|
|
||||||
pthread_cond_t hCond;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////
|
|
||||||
// Mutex
|
|
||||||
//
|
|
||||||
// Implementation:
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
ramutex ramutex_create(){
|
|
||||||
struct ramutex *m;
|
|
||||||
|
|
||||||
m = (struct ramutex*)aMalloc( sizeof(struct ramutex) );
|
|
||||||
if(m == NULL){
|
|
||||||
ShowFatalError("ramutex_create: OOM while allocating %u bytes.\n", sizeof(struct ramutex));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
InitializeCriticalSection(&m->hMutex);
|
|
||||||
#else
|
|
||||||
pthread_mutex_init(&m->hMutex, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return m;
|
|
||||||
}//end: ramutex_create()
|
|
||||||
|
|
||||||
|
|
||||||
void ramutex_destroy( ramutex m ){
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
DeleteCriticalSection(&m->hMutex);
|
|
||||||
#else
|
|
||||||
pthread_mutex_destroy(&m->hMutex);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
aFree(m);
|
|
||||||
|
|
||||||
}//end: ramutex_destroy()
|
|
||||||
|
|
||||||
|
|
||||||
void ramutex_lock( ramutex m ){
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
EnterCriticalSection(&m->hMutex);
|
|
||||||
#else
|
|
||||||
pthread_mutex_lock(&m->hMutex);
|
|
||||||
#endif
|
|
||||||
}//end: ramutex_lock
|
|
||||||
|
|
||||||
|
|
||||||
bool ramutex_trylock( ramutex m ){
|
|
||||||
#ifdef WIN32
|
|
||||||
if(TryEnterCriticalSection(&m->hMutex) == TRUE)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
if(pthread_mutex_trylock(&m->hMutex) == 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}//end: ramutex_trylock()
|
|
||||||
|
|
||||||
|
|
||||||
void ramutex_unlock( ramutex m ){
|
|
||||||
#ifdef WIN32
|
|
||||||
LeaveCriticalSection(&m->hMutex);
|
|
||||||
#else
|
|
||||||
pthread_mutex_unlock(&m->hMutex);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}//end: ramutex_unlock()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
|
||||||
// Condition Variables
|
|
||||||
//
|
|
||||||
// Implementation:
|
|
||||||
//
|
|
||||||
|
|
||||||
racond racond_create(){
|
|
||||||
struct racond *c;
|
|
||||||
|
|
||||||
c = (struct racond*)aMalloc( sizeof(struct racond) );
|
|
||||||
if(c == NULL){
|
|
||||||
ShowFatalError("racond_create: OOM while allocating %u bytes\n", sizeof(struct racond));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
c->nWaiters = 0;
|
|
||||||
c->events[ EVENT_COND_SIGNAL ] = CreateEvent( NULL, FALSE, FALSE, NULL );
|
|
||||||
c->events[ EVENT_COND_BROADCAST ] = CreateEvent( NULL, TRUE, FALSE, NULL );
|
|
||||||
InitializeCriticalSection( &c->waiters_lock );
|
|
||||||
#else
|
|
||||||
pthread_cond_init(&c->hCond, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}//end: racond_create()
|
|
||||||
|
|
||||||
|
|
||||||
void racond_destroy( racond c ){
|
|
||||||
#ifdef WIN32
|
|
||||||
CloseHandle( c->events[ EVENT_COND_SIGNAL ] );
|
|
||||||
CloseHandle( c->events[ EVENT_COND_BROADCAST ] );
|
|
||||||
DeleteCriticalSection( &c->waiters_lock );
|
|
||||||
#else
|
|
||||||
pthread_cond_destroy(&c->hCond);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
aFree(c);
|
|
||||||
}//end: racond_destroy()
|
|
||||||
|
|
||||||
|
|
||||||
void racond_wait( racond c, ramutex m, sysint timeout_ticks){
|
|
||||||
#ifdef WIN32
|
|
||||||
register DWORD ms;
|
|
||||||
int result;
|
|
||||||
bool is_last = false;
|
|
||||||
|
|
||||||
|
|
||||||
EnterCriticalSection(&c->waiters_lock);
|
|
||||||
c->nWaiters++;
|
|
||||||
LeaveCriticalSection(&c->waiters_lock);
|
|
||||||
|
|
||||||
if(timeout_ticks < 0)
|
|
||||||
ms = INFINITE;
|
|
||||||
else
|
|
||||||
ms = (timeout_ticks > MAXDWORD) ? (MAXDWORD - 1) : (DWORD)timeout_ticks;
|
|
||||||
|
|
||||||
|
|
||||||
// we can release the mutex (m) here, cause win's
|
|
||||||
// manual reset events maintain state when used with
|
|
||||||
// SetEvent()
|
|
||||||
ramutex_unlock(m);
|
|
||||||
|
|
||||||
result = WaitForMultipleObjects(2, c->events, FALSE, ms);
|
|
||||||
|
|
||||||
|
|
||||||
EnterCriticalSection(&c->waiters_lock);
|
|
||||||
c->nWaiters--;
|
|
||||||
if( (result == WAIT_OBJECT_0 + EVENT_COND_BROADCAST) && (c->nWaiters == 0) )
|
|
||||||
is_last = true; // Broadcast called!
|
|
||||||
LeaveCriticalSection(&c->waiters_lock);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// we are the last waiter that has to be notified, or to stop waiting
|
|
||||||
// so we have to do a manual reset
|
|
||||||
if(is_last == true)
|
|
||||||
ResetEvent( c->events[EVENT_COND_BROADCAST] );
|
|
||||||
|
|
||||||
|
|
||||||
ramutex_lock(m);
|
|
||||||
|
|
||||||
#else
|
|
||||||
if(timeout_ticks < 0){
|
|
||||||
pthread_cond_wait( &c->hCond, &m->hMutex );
|
|
||||||
}else{
|
|
||||||
struct timespec wtime;
|
|
||||||
int64 exact_timeout = gettick() + timeout_ticks;
|
|
||||||
|
|
||||||
wtime.tv_sec = exact_timeout/1000;
|
|
||||||
wtime.tv_nsec = (exact_timeout%1000)*1000000;
|
|
||||||
|
|
||||||
pthread_cond_timedwait( &c->hCond, &m->hMutex, &wtime);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}//end: racond_wait()
|
|
||||||
|
|
||||||
|
|
||||||
void racond_signal( racond c ){
|
|
||||||
#ifdef WIN32
|
|
||||||
// bool has_waiters = false;
|
|
||||||
// EnterCriticalSection(&c->waiters_lock);
|
|
||||||
// if(c->nWaiters > 0)
|
|
||||||
// has_waiters = true;
|
|
||||||
// LeaveCriticalSection(&c->waiters_lock);
|
|
||||||
|
|
||||||
// if(has_waiters == true)
|
|
||||||
SetEvent( c->events[ EVENT_COND_SIGNAL ] );
|
|
||||||
#else
|
|
||||||
pthread_cond_signal(&c->hCond);
|
|
||||||
#endif
|
|
||||||
}//end: racond_signal()
|
|
||||||
|
|
||||||
|
|
||||||
void racond_broadcast( racond c ){
|
|
||||||
#ifdef WIN32
|
|
||||||
// bool has_waiters = false;
|
|
||||||
// EnterCriticalSection(&c->waiters_lock);
|
|
||||||
// if(c->nWaiters > 0)
|
|
||||||
// has_waiters = true;
|
|
||||||
// LeaveCriticalSection(&c->waiters_lock);
|
|
||||||
|
|
||||||
// if(has_waiters == true)
|
|
||||||
SetEvent( c->events[ EVENT_COND_BROADCAST ] );
|
|
||||||
#else
|
|
||||||
pthread_cond_broadcast(&c->hCond);
|
|
||||||
#endif
|
|
||||||
}//end: racond_broadcast()
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
|
|
||||||
// For more information, see LICENCE in the main folder
|
|
||||||
|
|
||||||
#ifndef _rA_MUTEX_H_
|
|
||||||
#define _rA_MUTEX_H_
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct ramutex *ramutex; // Mutex
|
|
||||||
typedef struct racond *racond; // Condition Var
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a Mutex
|
|
||||||
*
|
|
||||||
* @return not NULL
|
|
||||||
*/
|
|
||||||
ramutex ramutex_create();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys a Mutex
|
|
||||||
*
|
|
||||||
* @param m - the mutex to destroy
|
|
||||||
*/
|
|
||||||
void ramutex_destroy( ramutex m );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a lock
|
|
||||||
*
|
|
||||||
* @param m - the mutex to lock
|
|
||||||
*/
|
|
||||||
void ramutex_lock( ramutex m);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trys to get the Lock
|
|
||||||
*
|
|
||||||
* @param m - the mutex try to lock
|
|
||||||
*
|
|
||||||
* @return boolean (true = got the lock)
|
|
||||||
*/
|
|
||||||
bool ramutex_trylock( ramutex m );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unlocks a mutex
|
|
||||||
*
|
|
||||||
* @param m - the mutex to unlock
|
|
||||||
*/
|
|
||||||
void ramutex_unlock( ramutex m);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a Condition variable
|
|
||||||
*
|
|
||||||
* @return not NULL
|
|
||||||
*/
|
|
||||||
racond racond_create();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy a Condition variable
|
|
||||||
*
|
|
||||||
* @param c - the condition varaible to destroy
|
|
||||||
*/
|
|
||||||
void racond_destroy( racond c );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Waits Until state is signalled
|
|
||||||
*
|
|
||||||
* @param c - the condition var to wait for signalled state
|
|
||||||
* @param m - the mutex used for syncronization
|
|
||||||
* @param timeout_ticks - timeout in ticks ( -1 = INFINITE )
|
|
||||||
*/
|
|
||||||
void racond_wait( racond c, ramutex m, sysint timeout_ticks);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the given condition var to signalled state
|
|
||||||
*
|
|
||||||
* @param c - condition var to set in signalled state.
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* Only one waiter gets notified.
|
|
||||||
*/
|
|
||||||
void racond_signal( racond c );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets notifys all waiting threads thats signalled.
|
|
||||||
* @param c - condition var to set in signalled state
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* All Waiters getting notified.
|
|
||||||
*/
|
|
||||||
void racond_broadcast( racond c );
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,206 +0,0 @@
|
|||||||
|
|
||||||
//
|
|
||||||
// Network Buffer Subsystem (iobuffer)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Author: Florian Wilkemeyer <fw@f-ws.de>
|
|
||||||
//
|
|
||||||
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
|
|
||||||
// For more information, see LICENCE in the main folder
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Buffers are available in the following sizes:
|
|
||||||
// 48, 192, 2048, 8192
|
|
||||||
// 65536 (inter server connects may use it for charstatus struct..)
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
// Implementation:
|
|
||||||
//
|
|
||||||
static volatile int32 l_nEmergencyAllocations = 0; // stats.
|
|
||||||
static sysint l_nPools = 0;
|
|
||||||
static sysint *l_poolElemSize = NULL;
|
|
||||||
static mempool *l_pool = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
void netbuffer_init(){
|
|
||||||
char localsection[32];
|
|
||||||
raconf conf;
|
|
||||||
sysint i;
|
|
||||||
|
|
||||||
// Initialize Statistic counters:
|
|
||||||
l_nEmergencyAllocations = 0;
|
|
||||||
|
|
||||||
// Set localsection name according to running serverype.
|
|
||||||
switch(SERVER_TYPE){
|
|
||||||
case ATHENA_SERVER_LOGIN: strcpy(localsection, "login-netbuffer"); break;
|
|
||||||
case ATHENA_SERVER_CHAR: strcpy(localsection, "char-netbuffer"); break;
|
|
||||||
case ATHENA_SERVER_INTER: strcpy(localsection, "inter-netbuffer"); break;
|
|
||||||
case ATHENA_SERVER_MAP: strcpy(localsection, "map-netbuffer"); break;
|
|
||||||
default: strcpy(localsection, "unsupported_type"); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
conf = raconf_parse("conf/network.conf");
|
|
||||||
if(conf == NULL){
|
|
||||||
ShowFatalError("Failed to Parse required Configuration (conf/network.conf)");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Values from config file
|
|
||||||
l_nPools = (sysint)raconf_getintEx(conf, localsection, "netbuffer", "num", 0);
|
|
||||||
if(l_nPools == 0){
|
|
||||||
ShowFatalError("Netbuffer (network.conf) failure - requires at least 1 Pool.\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allocate arrays.
|
|
||||||
l_poolElemSize = (sysint*)aCalloc( l_nPools, sizeof(sysint) );
|
|
||||||
l_pool = (mempool*)aCalloc( l_nPools, sizeof(mempool) );
|
|
||||||
|
|
||||||
|
|
||||||
for(i = 0; i < l_nPools; i++){
|
|
||||||
int64 num_prealloc, num_realloc;
|
|
||||||
char key[32];
|
|
||||||
|
|
||||||
sprintf(key, "pool_%u_size", (uint32)i+1);
|
|
||||||
l_poolElemSize[i] = (sysint)raconf_getintEx(conf, localsection, "netbuffer", key, 4096);
|
|
||||||
if(l_poolElemSize[i] < 32){
|
|
||||||
ShowWarning("Netbuffer (network.conf) failure - minimum allowed buffer size is 32 byte) - fixed.\n");
|
|
||||||
l_poolElemSize[i] = 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(key, "pool_%u_prealloc", (uint32)i+1);
|
|
||||||
num_prealloc = raconf_getintEx(conf, localsection, "netbuffer", key, 150);
|
|
||||||
|
|
||||||
sprintf(key, "pool_%u_realloc_step", (uint32)i+1);
|
|
||||||
num_realloc = raconf_getintEx(conf, localsection, "netbuffer", key, 100);
|
|
||||||
|
|
||||||
// Create Pool!
|
|
||||||
sprintf(key, "Netbuffer %u", (uint32)l_poolElemSize[i]); // name.
|
|
||||||
|
|
||||||
// Info
|
|
||||||
ShowInfo("NetBuffer: Creating Pool %u (Prealloc: %u, Realloc Step: %u) - %0.2f MiB\n", l_poolElemSize[i], num_prealloc, num_realloc, (float)((sizeof(struct netbuf) + l_poolElemSize[i] - 32)* num_prealloc)/1024.0f/1024.0f);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Size Calculation:
|
|
||||||
// struct netbuf + requested buffer size - 32 (because the struct already contains 32 byte buffer space at the end of struct)
|
|
||||||
l_pool[i] = mempool_create(key, (sizeof(struct netbuf) + l_poolElemSize[i] - 32), num_prealloc, num_realloc, NULL, NULL);
|
|
||||||
if(l_pool[i] == NULL){
|
|
||||||
ShowFatalError("Netbuffer: cannot create Pool for %u byte buffers.\n", l_poolElemSize[i]);
|
|
||||||
// @leak: clean everything :D
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}//
|
|
||||||
|
|
||||||
|
|
||||||
raconf_destroy(conf);
|
|
||||||
|
|
||||||
}//end: netbuffer_init()
|
|
||||||
|
|
||||||
|
|
||||||
void netbuffer_final(){
|
|
||||||
sysint i;
|
|
||||||
|
|
||||||
if(l_nPools > 0){
|
|
||||||
/// .. finalize mempools
|
|
||||||
for(i = 0; i < l_nPools; i++){
|
|
||||||
mempool_stats stats = mempool_get_stats(l_pool[i]);
|
|
||||||
|
|
||||||
ShowInfo("Netbuffer: Freeing Pool %u (Peak Usage: %u, Realloc Events: %u)\n", l_poolElemSize[i], stats.peak_nodes_used, stats.num_realloc_events);
|
|
||||||
|
|
||||||
mempool_destroy(l_pool[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(l_nEmergencyAllocations > 0){
|
|
||||||
ShowWarning("Netbuffer: did %u Emergency Allocations, please tune your network.conf!\n", l_nEmergencyAllocations);
|
|
||||||
l_nEmergencyAllocations = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
aFree(l_poolElemSize); l_poolElemSize = NULL;
|
|
||||||
aFree(l_pool); l_pool = NULL;
|
|
||||||
l_nPools = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}//end: netbuffer_final()
|
|
||||||
|
|
||||||
|
|
||||||
netbuf netbuffer_get( sysint sz ){
|
|
||||||
sysint i;
|
|
||||||
netbuf nb = NULL;
|
|
||||||
|
|
||||||
// Search an appropriate pool
|
|
||||||
for(i = 0; i < l_nPools; i++){
|
|
||||||
if(sz <= l_poolElemSize[i]){
|
|
||||||
// match
|
|
||||||
|
|
||||||
nb = (netbuf)mempool_node_get(l_pool[i]);
|
|
||||||
nb->pool = i;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// No Bufferpool found that mets there quirements?.. (thats bad..)
|
|
||||||
if(nb == NULL){
|
|
||||||
ShowWarning("Netbuffer: get(%u): => no appropriate pool found - emergency allocation required.\n", sz);
|
|
||||||
ShowWarning("Please reconfigure your network.conf!");
|
|
||||||
|
|
||||||
InterlockedIncrement(&l_nEmergencyAllocations);
|
|
||||||
|
|
||||||
// .. better to check (netbuf struct provides 32 byte bufferspace itself.
|
|
||||||
if(sz < 32) sz = 32;
|
|
||||||
|
|
||||||
// allocate memory using malloc ..
|
|
||||||
while(1){
|
|
||||||
nb = (netbuf) aMalloc( (sizeof(struct netbuf) + sz - 32) );
|
|
||||||
if(nb != NULL){
|
|
||||||
memset(nb, 0x00, (sizeof(struct netbuf) + sz - 32) ); // zero memory! (to enforce commit @ os.)
|
|
||||||
nb->pool = -1; // emergency alloc.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
rathread_yield();
|
|
||||||
}// spin allocation.
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nb->refcnt = 1; // Initial refcount is 1
|
|
||||||
|
|
||||||
return nb;
|
|
||||||
}//end: netbuffer_get()
|
|
||||||
|
|
||||||
|
|
||||||
void netbuffer_put( netbuf nb ){
|
|
||||||
|
|
||||||
// Decrement reference counter, if > 0 do nothing :)
|
|
||||||
if( InterlockedDecrement(&nb->refcnt) > 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Is this buffer an emergency allocated buffer?
|
|
||||||
if(nb->pool == -1){
|
|
||||||
aFree(nb);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Otherwise its a normal mempool based buffer
|
|
||||||
// return it to the according mempool:
|
|
||||||
mempool_node_put( l_pool[nb->pool], nb);
|
|
||||||
|
|
||||||
|
|
||||||
}//end: netbuffer_put()
|
|
||||||
|
|
||||||
|
|
||||||
void netbuffer_incref( netbuf nb ){
|
|
||||||
|
|
||||||
InterlockedIncrement(&nb->refcnt);
|
|
||||||
|
|
||||||
}//end: netbuf_incref()
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
// Copyright (c) rAthena Project (www.rathena.org) - Licensed under GNU GPL
|
|
||||||
// For more information, see LICENCE in the main folder
|
|
||||||
|
|
||||||
#ifndef _rA_NETBUFFER_H_
|
|
||||||
#define _rA_NETBUFFER_H_
|
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
|
|
||||||
typedef struct netbuf{
|
|
||||||
sysint pool; // The pool ID this buffer belongs to,
|
|
||||||
// is set to -1 if its an emergency allocated buffer
|
|
||||||
|
|
||||||
struct netbuf *next; // Used by Network system.
|
|
||||||
|
|
||||||
volatile int32 refcnt; // Internal Refcount, it gets lowered every call to netbuffer_put,
|
|
||||||
// if its getting zero, the buffer will returned back to the pool
|
|
||||||
// and can be reused.
|
|
||||||
|
|
||||||
int32 dataPos; // Current Offset
|
|
||||||
// Used only for Reading (recv job)
|
|
||||||
// write cases are using the sessions local datapos member due to
|
|
||||||
// shared write buffer support.
|
|
||||||
|
|
||||||
int32 dataLen; // read buffer case:
|
|
||||||
// The length expected to read to.
|
|
||||||
// when this->dataPos == dateLen, read job has been completed.
|
|
||||||
// write buffer case:
|
|
||||||
// The lngth of data in te buffer
|
|
||||||
// when s->dataPos == dataLen, write job has been completed
|
|
||||||
//
|
|
||||||
// Note:
|
|
||||||
// leftBytes = (dateLen - dataPos)
|
|
||||||
//
|
|
||||||
// Due to shared buffer support
|
|
||||||
// dataPos gets not used in write case (each connection has its local offset)
|
|
||||||
//
|
|
||||||
|
|
||||||
// The Bufferspace itself.
|
|
||||||
char buf[32];
|
|
||||||
} *netbuf;
|
|
||||||
|
|
||||||
|
|
||||||
void netbuffer_init();
|
|
||||||
void netbuffer_final();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a netbuffer that has atleast (sz) byes space.
|
|
||||||
*
|
|
||||||
* @note: The netbuffer system guarantees that youll always recevie a buffer.
|
|
||||||
* no check for null is required!
|
|
||||||
*
|
|
||||||
* @param sz - minimum size needed.
|
|
||||||
*
|
|
||||||
* @return pointer to netbuf struct
|
|
||||||
*/
|
|
||||||
netbuf netbuffer_get( sysint sz );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the given netbuffer (decreases refcount, if its 0 - the buffer will get returned to the pool)
|
|
||||||
*
|
|
||||||
* @param buf - the buffer to return
|
|
||||||
*/
|
|
||||||
void netbuffer_put( netbuf buf );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Increases the Refcount on the given buffer
|
|
||||||
* (used for areasends .. etc)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void netbuffer_incref( netbuf buf );
|
|
||||||
|
|
||||||
|
|
||||||
// Some Useful macros
|
|
||||||
#define NBUFP(netbuf,pos) (((uint8*)(netbuf->buf)) + (pos))
|
|
||||||
#define NBUFB(netbuf,pos) (*(uint8*)((netbuf->buf) + (pos)))
|
|
||||||
#define NBUFW(netbuf,pos) (*(uint16*)((netbuf->buf) + (pos)))
|
|
||||||
#define NBUFL(netbuf,pos) (*(uint32*)((netbuf->buf) + (pos)))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
1034
src/common/network.c
1034
src/common/network.c
File diff suppressed because it is too large
Load Diff
@@ -1,189 +0,0 @@
|
|||||||
#ifndef _rA_NETWORK_H_
|
|
||||||
#define _rA_NETWORK_H_
|
|
||||||
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
#include "netbuffer.h"
|
|
||||||
#include "evdp.h"
|
|
||||||
|
|
||||||
#ifndef MAXCONN
|
|
||||||
#define MAXCONN 16384
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct SESSION{
|
|
||||||
EVDP_DATA evdp_data; // Must be always the frist member! (some evdp's may rely on this fact)
|
|
||||||
|
|
||||||
// Connection Type
|
|
||||||
enum{ NST_FREE=0, NST_LISTENER = 1, NST_CLIENT=2, NST_OUTGOING=3} type;
|
|
||||||
|
|
||||||
// Flags / Settings.
|
|
||||||
bool v6; // is v6?
|
|
||||||
bool disconnect_in_progress; // To prevent stack overflows / recursive calls.
|
|
||||||
|
|
||||||
|
|
||||||
union{ // union to save memory.
|
|
||||||
struct sockaddr_in v4;
|
|
||||||
struct sockaddr_in6 v6;
|
|
||||||
}addr;
|
|
||||||
|
|
||||||
|
|
||||||
// "lowlevel" Handlers
|
|
||||||
// (Implemented by the protocol specific parser)
|
|
||||||
//
|
|
||||||
bool (*onRecv)(int32 fd); // return false = disconnect
|
|
||||||
bool (*onSend)(int32 fd); // return false = disconnect
|
|
||||||
|
|
||||||
// Event Handlers for LISTENER type sockets
|
|
||||||
//
|
|
||||||
// onConnect gets Called when a connection has been
|
|
||||||
// successfully accepted.
|
|
||||||
// Session entry is available in this Handler!
|
|
||||||
// A returncode of false will reejct the connection (disconnect)
|
|
||||||
// Note: When rejecting a connection in onConnect by returning false
|
|
||||||
// The onDisconnect handler wont get called!
|
|
||||||
// Note: the onConnect Handler is also responsible for setting
|
|
||||||
// the appropriate netparser (which implements onRecv/onSend..) [protocol specific]
|
|
||||||
//
|
|
||||||
// onDisconnect gets called when a connection gets disconnected
|
|
||||||
// (by peer as well as by core)
|
|
||||||
//
|
|
||||||
bool (*onConnect)(int32 fd); // return false = disconnect (wont accept)
|
|
||||||
void (*onDisconnect)(int32 fd);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Parser specific data
|
|
||||||
//
|
|
||||||
void *netparser_data; // incase of RO Packet Parser, pointer to packet len table (uint16array)
|
|
||||||
void (*onPacketComplete)(int32 fd, uint16 op, uint16 len, netbuf buf);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Buffers
|
|
||||||
//
|
|
||||||
struct{
|
|
||||||
enum NETREADSTATE { NRS_WAITOP = 0, NRS_WAITLEN = 1, NRS_WAITDATA = 2} state;
|
|
||||||
|
|
||||||
uint32 head_left;
|
|
||||||
uint16 head[2];
|
|
||||||
|
|
||||||
netbuf buf;
|
|
||||||
} read;
|
|
||||||
|
|
||||||
struct{
|
|
||||||
uint32 max_outstanding;
|
|
||||||
uint32 n_outstanding;
|
|
||||||
|
|
||||||
uint32 dataPos;
|
|
||||||
|
|
||||||
netbuf buf, buf_last;
|
|
||||||
} write;
|
|
||||||
|
|
||||||
// Application Level data Pointer
|
|
||||||
// (required for backward compatibility with previous athena socket system.)
|
|
||||||
void *data;
|
|
||||||
|
|
||||||
} SESSION;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subsystem Initialization / Finalization.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void network_init();
|
|
||||||
void network_final();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Will do the net work :) ..
|
|
||||||
*/
|
|
||||||
void network_do();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new listner.
|
|
||||||
*
|
|
||||||
* @param v6 v6 listner?
|
|
||||||
* @param *addr the address to listen on.
|
|
||||||
* @param port port to listen on
|
|
||||||
*
|
|
||||||
* @return -1 on error otherwise the identifier of the new listener.
|
|
||||||
*/
|
|
||||||
int32 network_addlistener(bool v6, const char *addr, uint16 port);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tries to establish an outgoing connection.
|
|
||||||
*
|
|
||||||
* @param v6 operate with IPv6 addresses?
|
|
||||||
* @param addr the address to connect to
|
|
||||||
* @param port the port to connect to
|
|
||||||
* @param from_addr the address to connect from (local source / optional if auto -> NULL)
|
|
||||||
* @param from_port the port to connect from (local source / optional if auto -> 0)
|
|
||||||
* @param onConnectionEstablishedHandler callback that gets called when the connection is established.
|
|
||||||
* @param onConnectionLooseHandler callback that gets called when the connection gets disconnected (or the connection couldnt be established)
|
|
||||||
*
|
|
||||||
* @return -1 on error otherwise the identifier of the new connection
|
|
||||||
*/
|
|
||||||
int32 network_connect(bool v6,
|
|
||||||
const char *addr,
|
|
||||||
uint16 port,
|
|
||||||
const char *from_addr,
|
|
||||||
uint16 from_port,
|
|
||||||
bool (*onConnectionEstablishedHandler)(int32 fd),
|
|
||||||
void (*onConnectionLooseHandler)(int32 fd)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disconnects the given connection
|
|
||||||
*
|
|
||||||
* @param fd connection identifier.
|
|
||||||
*
|
|
||||||
* @Note:
|
|
||||||
* - onDisconnect callback gets called!
|
|
||||||
* - cleares (returns) all assigned buffers
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void network_disconnect(int32 fd);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attach's a netbuffer at the end of sending queue to the given connection
|
|
||||||
*
|
|
||||||
* @param fd connection identifier
|
|
||||||
* @param buf netbuffer to attach.
|
|
||||||
*/
|
|
||||||
void network_send(int32 fd, netbuf buf);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the parser to RO Protocol like Packet Parser.
|
|
||||||
*
|
|
||||||
* @param fd connection identifier
|
|
||||||
* @param *packetlentable pointer to array of uint16 in size of UINT16_MAX,
|
|
||||||
* @param onComplteProc callback for packet completion.
|
|
||||||
*
|
|
||||||
* @note:
|
|
||||||
* PacketLen Table Fromat:
|
|
||||||
* each element's offsets represents th ro opcode.
|
|
||||||
* value is length.
|
|
||||||
* a length of 0 means the packet is dynamic.
|
|
||||||
* a length of UINT16_MAX means the packet is unknown.
|
|
||||||
*
|
|
||||||
* Static Packets must contain their hader in len so (0x64 == 55 ..)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void network_parser_set_ro(int32 fd,
|
|
||||||
int16 *packetlentable,
|
|
||||||
void (*onPacketCompleteProc)(int32 fd, uint16 op, uint16 len, netbuf buf)
|
|
||||||
);
|
|
||||||
#define ROPACKET_UNKNOWN UINT16_MAX
|
|
||||||
#define ROPACKET_DYNLEN 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "nullpo.h"
|
#include "nullpo.hpp"
|
||||||
#include "showmsg.h"
|
#include "showmsg.hpp"
|
||||||
|
|
||||||
static void nullpo_info_core(const char *file, int line, const char *func, const char *fmt, va_list ap);
|
static void nullpo_info_core(const char *file, int line, const char *func, const char *fmt, va_list ap);
|
||||||
static void nullpo_info_core_(const char *file, int line, const char *func);
|
static void nullpo_info_core_(const char *file, int line, const char *func);
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
|
||||||
// For more information, see LICENCE in the main folder
|
// For more information, see LICENCE in the main folder
|
||||||
|
|
||||||
#ifndef _NULLPO_H_
|
#ifndef _NULLPO_HPP_
|
||||||
#define _NULLPO_H_
|
#define _NULLPO_HPP_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#include "cbasetypes.hpp"
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "cbasetypes.h"
|
|
||||||
|
|
||||||
#define NLP_MARK __FILE__, __LINE__, __func__
|
#define NLP_MARK __FILE__, __LINE__, __func__
|
||||||
|
|
||||||
@@ -211,8 +207,4 @@ void nullpo_info_f(const char *file, int line, const char *func,
|
|||||||
const char *fmt, ...)
|
const char *fmt, ...)
|
||||||
__attribute__((format(printf,4,5)));
|
__attribute__((format(printf,4,5)));
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#endif /* _NULLPO_HPP_ */
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _NULLPO_H_ */
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user