still more 'nethack --dumpweights'
After updating the --dumpweights code in hack.c to insert "pair of" for gloves and boots and "set of" for dragon scales, I've switched it to use simple_typename() instead. Turns out that that routine also lacked handling for 'pair|set of'. And it was generating "coin of gold piece". Fix those. Roughly half of the gems are "<gem>" and the others "<gem> stone", so the --dumpweights output is different by more than just pair/set.
This commit is contained in:
15
src/objnam.c
15
src/objnam.c
@@ -220,8 +220,7 @@ obj_typename(int otyp)
|
||||
buf[0] = '\0'; /* redundant */
|
||||
switch (ocl->oc_class) {
|
||||
case COIN_CLASS:
|
||||
Strcpy(buf, "coin");
|
||||
break;
|
||||
return strcpy(buf, actualn); /* "gold piece" */
|
||||
case POTION_CLASS:
|
||||
Strcpy(buf, "potion");
|
||||
break;
|
||||
@@ -252,9 +251,17 @@ obj_typename(int otyp)
|
||||
if (dn)
|
||||
Sprintf(eos(buf), " (%s)", dn);
|
||||
return buf;
|
||||
case ARMOR_CLASS:
|
||||
if (objects[otyp].oc_armcat == ARM_GLOVES
|
||||
|| objects[otyp].oc_armcat == ARM_BOOTS)
|
||||
Strcpy(buf, "pair of ");
|
||||
else if (otyp >= GRAY_DRAGON_SCALES && otyp <= YELLOW_DRAGON_SCALES)
|
||||
Strcpy(buf, "set of ");
|
||||
FALLTHROUGH;
|
||||
/*FALLTHRU*/
|
||||
default:
|
||||
if (nn) {
|
||||
Strcpy(buf, actualn);
|
||||
Strcat(buf, actualn);
|
||||
if (GemStone(otyp))
|
||||
Strcat(buf, " stone");
|
||||
if (un) /* 3: length of " (" + ")" which will enclose 'dn' */
|
||||
@@ -262,7 +269,7 @@ obj_typename(int otyp)
|
||||
if (dn)
|
||||
Sprintf(eos(buf), " (%s)", dn);
|
||||
} else {
|
||||
Strcpy(buf, dn ? dn : actualn);
|
||||
Strcat(buf, dn ? dn : actualn);
|
||||
if (ocl->oc_class == GEM_CLASS)
|
||||
Strcat(buf,
|
||||
(ocl->oc_material == MINERAL) ? " stone" : " gem");
|
||||
|
||||
Reference in New Issue
Block a user