[CODE] Level Restrict. Problem

From: Leonard Burns IV (lburns@continet.com)
Date: 02/18/97


I've coded in a way to restrict eq to certain levels, I added the extra
value and I made it read it in, in db.c. Everything works, I add a part
so you can stat the obj and see what level is required, which shows the
right level. But I am getting an error when trying to eq the item, it
says 'You must be at least level 27243 before using this item.' My test
char is level 10 out of a 55 level system, and the level required to use
the item is 40. Even with my level 55 Imp it says i need to be level
26228.

I looked at how the do_stat_object returned the level and it used a
'struct obj_index *j = 0;' so I tried to add that to the do_wear, and
changed the 'obj' to 'j' but that causes the mud to crash when I eq an
item.

/*** CODE AND ERRORS ***/
  if (GET_OBJ_VAL(obj, 4) > GET_LEVEL(ch)) {
    sprintf(buf, "You must be at least level %d before using this
item.\r\n",             GET_OBJ_VAL(obj, 4));
    send_to_char(buf, ch);
    return;

}                                                                            

When I compile I get this error:
act.item.c: In function `do_wear':
act.item.c:1244: warning: `obj' might be used uninitialized in this
function
/*** END OF CODE AND ERRORS ***/

I appreciate any help that your willing to offer.
-- 
Leonard Burns IV
lburns@continet.com
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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