> Here are some possible remedies. You may decide that the cure is worse > than the disease, and I'd agree with you, for some of these. > > 3. Make a second variable to hold the additional flags. This requires > hand-changing much of the code to use the correct variable automagically. How about making the flags just the bit position, eg 0, 1, 2, 3 etc And then: #define eIS_SET(bitarray, pos) (((pos)<32? bitarray[0] : bitarray[1]) & \ 1<<(pos)) or even (for a LOT of flags) #define eIS_SET(bitarray, pos) (bitarray[pos/32] & 1<<pos) etc Where bitarray is the necessary number of ints, of course. The second one might even be faster, considering that a SHL AX, 5 isn't too costly... go with that one :) (Hope that your compiler is smart enough to know that '/32' == '>> 5', else just put pos>>5 aah what the hell I'm babbling) continuing: #define eSET(bitarray, pos) (bitarray[(pos)/32] |= 1<<(pos)) #define eTOGGLE(...) (... ^= ...) and #define MOB_FLAGGED(ch, flag) (IS_NPC(ch) && eIS_SET(MOB_FLAGS(ch), (flag)) And MOB_FLAGS is of course a bitarray. Remember to change the bitvectorprinters and asciiflagsthingy etc because they don't use the macro's of course. or be bold and convert ALL bitflags to that format, so there's no problem > Next step: how to identify these. Best suggestion I've heard so far is > to use a special character, such as a ^. So the following line: > > abcdef^gh > > is really interpreted as: > > a | b | c | d | e | f | (z + g) | h > > (z is in the second set of characters). weeeell, since z is 26 that's not a good idea :) Why not just continue: a-zA-Z that gives 52 flags... And THEN you can use ^ Just my 2 cents... Wout.
This archive was generated by hypermail 2b30 : 12/18/00 PST