--- Thori <[EMAIL PROTECTED]> wrote:
> I'm experiencing difficulties adding new affect flags to my MUD.
> Eventually, of course, I wanted to go past "ee", but doubling the value for
> "ee" as seems to be the pattern for the other affect definitions yielded a
> number large enough to flag a warning.  When I tried to use a number for
> "ff" that was just 'any old number', people with sanctuary seemed to be
> affected by it, or at least, those who shouldn't have been, were... so what
> should I do?  It's obvious that doubling the value of "ee" to get "ff" is
> necessary, but I can't really do that...

The reason you can't double it is because the size of the number is too large
to store in a 32 bit integer. You could use one of the "bit systems" to give
yourself more bits, but many times it's not really nessicary.

My suggestion has always been to restructure your bits into more logical
categories. Instead of having 32 flags showing what spells you are affected by,
you could break them down by spell types.

For example, instead of having an affected_by variable in char data, you could
have a protections, poisons, blessings, etc. variable.

Then you could reuse the same bits in each variable..

/* Protection Flags */

#define PROTECTION_ARMOR    (a)
#define PROTECTION_EVIL     (b)
#define PROTECTION_SANC     (c)
...

/* Types of Poison */
#define POISON_CYANIDE          (a)
#define POISON_VENOM            (b)
#define POISON_ARSENIC          (c)
...


Then you can do..

if(IS_SET(ch->protections, PROTECTION_SANC))

or

if(IS_SET(ch->poison, POISON_VENOM))

etc..


It also then becomes very simple to remove all flags of a particular type.

ch->protections = 0;

Would strip all protections, but would not effect ch->curses at all =)

~Kender

=====
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/L/C/O d-(+) s++:+ a-- C+++$>++++ UBLS++++$ 
P+++(--)$ L++>+++ E--- W+>++$ N !o K? w(--) !O 
M- !V PS+ PE(++) Y+ PGP->+ t- 5 X+() R(+) tv+@ 
b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
------END GEEK CODE BLOCK------

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

Reply via email to