Re: [NEWBIE] If statement checking all sockets

From: Luke Waite (lwaite2000@home.com)
Date: 12/28/00


Ok I'm making 2 assumptions and asking one question.
I'm assuming the (*1) and (*2) are just to explain what they do.
but,  the question is:
I assume
(GET_LEVEL(i->character) == GET_LEVEL(ch))
                               ^
                           Changed from "whatever"
would go here

     for (i = descriptor_list; i; i = i->next)
       if (STATE(i) == CON_PLAYING)
         if (GET_LEVEL(i->character) == whatever)
           SEND_TO_Q(messg, i);

Am I correct?

Thanks

Brandon Brown wrote:
>
> > How do I make an IF statement check all the playing sockets. So like say a
> > level chat. Yes I know this is a bad example but... I know this much
> > so maybe
> >      if (GET_LEVEL == GET_LEVEL(ch))
> >               ^             ^
> > Check of all the players    Level of the player executing the command
> > Oh yeah and I would prefer it not in do_gen_comm.
>
>     I'm not going to tell you because that'd be too easy. ;)
*mutter* ;)
>
>     Where does something like this occur?  A few places.. the one that comes
> to mind, for example's use is send_to_all in comm.c:
>
> void send_to_all(char *messg)
> {
>   struct descriptor_data *i;
>
>   if (messg)
>     for (i = descriptor_list; i; i = i->next)    (*1)
>       if (STATE(i) == CON_PLAYING)   (*2)
>         SEND_TO_Q(messg, i);
> }
>
> *1 - This is what's cycling through all of the sockets connected.
> *2 - This where you would check the level - except you'd want to use if
> (GET_LEVEL(i->character) == whatever)

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT