summaryrefslogtreecommitdiff
path: root/src/map/guild.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-11 17:46:31 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-11 17:46:31 +0000
commitc2e7d12b8baff6c190b1a61c175366a6af15326d (patch)
treebecd092d9c0d11065f722991c7caace7502c9535 /src/map/guild.c
parentc31be7e56e5c1d4345df7c5baf6fb4f4c412d7aa (diff)
downloadhercules-c2e7d12b8baff6c190b1a61c175366a6af15326d.tar.gz
hercules-c2e7d12b8baff6c190b1a61c175366a6af15326d.tar.bz2
hercules-c2e7d12b8baff6c190b1a61c175366a6af15326d.tar.xz
hercules-c2e7d12b8baff6c190b1a61c175366a6af15326d.zip
Getting rid of map_getallusers(), part 1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12195 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/guild.c')
-rw-r--r--src/map/guild.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index b5cb708ee..a9670400a 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -470,43 +470,48 @@ int guild_npc_request_info(int guild_id,const char *event)
// 所属キャラの確認
int guild_check_member(struct guild *g)
{
- int i, j, users;
- struct map_session_data *sd, **all_sd;
+ int i;
+ struct map_session_data *sd;
+ struct s_mapiterator* iter;
nullpo_retr(0, g);
- all_sd = map_getallusers(&users);
-
- for(i=0;i<users;i++){
- sd=all_sd[i];
- if(sd->status.guild_id==g->guild_id){
- j=guild_getindex(g,sd->status.account_id,sd->status.char_id);
- if (j < 0) {
- sd->status.guild_id=0;
- sd->state.guild_sent=0;
- sd->guild_emblem_id=0;
- ShowWarning("guild: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name);
- }
+ iter = mapit_getallusers();
+ for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
+ {
+ if( sd->status.guild_id != g->guild_id )
+ continue;
+
+ i = guild_getindex(g,sd->status.account_id,sd->status.char_id);
+ if (i < 0) {
+ sd->status.guild_id=0;
+ sd->state.guild_sent=0;
+ sd->guild_emblem_id=0;
+ ShowWarning("guild: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name);
}
}
+ mapit_free(iter);
+
return 0;
}
+
// 情報所得失敗(そのIDのキャラを全部未所属にする)
int guild_recv_noinfo(int guild_id)
{
- int i, users;
- struct map_session_data *sd, **all_sd;
+ struct map_session_data *sd;
+ struct s_mapiterator* iter;
- all_sd = map_getallusers(&users);
-
- for(i=0;i<users;i++){
- if((sd=all_sd[i])){
- if(sd->status.guild_id==guild_id)
- sd->status.guild_id=0;
- }
+ iter = mapit_getallusers();
+ for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
+ {
+ if( sd->status.guild_id == guild_id )
+ sd->status.guild_id = 0; // erase guild
}
+ mapit_free(iter);
+
return 0;
}
+
// 情報所得
int guild_recv_info(struct guild *sg)
{