Re: curious

From: Greg Alexander Irvine (s9211947@arcadia.cs.rmit.edu.au)
Date: 08/21/95


> I'm curious as to the reason for adding AFF2 & AFF3 bits...

Well, basically, because the AFF, PLR, and PRF all work as bitvectors,
(hence really only an integer (or long (??))).

eventually by adding new spells (which at times requires new AFF's) you
end up with an effect list like below

#define AFF_BLESS (1 << 0)  /* affected by bless */
#define ...
...
#define AFF_NEWSPELL1 (1 << 31)
#define AFF_NEWSPELL2 (1 << 32)

It's at this point we start to run into trouble because our bitvector (or
rather the integer storing the value of AFF flags) can't handle numbers
any higher than 2 to the power 31 (or is it 32 ?? :P ).
So we basically can't add any new affects and have somewhere to store them

So what he has done  (and I did with my PRF's, and I daresay will have to
do with AFF and PLR's too at some stage)  was create a second and third
AFF vectors.  so what this means is he can have 3 times as many AFF flags
as the original.. ie. some AFFs are stored in the bitvector AFF1, some in
AFF2, and some in AFF3   (which would be preset in hard code as to which
vector the AFF was to be stored in)

so now his AFF list would look something like.

/* AFFs for AFF1 *//
#define AFF_BLESS  (1 << 0)
....
#define AFF_SANC (1 << 31)


/* AFFs for AFF2 */

#define AFF_NEWSPELL1  (1 << 0)
#define AFF_NEWSPELL2  (1 << 1)
...
#define AFF_NEWSPELL31 (1 << 30)


/* AFFs for AFF3
#define....  

etc.


As i said I had to do this with my PRF vectors.  So now i store all my
prompt, auto and i think !channel options in PRF2, and the other stuff
like color, brief, compact, syslog etc options in PRF1.

It's quite easy to implement, does screw the pfile *shrug*, but increases
your options in the future.  You just have to know which vector to access
when accessing them for data.    You could probably just alter the the
is_affected() function and put your checks for specific spells in there.
this is going onthe assumption that your first 30 AFF_FLAGS are used up bu
any of the first 60 spells in the spell list (not all spells cause AFF.
the next 30 are in the following 50 spells, ....

if (spellnum <= 60)
   do the normal cehck but specify AFF1 vector
else if (spellnum <= 110)
   do the normal cehck but specify AFF2 vector
else 
   do the normal check but specify AFF3 vector.


hope this helps you if you want to implement it. :)   most will find it a
necessity if they add a lot of new stuff.  *shrug*


Greg.



This archive was generated by hypermail 2b30 : 12/18/00 PST