21 Oct, 2011, arholly wrote in the 1st comment:
Votes: 0
Hello again. OK, I noticed that when looking at objects, it is not displaying the quality of the object correctly. It is always showing it as poor quality. I'm learning, so I put in a check in save_objects to make sure it is saving the quality when it is changed, and it is apparently. That means it must be viewing it incorrectly then, right? Well, here is the code for what it is doing when it looks at an object.
void state_obj_cond(OBJ_DATA *obj, CHAR_DATA *ch)
{
char buf[MAX_STRING_LENGTH];

if(obj->condition > 90)
send_to_char("It is in excellent condition.\n\r", ch);
else if(obj->condition > 80)
send_to_char("It is in good condition.\n\r", ch);
else if(obj->condition > 70)
send_to_char("It has begun to show signs of wear.\n\r", ch);
else if(obj->condition > 60)
send_to_char("It is showing signs of wear.\n\r", ch);
else if(obj->condition > 50)
send_to_char("It is in fair condition.\n\r", ch);
else if(obj->condition > 40)
send_to_char("It is not looking so good.\n\r", ch);
else if(obj->condition > 30)
send_to_char("It is in poor condition.\n\r", ch);
else if(obj->condition > 20)
send_to_char("It is in very bad condition.\n\r", ch);
else
send_to_char("It is falling apart.\n\r", ch);

sprintf(buf, "It is of %s quality.\n\r", quality_flags[obj->quality].name);
send_to_char(buf, ch);

if(obj->item_type == ITEM_BOMB)
send_to_char("It is ticking softly.\n\r", ch);
}


Now, because everything is showing as poor quality, that get's me thinking it must be calling the wrong thing because according to the quality_flags table, poor quality is like the default.
const struct flag_type quality_flags [] =
{
{ "poor", 0, FALSE },
{ "functional", 1, TRUE },
{ "functional", 2, TRUE },
{ "good", 3, TRUE },
{ "good", 4, TRUE },
{ "very good", 5, TRUE },
{ "very good", 6, TRUE },
{ "exceptional", 7, TRUE },
{ "exceptional", 8, TRUE },
{ "exceptional", 9, TRUE },
{ "exceptional", 10, TRUE },
{ "extraordinary", 11, TRUE },
{ "extraordinary", 12, TRUE },
{ "master craftsmanship", 13, TRUE },
{ "master craftsmanship", 14, TRUE },
{ "artistic perfection", 15, TRUE },
{ NULL, 0, FALSE }
};


So, can someone help me and explain what it is doing? Is it just calling quality wrong?

