Re: [code] This must be wrong.... <Pine.SOL.3.95.980817020328.26701B-100000@cambot.dcrt.nih.gov>

From: Kevin Doherty (kdoherty@JURAI.NET)
Date: 08/17/98


Thus spake George <greerga@CIRCLEMUD.ORG>:
>On Sun, 16 Aug 1998, Christoffer Lundberg wrote:
>
>>Is this a valid thing to write? It sure doesn't work anyways.
>>
>>if (world[ch->in_room].people == 0) {
>>
>>I want to make sure that there are absolutely no other chars present
>>in that room, and something will happen.
>
>It should work (but I write this at 2am), although it is highly misleading.
>
>'people' would actually be a NULL pointer and NULL just happens to be 0 (in

If ch->in_room is equal to X, wouldn't world[X].people _have_ to be
non-null, as presumably if ch thinks its in room X, room X thinks it
contains ch. I think the correct solution (though I have no source at hand
so I could be wrong) would be:

  if (ch->next_in_room == NULL) {

Though I can't remember if circular linked lists are used. If so, it would
be:

  if (ch->next_in_room == ch) {

--
Kevin Doherty, kdoherty@jurai.net
"Multiple exclamation marks are a sure sign of a diseased mind."
       -- Rincewind (from _Eric_)


     +------------------------------------------------------------+
     | 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/15/00 PST