Re: Bitvectors

From: David Cole (tiznor@hotmail.com)
Date: 01/04/02


> What about changing it to an array in char_specials_saved
> (affected_by[4]) then change the definitions to
>
> #define AFF_FLAGGED(ch, num, flag) (IS_SET(AFF_FLAGS(ch), (num)), (flag))
> #define AFF_FLAGS(ch, num) ((ch)->char_specials_saved.affected_by[(num)])
> #define IS_AFFECTED(ch, num, flag) (AFF_FLAGGED((ch), (num), (skill))
>
> That'll break all the aff_flag usages and need a bunch of editing but
> it'll also make sure you get all of them changed, and it's pretty simple
> to handle with a perl/sed/awk (take your pick) script.
>
> My scripts are all rusty again, but...
> something like
> gawk {if $0 ~ "IS_AFFECTED(.*, .*)") sub(/, /, ", 0, "); print $0;}
> to convert all the normal "IS_AFFECTED()"'s to the new format, then:
> perl -i -pe 's/IS_AFFECTED(\d+)\((.*), (.*)\)/IS_AFFECTED($2, $1, $3)/g'
*.c
> to convert all of your IS_AFFECTED's to the 3-arg format.
>
> Substitute as needed for other macro calls, or just switch them all to
> AFF_FLAGGED for consistency such as AFF(\d+)_FLAGGED\(....\)
>
> Just a thought.
> -mike

In all honestly I liked to use the array, it looked allot cleaner & an more
friendly. I was looking through the Vision source code, and I believe it
used arrays, was very well done, and looked pretty simple. However my
knowledge with arrays is rough at best, and I couldn't quit seem to grasp
how to make it work with ASCII pfiles, It keep complaining about me using
AFF_FLAGS(ch) = PFILE_AFF_FLAGGED (Something to that affect).

Also with OLC installed it complained about it as well, but I believe I was
able to cook something up that made it work, Can't really remember its been
a week or so and I have slept since then.. :p

Have you used this method with having acsii pfiles? If so, how did you over
come the above?

Thanks,
Dave (Tiznor)

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT