summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-17 16:07:30 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-17 16:08:01 +0300
commitaa9464281141d0fe098285e0a32ca33d852c0552 (patch)
treea2896c27699b888ac3084f28d4a22ec0156af5e3
parent974774dc41249f683019a8c8ed6954a099672157 (diff)
downloadevol-hercules-aa9464281141d0fe098285e0a32ca33d852c0552.tar.gz
evol-hercules-aa9464281141d0fe098285e0a32ca33d852c0552.tar.bz2
evol-hercules-aa9464281141d0fe098285e0a32ca33d852c0552.tar.xz
evol-hercules-aa9464281141d0fe098285e0a32ca33d852c0552.zip
Move common interfaces initialisation into separate file.
-rw-r--r--src/Makefile.am4
-rw-r--r--src/common/interfaces.c29
-rw-r--r--src/common/interfaces.h9
-rw-r--r--src/login/init.c1
-rw-r--r--src/map/init.c14
5 files changed, 44 insertions, 13 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6d5b292..59554ca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,7 +24,9 @@ MAP_SRC = map/dummy.c \
map/send.h \
map/session.c \
map/session.h \
- map/sessionext.h
+ map/sessionext.h \
+ common/interfaces.c \
+ common/interfaces.h
SHARED_CFLAGS = -pipe -ffast-math -Wall -Wextra -Wno-sign-compare -DPCRE_SUPPORT
SHARED_LDFLAGS = -avoid-version -Wl,--no-undefined
diff --git a/src/common/interfaces.c b/src/common/interfaces.c
new file mode 100644
index 0000000..40a71fb
--- /dev/null
+++ b/src/common/interfaces.c
@@ -0,0 +1,29 @@
+// 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/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");
+}
diff --git a/src/common/interfaces.h b/src/common/interfaces.h
new file mode 100644
index 0000000..2215978
--- /dev/null
+++ b/src/common/interfaces.h
@@ -0,0 +1,9 @@
+// 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);
+
+#endif // EVOL_COMMON_INTERFACES
diff --git a/src/login/init.c b/src/login/init.c
index b1682af..6eff178 100644
--- a/src/login/init.c
+++ b/src/login/init.c
@@ -30,6 +30,7 @@ HPExport void plugin_init (void)
session = GET_SYMBOL("session");
sockt = GET_SYMBOL("sockt");
strlib = GET_SYMBOL("strlib");
+
login = GET_SYMBOL("login");
addPacket(0x7530, 22, login_parse_version, hpParse_Login);
diff --git a/src/map/init.c b/src/map/init.c
index 7620757..52c5f58 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -10,8 +10,6 @@
#include "../../../common/mmo.h"
#include "../../../common/socket.h"
#include "../../../common/strlib.h"
-#include "../../../common/sysinfo.h"
-#include "../../../common/timer.h"
#include "../../../map/chat.h"
#include "../../../map/chrif.h"
#include "../../../map/clif.h"
@@ -35,6 +33,7 @@
#include "../../../map/trade.h"
#include "../../../map/quest.h"
+#include "common/interfaces.h"
#include "map/dummy.h"
#include "map/parse.h"
#include "map/script.h"
@@ -54,16 +53,7 @@ HPExport struct hplugin_info pinfo =
HPExport void plugin_init (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");
+ interfaces_init_common();
atcommand = GET_SYMBOL("atcommand");
battle = GET_SYMBOL("battle");