diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/cbasetypes.h | 4 | ||||
-rw-r--r-- | src/common/lock.c | 8 | ||||
-rw-r--r-- | src/common/plugin.h | 4 | ||||
-rw-r--r-- | src/common/plugins.h | 5 | ||||
-rw-r--r-- | src/common/showmsg.c | 9 | ||||
-rw-r--r-- | src/common/socket.c | 25 | ||||
-rw-r--r-- | src/common/socket.h | 9 | ||||
-rw-r--r-- | src/common/timer.c | 17 | ||||
-rw-r--r-- | src/common/timer.h | 11 |
9 files changed, 57 insertions, 35 deletions
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 00296588e..468c0c8d0 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -307,4 +307,8 @@ typedef char bool; #define TOLOWER(c) (tolower((unsigned char)(c))) #define TOUPPER(c) (toupper((unsigned char)(c))) +////////////////////////////////////////////////////////////////////////// +// length of a static array +#define ARRAYLENGTH(A) ( sizeof(A)/sizeof((A)[0]) ) + #endif /* _CBASETYPES_H_ */ diff --git a/src/common/lock.c b/src/common/lock.c index a08b46756..e4ec36302 100644 --- a/src/common/lock.c +++ b/src/common/lock.c @@ -1,6 +1,10 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder +#include "../common/cbasetypes.h" +#include "../common/showmsg.h" +#include "lock.h" + #include <stdio.h> #include <errno.h> #include <string.h> @@ -11,10 +15,8 @@ #define F_OK 0x0 #define R_OK 0x4 #endif -#include "lock.h" -#include "showmsg.h" -#ifndef _WIN32 +#ifndef WIN32 #define exists(filename) (!access(filename, F_OK)) #else // could be speed up maybe? diff --git a/src/common/plugin.h b/src/common/plugin.h index 3ddbaae98..8aef934d0 100644 --- a/src/common/plugin.h +++ b/src/common/plugin.h @@ -4,7 +4,9 @@ #ifndef _PLUGIN_H_ #define _PLUGIN_H_ -#include "cbasetypes.h" +#ifndef _CBASETYPES_H_ +#include "../common/cbasetypes.h" +#endif ////// Plugin functions /////////////// diff --git a/src/common/plugins.h b/src/common/plugins.h index 70dd6b326..b4235e72d 100644 --- a/src/common/plugins.h +++ b/src/common/plugins.h @@ -4,12 +4,17 @@ #ifndef _PLUGINS_H_ #define _PLUGINS_H_ +#ifndef _CBASETYPES_H_ +#include "../common/cbasetypes.h" +#endif + #include "../common/plugin.h" ////// Dynamic Link Library functions /////////////// #ifdef WIN32 + #define WIN32_LEAN_AND_MEAN #include <windows.h> #define DLL_OPEN(x) LoadLibrary(x) #define DLL_SYM(x,y,z) (FARPROC)(x) = GetProcAddress(y,z) diff --git a/src/common/showmsg.c b/src/common/showmsg.c index f56c66525..34338da4b 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -1,16 +1,17 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder +#include "../common/cbasetypes.h" +#include "../common/utils.h" +#include "showmsg.h" + #include <stdio.h> #include <string.h> #include <stdarg.h> #include <time.h> #include <stdlib.h> // atexit -#include "cbasetypes.h" -#include "showmsg.h" -#include "utils.h" -#ifdef _WIN32 +#ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> diff --git a/src/common/socket.c b/src/common/socket.c index 73b0fb06b..efc51b99d 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1,14 +1,22 @@ // Copyright (c) Athena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder +#include "../common/cbasetypes.h" +#include "../common/mmo.h" +#include "../common/timer.h" +#include "../common/malloc.h" +#include "../common/showmsg.h" +#include "../common/strlib.h" +#include "socket.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> -#ifdef __WIN32 - #define WIN32_LEAN_AND_MEAN - #include <windows.h> +#ifdef WIN32 + //#define WIN32_LEAN_AND_MEAN + //#include <windows.h> #include <winsock2.h> #include <io.h> #else @@ -29,7 +37,7 @@ #endif // portability layer -#ifdef _WIN32 +#ifdef WIN32 typedef int socklen_t; #define s_errno WSAGetLastError() @@ -52,13 +60,6 @@ #define S_ECONNABORTED ECONNABORTED #endif -#include "../common/socket.h" -#include "../common/mmo.h" -#include "../common/timer.h" -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "../common/strlib.h" - fd_set readfds; int fd_max; time_t last_tick; @@ -561,7 +562,7 @@ int do_sendrecv(int next) fd_max = ret; } -#ifdef _WIN32 +#ifdef WIN32 // on windows, enumerating all members of the fd_set is way faster if we access the internals for(i=0;i<(int)rfd.fd_count;i++) { diff --git a/src/common/socket.h b/src/common/socket.h index 64190d6e7..3d860e166 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -4,10 +4,12 @@ #ifndef _SOCKET_H_ #define _SOCKET_H_ +#ifndef _CBASETYPES_H_ +#include "../common/cbasetypes.h" +#endif + #ifdef WIN32 - #define WIN32_LEAN_AND_MEAN - #include <windows.h> - #include <winsock.h> + #include <winsock2.h> typedef long in_addr_t; #else #include <sys/types.h> @@ -15,7 +17,6 @@ #include <netinet/in.h> #endif -#include "../common/cbasetypes.h" #include <time.h> diff --git a/src/common/timer.c b/src/common/timer.c index 6c228839c..09be7d949 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -3,11 +3,17 @@ #include <sys/types.h> -#ifdef __WIN32 -#define __USE_W32_SOCKETS +#include "../common/cbasetypes.h" +#include "../common/malloc.h" +#include "../common/showmsg.h" +#include "timer.h" + +#ifdef WIN32 +//#define __USE_W32_SOCKETS // Well, this won't last another 30++ years (where conversion will truncate). //#define _USE_32BIT_TIME_T // use 32 bit time variables on 64bit windows -#include <windows.h> +//#include <windows.h> +#include <winsock2.h> #else #include <sys/socket.h> #include <sys/time.h> @@ -18,11 +24,6 @@ #include <string.h> #include <time.h> -#include "../common/cbasetypes.h" -#include "../common/malloc.h" -#include "../common/showmsg.h" -#include "timer.h" - // タイマー間隔の最小値。モンスターの大量召還時、多数のクライアント接続時に // サーバーが反応しなくなる場合は、TIMER_MIN_INTERVAL を増やしてください。 diff --git a/src/common/timer.h b/src/common/timer.h index 23cb6beaa..24534de2a 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -4,10 +4,15 @@ #ifndef _TIMER_H_ #define _TIMER_H_ -#ifdef __WIN32 +#ifndef _CBASETYPES_H_ +#include "../common/cbasetypes.h" +#endif + +#ifdef WIN32 /* We need winsock lib to have timeval struct - windows is weirdo */ -#define __USE_W32_SOCKETS -#include <windows.h> +//#define __USE_W32_SOCKETS +//#include <windows.h> +#include <winsock2.h> #endif #define BASE_TICK 5 |