Sector checking for camping hack

BuckFloyd@aol.com
Date: 10/29/96


I hacked objsave.c and act.other.c and made a new function
for camping.  Works fine, including checking for room 
sector type to make sure one can only camp outside. 
While farting around with getting the sector check to work,
I discovered that one way I tried to do it wouldn't work,
although it compiled fine, and aother works just fine.
If anybody has any comments on why, I'd be interested in
knowing.  Follows are my code snips that didn't work and
did work.  Thanks..

Note:  I used both GET_ROOM_SECTOR and SECT,
since I have added obuild, thinking that might 
be the problem. 
The funky spacing is due to AOL's stupid char limit.

1)  This worked by itself.

     if (GET_ROOM_SECTOR(ch->in_room) != SECT_FIELD)
        send_to_char("You must be outdoors to camp\r\n",ch);
        
2)  But this didn't (GET_ROOM_SECTOR didn't either)..

     if ((SECT(ch->in_room) != SECT_FIELD) || 
      (SECT(ch->in_room) != SECT_FOREST) || (SECT(ch->in_room)
      != SECT_HILLS)  || (SECT(ch->in_room) != SECT_MOUNTAIN))
         send_to_char("You must be outdoors to camp.", ch);

3)  Finally, I defined int secttype and did it this way,
    which worked, and is what I'm using, but I don't
    understand why #2 didn't work.

    secttype = GET_ROOM_SECTOR(ch->in_room);
    if ((secttype < 2) || (secttype > 5))
        send_to_char("You must be outdoors to camp.\r\n", ch);

Any comments would be greatly appreciated.  I have a feeling
it has something to do with the way comparison operators work,
but as I'm a novice at C, I can't say for sure..Code base
is 30pl11.

+-----------------------------------------------------------+
| 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