diff options
author | dastgir <dastgirpojee@rocketmail.com> | 2015-09-09 09:28:39 -0400 |
---|---|---|
committer | dastgir <dastgirpojee@rocketmail.com> | 2015-09-09 10:03:58 -0400 |
commit | 0af11c16f1daf23d77a237b9452945706e9b40bc (patch) | |
tree | 004aa5258eb7eb37a29b8dc04a9df6b357ee0857 /src/map/pc.c | |
parent | c76aa5f4843a521b1839875bf6c139f4658bd6d1 (diff) | |
download | hercules-0af11c16f1daf23d77a237b9452945706e9b40bc.tar.gz hercules-0af11c16f1daf23d77a237b9452945706e9b40bc.tar.bz2 hercules-0af11c16f1daf23d77a237b9452945706e9b40bc.tar.xz hercules-0af11c16f1daf23d77a237b9452945706e9b40bc.zip |
Autotrade Struct to HPM
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 31 |
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; } |