Re: Hopefully last addition to clan code

From: Daniel Koepke (dkoepke@california.com)
Date: 01/23/97


On Thu, 23 Jan 1997, Mehdi Keddache wrote:

> struct char_data *is_playing(char *vict_name)
> {
>   extern struct descriptor_data *descriptor_list;
>   struct descriptor_data *i, *next_i;
> 
>   for (i = descriptor_list; i; i = next_i) {
>     next_i = i->next;
>     if(i->connected == CON_PLAYING && !strcmp(i->character->player.name,CAP(vict_name)))
>       return i->character;
>   }
>   return NULL;
> }

This could be written like:

  struct char_data *is_player(char *vict_name) {
    struct descriptor_data *i = descriptor_list;
    while (i)
      if (!i->connected && i->character &&
          !str_cmp(GET->NAME(i->character), vict_name))
        break;
    return (i);
  }

Just a random thought...


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST