On Thu, 16 Jan 1997, 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... - - 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 :) How about this: Change long room_flags to long room_flags[2], and do the same with all other bitvectors. Change all your ROOM defines from binary to decimal like this: #define ROOM_DARK 0 #define ROOM_DEATH 1 #define ROOM_NOMOB 2 #define ROOM_INDOORS 3 // etc... and do the same for other bitvectors change your flag macros to these: #define SET_BIT(var, bit) ((var)[(bit)/32] |= 1 << ((bit) % 32)) #define TOGGLE_BIT(var, bit) ((var)[(bit)/32] ^= 1 << ((bit) % 32)) #define REMOVE_BIT(var, bit) ((var)[(bit)/32] &= ~(1 << ((bit) % 32))) #define IS_SET(flag, bit) ((flag)[(bit)/32] & 1 << ((bit) % 32)) Now you can use up to 64 flags in each bitvector. You'll have to change the pfile, but you can keep the world files the same if you modify asciiflag_conv to allow 64 flags. You can get 64 flags using lowercase, then uppercase, then digits, then one more character, like a '+'. Note that this will make worldfile bitvectors in integer format unusable, so you'll have to convert any old style bitvecotrs to ascii bitvectors first. Another problem is that you can't set, remove, or toggle multiple flags, so: SET_BIT(PLR_FLAGS(ch), PLR_WRITING | PLR_MAILING); Must be changed to: SET_BIT(PLR_FLAGS(ch), PLR_WRITING); SET_BIT(PLR_FLAGS(ch), PLR_WRITING); If you've got olc, you'll need to make some changes there too. Oh and sprinttypes, and any other functions/macros that deal with bitvectors will need small mods. Oh I forgot to mention a nice advantage. If you leave the player bitvectors as a single long (tho still changing the flag definitions from binary to decimal), you don't have to make any pfiles changes. This allows you to double your room, mob, and object bitvectors without having to deal with pfile changes if you don't need them yet. The only thing I can think of to keep you from expanding the array is the world files. You could probably split a bigger array into groups of 2. Anybody got a better idea? Sam +-----------------------------------------------------------+ | 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