diff options
author | Susu <susu-@live.fr> | 2013-05-17 11:10:30 +0200 |
---|---|---|
committer | Susu <susu-@live.fr> | 2013-05-17 11:10:30 +0200 |
commit | 25e848f1a0f9317d63106cae048a1ef838411cb2 (patch) | |
tree | 0c1dc751af9f06e1ce3729d271de301f78a4e611 /src/map | |
parent | 3820bd7e7715bc84f458cf1bf466e6377a2d2e46 (diff) | |
download | hercules-25e848f1a0f9317d63106cae048a1ef838411cb2.tar.gz hercules-25e848f1a0f9317d63106cae048a1ef838411cb2.tar.bz2 hercules-25e848f1a0f9317d63106cae048a1ef838411cb2.tar.xz hercules-25e848f1a0f9317d63106cae048a1ef838411cb2.zip |
- Made DB and malloc lib HPM-friendly
- Also fixed a bug preventing the plugins to be loeaded because HPMI and HPMI_s weren't HPExport
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 8 | ||||
-rw-r--r-- | src/map/battleground.c | 2 | ||||
-rw-r--r-- | src/map/chrif.c | 6 | ||||
-rw-r--r-- | src/map/guild.c | 28 | ||||
-rw-r--r-- | src/map/itemdb.c | 8 | ||||
-rw-r--r-- | src/map/map.c | 14 | ||||
-rw-r--r-- | src/map/npc.c | 14 | ||||
-rw-r--r-- | src/map/script.c | 2 | ||||
-rw-r--r-- | src/map/skill.c | 2 | ||||
-rw-r--r-- | src/map/storage.c | 4 |
10 files changed, 44 insertions, 44 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 8a6399568..d923027dd 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5350,12 +5350,12 @@ ACMD(skillid) { iter = db_iterator(skilldb_name2id); for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) { - idx = skill->get_index(db_data2i(data)); + idx = skill->get_index(DB->data2i(data)); if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill_db[idx].desc, message, skillen) == 0) { - sprintf(atcmd_output, msg_txt(1164), db_data2i(data), skill_db[idx].desc, key.str); // skill %d: %s (%s) + sprintf(atcmd_output, msg_txt(1164), DB->data2i(data), skill_db[idx].desc, key.str); // skill %d: %s (%s) clif->message(fd, atcmd_output); } else if ( found < MAX_SKILLID_PARTIAL_RESULTS && ( stristr(key.str,message) || stristr(skill_db[idx].desc,message) ) ) { - snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), db_data2i(data), skill_db[idx].desc, key.str); + snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), DB->data2i(data), skill_db[idx].desc, key.str); } } @@ -9206,7 +9206,7 @@ ACMD(channel) { iter = db_iterator(channel->banned); for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) { - struct hChSysBanEntry * entry = db_data2ptr(data); + struct hChSysBanEntry * entry = DB->data2ptr(data); if( !isA ) sprintf(atcmd_output, msg_txt(1444), entry->name);// - %s %s diff --git a/src/map/battleground.c b/src/map/battleground.c index fa4db436a..618679406 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -222,7 +222,7 @@ int bg_send_message(struct map_session_data *sd, const char *mes, int len) */ int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap) { - struct battleground_data *bg = db_data2ptr(data); + struct battleground_data *bg = DB->data2ptr(data); struct map_session_data *sd; int i; nullpo_ret(bg); diff --git a/src/map/chrif.c b/src/map/chrif.c index 05f56029b..efe976942 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -479,7 +479,7 @@ int chrif_connectack(int fd) { * @see DBApply */ static int chrif_reconnect(DBKey key, DBData *data, va_list ap) { - struct auth_node *node = db_data2ptr(data); + struct auth_node *node = DB->data2ptr(data); switch (node->state) { case ST_LOGIN: @@ -687,7 +687,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used ( * @see DBApply */ int auth_db_cleanup_sub(DBKey key, DBData *data, va_list ap) { - struct auth_node *node = db_data2ptr(data); + struct auth_node *node = DB->data2ptr(data); const char* states[] = { "Login", "Logout", "Map change" }; if(DIFF_TICK(gettick(),node->node_created)>60000) { @@ -1596,7 +1596,7 @@ void chrif_send_report(char* buf, int len) { * @see DBApply */ int auth_db_final(DBKey key, DBData *data, va_list ap) { - struct auth_node *node = db_data2ptr(data); + struct auth_node *node = DB->data2ptr(data); if (node->char_dat) aFree(node->char_dat); diff --git a/src/map/guild.c b/src/map/guild.c index 9e7dc9b0f..b83f05f00 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -296,7 +296,7 @@ int guild_payexp_timer_sub(DBKey key, DBData *data, va_list ap) { struct guild_expcache *c; struct guild *g; - c = db_data2ptr(data); + c = DB->data2ptr(data); if ( (g = guild->search(c->guild_id)) == NULL || @@ -331,7 +331,7 @@ int guild_payexp_timer(int tid, unsigned int tick, int id, intptr_t data) */ int guild_send_xy_timer_sub(DBKey key, DBData *data, va_list ap) { - struct guild *g = db_data2ptr(data); + struct guild *g = DB->data2ptr(data); int i; nullpo_ret(g); @@ -439,8 +439,8 @@ int guild_npc_request_info(int guild_id,const char *event) ev=(struct eventlist *)aCalloc(sizeof(struct eventlist),1); memcpy(ev->name,event,strlen(event)); //The one in the db (if present) becomes the next event from this. - if (guild_infoevent_db->put(guild_infoevent_db, db_i2key(guild_id), db_ptr2data(ev), &prev)) - ev->next = db_data2ptr(&prev); + if (guild_infoevent_db->put(guild_infoevent_db, DB->i2key(guild_id), DB->ptr2data(ev), &prev)) + ev->next = DB->data2ptr(&prev); } return guild->request_info(guild_id); @@ -615,8 +615,8 @@ int guild_recv_info(struct guild *sg) { } //Occurrence of an event - if (guild_infoevent_db->remove(guild_infoevent_db, db_i2key(sg->guild_id), &data)) { - struct eventlist *ev = db_data2ptr(&data), *ev2; + if (guild_infoevent_db->remove(guild_infoevent_db, DB->i2key(sg->guild_id), &data)) { + struct eventlist *ev = DB->data2ptr(&data), *ev2; while(ev) { npc_event_do(ev->name); ev2=ev->next; @@ -1243,7 +1243,7 @@ static DBData create_expcache(DBKey key, va_list args) c->account_id = sd->status.account_id; c->char_id = sd->status.char_id; c->exp = 0; - return db_ptr2data(c); + return DB->ptr2data(c); } /*==================================================== @@ -1269,7 +1269,7 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) { exp = exp * per / 100; //Otherwise tax everything. - c = db_data2ptr(guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd)); + c = DB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, DB->i2key(sd->status.char_id), create_expcache, sd)); if (c->exp > UINT64_MAX - exp) c->exp = UINT64_MAX; @@ -1292,7 +1292,7 @@ int guild_getexp(struct map_session_data *sd,int exp) if (sd->status.guild_id == 0 || sd->guild == NULL) return 0; - c = db_data2ptr(guild_expcache_db->ensure(guild_expcache_db, db_i2key(sd->status.char_id), create_expcache, sd)); + c = DB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, DB->i2key(sd->status.char_id), create_expcache, sd)); if (c->exp > UINT64_MAX - exp) c->exp = UINT64_MAX; else @@ -1692,7 +1692,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id */ int guild_broken_sub(DBKey key, DBData *data, va_list ap) { - struct guild *g = db_data2ptr(data); + struct guild *g = DB->data2ptr(data); int guild_id=va_arg(ap,int); int i,j; struct map_session_data *sd=NULL; @@ -1717,7 +1717,7 @@ int guild_broken_sub(DBKey key, DBData *data, va_list ap) */ int castle_guild_broken_sub(DBKey key, DBData *data, va_list ap) { - struct guild_castle *gc = db_data2ptr(data); + struct guild_castle *gc = DB->data2ptr(data); int guild_id = va_arg(ap, int); nullpo_ret(gc); @@ -2145,7 +2145,7 @@ void guild_flag_remove(struct npc_data *nd) { */ static int eventlist_db_final(DBKey key, DBData *data, va_list ap) { struct eventlist *next = NULL; - struct eventlist *current = db_data2ptr(data); + struct eventlist *current = DB->data2ptr(data); while (current != NULL) { next = current->next; aFree(current); @@ -2158,7 +2158,7 @@ static int eventlist_db_final(DBKey key, DBData *data, va_list ap) { * @see DBApply */ static int guild_expcache_db_final(DBKey key, DBData *data, va_list ap) { - ers_free(expcache_ers, db_data2ptr(data)); + ers_free(expcache_ers, DB->data2ptr(data)); return 0; } @@ -2166,7 +2166,7 @@ static int guild_expcache_db_final(DBKey key, DBData *data, va_list ap) { * @see DBApply */ static int guild_castle_db_final(DBKey key, DBData *data, va_list ap) { - struct guild_castle* gc = db_data2ptr(data); + struct guild_castle* gc = DB->data2ptr(data); if( gc->temp_guardians ) aFree(gc->temp_guardians); aFree(gc); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 590a0cf57..2a5fa48de 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -30,7 +30,7 @@ struct item_data dummy_item; //This is the default dummy item used for non-exist */ static int itemdb_searchname_sub(DBKey key, DBData *data, va_list ap) { - struct item_data *item = db_data2ptr(data), **dst, **dst2; + struct item_data *item = DB->data2ptr(data), **dst, **dst2; char *str; str=va_arg(ap,char *); dst=va_arg(ap,struct item_data **); @@ -83,7 +83,7 @@ struct item_data* itemdb_searchname(const char *str) */ static int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap) { - struct item_data *item = db_data2ptr(&data); + struct item_data *item = DB->data2ptr(&data); char *str; str=va_arg(ap,char *); if (item == &dummy_item) @@ -127,7 +127,7 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str) size -= count; db_count = itemdb_other->getall(itemdb_other, (DBData**)&db_data, size, itemdb_searchname_array_sub, str); for (i = 0; i < db_count; i++) - data[count++] = db_data2ptr(db_data[i]); + data[count++] = DB->data2ptr(db_data[i]); count += db_count; } return count; @@ -1376,7 +1376,7 @@ static void destroy_item_data(struct item_data* self, int free_self) */ static int itemdb_final_sub(DBKey key, DBData *data, va_list ap) { - struct item_data *id = db_data2ptr(data); + struct item_data *id = DB->data2ptr(data); if( id != &dummy_item ) destroy_item_data(id, 1); diff --git a/src/map/map.c b/src/map/map.c index 49aef6c4c..6f61375fe 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1479,7 +1479,7 @@ static DBData create_charid2nick(DBKey key, va_list args) { struct charid2nick *p; CREATE(p, struct charid2nick, 1); - return db_ptr2data(p); + return DB->ptr2data(p); } /// Adds(or replaces) the nick of charid to nick_db and fullfils pending requests. @@ -1515,7 +1515,7 @@ void map_delnickdb(int charid, const char* name) struct map_session_data* sd; DBData data; - if (!nick_db->remove(nick_db, db_i2key(charid), &data) || (p = db_data2ptr(&data)) == NULL) + if (!nick_db->remove(nick_db, DB->i2key(charid), &data) || (p = DB->data2ptr(&data)) == NULL) return; while( p->requests ) { @@ -2703,7 +2703,7 @@ static DBData create_map_data_other_server(DBKey key, va_list args) mdos=(struct map_data_other_server *)aCalloc(1,sizeof(struct map_data_other_server)); mdos->index = mapindex; memcpy(mdos->name, mapindex_id2name(mapindex), MAP_NAME_LENGTH); - return db_ptr2data(mdos); + return DB->ptr2data(mdos); } /*========================================== @@ -2733,7 +2733,7 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port) */ int map_eraseallipport_sub(DBKey key, DBData *data, va_list va) { - struct map_data_other_server *mdos = db_data2ptr(data); + struct map_data_other_server *mdos = DB->data2ptr(data); if(mdos->cell == NULL) { db_remove(map_db,key); aFree(mdos); @@ -4854,7 +4854,7 @@ void read_map_zone_db(void) { */ int map_db_final(DBKey key, DBData *data, va_list ap) { - struct map_data_other_server *mdos = db_data2ptr(data); + struct map_data_other_server *mdos = DB->data2ptr(data); if(mdos && mdos->cell == NULL) aFree(mdos); return 0; @@ -4865,7 +4865,7 @@ int map_db_final(DBKey key, DBData *data, va_list ap) */ int nick_db_final(DBKey key, DBData *data, va_list args) { - struct charid2nick* p = db_data2ptr(data); + struct charid2nick* p = DB->data2ptr(data); struct charid_request* req; if( p == NULL ) @@ -4913,7 +4913,7 @@ int cleanup_sub(struct block_list *bl, va_list ap) */ static int cleanup_db_sub(DBKey key, DBData *data, va_list va) { - return cleanup_sub(db_data2ptr(data), va); + return cleanup_sub(DB->data2ptr(data), va); } /*========================================== diff --git a/src/map/npc.c b/src/map/npc.c index 77ee8d486..090c03e58 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -353,7 +353,7 @@ int npc_event_doall_sub(DBKey key, DBData *data, va_list ap) const char* name; int rid; - nullpo_ret(ev = db_data2ptr(data)); + nullpo_ret(ev = DB->data2ptr(data)); nullpo_ret(c = va_arg(ap, int *)); nullpo_ret(name = va_arg(ap, const char *)); rid = va_arg(ap, int); @@ -381,7 +381,7 @@ static int npc_event_do_sub(DBKey key, DBData *data, va_list ap) int* c; const char* name; - nullpo_ret(ev = db_data2ptr(data)); + nullpo_ret(ev = DB->data2ptr(data)); nullpo_ret(c = va_arg(ap, int *)); nullpo_ret(name = va_arg(ap, const char *)); @@ -1785,7 +1785,7 @@ int npc_remove_map(struct npc_data* nd) */ static int npc_unload_ev(DBKey key, DBData *data, va_list ap) { - struct event_data* ev = db_data2ptr(data); + struct event_data* ev = DB->data2ptr(data); char* npcname = va_arg(ap, char *); if(strcmp(ev->nd->exname,npcname)==0){ @@ -2302,7 +2302,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const int npc_convertlabel_db(DBKey key, DBData *data, va_list ap) { const char* lname = (const char*)key.str; - int lpos = db_data2i(data); + int lpos = DB->data2i(data); struct npc_label_list** label_list; int* label_list_num; const char* filepath; @@ -2972,9 +2972,9 @@ static const char* npc_parse_function(char* w1, char* w2, char* w3, char* w4, co return end; func_db = script_get_userfunc_db(); - if (func_db->put(func_db, db_str2key(w3), db_ptr2data(script), &old_data)) + if (func_db->put(func_db, DB->str2key(w3), DB->ptr2data(script), &old_data)) { - struct script_code *oldscript = (struct script_code*)db_data2ptr(&old_data); + struct script_code *oldscript = (struct script_code*)DB->data2ptr(&old_data); ShowInfo("npc_parse_function: Overwriting user function [%s] (%s:%d)\n", w3, filepath, strline(buffer,start-buffer)); script_free_vars(oldscript->script_vars); aFree(oldscript->script_buf); @@ -3776,7 +3776,7 @@ void npc_read_event_script(void) for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) { const char* p = key.str; - struct event_data* ed = db_data2ptr(data); + struct event_data* ed = DB->data2ptr(data); unsigned char count = script_event[i].event_count; if( count >= ARRAYLENGTH(script_event[i].event) ) diff --git a/src/map/script.c b/src/map/script.c index 76092f4ce..41f8e7472 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -3658,7 +3658,7 @@ int script_config_read(char *cfgName) */ static int db_script_free_code_sub(DBKey key, DBData *data, va_list ap) { - struct script_code *code = db_data2ptr(data); + struct script_code *code = DB->data2ptr(data); if (code) script_free_code(code); return 0; diff --git a/src/map/skill.c b/src/map/skill.c index bbc88d9d2..06bfca5f8 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -15363,7 +15363,7 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) { * @see DBApply */ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { - struct skill_unit* unit = db_data2ptr(data); + struct skill_unit* unit = DB->data2ptr(data); struct skill_unit_group* group = unit->group; unsigned int tick = va_arg(ap,unsigned int); bool dissonance; diff --git a/src/map/storage.c b/src/map/storage.c index fda80735a..01da53907 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -73,7 +73,7 @@ void do_final_storage(void) // by [MC Cameri] */ static int storage_reconnect_sub(DBKey key, DBData *data, va_list ap) { - struct guild_storage *stor = db_data2ptr(data); + struct guild_storage *stor = DB->data2ptr(data); if (stor->dirty && stor->storage_status == 0) //Save closed storages. storage_guild_storagesave(0, stor->guild_id,0); @@ -352,7 +352,7 @@ static DBData create_guildstorage(DBKey key, va_list args) struct guild_storage *gs = NULL; gs = (struct guild_storage *) aCalloc(sizeof(struct guild_storage), 1); gs->guild_id=key.i; - return db_ptr2data(gs); + return DB->ptr2data(gs); } struct guild_storage *guild2storage(int guild_id) |