'Sanity checker'

From: James Kane (jkane@holly.ColoState.EDU)
Date: 05/06/95


In case anyone is interested in the changes neccessary to catch 'insane' uses
of G commands in the zone tables, here's the quite trivial modifications that
are needed.  I'd have made a patch file but both the affected files have been
changed quite a bit for different stuff and I couldn't be bothered to unpack
the original source. :)


File db.c function reset_zone()
add the next line after the other variable declarations 
  extern int wear_bitvectors[];

change
       ZONE_ERROR("invalid equipment pos number");
     } else {
       obj = read_object(ZCMD.arg1, REAL);

to the following
       ZONE_ERROR("invalid equipment pos number");
     } else if(!CAN_WEAR(obj_proto + ZCMD.arg1, wear_bitvectors[ZCMD.arg3])) {
       ZONE_ERROR("invalid equipment pos for obj");
     } else {
       obj = read_object(ZCMD.arg1, REAL);

File act.obj.c function perform_wear()
move the following array into the global name space somewhere
   int wear_bitvectors[] = {
   .
   .
   . };

Then G commands that have a mob wear a weapon, wield armor, or whatever will
be logged and not executed.  Normally this is unneeded since it isn't a mud
crashing event if an item is worn in the wrong spot, but when you start making
assumptions about what can be in those locations it can cause all kinds of
headaches if a mob has an errantly equipped object.

Jim



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