I am creating a new item type - ITEM_LOCKPICK, and I'm having some problems
with it.
It does not save correctly, and the only message that I get is from the log
files:
Thu Aug 29 00:03:15 2002 :: [*****] FILE: plains.are LINE: 416
Thu Aug 29 00:03:15 2002 :: [*****] BUG: CHECK_POS : item_type == -1 < 0
This is from merc.h:
#define CHECK_POS(a, b, c) {
\
(a) = (b);
\
if ( (a) < 0 )
\
bug( "CHECK_POS : " c " == %d < 0", a
); \
}
This is in olc_act, void show_obj_values( CHAR_DATA *ch, OBJ_INDEX_DATA *obj
):
case ITEM_LOCKPICK:
sf(buf,
"[v0] Bonus: [%d]\n\r"
"[v1] N/A : [%d]\n\r"
"[v2] N/A : [%d]\n\r"
"[v3] N/A : [%d]\n\r"
"[v4] N/A : [%d]\n\r"
"[v5] N/A : [%d]\n\r",
obj->value[0],
obj->value[1],
obj->value[2],
obj->value[3],
obj->value[4],
obj->value[5]);
stc(buf, ch);
break;
This is right under ITEM_SCROLL
Farther down in olc_act, in bool set_obj_values( CHAR_DATA *ch,
OBJ_INDEX_DATA *pObj, int value_num, char *argument):
case ITEM_LOCKPICK:
switch ( value_num )
{
default:
stc("v0 = Lock picking bonus.\n\r", ch);
return FALSE;
case 0:
stc("Lock bonus set.\n\r", ch);
pObj->value[0] = atoi( argument );
break;
}
break;
===================
This is in olc_save.c, void save_object( FILE *fp, OBJ_INDEX_DATA *pObjIndex
):
//Lock picks. Dayrinni 8/28/02
case ITEM_LOCKPICK:
fprintf(fp, "%d %d %d %d %d %d\n",
pObjIndex->value[0],
pObjIndex->value[1],
pObjIndex->value[2],
pObjIndex->value[3],
pObjIndex->value[4],
pObjIndex->value[5]);
break;
It is right under ITEM_WAND
===================
This is in db2.c, void load_objects( FILE *fp ):
//Lock picks. Dayrinni. 8/26/02
case ITEM_LOCKPICK:
pObjIndex->value[0] = fread_number(fp);
pObjIndex->value[1] = fread_number(fp);
pObjIndex->value[2] = fread_number(fp);
pObjIndex->value[3] = fread_number(fp);
pObjIndex->value[4] = fread_number(fp);
pObjIndex->value[5] = fread_number(fp);
break;
It is under ITEM_WEAPON.
====================
This is in tables.c, at the bottom of the const struct flag_type
type_flags[] =
section:
{ "lockpick", ITEM_LOCKPICK, TRUE },
================
This is in const.c, const struct item_type item_table [] =:
{ ITEM_LOCKPICK, "lockpick" },
============
This is in db.c,OBJ_DATA *create_object( OBJ_INDEX_DATA *pObjIndex, int level
):
case ITEM_LIGHT:
if (obj->value[2] == 999)
obj->value[2] = -1;
break;
case ITEM_LOCKPICK:
case ITEM_FURNITURE:
case ITEM_TRASH:
case ITEM_CONTAINER:
case ITEM_DRINK_CON:
=================
This is in merc.h:
/*
* Item types.
* Used in #OBJECTS.
*/
#define ITEM_GEM 32
#define ITEM_JEWELRY 33
#define ITEM_JUKEBOX 34
#define ITEM_LOCKPICK 35
I get no compile errors, and the area file says "none" as item type after I
asave area.
If you need more info, just say so and I'll send it out.
Thanks for your help