Re: [CODE] Limited Items Loading

From: Johan Dustler (
Date: 01/18/99

> From: Julian Buckley <>
> This really has me stumped.  I'd appreciate all help.
> Okies, take your normal stock do_load function, but more importantly the
> obj_loading section.  Okies, now inside that, I have placed a call so
> that if the PC is < LVL_GOD, they get called back and are not allowed to
> load the item.  i.e....
> ***SNIP***
>     obj = read_object(r_num, REAL);
>     if (GET_OBJ_EXTRA(obj) = ITEM_LIMITED && GET_LEVEL(ch) < LVL_GOD) {

      if (IS_OBJ_STAT(obj, ITEM_LIMITED) && (GET_LEVEL(ch) > LVL_GOD)) {

> Now, assume the item has GLOW HUM LIMITED as its extra flags.  With code
> the way it is, when I load this item, all the extra flags get cleared
> once it gets loaded.  The item still has all of it's stats etc, but the
> extra flags get wiped.  If I change GET_OBJ_EXTRA(obj) = ITEM_LIMITED to
> use a "==", the item keeps its flags, but any immortal with the load
> command can load it.  If I move that bit of code above the obj =

If you use '=' you assign ITEM_LIMITED to the extra flag variable.

If you use '==' the check will work, if the only extra flag is
ITEM_LIMITED. If the object has more flags, you are doing is
checking if '1 == 3'.

What you should use is IS_OBJ_STAT, as I have shown above. The macro
will check if the ITEM_LIMITED bit is set in the extra flags variable.


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

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