summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 49b8f1f94..36bcbae88 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -40,6 +40,7 @@
#include "common/cbasetypes.h"
#include "common/conf.h"
#include "common/core.h" // get_svn_revision()
+#include "common/HPM.h"
#include "common/malloc.h"
#include "common/mmo.h" // NAME_LENGTH, MAX_CARTS, NEW_CARTS
#include "common/nullpo.h"
@@ -11354,9 +11355,36 @@ void pc_autotrade_populate(struct map_session_data *sd) {
pc->autotrade_update(sd,PAUC_START);
+ for(i = 0; i < data->hdatac; i++ ) {
+ if( data->hdata[i]->flag.free ) {
+ aFree(data->hdata[i]->data);
+ }
+ aFree(data->hdata[i]);
+ }
+ if( data->hdata )
+ aFree(data->hdata);
+
idb_remove(pc->at_db, sd->status.char_id);
}
+/**
+ * @see DBApply
+ */
+int pc_autotrade_final(DBKey key, DBData *data, va_list ap) {
+ struct autotrade_vending* at_v = DB->data2ptr(data);
+ int i;
+ for(i = 0; i < at_v->hdatac; i++ ) {
+ if( at_v->hdata[i]->flag.free ) {
+ aFree(at_v->hdata[i]->data);
+ }
+ aFree(at_v->hdata[i]);
+ }
+ if( at_v->hdata )
+ aFree(at_v->hdata);
+
+ return 0;
+}
+
//Checks if the given class value corresponds to a player class. [Skotlex]
//JOB_NOVICE isn't checked for class_ is supposed to be unsigned
bool pc_db_checkid(unsigned int class_)
@@ -11373,7 +11401,7 @@ bool pc_db_checkid(unsigned int class_)
void do_final_pc(void) {
db_destroy(pc->itemcd_db);
- db_destroy(pc->at_db);
+ pc->at_db->destroy(pc->at_db,pc->autotrade_final);
pcg->final();
@@ -11733,6 +11761,7 @@ void pc_defaults(void) {
pc->autotrade_start = pc_autotrade_start;
pc->autotrade_prepare = pc_autotrade_prepare;
pc->autotrade_populate = pc_autotrade_populate;
+ pc->autotrade_final = pc_autotrade_final;
pc->check_job_name = pc_check_job_name;
}