summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-06-08 17:31:28 -0300
committershennetsind <ind@henn.et>2013-06-08 17:31:28 -0300
commit4c31ec091c3dcef916c90b6416976ea701671e90 (patch)
tree421552306c5f014103c6f8efc261e947bbb448c5 /src
parent60eb0c9e0527e80b7793e48d2cea47e3204b777c (diff)
downloadhercules-4c31ec091c3dcef916c90b6416976ea701671e90.tar.gz
hercules-4c31ec091c3dcef916c90b6416976ea701671e90.tar.bz2
hercules-4c31ec091c3dcef916c90b6416976ea701671e90.tar.xz
hercules-4c31ec091c3dcef916c90b6416976ea701671e90.zip
Follow up d73783f22b2bb881aab74524d153d89a5932a199
Adjusting db.c interface name to adhere with the rest (pretty much we try to make it as short as we can, and being there were no conflicts we saw no reason to maintain the 'i') Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c12
-rw-r--r--src/char/int_guild.c4
-rw-r--r--src/char/inter.c2
-rw-r--r--src/common/HPM.c2
-rw-r--r--src/common/core.c4
-rw-r--r--src/common/db.c46
-rw-r--r--src/common/db.h88
-rw-r--r--src/common/timer.h1
-rw-r--r--src/login/login.c6
-rw-r--r--src/map/atcommand.c8
-rw-r--r--src/map/battleground.c2
-rw-r--r--src/map/chrif.c6
-rw-r--r--src/map/guild.c28
-rw-r--r--src/map/itemdb.c8
-rw-r--r--src/map/map.c14
-rw-r--r--src/map/npc.c14
-rw-r--r--src/map/party.c2
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/storage.c4
20 files changed, 128 insertions, 127 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 3083876ab..8672d10ef 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -188,7 +188,7 @@ static DBData create_online_char_data(DBKey key, va_list args)
character->pincode_enable = -1;
character->fd = -1;
character->waiting_disconnect = INVALID_TIMER;
- return iDB->ptr2data(character);
+ return DB->ptr2data(character);
}
void set_char_charselect(int account_id)
@@ -322,7 +322,7 @@ void set_char_offline(int char_id, int account_id)
*/
static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = (struct online_char_data*)iDB->data2ptr(data);
+ struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data);
int server = va_arg(ap, int);
if (server == -1) {
character->char_id = -1;
@@ -341,7 +341,7 @@ static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
*/
static int char_db_kickoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = (struct online_char_data*)iDB->data2ptr(data);
+ struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data);
int server_id = va_arg(ap, int);
if (server_id > -1 && character->server != server_id)
@@ -393,7 +393,7 @@ static DBData create_charstatus(DBKey key, va_list args)
struct mmo_charstatus *cp;
cp = (struct mmo_charstatus *) aCalloc(1,sizeof(struct mmo_charstatus));
cp->char_id = key.i;
- return iDB->ptr2data(cp);
+ return DB->ptr2data(cp);
}
int inventory_to_sql(const struct item items[], int max, int id);
@@ -4457,7 +4457,7 @@ int broadcast_user_count(int tid, unsigned int tick, int id, intptr_t data)
*/
static int send_accounts_tologin_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = iDB->data2ptr(data);
+ struct online_char_data* character = DB->data2ptr(data);
int* i = va_arg(ap, int*);
if(character->server > -1)
@@ -4539,7 +4539,7 @@ static int chardb_waiting_disconnect(int tid, unsigned int tick, int id, intptr_
*/
static int online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data *character= iDB->data2ptr(data);
+ struct online_char_data *character= DB->data2ptr(data);
if (character->fd != -1)
return 0; //Character still connected
if (character->server == -2) //Unknown server.. set them offline
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 55f29953f..a9bce9cbe 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -57,7 +57,7 @@ static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
if( last_id == 0 ) //Save the first guild in the list.
state = 1;
- for( g = iDB->data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = iDB->data2ptr(iter->next(iter, &key)) )
+ for( g = DB->data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = DB->data2ptr(iter->next(iter, &key)) )
{
if( state == 0 && g->guild_id == last_id )
state++; //Save next guild in the list.
@@ -739,7 +739,7 @@ int inter_guild_sql_init(void)
*/
static int guild_db_final(DBKey key, DBData *data, va_list ap)
{
- struct guild *g = iDB->data2ptr(data);
+ struct guild *g = DB->data2ptr(data);
if (g->save_flag&GS_MASK) {
inter_guild_tosql(g, g->save_flag&GS_MASK);
return 1;
diff --git a/src/char/inter.c b/src/char/inter.c
index a9e9dece4..1ff2bca61 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -935,7 +935,7 @@ int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason)
int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap)
{
unsigned long tick;
- struct WisData *wd = iDB->data2ptr(data);
+ struct WisData *wd = DB->data2ptr(data);
tick = va_arg(ap, unsigned long);
if (DIFF_TICK(tick, wd->tick) > WISDATA_TTL && wis_delnum < WISDELLIST_MAX)
diff --git a/src/common/HPM.c b/src/common/HPM.c
index ed6151c95..9283360dc 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -264,7 +264,7 @@ void hplugins_share_defaults(void) {
HPM->share(&SERVER_TYPE,"SERVER_TYPE");
HPM->share((void*)get_svn_revision,"get_svn_revision");
HPM->share((void*)get_git_hash,"get_git_hash");
- HPM->share(iDB, "iDB");
+ HPM->share(DB, "DB");
HPM->share(iMalloc, "iMalloc");
/* socket */
HPM->share(RFIFOSKIP,"RFIFOSKIP");
diff --git a/src/common/core.c b/src/common/core.c
index d6cfff662..c53d2243b 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -322,7 +322,7 @@ int main (int argc, char **argv) {
Sql_Init();
rathread_init();
mempool_init();
- iDB->init();
+ DB->init();
signals_init();
#ifdef _WIN32
@@ -356,7 +356,7 @@ int main (int argc, char **argv) {
#endif
iTimer->final();
socket_final();
- iDB->final();
+ DB->final();
mempool_final();
rathread_final();
#endif
diff --git a/src/common/db.c b/src/common/db.c
index b1fe22a4a..561371787 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -2349,7 +2349,7 @@ DBHasher db_default_hash(DBType type)
DBReleaser db_default_release(DBType type, DBOptions options)
{
DB_COUNTSTAT(db_default_release);
- options = iDB->fix_options(type, options);
+ options = DB->fix_options(type, options);
if (options&DB_OPT_RELEASE_DATA) { // Release data, what about the key?
if (options&(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY))
return &db_release_both; // Release both key and data
@@ -2416,7 +2416,7 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt
#endif /* DB_ENABLE_STATS */
db = ers_alloc(db_alloc_ers, struct DBMap_impl);
- options = iDB->fix_options(type, options);
+ options = DB->fix_options(type, options);
/* Interface of the database */
db->vtable.iterator = db_obj_iterator;
db->vtable.exists = db_obj_exists;
@@ -2447,9 +2447,9 @@ DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOpt
/* Other */
snprintf(ers_name, 50, "db_alloc:nodes:%s:%s:%d",func,file,line);
db->nodes = ers_new(sizeof(struct dbn),ers_name,ERS_OPT_WAIT|ERS_OPT_FREE_NAME);
- db->cmp = iDB->default_cmp(type);
- db->hash = iDB->default_hash(type);
- db->release = iDB->default_release(type, options);
+ db->cmp = DB->default_cmp(type);
+ db->hash = DB->default_hash(type);
+ db->release = DB->default_release(type, options);
for (i = 0; i < HASH_SIZE; i++)
db->ht[i] = NULL;
db->cache = NULL;
@@ -2830,22 +2830,22 @@ void linkdb_final( struct linkdb_node** head )
*head = NULL;
}
void db_defaults(void) {
- iDB = &iDB_s;
- iDB->alloc = db_alloc;
- iDB->custom_release = db_custom_release;
- iDB->data2i = db_data2i;
- iDB->data2ptr = db_data2ptr;
- iDB->data2ui = db_data2ui;
- iDB->default_cmp = db_default_cmp;
- iDB->default_hash = db_default_hash;
- iDB->default_release = db_default_release;
- iDB->final = db_final;
- iDB->fix_options = db_fix_options;
- iDB->i2data = db_i2data;
- iDB->i2key = db_i2key;
- iDB->init = db_init;
- iDB->ptr2data = db_ptr2data;
- iDB->str2key = db_str2key;
- iDB->ui2data = db_ui2data;
- iDB->ui2key = db_ui2key;
+ DB = &DB_s;
+ DB->alloc = db_alloc;
+ DB->custom_release = db_custom_release;
+ DB->data2i = db_data2i;
+ DB->data2ptr = db_data2ptr;
+ DB->data2ui = db_data2ui;
+ DB->default_cmp = db_default_cmp;
+ DB->default_hash = db_default_hash;
+ DB->default_release = db_default_release;
+ DB->final = db_final;
+ DB->fix_options = db_fix_options;
+ DB->i2data = db_i2data;
+ DB->i2key = db_i2key;
+ DB->init = db_init;
+ DB->ptr2data = db_ptr2data;
+ DB->str2key = db_str2key;
+ DB->ui2data = db_ui2data;
+ DB->ui2key = db_ui2key;
}
diff --git a/src/common/db.h b/src/common/db.h
index 8ad033cce..5a555b2fa 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -599,73 +599,73 @@ struct DBMap {
// For easy access to the common functions.
#define db_exists(db,k) ( (db)->exists((db),(k)) )
-#define idb_exists(db,k) ( (db)->exists((db),iDB->i2key(k)) )
-#define uidb_exists(db,k) ( (db)->exists((db),iDB->ui2key(k)) )
-#define strdb_exists(db,k) ( (db)->exists((db),iDB->str2key(k)) )
+#define idb_exists(db,k) ( (db)->exists((db),DB->i2key(k)) )
+#define uidb_exists(db,k) ( (db)->exists((db),DB->ui2key(k)) )
+#define strdb_exists(db,k) ( (db)->exists((db),DB->str2key(k)) )
// Get pointer-type data from DBMaps of various key types
-#define db_get(db,k) ( iDB->data2ptr((db)->get((db),(k))) )
-#define idb_get(db,k) ( iDB->data2ptr((db)->get((db),iDB->i2key(k))) )
-#define uidb_get(db,k) ( iDB->data2ptr((db)->get((db),iDB->ui2key(k))) )
-#define strdb_get(db,k) ( iDB->data2ptr((db)->get((db),iDB->str2key(k))) )
+#define db_get(db,k) ( DB->data2ptr((db)->get((db),(k))) )
+#define idb_get(db,k) ( DB->data2ptr((db)->get((db),DB->i2key(k))) )
+#define uidb_get(db,k) ( DB->data2ptr((db)->get((db),DB->ui2key(k))) )
+#define strdb_get(db,k) ( DB->data2ptr((db)->get((db),DB->str2key(k))) )
// Get int-type data from DBMaps of various key types
-#define db_iget(db,k) ( iDB->data2i((db)->get((db),(k))) )
-#define idb_iget(db,k) ( iDB->data2i((db)->get((db),iDB->i2key(k))) )
-#define uidb_iget(db,k) ( iDB->data2i((db)->get((db),iDB->ui2key(k))) )
-#define strdb_iget(db,k) ( iDB->data2i((db)->get((db),iDB->str2key(k))) )
+#define db_iget(db,k) ( DB->data2i((db)->get((db),(k))) )
+#define idb_iget(db,k) ( DB->data2i((db)->get((db),DB->i2key(k))) )
+#define uidb_iget(db,k) ( DB->data2i((db)->get((db),DB->ui2key(k))) )
+#define strdb_iget(db,k) ( DB->data2i((db)->get((db),DB->str2key(k))) )
// Get uint-type data from DBMaps of various key types
-#define db_uiget(db,k) ( iDB->data2ui((db)->get((db),(k))) )
-#define idb_uiget(db,k) ( iDB->data2ui((db)->get((db),iDB->i2key(k))) )
-#define uidb_uiget(db,k) ( iDB->data2ui((db)->get((db),iDB->ui2key(k))) )
-#define strdb_uiget(db,k) ( iDB->data2ui((db)->get((db),iDB->str2key(k))) )
+#define db_uiget(db,k) ( DB->data2ui((db)->get((db),(k))) )
+#define idb_uiget(db,k) ( DB->data2ui((db)->get((db),DB->i2key(k))) )
+#define uidb_uiget(db,k) ( DB->data2ui((db)->get((db),DB->ui2key(k))) )
+#define strdb_uiget(db,k) ( DB->data2ui((db)->get((db),DB->str2key(k))) )
// Put pointer-type data into DBMaps of various key types
-#define db_put(db,k,d) ( (db)->put((db),(k),iDB->ptr2data(d),NULL) )
-#define idb_put(db,k,d) ( (db)->put((db),iDB->i2key(k),iDB->ptr2data(d),NULL) )
-#define uidb_put(db,k,d) ( (db)->put((db),iDB->ui2key(k),iDB->ptr2data(d),NULL) )
-#define strdb_put(db,k,d) ( (db)->put((db),iDB->str2key(k),iDB->ptr2data(d),NULL) )
+#define db_put(db,k,d) ( (db)->put((db),(k),DB->ptr2data(d),NULL) )
+#define idb_put(db,k,d) ( (db)->put((db),DB->i2key(k),DB->ptr2data(d),NULL) )
+#define uidb_put(db,k,d) ( (db)->put((db),DB->ui2key(k),DB->ptr2data(d),NULL) )
+#define strdb_put(db,k,d) ( (db)->put((db),DB->str2key(k),DB->ptr2data(d),NULL) )
// Put int-type data into DBMaps of various key types
-#define db_iput(db,k,d) ( (db)->put((db),(k),iDB->i2data(d),NULL) )
-#define idb_iput(db,k,d) ( (db)->put((db),iDB->i2key(k),iDB->i2data(d),NULL) )
-#define uidb_iput(db,k,d) ( (db)->put((db),iDB->ui2key(k),iDB->i2data(d),NULL) )
-#define strdb_iput(db,k,d) ( (db)->put((db),iDB->str2key(k),iDB->i2data(d),NULL) )
+#define db_iput(db,k,d) ( (db)->put((db),(k),DB->i2data(d),NULL) )
+#define idb_iput(db,k,d) ( (db)->put((db),DB->i2key(k),DB->i2data(d),NULL) )
+#define uidb_iput(db,k,d) ( (db)->put((db),DB->ui2key(k),DB->i2data(d),NULL) )
+#define strdb_iput(db,k,d) ( (db)->put((db),DB->str2key(k),DB->i2data(d),NULL) )
// Put uint-type data into DBMaps of various key types
-#define db_uiput(db,k,d) ( (db)->put((db),(k),iDB->ui2data(d),NULL) )
-#define idb_uiput(db,k,d) ( (db)->put((db),iDB->i2key(k),iDB->ui2data(d),NULL) )
-#define uidb_uiput(db,k,d) ( (db)->put((db),iDB->ui2key(k),iDB->ui2data(d),NULL) )
-#define strdb_uiput(db,k,d) ( (db)->put((db),iDB->str2key(k),iDB->ui2data(d),NULL) )
+#define db_uiput(db,k,d) ( (db)->put((db),(k),DB->ui2data(d),NULL) )
+#define idb_uiput(db,k,d) ( (db)->put((db),DB->i2key(k),DB->ui2data(d),NULL) )
+#define uidb_uiput(db,k,d) ( (db)->put((db),DB->ui2key(k),DB->ui2data(d),NULL) )
+#define strdb_uiput(db,k,d) ( (db)->put((db),DB->str2key(k),DB->ui2data(d),NULL) )
// Remove entry from DBMaps of various key types
#define db_remove(db,k) ( (db)->remove((db),(k),NULL) )
-#define idb_remove(db,k) ( (db)->remove((db),iDB->i2key(k),NULL) )
-#define uidb_remove(db,k) ( (db)->remove((db),iDB->ui2key(k),NULL) )
-#define strdb_remove(db,k) ( (db)->remove((db),iDB->str2key(k),NULL) )
+#define idb_remove(db,k) ( (db)->remove((db),DB->i2key(k),NULL) )
+#define uidb_remove(db,k) ( (db)->remove((db),DB->ui2key(k),NULL) )
+#define strdb_remove(db,k) ( (db)->remove((db),DB->str2key(k),NULL) )
//These are discarding the possible vargs you could send to the function, so those
//that require vargs must not use these defines.
-#define db_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),(k),(f))) )
-#define idb_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),iDB->i2key(k),(f))) )
-#define uidb_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),iDB->ui2key(k),(f))) )
-#define strdb_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),iDB->str2key(k),(f))) )
+#define db_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),(k),(f))) )
+#define idb_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),DB->i2key(k),(f))) )
+#define uidb_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),DB->ui2key(k),(f))) )
+#define strdb_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),DB->str2key(k),(f))) )
// Database creation and destruction macros
-#define idb_alloc(opt) iDB->alloc(__FILE__,__func__,__LINE__,DB_INT,(opt),sizeof(int))
-#define uidb_alloc(opt) iDB->alloc(__FILE__,__func__,__LINE__,DB_UINT,(opt),sizeof(unsigned int))
-#define strdb_alloc(opt,maxlen) iDB->alloc(__FILE__,__func__,__LINE__,DB_STRING,(opt),(maxlen))
-#define stridb_alloc(opt,maxlen) iDB->alloc(__FILE__,__func__,__LINE__,DB_ISTRING,(opt),(maxlen))
+#define idb_alloc(opt) DB->alloc(__FILE__,__func__,__LINE__,DB_INT,(opt),sizeof(int))
+#define uidb_alloc(opt) DB->alloc(__FILE__,__func__,__LINE__,DB_UINT,(opt),sizeof(unsigned int))
+#define strdb_alloc(opt,maxlen) DB->alloc(__FILE__,__func__,__LINE__,DB_STRING,(opt),(maxlen))
+#define stridb_alloc(opt,maxlen) DB->alloc(__FILE__,__func__,__LINE__,DB_ISTRING,(opt),(maxlen))
#define db_destroy(db) ( (db)->destroy((db),NULL) )
// Other macros
#define db_clear(db) ( (db)->clear(db,NULL) )
#define db_size(db) ( (db)->size(db) )
#define db_iterator(db) ( (db)->iterator(db) )
-#define dbi_first(dbi) ( iDB->data2ptr((dbi)->first(dbi,NULL)) )
-#define dbi_last(dbi) ( iDB->data2ptr((dbi)->last(dbi,NULL)) )
-#define dbi_next(dbi) ( iDB->data2ptr((dbi)->next(dbi,NULL)) )
-#define dbi_prev(dbi) ( iDB->data2ptr((dbi)->prev(dbi,NULL)) )
+#define dbi_first(dbi) ( DB->data2ptr((dbi)->first(dbi,NULL)) )
+#define dbi_last(dbi) ( DB->data2ptr((dbi)->last(dbi,NULL)) )
+#define dbi_next(dbi) ( DB->data2ptr((dbi)->next(dbi,NULL)) )
+#define dbi_prev(dbi) ( DB->data2ptr((dbi)->prev(dbi,NULL)) )
#define dbi_remove(dbi) ( (dbi)->remove(dbi,NULL) )
#define dbi_exists(dbi) ( (dbi)->exists(dbi) )
#define dbi_destroy(dbi) ( (dbi)->destroy(dbi) )
@@ -867,9 +867,9 @@ void (*init) (void);
* @see #db_init(void)
*/
void (*final) (void);
-} iDB_s;
+} DB_s;
-struct db_interface *iDB;
+struct db_interface *DB;
void db_defaults(void);
// Link DB System - From jAthena
diff --git a/src/common/timer.h b/src/common/timer.h
index d68b5ed0f..2cc243692 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -59,6 +59,7 @@ struct timer_interface {
unsigned long (*get_uptime) (void);
int (*do_timer) (unsigned int tick);
+
void (*init) (void);
void (*final) (void);
} iTimer_s;
diff --git a/src/login/login.c b/src/login/login.c
index 159d99fee..e8f136ba9 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -109,7 +109,7 @@ static DBData create_online_user(DBKey key, va_list args)
p->account_id = key.i;
p->char_server = -1;
p->waiting_disconnect = INVALID_TIMER;
- return iDB->ptr2data(p);
+ return DB->ptr2data(p);
}
struct online_login_data* add_online_user(int char_server, int account_id)
@@ -154,7 +154,7 @@ static int waiting_disconnect_timer(int tid, unsigned int tick, int id, intptr_t
*/
static int online_db_setoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_login_data* p = iDB->data2ptr(data);
+ struct online_login_data* p = DB->data2ptr(data);
int server = va_arg(ap, int);
if( server == -1 )
{
@@ -175,7 +175,7 @@ static int online_db_setoffline(DBKey key, DBData *data, va_list ap)
*/
static int online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_login_data *character= iDB->data2ptr(data);
+ struct online_login_data *character= DB->data2ptr(data);
if (character->char_server == -2) //Unknown server.. set them offline
remove_online_user(character->account_id);
return 0;
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 32191032c..36c4b987d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -5340,12 +5340,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(iDB->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), iDB->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), iDB->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);
}
}
@@ -9156,7 +9156,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 = iDB->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 f91d7ae69..64bc25269 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -220,7 +220,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 = iDB->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 9f3a07680..6e076e6d8 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 = iDB->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 = iDB->data2ptr(data);
+ struct auth_node *node = DB->data2ptr(data);
const char* states[] = { "Login", "Logout", "Map change" };
if(DIFF_TICK(iTimer->gettick(),node->node_created)>60000) {
@@ -1595,7 +1595,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 = iDB->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 fc7779982..b28c14db7 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -297,7 +297,7 @@ int guild_payexp_timer_sub(DBKey key, DBData *data, va_list ap) {
struct guild_expcache *c;
struct guild *g;
- c = iDB->data2ptr(data);
+ c = DB->data2ptr(data);
if (
(g = guild->search(c->guild_id)) == NULL ||
@@ -332,7 +332,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 = iDB->data2ptr(data);
+ struct guild *g = DB->data2ptr(data);
int i;
nullpo_ret(g);
@@ -440,8 +440,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, iDB->i2key(guild_id), iDB->ptr2data(ev), &prev))
- ev->next = iDB->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);
@@ -618,8 +618,8 @@ int guild_recv_info(struct guild *sg) {
}
//Occurrence of an event
- if (guild_infoevent_db->remove(guild_infoevent_db, iDB->i2key(sg->guild_id), &data)) {
- struct eventlist *ev = iDB->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;
@@ -1247,7 +1247,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 iDB->ptr2data(c);
+ return DB->ptr2data(c);
}
/*====================================================
@@ -1273,7 +1273,7 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) {
exp = exp * per / 100;
//Otherwise tax everything.
- c = iDB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, iDB->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;
@@ -1296,7 +1296,7 @@ int guild_getexp(struct map_session_data *sd,int exp)
if (sd->status.guild_id == 0 || sd->guild == NULL)
return 0;
- c = iDB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, iDB->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
@@ -1696,7 +1696,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 = iDB->data2ptr(data);
+ struct guild *g = DB->data2ptr(data);
int guild_id=va_arg(ap,int);
int i,j;
struct map_session_data *sd=NULL;
@@ -1721,7 +1721,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 = iDB->data2ptr(data);
+ struct guild_castle *gc = DB->data2ptr(data);
int guild_id = va_arg(ap, int);
nullpo_ret(gc);
@@ -2149,7 +2149,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 = iDB->data2ptr(data);
+ struct eventlist *current = DB->data2ptr(data);
while (current != NULL) {
next = current->next;
aFree(current);
@@ -2162,7 +2162,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, iDB->data2ptr(data));
+ ers_free(expcache_ers, DB->data2ptr(data));
return 0;
}
@@ -2170,7 +2170,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 = iDB->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 00f4198a8..4b6275047 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 = iDB->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 = iDB->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++] = iDB->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 = iDB->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 bb1ea4fb4..44b328d05 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1490,7 +1490,7 @@ static DBData create_charid2nick(DBKey key, va_list args)
{
struct charid2nick *p;
CREATE(p, struct charid2nick, 1);
- return iDB->ptr2data(p);
+ return DB->ptr2data(p);
}
/// Adds(or replaces) the nick of charid to nick_db and fullfils pending requests.
@@ -1526,7 +1526,7 @@ void map_delnickdb(int charid, const char* name)
struct map_session_data* sd;
DBData data;
- if (!nick_db->remove(nick_db, iDB->i2key(charid), &data) || (p = iDB->data2ptr(&data)) == NULL)
+ if (!nick_db->remove(nick_db, DB->i2key(charid), &data) || (p = DB->data2ptr(&data)) == NULL)
return;
while( p->requests ) {
@@ -2751,7 +2751,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 iDB->ptr2data(mdos);
+ return DB->ptr2data(mdos);
}
/*==========================================
@@ -2781,7 +2781,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 = iDB->data2ptr(data);
+ struct map_data_other_server *mdos = DB->data2ptr(data);
if(mdos->cell == NULL) {
db_remove(map_db,key);
aFree(mdos);
@@ -4961,7 +4961,7 @@ void read_map_zone_db(void) {
* @see DBApply
*/
int map_db_final(DBKey key, DBData *data, va_list ap) {
- struct map_data_other_server *mdos = iDB->data2ptr(data);
+ struct map_data_other_server *mdos = DB->data2ptr(data);
if(mdos && iMalloc->verify_ptr(mdos) && mdos->cell == NULL)
aFree(mdos);
@@ -4974,7 +4974,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 = iDB->data2ptr(data);
+ struct charid2nick* p = DB->data2ptr(data);
struct charid_request* req;
if( p == NULL )
@@ -5021,7 +5021,7 @@ int cleanup_sub(struct block_list *bl, va_list ap) {
*/
static int cleanup_db_sub(DBKey key, DBData *data, va_list va)
{
- return iMap->cleanup_sub(iDB->data2ptr(data), va);
+ return iMap->cleanup_sub(DB->data2ptr(data), va);
}
/*==========================================
diff --git a/src/map/npc.c b/src/map/npc.c
index e842a6c05..5e03191e7 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -350,7 +350,7 @@ int npc_event_doall_sub(DBKey key, DBData *data, va_list ap)
const char* name;
int rid;
- nullpo_ret(ev = iDB->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);
@@ -378,7 +378,7 @@ static int npc_event_do_sub(DBKey key, DBData *data, va_list ap)
int* c;
const char* name;
- nullpo_ret(ev = iDB->data2ptr(data));
+ nullpo_ret(ev = DB->data2ptr(data));
nullpo_ret(c = va_arg(ap, int *));
nullpo_ret(name = va_arg(ap, const char *));
@@ -1773,7 +1773,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 = iDB->data2ptr(data);
+ struct event_data* ev = DB->data2ptr(data);
char* npcname = va_arg(ap, char *);
if(strcmp(ev->nd->exname,npcname)==0){
@@ -2289,7 +2289,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 = iDB->data2i(data);
+ int lpos = DB->data2i(data);
struct npc_label_list** label_list;
int* label_list_num;
const char* filepath;
@@ -2933,9 +2933,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, iDB->str2key(w3), iDB->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*)iDB->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);
@@ -3729,7 +3729,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 = iDB->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/party.c b/src/map/party.c
index 5f8164557..91d6188a9 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -102,7 +102,7 @@ static TBL_PC* party_sd_check(int party_id, int account_id, int char_id)
int party_db_final(DBKey key, DBData *data, va_list ap) {
struct party_data *p;
- if( ( p = iDB->data2ptr(data) ) && p->instance )
+ if( ( p = DB->data2ptr(data) ) && p->instance )
aFree(p->instance);
return 0;
diff --git a/src/map/script.c b/src/map/script.c
index 752f4445d..612bf52f5 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3659,7 +3659,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 = iDB->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 2ada270e8..8f13591b6 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -15373,7 +15373,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 = iDB->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 17b7c82ae..ea30f6c0f 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 = iDB->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 iDB->ptr2data(gs);
+ return DB->ptr2data(gs);
}
struct guild_storage *guild2storage(int guild_id)