RE: Increasing sizes of bit vectors

From: Gary Barnett (gbarnett@polarnet.com)
Date: 01/16/97


On Thursday, January 16, 1997 5:31 PM, Niese-Petersen wrote:
>On Fri, 17 Jan 1997, Chris Warren wrote:
>
>> I think this may have been covered before, but I can't remember....
>> My problem is this.... I *NEED* 42 ITEM_XXXXX extra flags. Now I was
>> wondering if it would be possible to change...
>> struct obj_flag_data {
>>    .
>>    int extra_flags;    /* If it hums, glows, etc.          */
>> 
>> to a double value??? The annoying thing is this would mean changing
>> every object in my world and then there may be problems with rounding,
>> am I correct? ARRRGGH If I have to change all the object files I may
>> aswell do a ITEM2_XXXXX extra flags set 2 kind of job.... A no win
>> situation?
>
>  I am working on an idea for more than the 32 bitvectors, with help
>of an array.  It's not a small process, but worth it I think.
>Hopefully I get time this coming weekend to test, what I have done 
>so far.
>  The obj files will be a job tho, since it got to read more than on
>bit field.  But then again, an obj. converter is always good to code
>and have for later use :)
>

Something like this might work:

bool abits[MAX_ABITS];    /* in char_special_data for this example */

#define MAX_ABITS 	1000
#define GET_ABIT(ch, i) ((ch)->char_specials.abits[i])

I am using this to enable mobs to remember events.. Mostly for transport rooms, and the like. 

An identical setup is being used for what I call qbits.. I use them to store info on players only.
As they are on/off only they can store whether a quest has been completed.. and in my case
I extended them to provide command based wizard powers.. i.e. a wizset command with all
the options.. These bits also allow a mob to know if a player has learned a skill from it, etc.

It works well, but does have the obvious deficiency, a static array.. But for my purposes, it fills
the bill quite nicely. With the suitable defines, and a wrapper, it could serve to replace the
variables when you exceed 32 bits.. 

--Mallory




-- http://www.polarnet.com/Users/gbarnett/ -- telnet://204.119.24.14:4000
+-----------------------------------------------------------+
| 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