Re: [NEWBIE][CODE] invalid_race/invalid_class

From: Peter Ajamian (
Date: 03/10/01

George Greer wrote:
> On Sat, 10 Mar 2001, Peter Ajamian wrote:
> >Note however, that in two recent posts about people modifying that
> >function, they both initially got the mod right for that function, the
> >problem for both of them was in the #defines, they just thought that that
> >function was the problem because that's where the compiler was stopping.
> >The change you made would not have affected them but it may just confuse
> >newbie coders who are trying to follow the older snippet since the
> >snippets will no longer show the correct way to modify the function.
> Now the problem can be easily noticed on the proper line and is less likely
> to be mistaken for a ()-counting error in the class function itself.  It's
> not the perfect solution, but it's a good step.

True, somehow I get the feeling that we'd still be hearing from them on
the mailing list though.  ;)

> >Hrmmm, looks easier to modify, but I can't help thinking there's gotta be
> >a cleaner way to do all that.  I'm wondering if the test can be
> >bitvectorized to be able to combine all the testing into one...
> IS_OBJ_STAT(obj, 1 << (GET_CLASS(ch) + 12))
> Not that it'll work due to ITEM_NOSELL.  It's also a hack because it relies
> on the particular values.

Yeah, the reason I messed with the stat bitvector instead is because it
doesn't rely on the magic number 12.

> >So why did I post it in the first place?  Because it might be something
> >to consider if you ever decide that trashing the object files is
> >necessary for a different reason.  It would work especially well if you
> >want to move the ITEM_ANTI flags off to thier own separate bitvector in
> >which case you could just force them to line right up with the classes.
> Or make a less black-and-white system for equipping. Allow mages to equip a
> long sword, but they get a huge penalty and can't cast with it wielded.
> Clerics attacking with slashing weapons become "fallen" (assuming their
> 'god' gets uptight about that).  Thieves using two-handed swords don't
> sneak or hide so well.  ...etc...

Yeah, but I don't follow how that relates to what I just said, maybe you
misunderstood what I meant by "force them", "them" refered to the macros
lining up (ie the ITEM_ANTI_ bitvector should correspond with the CLASS_
list).  That can easily be enforced by not even using #defines for the
bitvector but just having a single macro like this...

#define ITEM_ANTI(class) (1 << (class))

Regards, Peter

   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/04/01 PST