diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/int_auction.c | 4 | ||||
-rw-r--r-- | src/char/int_guild.c | 2 | ||||
-rw-r--r-- | src/common/db.c | 56 | ||||
-rw-r--r-- | src/common/db.h | 36 | ||||
-rw-r--r-- | src/common/socket.c | 2 | ||||
-rw-r--r-- | src/map/atcommand.c | 18 | ||||
-rw-r--r-- | src/map/channel.c | 5 | ||||
-rw-r--r-- | src/map/clif.c | 4 | ||||
-rw-r--r-- | src/map/guild.c | 15 | ||||
-rw-r--r-- | src/map/intif.c | 5 | ||||
-rw-r--r-- | src/map/itemdb.c | 5 | ||||
-rw-r--r-- | src/map/map.c | 65 | ||||
-rw-r--r-- | src/map/mapreg_sql.c | 7 | ||||
-rw-r--r-- | src/map/npc.c | 12 | ||||
-rw-r--r-- | src/map/party.c | 14 | ||||
-rw-r--r-- | src/map/pc_groups.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 25 |
17 files changed, 144 insertions, 133 deletions
diff --git a/src/char/int_auction.c b/src/char/int_auction.c index 2c9942dac..51acb32a6 100644 --- a/src/char/int_auction.c +++ b/src/char/int_auction.c @@ -47,7 +47,7 @@ static int inter_auction_count(int char_id, bool buy) { int i = 0; struct auction_data *auction; - DBIterator *iter = db_iterator(inter_auction->db); + struct DBIterator *iter = db_iterator(inter_auction->db); for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) ) { @@ -280,7 +280,7 @@ void mapif_parse_auction_requestlist(int fd) int price = RFIFOL(fd,10); short type = RFIFOW(fd,8), page = max(1,RFIFOW(fd,14)); unsigned char buf[5 * sizeof(struct auction_data)]; - DBIterator *iter = db_iterator(inter_auction->db); + struct DBIterator *iter = db_iterator(inter_auction->db); struct auction_data *auction; short i = 0, j = 0, pages = 1; diff --git a/src/char/int_guild.c b/src/char/int_guild.c index c269a8f6f..21f38d049 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -59,7 +59,7 @@ static const char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9 int inter_guild_save_timer(int tid, int64 tick, int id, intptr_t data) { static int last_id = 0; //To know in which guild we were. int state = 0; //0: Have not reached last guild. 1: Reached last guild, ready for save. 2: Some guild saved, don't do further saving. - DBIterator *iter = db_iterator(inter_guild->guild_db); + struct DBIterator *iter = db_iterator(inter_guild->guild_db); union DBKey key; struct guild* g; diff --git a/src/common/db.c b/src/common/db.c index 639d42156..fa1a6d65c 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -234,17 +234,17 @@ typedef struct DBMap_impl { * @param ht_index Current index of the hashtable * @param node Current node * @private - * @see #DBIterator + * @see struct DBIterator * @see #DBMap_impl * @see #DBNode */ -typedef struct DBIterator_impl { +struct DBIterator_impl { // Iterator interface struct DBIterator vtable; DBMap_impl* db; int ht_index; DBNode *node; -} DBIterator_impl; +}; #if defined(DB_ENABLE_STATS) /** @@ -1245,11 +1245,11 @@ static void db_release_both(union DBKey key, struct DBData data, enum DBReleaseO * @param out_key Key of the entry * @return Data of the entry * @protected - * @see DBIterator#first + * @see struct DBIterator#first() */ -struct DBData *dbit_obj_first(DBIterator* self, union DBKey *out_key) +struct DBData *dbit_obj_first(struct DBIterator *self, union DBKey *out_key) { - DBIterator_impl* it = (DBIterator_impl*)self; + struct DBIterator_impl *it = (struct DBIterator_impl *)self; DB_COUNTSTAT(dbit_first); // position before the first entry @@ -1267,11 +1267,11 @@ struct DBData *dbit_obj_first(DBIterator* self, union DBKey *out_key) * @param out_key Key of the entry * @return Data of the entry * @protected - * @see DBIterator#last + * @see struct DBIterator#last() */ -struct DBData *dbit_obj_last(DBIterator* self, union DBKey *out_key) +struct DBData *dbit_obj_last(struct DBIterator *self, union DBKey *out_key) { - DBIterator_impl* it = (DBIterator_impl*)self; + struct DBIterator_impl *it = (struct DBIterator_impl *)self; DB_COUNTSTAT(dbit_last); // position after the last entry @@ -1289,11 +1289,11 @@ struct DBData *dbit_obj_last(DBIterator* self, union DBKey *out_key) * @param out_key Key of the entry * @return Data of the entry * @protected - * @see DBIterator#next + * @see struct DBIterator#next() */ -struct DBData *dbit_obj_next(DBIterator* self, union DBKey *out_key) +struct DBData *dbit_obj_next(struct DBIterator *self, union DBKey *out_key) { - DBIterator_impl* it = (DBIterator_impl*)self; + struct DBIterator_impl *it = (struct DBIterator_impl *)self; DBNode *node; DBNode *parent; struct dbn fake; @@ -1365,11 +1365,11 @@ struct DBData *dbit_obj_next(DBIterator* self, union DBKey *out_key) * @param out_key Key of the entry * @return Data of the entry * @protected - * @see DBIterator#prev + * @see struct DBIterator#prev() */ -struct DBData *dbit_obj_prev(DBIterator* self, union DBKey *out_key) +struct DBData *dbit_obj_prev(struct DBIterator *self, union DBKey *out_key) { - DBIterator_impl* it = (DBIterator_impl*)self; + struct DBIterator_impl *it = (struct DBIterator_impl *)self; DBNode *node; DBNode *parent; struct dbn fake; @@ -1440,11 +1440,11 @@ struct DBData *dbit_obj_prev(DBIterator* self, union DBKey *out_key) * @param self Iterator * @return true if the entry exists * @protected - * @see DBIterator#exists + * @see struct DBIterator#exists() */ -bool dbit_obj_exists(DBIterator* self) +bool dbit_obj_exists(struct DBIterator *self) { - DBIterator_impl* it = (DBIterator_impl*)self; + struct DBIterator_impl *it = (struct DBIterator_impl *)self; DB_COUNTSTAT(dbit_exists); return (it->node && !it->node->deleted); @@ -1452,19 +1452,21 @@ bool dbit_obj_exists(DBIterator* self) /** * Removes the current entry from the database. - * NOTE: {@link DBIterator#exists} will return false until another entry - * is fetched + * + * NOTE: struct DBIterator#exists() will return false until another entry is + * fetched. + * * Puts data of the removed entry in out_data, if out_data is not NULL (unless data has been released) * @param self Iterator * @param out_data Data of the removed entry. * @return 1 if entry was removed, 0 otherwise * @protected * @see DBMap#remove - * @see DBIterator#remove + * @see struct DBIterator#remove() */ -int dbit_obj_remove(DBIterator* self, struct DBData *out_data) +int dbit_obj_remove(struct DBIterator *self, struct DBData *out_data) { - DBIterator_impl* it = (DBIterator_impl*)self; + struct DBIterator_impl *it = (struct DBIterator_impl *)self; DBNode *node; int retval = 0; @@ -1489,9 +1491,9 @@ int dbit_obj_remove(DBIterator* self, struct DBData *out_data) * @param self Iterator * @protected */ -void dbit_obj_destroy(DBIterator* self) +void dbit_obj_destroy(struct DBIterator *self) { - DBIterator_impl* it = (DBIterator_impl*)self; + struct DBIterator_impl *it = (struct DBIterator_impl *)self; DB_COUNTSTAT(dbit_destroy); // unlock the database @@ -1509,10 +1511,10 @@ void dbit_obj_destroy(DBIterator* self) * @return New iterator * @protected */ -static DBIterator* db_obj_iterator(DBMap* self) +static struct DBIterator *db_obj_iterator(DBMap* self) { DBMap_impl* db = (DBMap_impl*)self; - DBIterator_impl* it; + struct DBIterator_impl *it; DB_COUNTSTAT(db_iterator); it = ers_alloc(db_iterator_ers, struct DBIterator_impl); diff --git a/src/common/db.h b/src/common/db.h index 1c2da3917..a867b011f 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -76,9 +76,9 @@ * DBComparator - Format of the comparators used by the databases. * * DBHasher - Format of the hashers used by the databases. * * DBReleaser - Format of the releasers used by the databases. * - * DBIterator - Database iterator. * + * struct DBIterator - Database iterator. * * DBMap - Database interface. * -\*****************************************************************************/ + *****************************************************************************/ /** * Bitfield with what should be released by the releaser function (if the @@ -288,21 +288,21 @@ typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); */ typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); -typedef struct DBIterator DBIterator; typedef struct DBMap DBMap; /** * Database iterator. + * * Supports forward iteration, backward iteration and removing entries from the database. * The iterator is initially positioned before the first entry of the database. + * * While the iterator exists the database is locked internally, so invoke - * {@link DBIterator#destroy} as soon as possible. + * struct DBIterator#destroy() as soon as possible. + * * @public * @see #DBMap */ -struct DBIterator -{ - +struct DBIterator { /** * Fetches the first entry in the database. * Returns the data of the entry. @@ -312,7 +312,7 @@ struct DBIterator * @return Data of the entry * @protected */ - struct DBData *(*first)(DBIterator* self, union DBKey *out_key); + struct DBData *(*first)(struct DBIterator *self, union DBKey *out_key); /** * Fetches the last entry in the database. @@ -323,7 +323,7 @@ struct DBIterator * @return Data of the entry * @protected */ - struct DBData *(*last)(DBIterator* self, union DBKey *out_key); + struct DBData *(*last)(struct DBIterator *self, union DBKey *out_key); /** * Fetches the next entry in the database. @@ -334,7 +334,7 @@ struct DBIterator * @return Data of the entry * @protected */ - struct DBData *(*next)(DBIterator* self, union DBKey *out_key); + struct DBData *(*next)(struct DBIterator *self, union DBKey *out_key); /** * Fetches the previous entry in the database. @@ -345,7 +345,7 @@ struct DBIterator * @return Data of the entry * @protected */ - struct DBData *(*prev)(DBIterator* self, union DBKey *out_key); + struct DBData *(*prev)(struct DBIterator *self, union DBKey *out_key); /** * Returns true if the fetched entry exists. @@ -355,12 +355,14 @@ struct DBIterator * @return true is the entry exists * @protected */ - bool (*exists)(DBIterator* self); + bool (*exists)(struct DBIterator *self); /** * Removes the current entry from the database. - * NOTE: {@link DBIterator#exists} will return false until another entry - * is fetched + * + * NOTE: struct DBIterator#exists() will return false until another + * entry is fetched. + * * Puts data of the removed entry in out_data, if out_data is not NULL. * @param self Iterator * @param out_data Data of the removed entry. @@ -368,14 +370,14 @@ struct DBIterator * @protected * @see DBMap#remove */ - int (*remove)(DBIterator* self, struct DBData *out_data); + int (*remove)(struct DBIterator *self, struct DBData *out_data); /** * Destroys this iterator and unlocks the database. * @param self Iterator * @protected */ - void (*destroy)(DBIterator* self); + void (*destroy)(struct DBIterator *self); }; @@ -396,7 +398,7 @@ struct DBMap { * @return New iterator * @protected */ - DBIterator* (*iterator)(DBMap* self); + struct DBIterator *(*iterator)(DBMap* self); /** * Returns true if the entry exists. diff --git a/src/common/socket.c b/src/common/socket.c index 10712c78b..05ac4ca01 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1089,7 +1089,7 @@ static int connect_check_clear(int tid, int64 tick, int id, intptr_t data) { int clear = 0; int list = 0; ConnectHistory *hist = NULL; - DBIterator *iter; + struct DBIterator *iter; if( !db_size(connect_history) ) return 0; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index fbd8d6517..3da5c203f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1511,7 +1511,7 @@ ACMD(help) { clif->message(fd, atcmd_output); { // Display aliases - DBIterator* iter; + struct DBIterator *iter; AtCommandInfo *command_info; AliasInfo *alias_info = NULL; StringBuf buf; @@ -5278,10 +5278,11 @@ ACMD(clearcart) *------------------------------------------*/ #define MAX_SKILLID_PARTIAL_RESULTS 5 #define MAX_SKILLID_PARTIAL_RESULTS_LEN 74 /* "skill " (6) + "%d:" (up to 5) + "%s" (up to 30) + " (%s)" (up to 33) */ -ACMD(skillid) { +ACMD(skillid) +{ int i, found = 0; size_t skillen; - DBIterator* iter; + struct DBIterator *iter; union DBKey key; struct DBData *data; char partials[MAX_SKILLID_PARTIAL_RESULTS][MAX_SKILLID_PARTIAL_RESULTS_LEN]; @@ -8352,7 +8353,7 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand char line_buff[CHATBOX_SIZE]; char* cur = line_buff; AtCommandInfo* cmd; - DBIterator *iter = db_iterator(atcommand->db); + struct DBIterator *iter = db_iterator(atcommand->db); int count = 0; memset(line_buff,' ',CHATBOX_SIZE); @@ -8826,7 +8827,7 @@ ACMD(channel) { clif->messagecolor_self(fd, channel->config->colors[k], atcmd_output); } } else { - DBIterator *iter = db_iterator(channel->db); + struct DBIterator *iter = db_iterator(channel->db); bool show_all = pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ? true : false; clif->message(fd, msg_fd(fd,1410)); // -- Public Channels if (channel->config->local) { @@ -9056,7 +9057,7 @@ ACMD(channel) { clif->message(fd, atcmd_output); } else if (strcmpi(subcmd,"banlist") == 0) { // sub1 = channel name; sub2 = unused; sub3 = unused - DBIterator *iter = NULL; + struct DBIterator *iter = NULL; union DBKey key; struct DBData *data; bool isA = pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)?true:false; @@ -9733,8 +9734,7 @@ const char* atcommand_checkalias(const char *aliasname) { /// AtCommand suggestion void atcommand_get_suggestions(struct map_session_data* sd, const char *name, bool is_atcmd_cmd) { - DBIterator* atcommand_iter; - DBIterator* alias_iter; + struct DBIterator *atcommand_iter, *alias_iter; AtCommandInfo* command_info = NULL; AliasInfo* alias_info = NULL; AtCommandType type = is_atcmd_cmd ? COMMAND_ATCOMMAND : COMMAND_CHARCOMMAND; @@ -10120,7 +10120,7 @@ static inline int atcommand_command_type2idx(AtCommandType type) */ void atcommand_db_load_groups(GroupSettings **groups, struct config_setting_t **commands_, size_t sz) { - DBIterator *iter = db_iterator(atcommand->db); + struct DBIterator *iter = db_iterator(atcommand->db); AtCommandInfo *atcmd; nullpo_retv(groups); diff --git a/src/map/channel.c b/src/map/channel.c index 28ef854da..3d1b3f975 100644 --- a/src/map/channel.c +++ b/src/map/channel.c @@ -127,9 +127,8 @@ void channel_delete(struct channel_data *chan) nullpo_retv(chan); if (db_size(chan->users) && !channel->config->closing) { - DBIterator *iter; struct map_session_data *sd; - iter = db_iterator(chan->users); + struct DBIterator *iter = db_iterator(chan->users); for (sd = dbi_first(iter); dbi_exists(iter); sd = dbi_next(iter)) { channel->leave_sub(chan, sd); } @@ -814,7 +813,7 @@ int do_init_channel(bool minimal) void do_final_channel(void) { - DBIterator *iter = db_iterator(channel->db); + struct DBIterator *iter = db_iterator(channel->db); struct channel_data *chan; unsigned char i; diff --git a/src/map/clif.c b/src/map/clif.c index 69d9b6779..e1b4be8f4 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8971,7 +8971,7 @@ bool clif_process_message(struct map_session_data *sd, int format, const char ** void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, char *msg) { - DBIterator *iter; + struct DBIterator *iter; struct map_session_data *user; unsigned short msg_len; uint32 color; @@ -9005,7 +9005,7 @@ void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, ch void clif_channel_msg2(struct channel_data *chan, char *msg) { - DBIterator *iter; + struct DBIterator *iter; struct map_session_data *user; unsigned char buf[210]; unsigned short msg_len; diff --git a/src/map/guild.c b/src/map/guild.c index 0ceaff518..39d580bb7 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -178,7 +178,7 @@ struct guild* guild_search(int guild_id) struct guild* guild_searchname(char* str) { struct guild* g; - DBIterator *iter = db_iterator(guild->db); + struct DBIterator *iter = db_iterator(guild->db); nullpo_retr(NULL, str); for( g = dbi_first(iter); dbi_exists(iter); g = dbi_next(iter) ) @@ -201,7 +201,7 @@ struct guild_castle* guild_castle_search(int gcid) struct guild_castle* guild_mapindex2gc(short map_index) { struct guild_castle* gc; - DBIterator *iter = db_iterator(guild->castle_db); + struct DBIterator *iter = db_iterator(guild->castle_db); for( gc = dbi_first(iter); dbi_exists(iter); gc = dbi_next(iter) ) { @@ -1225,7 +1225,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) } } {// update guardians (mobs) - DBIterator* iter = db_iterator(guild->castle_db); + struct DBIterator *iter = db_iterator(guild->castle_db); struct guild_castle* gc; for( gc = (struct guild_castle*)dbi_first(iter) ; dbi_exists(iter); gc = (struct guild_castle*)dbi_next(iter) ) { @@ -1956,7 +1956,7 @@ void guild_castle_map_init(void) if (num > 0) { struct guild_castle* gc = NULL; int *castle_ids, *cursor; - DBIterator* iter = NULL; + struct DBIterator *iter = NULL; CREATE(castle_ids, int, num); cursor = castle_ids; @@ -2154,7 +2154,7 @@ int guild_checkcastles(struct guild *g) { int nb_cas = 0; struct guild_castle* gc = NULL; - DBIterator *iter = db_iterator(guild->castle_db); + struct DBIterator *iter = db_iterator(guild->castle_db); for (gc = dbi_first(iter); dbi_exists(iter); gc = dbi_next(iter)) { if (gc->guild_id == g->guild_id) { @@ -2287,8 +2287,9 @@ void do_init_guild(bool minimal) { timer->add_interval(timer->gettick()+GUILD_SEND_XY_INVERVAL,guild->send_xy_timer,0,0,GUILD_SEND_XY_INVERVAL); } -void do_final_guild(void) { - DBIterator *iter = db_iterator(guild->db); +void do_final_guild(void) +{ + struct DBIterator *iter = db_iterator(guild->db); struct guild *g; for( g = dbi_first(iter); dbi_exists(iter); g = dbi_next(iter) ) { diff --git a/src/map/intif.c b/src/map/intif.c index 8106c6558..ec0251dad 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -300,8 +300,9 @@ int intif_wis_message_to_gm(char *wisp_name, int permission, char *mes) } //Request for saving registry values. -int intif_saveregistry(struct map_session_data *sd) { - DBIterator *iter; +int intif_saveregistry(struct map_session_data *sd) +{ + struct DBIterator *iter; union DBKey key; struct DBData *data; int plen = 0; diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 38913249b..c59f627cc 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -2307,8 +2307,9 @@ void itemdb_reload(void) { } mapit->free(iter); } -void itemdb_name_constants(void) { - DBIterator *iter = db_iterator(itemdb->names); +void itemdb_name_constants(void) +{ + struct DBIterator *iter = db_iterator(itemdb->names); struct item_data *data; #ifdef ENABLE_CASE_CHECK diff --git a/src/map/map.c b/src/map/map.c index 1ae094c75..aa4c2d84c 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2167,9 +2167,9 @@ struct map_session_data * map_nick2sd(const char *nick) /*========================================== * Convext Mirror *------------------------------------------*/ -struct mob_data * map_getmob_boss(int16 m) +struct mob_data *map_getmob_boss(int16 m) { - DBIterator* iter; + struct DBIterator *iter; struct mob_data *md = NULL; bool found = false; @@ -2231,11 +2231,11 @@ uint32 map_race_id2mask(int race) /// Applies func to all the players in the db. /// Stops iterating if func returns -1. -void map_vforeachpc(int (*func)(struct map_session_data* sd, va_list args), va_list args) { - DBIterator* iter; - struct map_session_data* sd; +void map_vforeachpc(int (*func)(struct map_session_data* sd, va_list args), va_list args) +{ + struct DBIterator *iter = db_iterator(map->pc_db); + struct map_session_data *sd = NULL; - iter = db_iterator(map->pc_db); for( sd = dbi_first(iter); dbi_exists(iter); sd = dbi_next(iter) ) { va_list argscopy; @@ -2263,11 +2263,11 @@ void map_foreachpc(int (*func)(struct map_session_data* sd, va_list args), ...) /// Applies func to all the mobs in the db. /// Stops iterating if func returns -1. -void map_vforeachmob(int (*func)(struct mob_data* md, va_list args), va_list args) { - DBIterator* iter; - struct mob_data* md; +void map_vforeachmob(int (*func)(struct mob_data* md, va_list args), va_list args) +{ + struct DBIterator *iter = db_iterator(map->mobid_db); + struct mob_data *md = NULL; - iter = db_iterator(map->mobid_db); for (md = dbi_first(iter); dbi_exists(iter); md = dbi_next(iter)) { va_list argscopy; int ret; @@ -2294,11 +2294,11 @@ void map_foreachmob(int (*func)(struct mob_data* md, va_list args), ...) { /// Applies func to all the npcs in the db. /// Stops iterating if func returns -1. -void map_vforeachnpc(int (*func)(struct npc_data* nd, va_list args), va_list args) { - DBIterator* iter; - struct block_list* bl; +void map_vforeachnpc(int (*func)(struct npc_data* nd, va_list args), va_list args) +{ + struct DBIterator *iter = db_iterator(map->id_db); + struct block_list *bl = NULL; - iter = db_iterator(map->id_db); for (bl = dbi_first(iter); dbi_exists(iter); bl = dbi_next(iter)) { if (bl->type == BL_NPC) { struct npc_data *nd = BL_UCAST(BL_NPC, bl); @@ -2328,11 +2328,11 @@ void map_foreachnpc(int (*func)(struct npc_data* nd, va_list args), ...) { /// Applies func to everything in the db. /// Stops iterating gif func returns -1. -void map_vforeachregen(int (*func)(struct block_list* bl, va_list args), va_list args) { - DBIterator* iter; - struct block_list* bl; +void map_vforeachregen(int (*func)(struct block_list* bl, va_list args), va_list args) +{ + struct DBIterator *iter = db_iterator(map->regen_db); + struct block_list *bl = NULL; - iter = db_iterator(map->regen_db); for (bl = dbi_first(iter); dbi_exists(iter); bl = dbi_next(iter)) { va_list argscopy; int ret; @@ -2359,11 +2359,11 @@ void map_foreachregen(int (*func)(struct block_list* bl, va_list args), ...) { /// Applies func to everything in the db. /// Stops iterating if func returns -1. -void map_vforeachiddb(int (*func)(struct block_list* bl, va_list args), va_list args) { - DBIterator* iter; - struct block_list* bl; +void map_vforeachiddb(int (*func)(struct block_list* bl, va_list args), va_list args) +{ + struct DBIterator *iter = db_iterator(map->id_db); + struct block_list *bl = NULL; - iter = db_iterator(map->id_db); for (bl = dbi_first(iter); dbi_exists(iter); bl = dbi_next(iter)) { va_list argscopy; int ret; @@ -2390,11 +2390,10 @@ void map_foreachiddb(int (*func)(struct block_list* bl, va_list args), ...) { /// Iterator. /// Can filter by bl type. -struct s_mapiterator -{ - enum e_mapitflags flags;// flags for special behaviour - enum bl_type types;// what bl types to return - DBIterator* dbi;// database iterator +struct s_mapiterator { + enum e_mapitflags flags; ///< flags for special behaviour + enum bl_type types; ///< what bl types to return + struct DBIterator *dbi; ///< database iterator }; /// Returns true if the block_list matches the description in the iterator. @@ -3023,9 +3022,10 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable return true; } -void map_iwall_get(struct map_session_data *sd) { +void map_iwall_get(struct map_session_data *sd) +{ struct iwall_data *iwall; - DBIterator* iter; + struct DBIterator *iter; int16 x1, y1; int i; @@ -3301,9 +3301,10 @@ void map_zone_clear_single(struct map_zone_data *zone) { /** * **/ -void map_zone_db_clear(void) { - struct map_zone_data *zone; - DBIterator *iter = db_iterator(map->zone_db); +void map_zone_db_clear(void) +{ + struct DBIterator *iter = db_iterator(map->zone_db); + struct map_zone_data *zone = NULL; for(zone = dbi_first(iter); dbi_exists(iter); zone = dbi_next(iter)) { map->zone_clear_single(zone); diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c index d9d8755c2..8a8f9f309 100644 --- a/src/map/mapreg_sql.c +++ b/src/map/mapreg_sql.c @@ -236,10 +236,11 @@ void script_load_mapreg(void) { /** * Saves permanent variables to database. */ -void script_save_mapreg(void) { +void script_save_mapreg(void) +{ if (mapreg->dirty) { - DBIterator *iter = db_iterator(mapreg->regs.vars); - struct mapreg_save *m; + struct DBIterator *iter = db_iterator(mapreg->regs.vars); + struct mapreg_save *m = NULL; for (m = dbi_first(iter); dbi_exists(iter); m = dbi_next(iter)) { if (m->save) { int num = script_getvarid(m->uid); diff --git a/src/map/npc.c b/src/map/npc.c index 68bb81031..291f3c172 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1632,7 +1632,7 @@ bool npc_trader_open(struct map_session_data *sd, struct npc_data *nd) { * @param master id of the original npc **/ void npc_trader_update(int master) { - DBIterator* iter; + struct DBIterator *iter; struct block_list* bl; struct npc_data *master_nd = map->id2nd(master); @@ -4569,9 +4569,8 @@ void npc_read_event_script(void) {"Kill NPC Event",script->config.kill_mob_event_name}, }; - for (i = 0; i < NPCE_MAX; i++) - { - DBIterator* iter; + for (i = 0; i < NPCE_MAX; i++) { + struct DBIterator *iter; union DBKey key; struct DBData *data; @@ -4756,8 +4755,9 @@ int npc_reload(void) { } //Unload all npc in the given file -bool npc_unloadfile( const char* filepath ) { - DBIterator * iter = db_iterator(npc->name_db); +bool npc_unloadfile(const char *filepath) +{ + struct DBIterator *iter = db_iterator(npc->name_db); struct npc_data* nd = NULL; bool found = false; diff --git a/src/map/party.c b/src/map/party.c index 049c42b1f..551c4d56f 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -147,9 +147,8 @@ struct party_data* party_searchname(const char* str) { struct party_data* p; - DBIterator *iter = db_iterator(party->db); - for( p = dbi_first(iter); dbi_exists(iter); p = dbi_next(iter) ) - { + struct DBIterator *iter = db_iterator(party->db); + for (p = dbi_first(iter); dbi_exists(iter); p = dbi_next(iter)) { if( strncmpi(p->party.name,str,NAME_LENGTH) == 0 ) break; } @@ -872,10 +871,11 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id return 0; } -int party_send_xy_timer(int tid, int64 tick, int id, intptr_t data) { +int party_send_xy_timer(int tid, int64 tick, int id, intptr_t data) +{ + struct DBIterator *iter = db_iterator(party->db); struct party_data* p; - DBIterator *iter = db_iterator(party->db); // for each existing party, for( p = dbi_first(iter); dbi_exists(iter); p = dbi_next(iter) ) { @@ -1285,7 +1285,7 @@ void party_recruit_search(struct map_session_data *sd, short level, short mapid, int count = 0; struct party_booking_ad_info* result_list[PARTY_BOOKING_RESULTS]; bool more_result = false; - DBIterator* iter = db_iterator(party->booking_db); + struct DBIterator *iter = db_iterator(party->booking_db); memset(result_list, 0, sizeof(result_list)); @@ -1316,7 +1316,7 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid, int count = 0; struct party_booking_ad_info* result_list[PARTY_BOOKING_RESULTS]; bool more_result = false; - DBIterator* iter = db_iterator(party->booking_db); + struct DBIterator *iter = db_iterator(party->booking_db); memset(result_list, 0, sizeof(result_list)); diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index 5b12a45dd..ccda34b1c 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -75,7 +75,7 @@ static void read_config(void) { if (groups != NULL) { GroupSettings *group_settings = NULL; - DBIterator *iter = NULL; + struct DBIterator *iter = NULL; int i, loop = 0; group_count = libconfig->setting_length(groups); diff --git a/src/map/script.c b/src/map/script.c index bb6651ca5..5d7698f75 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -4261,8 +4261,9 @@ void run_script(struct script_code *rootscript, int pos, int rid, int oid) { script->run_main(st); } -void script_stop_instances(struct script_code *code) { - DBIterator *iter; +void script_stop_instances(struct script_code *code) +{ + struct DBIterator *iter; struct script_state* st; if( !script->active_scripts ) @@ -4723,9 +4724,10 @@ void script_generic_ui_array_expand (unsigned int plus) { /*========================================== * Destructor *------------------------------------------*/ -void do_final_script(void) { +void do_final_script(void) +{ int i; - DBIterator *iter; + struct DBIterator *iter; struct script_state *st; #ifdef SCRIPT_DEBUG_HASH @@ -4916,8 +4918,7 @@ void script_load_translations(void) { libconfig->destroy(&translations_conf); if( total ) { - DBIterator *main_iter; - DBIterator *sub_iter; + struct DBIterator *main_iter, *sub_iter; DBMap *string_db; struct string_translation *st = NULL; uint32 j = 0; @@ -5138,7 +5139,7 @@ int script_translation_db_destroyer(union DBKey key, struct DBData *data, va_lis if( db_size(string_db) ) { struct string_translation *st = NULL; - DBIterator *iter = db_iterator(string_db); + struct DBIterator *iter = db_iterator(string_db); for( st = dbi_first(iter); dbi_exists(iter); st = dbi_next(iter) ) { aFree(st); @@ -5218,9 +5219,10 @@ void do_init_script(bool minimal) { script->load_translations(); } -int script_reload(void) { +int script_reload(void) +{ int i; - DBIterator *iter; + struct DBIterator *iter; struct script_state *st; #ifdef ENABLE_CASE_CHECK @@ -16995,8 +16997,9 @@ BUILDIN(sleep2) { /// Awakes all the sleep timers of the target npc /// /// awake "<npc name>"; -BUILDIN(awake) { - DBIterator *iter; +BUILDIN(awake) +{ + struct DBIterator *iter; struct script_state *tst; struct npc_data* nd; |