Thanks,
Arholly
21 Oct, 2011, Tavish wrote in the 2nd comment:
Votes: 0
Are you sure the obj->quality is getting set correctly on load?
21 Oct, 2011, arholly wrote in the 3rd comment:
Votes: 0
Good question. So, that made me realize that we did not have quality in our ostat command (now it does). That showed that the object quality is set to 0. So, the problem must be then in the load_object function.
void load_objects( FILE *fp )
{
OBJ_INDEX_DATA *pObjIndex;

if ( !area_last ) /* OLC */
{
bug( "Load_objects: no #AREA seen yet.", 0 );
exit( 1 );
}

for ( ; ; )
{
sh_int vnum;
char letter;
int iHash;

letter = fread_letter( fp );
if ( letter != '#' )
{
bug( "Load_objects: # not found.", 0 );
exit( 1 );
}

vnum = fread_number( fp );
if ( vnum == 0 )
break;

fBootDb = FALSE;
if ( get_obj_index( vnum ) != NULL )
{
bug( "Load_objects: vnum %d duplicated.", vnum );
exit( 1 );
}
fBootDb = TRUE;

pObjIndex = new_obj_index();
pObjIndex->vnum = vnum;
pObjIndex->area = area_last; /* OLC */
pObjIndex->reset_num = 0;
newobjs++;
free_string(pObjIndex->name);
free_string(pObjIndex->short_descr);
free_string(pObjIndex->description);
free_string(pObjIndex->full_desc);
free_string(pObjIndex->material);
pObjIndex->name = fread_string( fp );
pObjIndex->short_descr = fread_string( fp );
pObjIndex->description = fread_string( fp );
pObjIndex->full_desc = fread_string( fp );
pObjIndex->material = fread_string( fp );

pObjIndex->item_type = fread_number( fp );
/* CHECK_POS(pObjIndex->item_type,item_lookup(fread_word(fp)),"item_type");
*/

pObjIndex->extra_flags = fread_flag( fp );
pObjIndex->wear_flags = fread_flag( fp );
switch(pObjIndex->item_type)
{
case ITEM_WEAPON:
pObjIndex->value[0] = fread_number(fp);
pObjIndex->value[1] = fread_number(fp);
pObjIndex->value[2] = fread_number(fp);
pObjIndex->value[3] = attack_lookup(fread_word(fp));
pObjIndex->value[4] = fread_flag(fp);
pObjIndex->value[5] = fread_number(fp);
break;
case ITEM_CONTAINER:
pObjIndex->value[0] = fread_number(fp);
pObjIndex->value[1] = fread_flag(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;
case ITEM_DRINK_CON:
case ITEM_FOUNTAIN:
pObjIndex->value[0] = fread_number(fp);
pObjIndex->value[1] = fread_number(fp);
/* pObjIndex->value[2] = liq_lookup(fread_word(fp)); */
CHECK_POS(pObjIndex->value[2],liq_lookup(fread_word(fp)),
"liq_lookup");
pObjIndex->value[3] = fread_number(fp);
pObjIndex->value[4] = fread_number(fp);
pObjIndex->value[5] = fread_number(fp);
break;
case ITEM_POTION:
case ITEM_PILL:
case ITEM_SCROLL:
pObjIndex->value[0] = fread_number(fp);
pObjIndex->value[1] = skill_lookup(fread_word(fp));
pObjIndex->value[2] = skill_lookup(fread_word(fp));
pObjIndex->value[3] = skill_lookup(fread_word(fp));
pObjIndex->value[4] = skill_lookup(fread_word(fp));
pObjIndex->value[5] = fread_number(fp);
break;
default:
pObjIndex->value[0] = fread_flag( fp );
pObjIndex->value[1] = fread_flag( fp );
pObjIndex->value[2] = fread_flag( fp );
pObjIndex->value[3] = fread_flag( fp );
pObjIndex->value[4] = fread_flag( fp );
pObjIndex->value[5] = fread_flag( fp );
break;
}
pObjIndex->weight = fread_number( fp );
pObjIndex->cost = fread_number( fp );

pObjIndex->condition = fread_number( fp );
if(pObjIndex->condition <= 0)
pObjIndex->condition = 100;

for ( ; ; )
{
char letter;

letter = fread_letter( fp );

if ( letter == 'A' )
{
AFFECT_DATA *paf;

paf = alloc_perm( sizeof(*paf) );
paf->where = TO_OBJECT;
paf->type = -1;
paf->duration = -1;
paf->location = fread_number( fp );
paf->modifier = fread_number( fp );
paf->bitvector = 0;
paf->next = pObjIndex->affected;
pObjIndex->affected = paf;
top_affect++;
}

else if (letter == 'F')
{
AFFECT_DATA *paf;

paf = alloc_perm( sizeof(*paf) );
letter = fread_letter(fp);
switch (letter)
{
case 'A':
paf->where = TO_AFFECTS;
break;
case 'I':
paf->where = TO_IMMUNE;
break;
case 'R':
paf->where = TO_RESIST;
break;
case 'V':
paf->where = TO_VULN;
break;
default:
bug( "Load_objects: Bad where on flag set.", 0 );
exit( 1 );
}
paf->type = -1;
paf->duration = -1;
paf->location = fread_number(fp);
paf->modifier = fread_number(fp);
paf->bitvector = fread_flag(fp);
paf->next = pObjIndex->affected;
pObjIndex->affected = paf;
top_affect++;
}

else if ( letter == 'E' )
{
EXTRA_DESCR_DATA *ed;

ed = new_extra_descr();
ed->keyword = fread_string( fp );
ed->description = fread_string( fp );
if(!str_cmp(ed->keyword, "–TUNONE")) {
free_string(pObjIndex->to_user_none);
pObjIndex->to_user_none = ed->description;
free_extra_descr(ed);
if(pObjIndex->uses < -1) pObjIndex->uses = -1;
}
else if(!str_cmp(ed->keyword, "–TUSELF")) {
free_string(pObjIndex->to_user_self);
pObjIndex->to_user_self = ed->description;
free_extra_descr(ed);
if(pObjIndex->uses < -1) pObjIndex->uses = -1;
}
else if(!str_cmp(ed->keyword, "–TUOTH")) {
free_string(pObjIndex->to_user_other);
pObjIndex->to_user_other = ed->description;
free_extra_descr(ed);
if(pObjIndex->uses < -1) pObjIndex->uses = -1;
}
else if(!str_cmp(ed->keyword, "–TRNONE")) {
free_string(pObjIndex->to_room_none);
pObjIndex->to_room_none = ed->description;
free_extra_descr(ed);
if(pObjIndex->uses < -1) pObjIndex->uses = -1;
}
else if(!str_cmp(ed->keyword, "–TRSELF")) {
free_string(pObjIndex->to_room_self);
pObjIndex->to_room_self = ed->description;
free_extra_descr(ed);
if(pObjIndex->uses < -1) pObjIndex->uses = -1;
}
else if(!str_cmp(ed->keyword, "–TROTH")) {
free_string(pObjIndex->to_room_other);
pObjIndex->to_room_other = ed->description;
free_extra_descr(ed);
if(pObjIndex->uses < -1) pObjIndex->uses = -1;
}
else if(!str_cmp(ed->keyword, "–TVOTH")) {
free_string(pObjIndex->to_vict_other);
pObjIndex->to_vict_other = ed->description;
free_extra_descr(ed);
if(pObjIndex->uses < -1) pObjIndex->uses = -1;
}
else if(!str_cmp(ed->keyword, "–TRUSE")) {
free_string(pObjIndex->to_room_used);
pObjIndex->to_room_used = ed->description;
free_extra_descr(ed);
if(pObjIndex->uses < -1) pObjIndex->uses = -1;
}
else if(!str_cmp(ed->keyword, "–TUUSE")) {
free_string(pObjIndex->to_user_used);
pObjIndex->to_user_used = ed->description;
free_extra_descr(ed);
if(pObjIndex->uses < -1) pObjIndex->uses = -1;
}
else if(!str_cmp(ed->keyword, "–USES")) {
pObjIndex->uses = atoi(ed->description);
free_extra_descr(ed);
}
else if(!str_cmp(ed->keyword, "–COMPANY")) {
free_string(pObjIndex->company);
pObjIndex->company = ed->description;
free_extra_descr(ed);
}
else {
ed->next = pObjIndex->extra_descr;
pObjIndex->extra_descr = ed;
top_ed++;
}
}

else if ( letter == 'S' )
{
pObjIndex->fetish_flags = fread_flag(fp);
pObjIndex->fetish_flags = fread_number(fp);
pObjIndex->fetish_target = fread_number(fp);
}

else if ( letter == 'Q' )
{
pObjIndex->quality = fread_number(fp);
}

else
{
ungetc( letter, fp );
break;
}
}

iHash = vnum % MAX_KEY_HASH;
pObjIndex->next = obj_index_hash[iHash];
obj_index_hash[iHash] = pObjIndex;
top_vnum_obj = top_vnum_obj < vnum ? vnum : top_vnum_obj; /* OLC */
assign_area_vnum( vnum ); /* OLC */
}

return;
}

And the way the object looks is like this from the area file.
Quote
#4100
long bookcase~
long bookcase~
A long bookcase~
This bookcase is a long bookcase, maybe six feet long and about four
feet high. It has three levels of shelving on it and appears to be of
excellent quality.
~
wood~
15 0 0
100 0 0 0 0 0
0 0 100
E
–USES~
-2~
Q 5
21 Oct, 2011, Rarva.Riendf wrote in the 4th comment:
Votes: 0
means obj->quality is always 0
just check where it is set. (you should find that at item creation, and when it loads item from files.)

If you did setup eclipse just ctrl+shift+g (or right click show references -> workspace)

Then look everywhere there is ->quality = in that

It will help you understand how this field is used.
21 Oct, 2011, arholly wrote in the 5th comment:
Votes: 0
It was in load, but not create_objects. Added it and it miraculously started showing conditions. Thanks everyone. I forgot about create_object.
0.0/5