Re: weapon flags

From: Richard Glover (
Date: 02/19/99

You'll have to add a new variable to obj_flag_data in structs.h.  2
approaches that I can think of will work.

1) Make a completely new variable.
2) Increase the # of 'values' that all items have.

Either method will consume the same amount of memory.  The 2nd method will
allow you to add other parameters to your objects as well as ITEM_WEAPON.

The 'values' are integers in stock and can handle up to 32 flags in a 32bit

Create a new set of bit flags in structs.h for your weapons like

WPN_SLYUNDEAD    (1 << 0)
WPN_SLYOOZE          (1 << 1)

Make a new macro in utils.h (not necessary, but handy).  I'll assume you
chose option #2.

#define WPN_FLAGS(obj)    ((obj)->obj_flags.value[4])
#define WPN_FLAGGED(obj, flag)    (IS_SET(WPN_FLAGS(obj), (flag)))

Then you'll have to change your object files to have 1 more parameter on the
numeric line that the rest of the obj values are on in db.c.

  if ((retval = sscanf(line, "%d %d %d %d %d", t, t + 1, t + 2, t + 3, t +
4)) != 5) {
    log("SYSERR: Format error in second numeric line (expecting 4 args, got
%d), %s", retval, buf2);
  obj_proto[i].obj_flags.value[0] = t[0];
  obj_proto[i].obj_flags.value[1] = t[1];
  obj_proto[i].obj_flags.value[2] = t[2];
  obj_proto[i].obj_flags.value[3] = t[3];
  obj_proto[i].obj_flags.value[3] = t[4];

If you have OasisOLC, then change oedit.c, oedit_save_to_disk.  I'll let you
figure out how.

The rest is up to you, making checks on the WPN_FLAGGED and whatnot.

Have fun,

-----Original Message-----
From: Shane Augustine <>
To: <>
Date: Friday, February 19, 1999 8:09 PM
Subject:  weapon flags

>I want to create weapon flags so these flags will only affect weapons
>and not
>other objs.  It is a waste of flags using item_undead_slayer for obj
>flags when this
>flag is only affective on weapons.  How would i go about adding
>specialized flags
>for only objs?

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

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