diff options
Diffstat (limited to 'src/common')
48 files changed, 234 insertions, 260 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c index 346748cfe..5a0fe16dc 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -3,28 +3,29 @@ #define HERCULES_CORE -#include "../config/core.h" // CONSOLE_INPUT +#include "config/core.h" // CONSOLE_INPUT #include "HPM.h" +#include "common/cbasetypes.h" +#include "common/conf.h" +#include "common/console.h" +#include "common/core.h" +#include "common/db.h" +#include "common/malloc.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/socket.h" +#include "common/sql.h" +#include "common/strlib.h" +#include "common/sysinfo.h" +#include "common/timer.h" +#include "common/utils.h" +#include "common/nullpo.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "../common/cbasetypes.h" -#include "../common/conf.h" -#include "../common/console.h" -#include "../common/core.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/socket.h" -#include "../common/sql.h" -#include "../common/strlib.h" -#include "../common/sysinfo.h" -#include "../common/timer.h" -#include "../common/utils.h" -#include "../common/nullpo.h" - #ifndef WIN32 # include <unistd.h> #endif diff --git a/src/common/HPM.h b/src/common/HPM.h index e99b0f2ae..1358f19dc 100644 --- a/src/common/HPM.h +++ b/src/common/HPM.h @@ -8,8 +8,8 @@ #error You should never include HPM.h from a plugin. #endif -#include "../common/HPMi.h" -#include "../common/cbasetypes.h" +#include "common/HPMi.h" +#include "common/cbasetypes.h" #ifdef WIN32 #ifndef WIN32_LEAN_AND_MEAN diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 10cf4fd9f..b700c1b73 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -4,10 +4,10 @@ #ifndef COMMON_HPMI_H #define COMMON_HPMI_H -#include "../common/cbasetypes.h" -#include "../common/console.h" -#include "../common/core.h" -#include "../common/sql.h" +#include "common/cbasetypes.h" +#include "common/console.h" +#include "common/core.h" +#include "common/sql.h" struct script_state; struct AtCommandInfo; @@ -21,7 +21,7 @@ struct map_session_data; #endif /* after */ -#include "../common/showmsg.h" +#include "common/showmsg.h" #define HPM_VERSION "1.0" #define HPM_ADDCONF_LENGTH 40 diff --git a/src/common/Makefile.in b/src/common/Makefile.in index 5dfdd35bd..f6f993165 100644 --- a/src/common/Makefile.in +++ b/src/common/Makefile.in @@ -6,17 +6,20 @@ CONFIG_D = ../config CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h) -LIBCONFIG_D = ../../3rdparty/libconfig +COMMON_INCLUDE = -I.. + +THIRDPARTY_D = ../../3rdparty +THIRDPARTY_INCLUDE = -I$(THIRDPARTY_D) + +LIBCONFIG_D = $(THIRDPARTY_D)/libconfig LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \ scanner.o strbuf.o) LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \ scanctx.h scanner.h strbuf.h wincompat.h) -LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D) -MT19937AR_D = ../../3rdparty/mt19937ar +MT19937AR_D = $(THIRDPARTY_D)/mt19937ar MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o MT19937AR_H = $(MT19937AR_D)/mt19937ar.h -MT19937AR_INCLUDE = -I$(MT19937AR_D) COMMON_SHARED_C = conf.c db.c des.c ers.c grfio.c HPM.c mapindex.c md5calc.c \ mutex.c nullpo.c random.c showmsg.c strlib.c sysinfo.c \ @@ -116,15 +119,15 @@ obj_all/sysinfo.o: sysinfo.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_ obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_all @echo " CC $<" - @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $< + @$(CC) @CFLAGS@ @DEFS@ $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $< obj_all/mini%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_all @echo " CC $<" - @$(CC) @CFLAGS@ @DEFS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $< + @$(CC) @CFLAGS@ @DEFS@ $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $< obj_sql/%.o: %.c $(COMMON_H) $(COMMON_SQL_H) $(CONFIG_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_sql @echo " CC $<" - @$(CC) @CFLAGS@ @DEFS@ $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $< + @$(CC) @CFLAGS@ @DEFS@ $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $< # missing object files $(MT19937AR_OBJ): diff --git a/src/common/atomic.h b/src/common/atomic.h index a42dfad1c..c1ea2aa48 100644 --- a/src/common/atomic.h +++ b/src/common/atomic.h @@ -14,10 +14,10 @@ // // our Abstraction is fully API-Compatible to Microsoft's implementation @ NT5.0+ // -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #if defined(_MSC_VER) -#include "../common/winapi.h" +#include "common/winapi.h" // This checks if C/C++ Compiler Version is 18.00 #if _MSC_VER < 1800 diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index a0fa77fb5..ce8fc6bcf 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -97,6 +97,7 @@ #include <inttypes.h> #include <stdint.h> #include <limits.h> +#include <time.h> // temporary fix for bugreport:4961 (unintended conversion from signed to unsigned) // (-20 >= UCHAR_MAX) returns true diff --git a/src/common/conf.c b/src/common/conf.c index c974decf9..cb0194c3a 100644 --- a/src/common/conf.c +++ b/src/common/conf.c @@ -6,9 +6,9 @@ #include "conf.h" -#include "../../3rdparty/libconfig/libconfig.h" +#include "common/showmsg.h" // ShowError -#include "../common/showmsg.h" // ShowError +#include <libconfig/libconfig.h> /* interface source */ struct libconfig_interface libconfig_s; diff --git a/src/common/conf.h b/src/common/conf.h index bd97d5c1e..1889aeb3a 100644 --- a/src/common/conf.h +++ b/src/common/conf.h @@ -5,9 +5,9 @@ #ifndef COMMON_CONF_H #define COMMON_CONF_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" -#include "../../3rdparty/libconfig/libconfig.h" +#include <libconfig/libconfig.h> /** * The libconfig interface -- specially for plugins, but we enforce it throughout the core to be consistent diff --git a/src/common/console.c b/src/common/console.c index 1eba48fa2..95d1e69fe 100644 --- a/src/common/console.c +++ b/src/common/console.c @@ -4,34 +4,33 @@ #define HERCULES_CORE -#include "../config/core.h" // CONSOLE_INPUT, MAX_CONSOLE_INPUT +#include "config/core.h" // CONSOLE_INPUT, MAX_CONSOLE_INPUT #include "console.h" -#include <stdio.h> -#include <stdlib.h> - -#include "../common/cbasetypes.h" -#include "../common/core.h" -#include "../common/showmsg.h" -#include "../common/sysinfo.h" +#include "common/cbasetypes.h" +#include "common/core.h" +#include "common/showmsg.h" +#include "common/sysinfo.h" #ifndef MINICORE -# include "../common/atomic.h" -# include "../common/ers.h" -# include "../common/malloc.h" -# include "../common/mutex.h" -# include "../common/spinlock.h" -# include "../common/sql.h" -# include "../common/strlib.h" -# include "../common/thread.h" -# include "../common/timer.h" +# include "common/atomic.h" +# include "common/ers.h" +# include "common/malloc.h" +# include "common/mutex.h" +# include "common/spinlock.h" +# include "common/sql.h" +# include "common/strlib.h" +# include "common/thread.h" +# include "common/timer.h" #endif +#include <stdio.h> +#include <stdlib.h> #if !defined(WIN32) # include <sys/time.h> # include <unistd.h> #else -# include "../common/winapi.h" // Console close event handling +# include "common/winapi.h" // Console close event handling # ifdef CONSOLE_INPUT # include <conio.h> /* _kbhit() */ # endif diff --git a/src/common/console.h b/src/common/console.h index 3d3c8e9dd..643edc3d9 100644 --- a/src/common/console.h +++ b/src/common/console.h @@ -4,13 +4,13 @@ #ifndef COMMON_CONSOLE_H #define COMMON_CONSOLE_H -#include "../config/core.h" // MAX_CONSOLE_INPUT +#include "config/core.h" // MAX_CONSOLE_INPUT -#include "../common/cbasetypes.h" -#include "../common/mutex.h" -#include "../common/spinlock.h" -#include "../common/sql.h" -#include "../common/thread.h" +#include "common/cbasetypes.h" +#include "common/mutex.h" +#include "common/spinlock.h" +#include "common/sql.h" +#include "common/thread.h" /** * Queue Max diff --git a/src/common/core.c b/src/common/core.c index ea028002a..e663c4e4c 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -4,41 +4,39 @@ #define HERCULES_CORE -#include "../config/core.h" +#include "config/core.h" #include "core.h" -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "../common/cbasetypes.h" -#include "../common/console.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/random.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" -#include "../common/sysinfo.h" -#include "../common/nullpo.h" +#include "common/cbasetypes.h" +#include "common/console.h" +#include "common/db.h" +#include "common/malloc.h" +#include "common/mmo.h" +#include "common/random.h" +#include "common/showmsg.h" +#include "common/strlib.h" +#include "common/sysinfo.h" +#include "common/nullpo.h" #ifndef MINICORE -# include "../common/HPM.h" -# include "../common/conf.h" -# include "../common/db.h" -# include "../common/ers.h" -# include "../common/socket.h" -# include "../common/sql.h" -# include "../common/thread.h" -# include "../common/timer.h" -# include "../common/utils.h" +# include "common/HPM.h" +# include "common/conf.h" +# include "common/ers.h" +# include "common/socket.h" +# include "common/sql.h" +# include "common/thread.h" +# include "common/timer.h" +# include "common/utils.h" #endif #ifndef _WIN32 # include <unistd.h> #else -# include "../common/winapi.h" // Console close event handling +# include "common/winapi.h" // Console close event handling #endif +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> /// Called when a terminate signal is received. void (*shutdown_callback)(void) = NULL; diff --git a/src/common/core.h b/src/common/core.h index 827d345ba..c2a8d9e58 100644 --- a/src/common/core.h +++ b/src/common/core.h @@ -5,9 +5,7 @@ #ifndef COMMON_CORE_H #define COMMON_CORE_H -#include "../common/cbasetypes.h" -#include "../common/db.h" -#include "../common/mmo.h" +#include "common/cbasetypes.h" /* so that developers with --enable-debug can raise signals from any section of the code they'd like */ #ifdef DEBUG diff --git a/src/common/db.c b/src/common/db.c index 69e2333a9..5063425e6 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -72,15 +72,15 @@ #include "db.h" +#include "common/ers.h" +#include "common/malloc.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/strlib.h" + #include <stdio.h> #include <stdlib.h> -#include "../common/ers.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" - struct db_interface DB_s; /*****************************************************************************\ diff --git a/src/common/db.h b/src/common/db.h index 4883489d7..f75cbd8dc 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -42,9 +42,9 @@ #ifndef COMMON_DB_H #define COMMON_DB_H -#include <stdarg.h> +#include "common/cbasetypes.h" -#include "../common/cbasetypes.h" +#include <stdarg.h> /*****************************************************************************\ * (1) Section with public typedefs, enums, unions, structures and defines. * diff --git a/src/common/des.c b/src/common/des.c index 89a920bc9..0a702bfdf 100644 --- a/src/common/des.c +++ b/src/common/des.c @@ -5,7 +5,7 @@ #include "des.h" -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" /// DES (Data Encryption Standard) algorithm, modified version. /// @see http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=5099. diff --git a/src/common/des.h b/src/common/des.h index 9e6aec4fd..6f54b36f2 100644 --- a/src/common/des.h +++ b/src/common/des.h @@ -3,7 +3,7 @@ #ifndef COMMON_DES_H #define COMMON_DES_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" /// One 64-bit block. typedef struct BIT64 { uint8_t b[8]; } BIT64; diff --git a/src/common/ers.c b/src/common/ers.c index 52cba0fe5..91fc6ccfb 100644 --- a/src/common/ers.c +++ b/src/common/ers.c @@ -44,14 +44,14 @@ #include "ers.h" +#include "common/cbasetypes.h" +#include "common/malloc.h" // CREATE, RECREATE, aMalloc, aFree +#include "common/nullpo.h" +#include "common/showmsg.h" // ShowMessage, ShowError, ShowFatalError, CL_BOLD, CL_NORMAL + #include <stdlib.h> #include <string.h> -#include "../common/cbasetypes.h" -#include "../common/malloc.h" // CREATE, RECREATE, aMalloc, aFree -#include "../common/nullpo.h" -#include "../common/showmsg.h" // ShowMessage, ShowError, ShowFatalError, CL_BOLD, CL_NORMAL - #ifndef DISABLE_ERS #define ERS_BLOCK_ENTRIES 2048 diff --git a/src/common/ers.h b/src/common/ers.h index 0117237d7..09290186e 100644 --- a/src/common/ers.h +++ b/src/common/ers.h @@ -40,7 +40,7 @@ #ifndef COMMON_ERS_H #define COMMON_ERS_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" /*****************************************************************************\ * (1) All public parts of the Entry Reusage System. * diff --git a/src/common/grfio.c b/src/common/grfio.c index 41a888267..614678da8 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -6,20 +6,19 @@ #include "grfio.h" +#include "common/cbasetypes.h" +#include "common/des.h" +#include "common/malloc.h" +#include "common/nullpo.h" +#include "common/showmsg.h" +#include "common/strlib.h" +#include "common/utils.h" + #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <sys/stat.h> #include <zlib.h> -#include "../common/cbasetypes.h" -#include "../common/des.h" -#include "../common/malloc.h" -#include "../common/nullpo.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" -#include "../common/utils.h" - //---------------------------- // file entry table struct //---------------------------- diff --git a/src/common/malloc.c b/src/common/malloc.c index c647dc18f..ec0467495 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -6,14 +6,14 @@ #include "malloc.h" +#include "common/cbasetypes.h" +#include "common/core.h" +#include "common/showmsg.h" +#include "common/sysinfo.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <time.h> - -#include "../common/core.h" -#include "../common/showmsg.h" -#include "../common/sysinfo.h" struct malloc_interface iMalloc_s; @@ -22,7 +22,7 @@ struct malloc_interface iMalloc_s; #if defined(MEMWATCH) # include <string.h> -# include "memwatch.h" +# include <memwatch.h> # define MALLOC(n,file,line,func) mwMalloc((n),(file),(line)) # define CALLOC(m,n,file,line,func) mwCalloc((m),(n),(file),(line)) # define REALLOC(p,n,file,line,func) mwRealloc((p),(n),(file),(line)) @@ -36,7 +36,7 @@ struct malloc_interface iMalloc_s; # include <string.h> # include <stdlib.h> -# include "dmalloc.h" +# include <dmalloc.h> # 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 REALLOC(p,n,file,line,func) dmalloc_realloc((file),(line),(p),(n),DMALLOC_FUNC_REALLOC,0) @@ -48,7 +48,7 @@ struct malloc_interface iMalloc_s; #elif defined(GCOLLECT) -# include "gc.h" +# include <gc.h> # ifdef GC_ADD_CALLER # define RETURN_ADDR 0, # else diff --git a/src/common/malloc.h b/src/common/malloc.h index 7ed2fb19c..20260de84 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -4,7 +4,7 @@ #ifndef COMMON_MALLOC_H #define COMMON_MALLOC_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #define ALC_MARK __FILE__, __LINE__, __func__ diff --git a/src/common/mapindex.c b/src/common/mapindex.c index e07ccd679..18aa413cc 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -6,15 +6,14 @@ #include "mapindex.h" +#include "common/cbasetypes.h" +#include "common/db.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/strlib.h" + #include <stdio.h> #include <stdlib.h> -#include <string.h> - -#include "../common/db.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" /* mapindex.c interface source */ struct mapindex_interface mapindex_s; diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 87a275f57..c334e7cca 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -5,8 +5,9 @@ #ifndef COMMON_MAPINDEX_H #define COMMON_MAPINDEX_H -#include "../common/db.h" -#include "../common/mmo.h" +#include "common/cbasetypes.h" +#include "common/db.h" +#include "common/mmo.h" #define MAX_MAPINDEX 2000 diff --git a/src/common/md5calc.c b/src/common/md5calc.c index 7b31a38d6..e594c364f 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.c @@ -10,16 +10,13 @@ #include "md5calc.h" +#include "common/cbasetypes.h" +#include "common/random.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "../common/random.h" - -#ifndef UINT_MAX -#define UINT_MAX 4294967295U -#endif - // Global variable static unsigned int *pX; diff --git a/src/common/mmo.h b/src/common/mmo.h index 766ccf182..3e497c667 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -5,11 +5,8 @@ #ifndef COMMON_MMO_H #define COMMON_MMO_H -#include <time.h> - -#include "../config/core.h" -#include "../common/cbasetypes.h" -#include "../common/db.h" +#include "config/core.h" +#include "common/cbasetypes.h" // server->client protocol version // 0 - pre-? diff --git a/src/common/mutex.c b/src/common/mutex.c index 7307f5f15..5dfb3d01c 100644 --- a/src/common/mutex.c +++ b/src/common/mutex.c @@ -5,20 +5,18 @@ #include "mutex.h" -#include "../common/cbasetypes.h" // for WIN32 +#include "common/cbasetypes.h" // for WIN32 +#include "common/malloc.h" +#include "common/showmsg.h" +#include "common/timer.h" #ifdef WIN32 -#include "../common/winapi.h" +#include "common/winapi.h" #else #include <pthread.h> -#include <time.h> #include <sys/time.h> #endif -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/timer.h" - struct ramutex{ #ifdef WIN32 CRITICAL_SECTION hMutex; diff --git a/src/common/mutex.h b/src/common/mutex.h index fa8170c98..a70f0e8fd 100644 --- a/src/common/mutex.h +++ b/src/common/mutex.h @@ -4,7 +4,7 @@ #ifndef COMMON_MUTEX_H #define COMMON_MUTEX_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" typedef struct ramutex ramutex; // Mutex typedef struct racond racond; // Condition Var diff --git a/src/common/nullpo.c b/src/common/nullpo.c index 97b206835..a8980885f 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -6,6 +6,8 @@ #include "nullpo.h" +#include "common/showmsg.h" + #include <stdio.h> #include <stdarg.h> #include <stdlib.h> @@ -14,8 +16,6 @@ #include <execinfo.h> #endif -#include "../common/showmsg.h" - struct nullpo_interface nullpo_s; /** @@ -43,11 +43,11 @@ void assert_report(const char *file, int line, const char *func, const char *tar ShowError("--- %s --------------------------------------------\n", title); ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func); #ifdef __GNUC__ - size = backtrace (array, 10); - strings = backtrace_symbols (array, size); + size = (int)backtrace(array, 10); + strings = backtrace_symbols(array, size); for (i = 0; i < size; i++) ShowError("%s\n", strings[i]); - free (strings); + free(strings); #endif ShowError("--- end %s ----------------------------------------\n", title); } diff --git a/src/common/nullpo.h b/src/common/nullpo.h index 573e351e0..a59c2ac2b 100644 --- a/src/common/nullpo.h +++ b/src/common/nullpo.h @@ -5,7 +5,7 @@ #ifndef COMMON_NULLPO_H #define COMMON_NULLPO_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" // enabled by default on debug builds #if defined(DEBUG) && !defined(NULLPO_CHECK) diff --git a/src/common/random.c b/src/common/random.c index 88d5748cf..a4d7c5d34 100644 --- a/src/common/random.c +++ b/src/common/random.c @@ -5,16 +5,14 @@ #include "random.h" -#include <time.h> // time +#include "common/cbasetypes.h" // for WIN32 +#include "common/showmsg.h" +#include "common/timer.h" // gettick -#include <mt19937ar.h> // init_genrand, genrand_int32, genrand_res53 - -#include "../common/cbasetypes.h" // for WIN32 -#include "../common/showmsg.h" -#include "../common/timer.h" // gettick +#include <mt19937ar/mt19937ar.h> // init_genrand, genrand_int32, genrand_res53 #if defined(WIN32) -# include "../common/winapi.h" +# include "common/winapi.h" #elif defined(HAVE_GETPID) || defined(HAVE_GETTID) # include <sys/types.h> # include <unistd.h> diff --git a/src/common/random.h b/src/common/random.h index 0ca375d28..379e675b2 100644 --- a/src/common/random.h +++ b/src/common/random.h @@ -4,7 +4,7 @@ #ifndef COMMON_RANDOM_H #define COMMON_RANDOM_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #ifdef HERCULES_CORE void rnd_init(void); diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 0dd645eeb..01dc0b01a 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -6,20 +6,18 @@ #include "showmsg.h" +#include "common/cbasetypes.h" +#include "common/core.h" //[Ind] - For SERVER_TYPE +#include "common/strlib.h" // StringBuf + +#include <libconfig/libconfig.h> + #include <stdarg.h> #include <stdio.h> #include <stdlib.h> // atexit -#include <string.h> -#include <time.h> - -#include "../../3rdparty/libconfig/libconfig.h" - -#include "../common/cbasetypes.h" -#include "../common/core.h" //[Ind] - For SERVER_TYPE -#include "../common/strlib.h" // StringBuf #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" #else // not WIN32 # include <unistd.h> #endif // WIN32 diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 0624f1786..63e42ab57 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -5,16 +5,16 @@ #ifndef COMMON_SHOWMSG_H #define COMMON_SHOWMSG_H -#include <stdarg.h> - -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #ifdef HERCULES_CORE -# include "../../3rdparty/libconfig/libconfig.h" +# include <libconfig/libconfig.h> #else -# include "../common/HPMi.h" +# include "common/HPMi.h" #endif +#include <stdarg.h> + // for help with the console colors look here: // http://www.edoceo.com/liberum/?doc=printf-with-color // some code explanation (used here): diff --git a/src/common/socket.c b/src/common/socket.c index 1b7f36f8b..17c31db50 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -4,26 +4,26 @@ #define HERCULES_CORE -#include "../config/core.h" // SHOW_SERVER_STATS +#include "config/core.h" // SHOW_SERVER_STATS #define H_SOCKET_C #include "socket.h" #undef H_SOCKET_C +#include "common/HPM.h" +#include "common/cbasetypes.h" +#include "common/db.h" +#include "common/malloc.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/strlib.h" +#include "common/timer.h" + #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <sys/types.h> -#include "../common/HPM.h" -#include "../common/cbasetypes.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" -#include "../common/timer.h" - #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" #else # include <arpa/inet.h> # include <errno.h> diff --git a/src/common/socket.h b/src/common/socket.h index 6323a6862..bd5d9baa2 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -5,12 +5,10 @@ #ifndef COMMON_SOCKET_H #define COMMON_SOCKET_H -#include <time.h> - -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" typedef long in_addr_t; #else # include <netinet/in.h> diff --git a/src/common/spinlock.h b/src/common/spinlock.h index 413067b68..811b239df 100644 --- a/src/common/spinlock.h +++ b/src/common/spinlock.h @@ -14,12 +14,12 @@ // // -#include "../common/atomic.h" -#include "../common/cbasetypes.h" -#include "../common/thread.h" +#include "common/atomic.h" +#include "common/cbasetypes.h" +#include "common/thread.h" #ifdef WIN32 -#include "../common/winapi.h" +#include "common/winapi.h" #endif #ifdef WIN32 diff --git a/src/common/sql.c b/src/common/sql.c index 4ca14d43b..a93092533 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -6,19 +6,17 @@ #include "sql.h" -#include <stdlib.h> // strtoul -#include <string.h> // strlen/strnlen/memcpy/memset - -#include "../common/cbasetypes.h" -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" -#include "../common/timer.h" +#include "common/cbasetypes.h" +#include "common/malloc.h" +#include "common/showmsg.h" +#include "common/strlib.h" +#include "common/timer.h" #ifdef WIN32 -# include "../common/winapi.h" // Needed before mysql.h +# include "common/winapi.h" // Needed before mysql.h #endif #include <mysql.h> +#include <stdlib.h> // strtoul void hercules_mysql_error_handler(unsigned int ecode); diff --git a/src/common/sql.h b/src/common/sql.h index c3598273e..d76b4f9d4 100644 --- a/src/common/sql.h +++ b/src/common/sql.h @@ -5,9 +5,9 @@ #ifndef COMMON_SQL_H #define COMMON_SQL_H -#include <stdarg.h>// va_list +#include "common/cbasetypes.h" -#include "../common/cbasetypes.h" +#include <stdarg.h>// va_list // Return codes #define SQL_ERROR (-1) diff --git a/src/common/strlib.c b/src/common/strlib.c index b5fcff576..555f591e6 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -8,14 +8,14 @@ #include "strlib.h" #undef H_STRLIB_C +#include "common/cbasetypes.h" +#include "common/malloc.h" +#include "common/showmsg.h" + #include <errno.h> #include <stdio.h> #include <stdlib.h> -#include "../common/cbasetypes.h" -#include "../common/malloc.h" -#include "../common/showmsg.h" - #define J_MAX_MALLOC_SIZE 65535 struct strlib_interface strlib_s; diff --git a/src/common/strlib.h b/src/common/strlib.h index c687d9e17..a768ebff5 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -5,11 +5,11 @@ #ifndef COMMON_STRLIB_H #define COMMON_STRLIB_H +#include "common/cbasetypes.h" + #include <stdarg.h> #include <string.h> -#include "../common/cbasetypes.h" - #ifdef WIN32 #define HAVE_STRTOK_R #define strtok_r(s,delim,save_ptr) strtok_r_((s),(delim),(save_ptr)) diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index 7edc5c72e..a27357e7e 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -8,16 +8,14 @@ #include "sysinfo.h" +#include "common/cbasetypes.h" +#include "common/core.h" +#include "common/malloc.h" +#include "common/strlib.h" + #include <stdio.h> // fopen #include <stdlib.h> // atoi - -#include "../common/cbasetypes.h" -#include "../common/core.h" -#include "../common/malloc.h" -#include "../common/strlib.h" - #ifdef WIN32 -# include <string.h> // strlen # include <windows.h> #else # include <unistd.h> diff --git a/src/common/sysinfo.h b/src/common/sysinfo.h index 8c8f6dbe6..3c0d01ca1 100644 --- a/src/common/sysinfo.h +++ b/src/common/sysinfo.h @@ -11,7 +11,7 @@ * cached at compile time) */ -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" struct sysinfo_private; diff --git a/src/common/thread.c b/src/common/thread.c index 95212b4b0..9b9308d06 100644 --- a/src/common/thread.c +++ b/src/common/thread.c @@ -10,10 +10,13 @@ #include "thread.h" -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" +#include "common/malloc.h" +#include "common/showmsg.h" +#include "common/sysinfo.h" // sysinfo->getpagesize() #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" # define __thread __declspec( thread ) #else # include <pthread.h> @@ -24,10 +27,6 @@ # include <unistd.h> #endif -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/sysinfo.h" // sysinfo->getpagesize() - // When Compiling using MSC (on win32..) we know we have support in any case! #ifdef _MSC_VER #define HAS_TLS diff --git a/src/common/thread.h b/src/common/thread.h index f79eb77f9..36ea006b3 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -4,7 +4,7 @@ #ifndef COMMON_THREAD_H #define COMMON_THREAD_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" typedef struct rAthread rAthread; typedef void* (*rAthreadProc)(void*); diff --git a/src/common/timer.c b/src/common/timer.c index 45dbb9f50..06309642e 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -6,24 +6,23 @@ #include "timer.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include "../common/cbasetypes.h" -#include "../common/db.h" -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/utils.h" +#include "common/cbasetypes.h" +#include "common/db.h" +#include "common/malloc.h" +#include "common/showmsg.h" +#include "common/utils.h" #ifdef WIN32 -# include "../common/winapi.h" // GetTickCount() +# include "common/winapi.h" // GetTickCount() #else # include <sys/time.h> // struct timeval, gettimeofday() # include <unistd.h> #endif +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + struct timer_interface timer_s; // If the server can't handle processing thousands of monsters diff --git a/src/common/timer.h b/src/common/timer.h index 6e8a72389..46a036ec7 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -5,7 +5,7 @@ #ifndef COMMON_TIMER_H #define COMMON_TIMER_H -#include "../common/cbasetypes.h" +#include "common/cbasetypes.h" #define DIFF_TICK(a,b) ((a)-(b)) #define DIFF_TICK32(a,b) ((int32)((a)-(b))) diff --git a/src/common/utils.c b/src/common/utils.c index ad68706ca..07e2e9fdf 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -6,32 +6,28 @@ #include "utils.h" -#include <math.h> // floor() -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> // cache purposes [Ind/Hercules] - -#include "../common/cbasetypes.h" -#include "../common/core.h" -#include "../common/malloc.h" -#include "../common/mmo.h" -#include "../common/showmsg.h" -#include "../common/socket.h" -#include "../common/strlib.h" +#include "common/cbasetypes.h" +#include "common/core.h" +#include "common/mmo.h" +#include "common/showmsg.h" +#include "common/socket.h" +#include "common/strlib.h" #ifdef WIN32 -# include "../common/winapi.h" +# include "common/winapi.h" # ifndef F_OK # define F_OK 0x0 # endif /* F_OK */ #else # include <dirent.h> -# include <sys/stat.h> # include <unistd.h> #endif +#include <math.h> // floor() +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> // cache purposes [Ind/Hercules] + struct HCache_interface HCache_s; /// Dumps given buffer into file pointed to by a handle. diff --git a/src/common/utils.h b/src/common/utils.h index e6102f184..0ac818468 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -5,10 +5,9 @@ #ifndef COMMON_UTILS_H #define COMMON_UTILS_H -#include <stdio.h> // FILE* -#include <time.h> +#include "common/cbasetypes.h" -#include "../common/cbasetypes.h" +#include <stdio.h> // FILE* /* [HCache] 1-byte key to ensure our method is the latest, we can modify to ensure the method matches */ #define HCACHE_KEY 'k' |