diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-08 14:08:32 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-08 14:08:32 +0000 |
commit | b5be01c5baca2d51da4ec9a138e3bb57eea7cbb4 (patch) | |
tree | b7f079f5317d736e49fdf8b12f6d3f18b2a98daf /src/map | |
parent | ad2a3a12e2d603e8ef2011d1121271b7ed2f05eb (diff) | |
download | hercules-b5be01c5baca2d51da4ec9a138e3bb57eea7cbb4.tar.gz hercules-b5be01c5baca2d51da4ec9a138e3bb57eea7cbb4.tar.bz2 hercules-b5be01c5baca2d51da4ec9a138e3bb57eea7cbb4.tar.xz hercules-b5be01c5baca2d51da4ec9a138e3bb57eea7cbb4.zip |
* Changed EXIT_SUCCESS back to 0 in console.c to avoid an unnecessary include.
* Fixed gm_account_db not being deallocated in login-converter.c.
* Refactoring names and documentation in db.h/db.c:
- changed 'struct dbt' to 'struct DBMap' and 'DB' to 'DBMap*'
- changed 'struct db' to 'struct DBMap_impl' and 'DB_impl' to 'DBMap_impl*'
- changed COUNT to DB_COUNTSTAT and made it's existence not depend on DB_ENABLE_STATS
- removed some @see links and corrected small typos in the documentation
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11698 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 4 | ||||
-rw-r--r-- | src/map/chrif.c | 12 | ||||
-rw-r--r-- | src/map/guild.c | 20 | ||||
-rw-r--r-- | src/map/itemdb.c | 4 | ||||
-rw-r--r-- | src/map/map.c | 20 | ||||
-rw-r--r-- | src/map/npc.c | 12 | ||||
-rw-r--r-- | src/map/party.c | 4 | ||||
-rw-r--r-- | src/map/script.c | 20 | ||||
-rw-r--r-- | src/map/script.h | 4 | ||||
-rw-r--r-- | src/map/storage.c | 8 |
10 files changed, 54 insertions, 54 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 43294ca87..7a590c2d2 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -6430,7 +6430,7 @@ int atcommand_pettalk(const int fd, struct map_session_data* sd, const char* com * @users - displays the number of players present on each map (percentage) *------------------------------------------*/ -static struct dbt *users_db = NULL; +static DBMap* users_db = NULL; // unsigned int mapindex -> int users static int users_all; static int atcommand_users_sub1(struct map_session_data* sd,va_list va) @@ -8554,7 +8554,7 @@ int atcommand_config_read(const char* cfgName) void do_init_atcommand() { - users_db = db_alloc(__FILE__,__LINE__,DB_UINT,DB_OPT_BASE,sizeof(int)); + users_db = uidb_alloc(DB_OPT_BASE); duel_count = 0; memset(&duel_list[0], 0, sizeof(duel_list)); add_timer_func_list(atshowmobs_timer, "atshowmobs_timer"); diff --git a/src/map/chrif.c b/src/map/chrif.c index 0ea1e06a9..6369a6745 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -25,7 +25,7 @@ #include <sys/types.h> #include <time.h> -struct dbt *auth_db; +DBMap* auth_db; // int id -> struct auth_node* static const int packet_len_table[0x3d] = { // U - used, F - free 60, 3,-1,27,10,-1, 6,-1, // 2af8-2aff: U->2af8, U->2af9, U->2afa, U->2afb, U->2afc, U->2afd, U->2afe, U->2aff @@ -430,7 +430,7 @@ void chrif_authreq(struct map_session_data *sd) auth_data->account_id = sd->bl.id; auth_data->login_id1 = sd->login_id1; auth_data->node_created = gettick(); - uidb_put(auth_db, sd->bl.id, auth_data); + idb_put(auth_db, sd->bl.id, auth_data); } return; } @@ -451,7 +451,7 @@ void chrif_authok(int fd) return; } - if ((auth_data =uidb_get(auth_db, RFIFOL(fd, 4))) != NULL) + if ((auth_data =idb_get(auth_db, RFIFOL(fd, 4))) != NULL) { //Is the character already awaiting authorization? if (auth_data->sd) { @@ -472,7 +472,7 @@ void chrif_authok(int fd) //Delete the data of this node... if (auth_data->char_dat) aFree (auth_data->char_dat); - uidb_remove(auth_db, RFIFOL(fd, 4)); + idb_remove(auth_db, RFIFOL(fd, 4)); return; } // Awaiting for client to connect. @@ -485,7 +485,7 @@ void chrif_authok(int fd) auth_data->login_id2=RFIFOL(fd, 16); memcpy(auth_data->char_dat,RFIFOP(fd, 20),sizeof(struct mmo_charstatus)); auth_data->node_created=gettick(); - uidb_put(auth_db, RFIFOL(fd, 4), auth_data); + idb_put(auth_db, RFIFOL(fd, 4), auth_data); } int auth_db_cleanup_sub(DBKey key,void *data,va_list ap) @@ -1445,7 +1445,7 @@ int do_init_chrif(void) #endif add_timer_interval(gettick() + 1000, auth_db_cleanup, 0, 0, 30 * 1000); - auth_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int)); + auth_db = idb_alloc(DB_OPT_RELEASE_DATA); return 0; } diff --git a/src/map/guild.c b/src/map/guild.c index c2738dc91..40449baf0 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -29,11 +29,11 @@ #include <string.h> -static DB guild_db; -static DB castle_db; -static DB guild_expcache_db; -static DB guild_infoevent_db; -static DB guild_castleinfoevent_db; +static DBMap* guild_db; // int guild_id -> struct guild* +static DBMap* castle_db; // int castle_id -> struct guild_castle* +static DBMap* guild_expcache_db; // int char_id -> struct guild_expcache* +static DBMap* guild_infoevent_db; // int guild_id -> struct eventlist* +static DBMap* guild_castleinfoevent_db; // int castle_id_index -> struct eventlist* struct eventlist { char name[50]; @@ -204,12 +204,12 @@ static int guild_read_castledb(void) // 初期化 void do_init_guild(void) { - guild_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int)); - castle_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int)); - guild_expcache_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int)); - guild_infoevent_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int)); + guild_db=idb_alloc(DB_OPT_RELEASE_DATA); + castle_db=idb_alloc(DB_OPT_RELEASE_DATA); + guild_expcache_db=idb_alloc(DB_OPT_BASE); + guild_infoevent_db=idb_alloc(DB_OPT_BASE); expcache_ers = ers_new(sizeof(struct guild_expcache)); - guild_castleinfoevent_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int)); + guild_castleinfoevent_db=idb_alloc(DB_OPT_BASE); guild_read_castledb(); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 46caca0da..513b19a2e 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -21,7 +21,7 @@ static struct item_data* itemdb_array[MAX_ITEMDB]; -static struct dbt* itemdb_other; +static DBMap* itemdb_other;// int nameid -> struct item_data* static struct item_group itemgroup_db[MAX_ITEMGROUP]; @@ -1044,7 +1044,7 @@ void do_final_itemdb(void) int do_init_itemdb(void) { memset(itemdb_array, 0, sizeof(itemdb_array)); - itemdb_other = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int)); + itemdb_other = idb_alloc(DB_OPT_BASE); create_dummy_data(); //Dummy data item. itemdb_read(); diff --git a/src/map/map.c b/src/map/map.c index 590cafc5c..52153c55d 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -93,11 +93,11 @@ char *SCRIPT_CONF_NAME; char *MSG_CONF_NAME; // 極力 staticでロ?カルに?める -static struct dbt * id_db=NULL;// id -> struct block_list -static struct dbt * pc_db=NULL;// id -> struct map_session_data -static struct dbt * map_db=NULL; -static struct dbt * nick_db=NULL;// charid -> struct charid2nick (requested names of offline characters) -static struct dbt * charid_db=NULL;// charid -> struct map_session_data +static DBMap* id_db=NULL; // int id -> struct block_list* +static DBMap* pc_db=NULL; // int id -> struct map_session_data* +static DBMap* map_db=NULL; // unsigned int mapindex -> struct map_data* +static DBMap* nick_db=NULL; // int char_id -> struct charid2nick* (requested names of offline characters) +static DBMap* charid_db=NULL; // int char_id -> struct map_session_data* static int map_users=0; static struct block_list *objects[MAX_FLOORITEM]; @@ -3303,11 +3303,11 @@ int do_init(int argc, char *argv[]) inter_config_read(INTER_CONF_NAME); log_config_read(LOG_CONF_NAME); - id_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int)); - pc_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int)); //Added for reliable map_id2sd() use. [Skotlex] - map_db = db_alloc(__FILE__,__LINE__,DB_UINT,DB_OPT_BASE,sizeof(int)); - nick_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int)); - charid_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int)); + id_db = idb_alloc(DB_OPT_BASE); + pc_db = idb_alloc(DB_OPT_BASE); //Added for reliable map_id2sd() use. [Skotlex] + map_db = uidb_alloc(DB_OPT_BASE); + nick_db = idb_alloc(DB_OPT_BASE); + charid_db = idb_alloc(DB_OPT_BASE); #ifndef TXT_ONLY map_sql_init(); #endif /* not TXT_ONLY */ diff --git a/src/map/npc.c b/src/map/npc.c index 3649731ed..f6e7f0cf0 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -49,8 +49,8 @@ static int npc_delay_mob=0; static int npc_cache_mob=0; int npc_get_new_npc_id(void){ return npc_id++; } -static struct dbt *ev_db; -static struct dbt *npcname_db; +static DBMap* ev_db; // const char* event_name -> struct event_data* +static DBMap* npcname_db; // const char* npc_name -> struct npc_data* struct event_data { struct npc_data *nd; @@ -1794,7 +1794,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons src_id = 0; if( script ) { - DB label_db = script_get_label_db(); + DBMap* label_db = script_get_label_db(); label_db->foreach(label_db, npc_convertlabel_db, &label_list, &label_list_num, filepath); label_db->clear(label_db, NULL); // not needed anymore, so clear the db } @@ -2022,7 +2022,7 @@ int npc_changename(const char* name, const char* newname, short look) /// function%TAB%script%TAB%<function name>%TAB%{<code>} static const char* npc_parse_function(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath) { - struct dbt *func_db; + DBMap* func_db; struct script_code *script; struct script_code *oldscript; const char* end; @@ -2867,8 +2867,8 @@ int do_init_npc(void) for( i = 1; i < MAX_NPC_CLASS; i++ ) npc_viewdb[i].class_ = i; - ev_db = db_alloc(__FILE__,__LINE__,DB_STRING,DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA,2*NAME_LENGTH+2+1); - npcname_db = db_alloc(__FILE__,__LINE__,DB_STRING,DB_OPT_BASE,NAME_LENGTH); + ev_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA,2*NAME_LENGTH+2+1); + npcname_db = strdb_alloc(DB_OPT_BASE,NAME_LENGTH); memset(&ev_tm_b, -1, sizeof(ev_tm_b)); timer_event_ers = ers_new(sizeof(struct timer_event_data)); diff --git a/src/map/party.c b/src/map/party.c index a81c7dc42..7b1e3f1ab 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -26,7 +26,7 @@ #include <string.h> -static DB party_db; +static DBMap* party_db; // int party_id -> struct party_data* int party_share_level = 10; int party_send_xy_timer(int tid,unsigned int tick,int id,int data); @@ -56,7 +56,7 @@ void do_final_party(void) // 初期化 void do_init_party(void) { - party_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int)); + party_db=idb_alloc(DB_OPT_RELEASE_DATA); add_timer_func_list(party_send_xy_timer, "party_send_xy_timer"); add_timer_interval(gettick()+battle_config.party_update_interval, party_send_xy_timer, 0, 0, battle_config.party_update_interval); } diff --git a/src/map/script.c b/src/map/script.c index a1b0834e0..71aee9d6f 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -170,17 +170,17 @@ int str_hash[SCRIPT_HASH_SIZE]; //#define SCRIPT_HASH_ELF //#define SCRIPT_HASH_PJW -static struct dbt *mapreg_db=NULL; -static struct dbt *mapregstr_db=NULL; +static DBMap* mapreg_db=NULL; // int var_id -> int value +static DBMap* mapregstr_db=NULL; // int var_id -> char* value static int mapreg_dirty=-1; char mapreg_txt[256]="save/mapreg.txt"; #define MAPREG_AUTOSAVE_INTERVAL (300*1000) -static struct dbt *scriptlabel_db=NULL; -static struct dbt *userfunc_db=NULL; +static DBMap* scriptlabel_db=NULL; // const char* label_name -> int script_pos +static DBMap* userfunc_db=NULL; // const char* func_name -> struct script_code* static int parse_options=0; -struct dbt* script_get_label_db(){ return scriptlabel_db; } -struct dbt* script_get_userfunc_db(){ return userfunc_db; } +DBMap* script_get_label_db(){ return scriptlabel_db; } +DBMap* script_get_userfunc_db(){ return userfunc_db; } struct Script_Config script_config; @@ -3685,10 +3685,10 @@ int do_final_script() *------------------------------------------*/ int do_init_script() { - mapreg_db= db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_BASE,sizeof(int)); - mapregstr_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int)); - userfunc_db=db_alloc(__FILE__,__LINE__,DB_STRING,DB_OPT_DUP_KEY,0); - scriptlabel_db=db_alloc(__FILE__,__LINE__,DB_STRING,DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA,50); + mapreg_db= idb_alloc(DB_OPT_BASE); + mapregstr_db=idb_alloc(DB_OPT_RELEASE_DATA); + userfunc_db=strdb_alloc(DB_OPT_DUP_KEY,0); + scriptlabel_db=strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA,50); script_load_mapreg(); diff --git a/src/map/script.h b/src/map/script.h index 1e92f73d1..709577c6d 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -88,8 +88,8 @@ void script_free_stack(struct script_stack*); void script_free_code(struct script_code* code); void script_free_vars(struct linkdb_node **node); -struct dbt* script_get_label_db(void); -struct dbt* script_get_userfunc_db(void); +struct DBMap* script_get_label_db(void); +struct DBMap* script_get_userfunc_db(void); int script_config_read(char *cfgName); int do_init_script(void); diff --git a/src/map/storage.c b/src/map/storage.c index 5d9b67778..e4ff030b3 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -24,8 +24,8 @@ #include <string.h> -static struct dbt *storage_db; -static struct dbt *guild_storage_db; +static DBMap* storage_db; // int account_id -> struct storage* +static DBMap* guild_storage_db; // int guild_id -> struct guild_storage* /*========================================== * 倉庫内アイテムソート @@ -61,8 +61,8 @@ void storage_gsortitem (struct guild_storage* gstor) *------------------------------------------*/ int do_init_storage(void) // map.c::do_init()から呼ばれる { - storage_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int)); - guild_storage_db=db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int)); + storage_db=idb_alloc(DB_OPT_RELEASE_DATA); + guild_storage_db=idb_alloc(DB_OPT_RELEASE_DATA); return 1; } void do_final_storage(void) // by [MC Cameri] |