On Thu, 19 Dec 1996, The Dark One wrote:
> could I do this?
> #define AFF_FLAGS(ch) ((ch)->char_specials.save.affected_by[4])
You wouldn't want to, since that'd still just give you 32 bits. You
want the following two macros:
#define FIELD(x) ((x) < 32 ? 1 : (x) / 32)
#define BIT(x) ((x) < 32 ? (x) : (x) % 32)
Now we change AFF_FLAGS(ch) to:
#define AFF_FLAGS(ch, v) ((ch)->char_specials.saved.affected_by[(v)])
And AFF_FLAGGED(ch) to:
#define AFF_FLAGGED(ch, bit) \
IS_SET(AFF_FLAGS((ch), FIELD(bit)), (1 << BIT(bit)))
Note that I changed the original posters FIELD/BIT [whatever he named
them] macros. BIT(x) was original defined as ((x) % 32) which, when the
number was under 32 would return a decimal value [and always equate to
1]. I've still yet to test this, but it seems feasible from where I'm
sitting...
--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.
+-----------------------------------------------------------+
| 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