diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-07-04 22:37:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-07-04 22:37:51 +0300 |
commit | 58b8c8d8cb9f78537495f908887fea9d0a451637 (patch) | |
tree | 74438cc91f5c5a6a7a953c98aa52106eb88b250f /src/ecommon | |
parent | 857c86d93ebd68e5edbbe14ce26a16a967622822 (diff) | |
download | evol-hercules-58b8c8d8cb9f78537495f908887fea9d0a451637.tar.gz evol-hercules-58b8c8d8cb9f78537495f908887fea9d0a451637.tar.bz2 evol-hercules-58b8c8d8cb9f78537495f908887fea9d0a451637.tar.xz evol-hercules-58b8c8d8cb9f78537495f908887fea9d0a451637.zip |
Rename login/char/map dirs to elogin/echar/emap for avoid conflicts with hercules.
Diffstat (limited to 'src/ecommon')
-rw-r--r-- | src/ecommon/config.c | 38 | ||||
-rw-r--r-- | src/ecommon/config.h | 16 | ||||
-rw-r--r-- | src/ecommon/init.c | 44 | ||||
-rw-r--r-- | src/ecommon/init.h | 11 | ||||
-rw-r--r-- | src/ecommon/ip.c | 25 | ||||
-rw-r--r-- | src/ecommon/ip.h | 9 |
6 files changed, 143 insertions, 0 deletions
diff --git a/src/ecommon/config.c b/src/ecommon/config.c new file mode 100644 index 0000000..0395dd7 --- /dev/null +++ b/src/ecommon/config.c @@ -0,0 +1,38 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "common/HPMi.h" +#include "common/malloc.h" +#include "common/mapindex.h" +#include "common/mmo.h" +#include "common/socket.h" +#include "common/strlib.h" + +#include "ecommon/config.h" + +const char *default_map = NULL; +int default_x = 0; +int default_y = 0; + +void config_default_map(const char *val) +{ + mapindex->default_map = aStrdup(val); +} + +void config_default_x(const char *val) +{ + mapindex->default_x = atoi(val); +} + +void config_default_y(const char *val) +{ + mapindex->default_y = atoi(val); +} + +void common_config_final(void) +{ +} diff --git a/src/ecommon/config.h b/src/ecommon/config.h new file mode 100644 index 0000000..9c24932 --- /dev/null +++ b/src/ecommon/config.h @@ -0,0 +1,16 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_COMMON_CONFIG +#define EVOL_COMMON_CONFIG + +void config_default_map(const char *val); +void config_default_x(const char *val); +void config_default_y(const char *val); +void common_config_final(void); + +extern const char *default_map; +extern int default_x; +extern int default_y; + +#endif // EVOL_COMMON_CONFIG diff --git a/src/ecommon/init.c b/src/ecommon/init.c new file mode 100644 index 0000000..d0304b2 --- /dev/null +++ b/src/ecommon/init.c @@ -0,0 +1,44 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "common/HPMi.h" +#include "common/conf.h" +#include "common/malloc.h" +#include "common/mapindex.h" +#include "common/mmo.h" +#include "common/socket.h" +#include "common/strlib.h" +#include "common/sysinfo.h" +#include "common/timer.h" + +void interfaces_init_common(void) +{ + iMalloc = GET_SYMBOL("iMalloc"); + strlib = GET_SYMBOL("strlib"); + session = GET_SYMBOL("session"); + sockt = GET_SYMBOL("sockt"); + sv = GET_SYMBOL("sv"); + StrBuf = GET_SYMBOL("StrBuf"); + SQL = GET_SYMBOL("SQL"); + timer = GET_SYMBOL("timer"); + libconfig = GET_SYMBOL("libconfig"); + sysinfo = GET_SYMBOL("sysinfo"); + DB = GET_SYMBOL("DB"); +} + +void setDefaultMap(void) +{ + mapindex->default_map = aStrdup("000-1"); + mapindex->default_x = 80; + mapindex->default_y = 109; +} + +void commonClean(void) +{ + aFree(mapindex->default_map); + mapindex->default_map = NULL; +} diff --git a/src/ecommon/init.h b/src/ecommon/init.h new file mode 100644 index 0000000..41f844c --- /dev/null +++ b/src/ecommon/init.h @@ -0,0 +1,11 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_COMMON_INTERFACES +#define EVOL_COMMON_INTERFACES + +void interfaces_init_common(void); +void setDefaultMap(void); +void commonClean(void); + +#endif // EVOL_COMMON_INTERFACES diff --git a/src/ecommon/ip.c b/src/ecommon/ip.c new file mode 100644 index 0000000..eb6d792 --- /dev/null +++ b/src/ecommon/ip.c @@ -0,0 +1,25 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "common/HPMi.h" +#include "common/malloc.h" +#include "common/mmo.h" +#include "common/socket.h" +#include "common/strlib.h" + +#include "ecommon/ip.h" + +bool checkAllowedIp(const char* const mask, const char* const ip) +{ + char buf[1000]; + + strcpy(buf, ","); + strcat(buf, ip); + strcat(buf, ","); + + return strstr(mask, buf) != NULL; +} diff --git a/src/ecommon/ip.h b/src/ecommon/ip.h new file mode 100644 index 0000000..1b0ba18 --- /dev/null +++ b/src/ecommon/ip.h @@ -0,0 +1,9 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_COMMON_IP +#define EVOL_COMMON_IP + +bool checkAllowedIp(const char* const mask, const char* const ip); + +#endif // EVOL_COMMON_IP |