summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-20 14:43:20 +0100
committerHaru <haru@dotalux.com>2016-03-20 18:32:08 +0100
commit9975335df7aa30d687bf47aa1fe01f0c4993849d (patch)
treee8dde5f5aa2d5fdc12d1e91b6a42a2a3e8b7513c /src/map
parent13dcf1e6c32b672e72f70a6cdbb42b4c3a2df3d8 (diff)
downloadhercules-9975335df7aa30d687bf47aa1fe01f0c4993849d.tar.gz
hercules-9975335df7aa30d687bf47aa1fe01f0c4993849d.tar.bz2
hercules-9975335df7aa30d687bf47aa1fe01f0c4993849d.tar.xz
hercules-9975335df7aa30d687bf47aa1fe01f0c4993849d.zip
Dropped typedef from DBIterator
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c18
-rw-r--r--src/map/channel.c5
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/guild.c15
-rw-r--r--src/map/intif.c5
-rw-r--r--src/map/itemdb.c5
-rw-r--r--src/map/map.c65
-rw-r--r--src/map/mapreg_sql.c7
-rw-r--r--src/map/npc.c12
-rw-r--r--src/map/party.c14
-rw-r--r--src/map/pc_groups.c2
-rw-r--r--src/map/script.c25
12 files changed, 92 insertions, 85 deletions
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;