From f20f9547576153b536be337e47e7a6b79500e2c2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 28 Sep 2015 15:14:02 +0300 Subject: Add functions for support battleground extension object. --- src/emap/data/bgd.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/emap/data/bgd.c (limited to 'src/emap/data/bgd.c') 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 +#include +#include + +#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; +} -- cgit v1.2.3-70-g09d2