Re: Newbie question--next_in_room

From: Gary Barnett (gbarnett@POLARNET.COM)
Date: 09/14/97


On Sunday, September 14, 1997 2:04 AM, Justin
[SMTP:c616077@SHOWME.MISSOURI.EDU] wrote:
> Does next_in_room ever equal NULL, or does it just wrap around to the
> first person/npc again?  I'm trying to find an example in the code where
> it goes through the occupants on a room one by one so that I can make a
> spell that hits a character at random.  Anyone know of a place in the code
> that does something similar that I can look at, didn't see it myself...
>
Here's a piece of code to do that:

struct char_data *vict, *next_v;

  for (vict = world[ch->in_room].people; vict; vict = next_v) {
       next_v = vict->next_in_room;
       if (vict && (vict->in_room == ch->in_room)) {
        /* put your spell on vict here */
       }
 }

ch being the person doing the cast.

--Mallory
I can picture in my mind a world without war, a world without hate.
And I can picture us attacking that world, because they'd never
expect it.     - Jack Handey


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



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