summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-12 17:39:04 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-12 17:39:04 +0300
commit8487d3de9cf9e1775d4cdb17a83cf48d4d732064 (patch)
tree5a36eb7794fb290dde3ffd4a4a879f4873c0ff68
parent009f4a01c538c44f15bfec720c6cea2dee249985 (diff)
downloadevol-hercules-8487d3de9cf9e1775d4cdb17a83cf48d4d732064.tar.gz
evol-hercules-8487d3de9cf9e1775d4cdb17a83cf48d4d732064.tar.bz2
evol-hercules-8487d3de9cf9e1775d4cdb17a83cf48d4d732064.tar.xz
evol-hercules-8487d3de9cf9e1775d4cdb17a83cf48d4d732064.zip
Add mob db field 'WalkMask' for now unused.
-rw-r--r--src/Makefile.am3
-rw-r--r--src/emap/data/mobd.c40
-rw-r--r--src/emap/data/mobd.h12
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/mob.c21
-rw-r--r--src/emap/mob.h4
-rw-r--r--src/emap/struct/mobdext.h12
7 files changed, 93 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b80abeb..fda9647 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -74,6 +74,8 @@ MAP_SRC = emap/atcommand.c \
emap/data/itemd.h \
emap/data/mapd.c \
emap/data/mapd.h \
+ emap/data/mobd.c \
+ emap/data/mobd.h \
emap/data/npcd.c \
emap/data/npcd.h \
emap/data/session.c \
@@ -81,6 +83,7 @@ MAP_SRC = emap/atcommand.c \
emap/struct/bgdext.h \
emap/struct/itemdext.h \
emap/struct/mapdext.h \
+ emap/struct/mobdext.h \
emap/struct/npcdext.h \
emap/struct/sessionext.h \
emap/utils/formatutils.c \
diff --git a/src/emap/data/mobd.c b/src/emap/data/mobd.c
new file mode 100644
index 0000000..c0dc9ca
--- /dev/null
+++ b/src/emap/data/mobd.c
@@ -0,0 +1,40 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#include "common/hercules.h"
+
+#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 "map/battle.h"
+#include "map/mob.h"
+
+#include "emap/data/mobd.h"
+#include "emap/struct/mobdext.h"
+
+struct MobdExt *mobd_get(struct mob_db *md)
+{
+ struct MobdExt *data = getFromMOBDB(md, 0);
+ if (!data)
+ {
+ data = mobd_create();
+ addToMOBDB(md, data, 0, true);
+ }
+ return data;
+}
+
+struct MobdExt *mobd_create(void)
+{
+ struct MobdExt *data = NULL;
+ CREATE(data, struct MobdExt, 1);
+ if (!data)
+ return NULL;
+ data->walkMask = 0;
+ return data;
+}
diff --git a/src/emap/data/mobd.h b/src/emap/data/mobd.h
new file mode 100644
index 0000000..0e93890
--- /dev/null
+++ b/src/emap/data/mobd.h
@@ -0,0 +1,12 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#ifndef EVOL_MAP_MOBD
+#define EVOL_MAP_MOBD
+
+struct MobdExt;
+
+struct MobdExt *mobd_get(struct mob_db *md);
+struct MobdExt *mobd_create(void);
+
+#endif // EVOL_MAP_MOBD
diff --git a/src/emap/init.c b/src/emap/init.c
index 3ec6eab..c19dc07 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -157,6 +157,7 @@ HPExport void plugin_init (void)
addHookPre("pc->check_job_name", epc_check_job_name);
addHookPre("pc->delitem", epc_delitem_pre);
addHookPre("mob->deleteslave_sub", emob_deleteslave_sub);
+ addHookPre("mob->read_db_additional_fields", emob_read_db_additional_fields);
addHookPre("npc->parse_unknown_mapflag", enpc_parse_unknown_mapflag);
addHookPre("npc->buysellsel", enpc_buysellsel);
addHookPre("npc->db_checkid", enpc_db_checkid);
diff --git a/src/emap/mob.c b/src/emap/mob.c
index 7e0a560..eae7901 100644
--- a/src/emap/mob.c
+++ b/src/emap/mob.c
@@ -17,6 +17,9 @@
#include "map/itemdb.h"
#include "map/mob.h"
+#include "emap/data/mobd.h"
+#include "emap/struct/mobdext.h"
+
int emob_deleteslave_sub(struct block_list *bl, va_list ap)
{
if (!bl)
@@ -48,3 +51,21 @@ int emob_deleteslave_sub(struct block_list *bl, va_list ap)
hookStop();
return 0;
}
+
+void emob_read_db_additional_fields(struct mob_db *entry,
+ int *classPtr,
+ config_setting_t *it,
+ int *nPtr, const char *source)
+{
+ int i32 = 0;
+
+ struct MobdExt *data = mobd_get(entry);
+ if (!data)
+ {
+ hookStop();
+ return;
+ }
+
+ if (mob->lookup_const(it, "WalkMask", &i32))
+ data->walkMask = i32;
+}
diff --git a/src/emap/mob.h b/src/emap/mob.h
index b6fc44f..028195f 100644
--- a/src/emap/mob.h
+++ b/src/emap/mob.h
@@ -5,5 +5,9 @@
#define EVOL_MAP_MOB
int emob_deleteslave_sub(struct block_list *bl, va_list ap);
+void emob_read_db_additional_fields(struct mob_db *entry,
+ int *classPtr,
+ config_setting_t *it,
+ int *nPtr, const char *source);
#endif // EVOL_MAP_MOB
diff --git a/src/emap/struct/mobdext.h b/src/emap/struct/mobdext.h
new file mode 100644
index 0000000..ed49e6c
--- /dev/null
+++ b/src/emap/struct/mobdext.h
@@ -0,0 +1,12 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#ifndef EVOL_MAP_MOBDEXT
+#define EVOL_MAP_MOBDEXT
+
+struct MobdExt
+{
+ int walkMask;
+};
+
+#endif // EVOL_MAP_MOBDEXT