summaryrefslogtreecommitdiff
path: root/src/map/irc.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/irc.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/irc.c')
-rw-r--r--src/map/irc.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/map/irc.c b/src/map/irc.c
index 88ada1311..f217d9de2 100644
--- a/src/map/irc.c
+++ b/src/map/irc.c
@@ -184,8 +184,6 @@ void irc_parse_sub(int fd, char *incoming_string)
int i=0;
- struct map_session_data **allsd;
-
memset(source,'\0',256);
memset(command,'\0',256);
memset(target,'\0',256);
@@ -266,25 +264,41 @@ void irc_parse_sub(int fd, char *incoming_string)
else // Number of users online
if(strcmpi(cmdname,"users")==0)
{
- int users;
- map_getallusers(&users);
+ int users = 0;
+ struct s_mapiterator* iter;
+
+ iter = mapit_getallusers();
+ for( mapit_first(iter); mapit_exists(iter); mapit_next(iter) )
+ users++;
+ mapit_free(iter);
+
sprintf(send_string, "PRIVMSG %s :Users Online: %d", irc_channel, users);
irc_send(send_string);
}
else // List all users online
if(strcmpi(cmdname,"who")==0)
{
- int users;
- allsd = map_getallusers(&users);
+ int users = 0;
+ struct s_mapiterator* iter;
+ struct map_session_data* sd;
+
+ iter = mapit_getallusers();
+ for( mapit_first(iter); mapit_exists(iter); mapit_next(iter) )
+ users++;
+ mapit_free(iter);
+
if(users > 0)
{
sprintf(send_string,"NOTICE %s :%d Users Online",source_nick,users);
irc_send(send_string);
- for(i = 0; i < users; i++)
+
+ iter = mapit_getallusers();
+ for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) )
{
- sprintf(send_string,"NOTICE %s :Name: \"%s\"",source_nick,allsd[i]->status.name);
+ sprintf(send_string,"NOTICE %s :Name: \"%s\"",source_nick,sd->status.name);
irc_send(send_string);
}
+ mapit_free(iter);
}
else
{