fix github issue #515 - grappling hook internals

Grappling hook used to have an undiscovered description of "iron hook"
and when that was removed, the oc_name_known flag was left set as if
for something that could become discovered.  I'm not sure whether that
made any difference anywhere.

Gold piece was in a similar situation, except that it wasn't because
an alternate description had been present and then removed.  That one
definitely didn't make any difference anywhere.

Fixes #515
This commit is contained in:
PatR
2021-05-20 18:56:03 -07:00
parent 5ad45fc696
commit d6cafdc527
2 changed files with 22 additions and 5 deletions

View File

@@ -167,14 +167,14 @@ init_objects(void)
break;
}
}
check:
checkprob:
sum = 0;
for (i = first; i < last; i++)
sum += objects[i].oc_prob;
if (sum == 0) {
for (i = first; i < last; i++)
objects[i].oc_prob = (1000 + i - first) / (last - first);
goto check;
goto checkprob;
}
if (sum != 1000)
error("init-prob error for class %d (%d%%)", oclass, sum);
@@ -191,6 +191,23 @@ init_objects(void)
if (!g.bases[last])
g.bases[last] = g.bases[last + 1];
/* check objects[].oc_name_known */
for (i = 0; i < NUM_OBJECTS; ++i) {
int nmkn = objects[i].oc_name_known != 0;
if (!OBJ_DESCR(objects[i]) ^ nmkn) {
if (iflags.sanity_check) {
impossible(
"obj #%d (%s) name is %s despite%s alternate description",
i, OBJ_NAME(objects[i]),
nmkn ? "pre-known" : "not known",
nmkn ? "" : " no");
}
/* repair the mistake and keep going */
objects[i].oc_name_known = nmkn ? 0 : 1;
}
}
/* shuffle descriptions */
shuffle_all();
#ifdef USE_TILES