summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-28 15:14:02 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-28 15:14:02 +0300
commitf20f9547576153b536be337e47e7a6b79500e2c2 (patch)
treecc3b2c21dcfa966012b20892a106c17a0b68219d
parent4f83ea8b4fab0f6fc7a136d7ce668160eeeae656 (diff)
downloadevol-hercules-f20f9547576153b536be337e47e7a6b79500e2c2.tar.gz
evol-hercules-f20f9547576153b536be337e47e7a6b79500e2c2.tar.bz2
evol-hercules-f20f9547576153b536be337e47e7a6b79500e2c2.tar.xz
evol-hercules-f20f9547576153b536be337e47e7a6b79500e2c2.zip
Add functions for support battleground extension object.
-rw-r--r--src/Makefile.am3
-rw-r--r--src/emap/data/bgd.c40
-rw-r--r--src/emap/data/bgd.h12
-rw-r--r--src/emap/struct/bgdext.h12
4 files changed, 67 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 97cda9b..64e3a22 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -66,6 +66,8 @@ MAP_SRC = emap/atcommand.c \
emap/status.h \
emap/unit.c \
emap/unit.h \
+ emap/data/bgd.c \
+ emap/data/bgd.h \
emap/data/itemd.c \
emap/data/itemd.h \
emap/data/mapd.c \
@@ -74,6 +76,7 @@ MAP_SRC = emap/atcommand.c \
emap/data/npcd.h \
emap/data/session.c \
emap/data/session.h \
+ emap/struct/bgdext.h \
emap/struct/itemdext.h \
emap/struct/mapdext.h \
emap/struct/npcdext.h \
diff --git a/src/emap/data/bgd.c b/src/emap/data/bgd.c
new file mode 100644
index 0000000..6f5956c
--- /dev/null
+++ b/src/emap/data/bgd.c
@@ -0,0 +1,40 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 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/battleground.h"
+
+#include "emap/data/bgd.h"
+#include "emap/struct/bgdext.h"
+
+struct BgdExt *bgd_get(struct battleground_data *bd)
+{
+ struct BgdExt *data = getFromBGDATA(bd, 0);
+ if (!data)
+ {
+ data = bgd_create();
+ addToBGDATA(bd, data, 0, true);
+ }
+ return data;
+}
+
+struct BgdExt *bgd_create(void)
+{
+ struct BgdExt *data = NULL;
+ CREATE(data, struct BgdExt, 1);
+ if (!data)
+ return NULL;
+ data->teamId = 0;
+ return data;
+}
diff --git a/src/emap/data/bgd.h b/src/emap/data/bgd.h
new file mode 100644
index 0000000..b14485a
--- /dev/null
+++ b/src/emap/data/bgd.h
@@ -0,0 +1,12 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#ifndef EVOL_MAP_BGD
+#define EVOL_MAP_BGD
+
+struct NgdExt;
+
+struct BgdExt *bgd_get(struct battleground_data *bd);
+struct BgdExt *bgd_create(void);
+
+#endif // EVOL_MAP_BGD
diff --git a/src/emap/struct/bgdext.h b/src/emap/struct/bgdext.h
new file mode 100644
index 0000000..7b870ad
--- /dev/null
+++ b/src/emap/struct/bgdext.h
@@ -0,0 +1,12 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#ifndef EVOL_MAP_BGDEXT
+#define EVOL_MAP_BGDEXT
+
+struct BgdExt
+{
+ int teamId;
+};
+
+#endif // EVOL_MAP_BGDEXT