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:
+3
-13
@@ -4349,25 +4349,15 @@ dump_weights(void)
|
|||||||
for (i = 0; i < ocount; ++i) {
|
for (i = 0; i < ocount; ++i) {
|
||||||
const char *oc_name = (i == SLIME_MOLD) ? "slime mold"
|
const char *oc_name = (i == SLIME_MOLD) ? "slime mold"
|
||||||
: obj_descr[i].oc_name;
|
: obj_descr[i].oc_name;
|
||||||
int wt = (int) objects[i].oc_weight,
|
int wt = (int) objects[i].oc_weight;
|
||||||
ocls = objects[i].oc_class;
|
|
||||||
|
|
||||||
if (wt && oc_name) {
|
if (wt && oc_name) {
|
||||||
weightlist[cnt].idx = i;
|
weightlist[cnt].idx = i;
|
||||||
weightlist[cnt].wt = wt;
|
weightlist[cnt].wt = wt;
|
||||||
weightlist[cnt].wtyp = 2;
|
weightlist[cnt].wtyp = 2;
|
||||||
weightlist[cnt].unique = (objects[i].oc_unique != 0);
|
weightlist[cnt].unique = (objects[i].oc_unique != 0);
|
||||||
Snprintf(nmbufbase, sizeof nmbufbase, "%s%s",
|
objects[i].oc_name_known = 1;
|
||||||
(ocls == POTION_CLASS) ? "potion of "
|
Strcpy(nmbufbase, simple_typename(i));
|
||||||
: (ocls == WAND_CLASS) ? "wand of "
|
|
||||||
: (ocls == SCROLL_CLASS) ? "scroll of "
|
|
||||||
: (ocls == RING_CLASS) ? "ring of "
|
|
||||||
: (ocls == SPBOOK_CLASS
|
|
||||||
&& objects[i].oc_name_idx != SPE_BOOK_OF_THE_DEAD
|
|
||||||
&& objects[i].oc_name_idx != SPE_NOVEL)
|
|
||||||
? "spellbook of "
|
|
||||||
: "",
|
|
||||||
oc_name);
|
|
||||||
Snprintf(nmbuf, sizeof nmbuf, "%07u%s", wt,
|
Snprintf(nmbuf, sizeof nmbuf, "%07u%s", wt,
|
||||||
(weightlist[cnt].unique) ? the(nmbufbase)
|
(weightlist[cnt].unique) ? the(nmbufbase)
|
||||||
: an(nmbufbase));
|
: an(nmbufbase));
|
||||||
|
|||||||
+11
-4
@@ -220,8 +220,7 @@ obj_typename(int otyp)
|
|||||||
buf[0] = '\0'; /* redundant */
|
buf[0] = '\0'; /* redundant */
|
||||||
switch (ocl->oc_class) {
|
switch (ocl->oc_class) {
|
||||||
case COIN_CLASS:
|
case COIN_CLASS:
|
||||||
Strcpy(buf, "coin");
|
return strcpy(buf, actualn); /* "gold piece" */
|
||||||
break;
|
|
||||||
case POTION_CLASS:
|
case POTION_CLASS:
|
||||||
Strcpy(buf, "potion");
|
Strcpy(buf, "potion");
|
||||||
break;
|
break;
|
||||||
@@ -252,9 +251,17 @@ obj_typename(int otyp)
|
|||||||
if (dn)
|
if (dn)
|
||||||
Sprintf(eos(buf), " (%s)", dn);
|
Sprintf(eos(buf), " (%s)", dn);
|
||||||
return buf;
|
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:
|
default:
|
||||||
if (nn) {
|
if (nn) {
|
||||||
Strcpy(buf, actualn);
|
Strcat(buf, actualn);
|
||||||
if (GemStone(otyp))
|
if (GemStone(otyp))
|
||||||
Strcat(buf, " stone");
|
Strcat(buf, " stone");
|
||||||
if (un) /* 3: length of " (" + ")" which will enclose 'dn' */
|
if (un) /* 3: length of " (" + ")" which will enclose 'dn' */
|
||||||
@@ -262,7 +269,7 @@ obj_typename(int otyp)
|
|||||||
if (dn)
|
if (dn)
|
||||||
Sprintf(eos(buf), " (%s)", dn);
|
Sprintf(eos(buf), " (%s)", dn);
|
||||||
} else {
|
} else {
|
||||||
Strcpy(buf, dn ? dn : actualn);
|
Strcat(buf, dn ? dn : actualn);
|
||||||
if (ocl->oc_class == GEM_CLASS)
|
if (ocl->oc_class == GEM_CLASS)
|
||||||
Strcat(buf,
|
Strcat(buf,
|
||||||
(ocl->oc_material == MINERAL) ? " stone" : " gem");
|
(ocl->oc_material == MINERAL) ? " stone" : " gem");
|
||||||
|
|||||||
Reference in New Issue
Block a user