diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-31 21:26:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-31 21:26:28 +0300 |
commit | 8c2d41ab26c49ec6b9398a3d5117e69d8b1bcbf0 (patch) | |
tree | 86d84540074f4b212c433e3c50c9a66f85db2999 /src | |
parent | c3ac3686cd4a52a9c72da045564e653e94c30d48 (diff) | |
download | evol-hercules-8c2d41ab26c49ec6b9398a3d5117e69d8b1bcbf0.tar.gz evol-hercules-8c2d41ab26c49ec6b9398a3d5117e69d8b1bcbf0.tar.bz2 evol-hercules-8c2d41ab26c49ec6b9398a3d5117e69d8b1bcbf0.tar.xz evol-hercules-8c2d41ab26c49ec6b9398a3d5117e69d8b1bcbf0.zip |
Read default map and position from config.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/char/init.c | 4 | ||||
-rw-r--r-- | src/common/config.c | 38 | ||||
-rw-r--r-- | src/common/config.h | 16 | ||||
-rw-r--r-- | src/common/init.c | 2 | ||||
-rw-r--r-- | src/map/init.c | 4 |
6 files changed, 69 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 9599d00..07bffc3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,8 @@ CHAR_SRC = char/char.c \ char/config.c \ char/config.h \ char/init.c \ + common/config.c \ + common/config.h \ common/init.c \ common/init.h \ common/ip.c \ @@ -17,6 +19,8 @@ LOGIN_SRC = login/config.c \ login/parse.h \ login/send.c \ login/send.h \ + common/config.c \ + common/config.h \ common/init.c \ common/init.h \ common/ip.c \ @@ -64,6 +68,8 @@ MAP_SRC = map/clif.c \ map/struct/sessionext.h \ map/utils/formatutils.c \ map/utils/formatutils.h \ + common/config.c \ + common/config.h \ common/init.c \ common/init.h diff --git a/src/char/init.c b/src/char/init.c index e4b5f84..6e3ed0f 100644 --- a/src/char/init.c +++ b/src/char/init.c @@ -27,6 +27,7 @@ #include "../../../char/loginif.h" #include "../../../char/mapif.h" +#include "common/config.h" #include "common/init.h" #include "char/char.h" #include "char/config.h" @@ -70,6 +71,9 @@ HPExport void server_preinit (void) mapindex = GET_SYMBOL("mapindex"); setDefaultMap(); + addMapInterConf("default_map", config_default_map); + addMapInterConf("default_x", config_default_x); + addMapInterConf("default_y", config_default_y); addCharInterConf("inter_server_ip", config_inter_server_ip); addCharConf("min_char_class", config_min_char_class); diff --git a/src/common/config.c b/src/common/config.c new file mode 100644 index 0000000..232b199 --- /dev/null +++ b/src/common/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 "common/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/common/config.h b/src/common/config.h new file mode 100644 index 0000000..9c24932 --- /dev/null +++ b/src/common/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/common/init.c b/src/common/init.c index 38797dc..9b70e50 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -32,7 +32,7 @@ void interfaces_init_common(void) void setDefaultMap(void) { - mapindex->default_map = "000-1"; + mapindex->default_map = aStrdup("000-1"); mapindex->default_x = 80; mapindex->default_y = 109; } diff --git a/src/map/init.c b/src/map/init.c index 3e92ce9..d7ba9f2 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -34,6 +34,7 @@ #include "../../../map/trade.h" #include "../../../map/quest.h" +#include "common/config.h" #include "common/init.h" #include "map/clif.h" #include "map/itemdb.h" @@ -186,6 +187,9 @@ HPExport void server_preinit (void) channel = GET_SYMBOL("channel"); setDefaultMap(); + addMapInterConf("default_map", config_default_map); + addMapInterConf("default_x", config_default_x); + addMapInterConf("default_y", config_default_y); addHookPre("quest->read_db_sub", equest_read_db_sub); addGroupPermission("send_gm_flag", permission_send_gm_flag); |