Re: Room Bits
Date: 03/08/96

In a message dated 96-03-08 15:24:15 EST, you write:

>I am curious as to whether or not there is a way (and I'm sure there is) 
>to temporarily set a bit on a room if something else is true. For 
>example: I want to make a NOMAGIC flag for objects. I want any room that 
>the nomagic object is in to be flagged NOMAGIC as long as the object is 
>in that rom, and then remove the bit when the object is removed.

I wouldn't think this would be too tough - you would need to add to the
function char_to_room to accomplish this. You would either want to search
through the items in use by the character, or all items in the character's
inventory for an item with your NOMAGIC characteristic - a simple for loop.
If it finds such an item, set the NOMAGIC room flag. Then do the exact same
thing in the function char_from_room but remove the NOMAGIC flag. Both these
functions are found in handler.c.

The only problem there would be if 2 characters were in a room with such
items - in char_from_room if someone with a NOMAGIC item left the rrom, you
would need to search the inventory of every other character in the room for a
second such item before removing the NOMAGIC flag. An alternative to this
would be to assign a counter for NOMAGIC items in the room structure (outside
the structure which is loaded from disk)
That way you would have a much faster way to see if there was more than one
NOMAGIC item in the room (Though this obviously would cost you memory).

If you need something more specific, send me e-mail at

(The account is my work account)

- Brian

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