summaryrefslogtreecommitdiff
path: root/src/map/battleground.c
diff options
context:
space:
mode:
authordastgir <dastgirpojee@rocketmail.com>2015-02-11 10:01:41 -0500
committerdastgir <dastgirpojee@rocketmail.com>2015-02-11 10:01:41 -0500
commit0bd4a0178cd5beb8bee955777afe32392d75afa9 (patch)
treebb3062df27d13ada5938e6003f3b8eb55e42dc3a /src/map/battleground.c
parent56c4c0d997f0776c606a9a9594772f86ea181b68 (diff)
downloadhercules-0bd4a0178cd5beb8bee955777afe32392d75afa9.tar.gz
hercules-0bd4a0178cd5beb8bee955777afe32392d75afa9.tar.bz2
hercules-0bd4a0178cd5beb8bee955777afe32392d75afa9.tar.xz
hercules-0bd4a0178cd5beb8bee955777afe32392d75afa9.zip
Battleground Data to HPM Struct
Diffstat (limited to 'src/map/battleground.c')
-rw-r--r--src/map/battleground.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 2d4ba6bf1..f0bad2b3d 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -22,6 +22,7 @@
#include "pet.h"
#include "../common/cbasetypes.h"
#include "../common/conf.h"
+#include "../common/HPM.h"
#include "../common/malloc.h"
#include "../common/nullpo.h"
#include "../common/showmsg.h"
@@ -856,9 +857,27 @@ void do_init_battleground(bool minimal) {
bg->config_read();
}
+/**
+ * @see DBApply
+ */
+int bg_team_db_final(DBKey key, DBData *data, va_list ap) {
+ struct battleground_data* bgd = DB->data2ptr(data);
+ int i;
+ for(i = 0; i < bgd->hdatac; i++ ) {
+ if( bgd->hdata[i]->flag.free ) {
+ aFree(bgd->hdata[i]->data);
+ }
+ aFree(bgd->hdata[i]);
+ }
+ if( bgd->hdata )
+ aFree(bgd->hdata);
+
+ return 0;
+}
+
void do_final_battleground(void)
{
- db_destroy(bg->team_db);
+ bg->team_db->destroy(bg->team_db,bg->team_db_final);
if (bg->arena) {
int i;
@@ -868,6 +887,7 @@ void do_final_battleground(void)
}
aFree(bg->arena);
}
+
}
void battleground_defaults(void) {
bg = &bg_s;
@@ -911,6 +931,7 @@ void battleground_defaults(void) {
bg->send_xy_timer_sub = bg_send_xy_timer_sub;
bg->send_xy_timer = bg_send_xy_timer;
bg->afk_timer = bg_afk_timer;
+ bg->team_db_final = bg_team_db_final;
/* */
bg->str2teamtype = bg_str2teamtype;
/* */