hand slip when naming objects (trunk only)
From a bug report, the text change applied when you try to give an artifact's name to am item of that artifact's type would choose a letter from 'a' through 'y' when replacing the randomly selected target letter. Rather than fixing the off by one bug which prevented 'z' from being chosen, this switches to the existing routine used for mangling engravings. (Unfortunately the fix is not as simple as first expected, because wipeout_text() doesn't guarantee to change text which has spaces in it and all the quest artifact names have those.)
This commit is contained in:
@@ -292,6 +292,7 @@ give "shuddering vibrations" feedback if breaking a poly wand uses up items
|
||||
if polymorph causes a monster to drop items, they won't be used up via
|
||||
shuddering vibrations or as golem creation fodder
|
||||
monsters who ate green slime corpses weren't turned into green slime
|
||||
"hand slip" while naming an object would never pick 'z' as a substitute letter
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)do_name.c 3.5 2007/05/12 */
|
||||
/* SCCS Id: @(#)do_name.c 3.5 2008/11/02 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -386,7 +386,7 @@ void
|
||||
do_oname(obj)
|
||||
register struct obj *obj;
|
||||
{
|
||||
char buf[BUFSZ], qbuf[QBUFSZ];
|
||||
char buf[BUFSZ], bufcpy[BUFSZ], qbuf[QBUFSZ];
|
||||
const char *aname;
|
||||
short objtyp;
|
||||
|
||||
@@ -406,13 +406,22 @@ register struct obj *obj;
|
||||
pline_The("artifact seems to resist the attempt.");
|
||||
return;
|
||||
} else if (restrict_name(obj, buf) || exist_artifact(obj->otyp, buf)) {
|
||||
int n = rn2((int)strlen(buf));
|
||||
register char c1, c2;
|
||||
|
||||
c1 = lowc(buf[n]);
|
||||
do c2 = 'a' + rn2('z'-'a'); while (c1 == c2);
|
||||
buf[n] = (buf[n] == c1) ? c2 : highc(c2); /* keep same case */
|
||||
pline("While engraving your %s slips.", body_part(HAND));
|
||||
/* this used to change one letter, substituting a value
|
||||
of 'a' through 'y' (due to an off by one error, 'z'
|
||||
would never be selected) and then force that to
|
||||
upper case if such was the case of the input;
|
||||
now, the hand slip scuffs one or two letters as if
|
||||
the text had been trodden upon, sometimes picking
|
||||
punctuation instead of an arbitrary letter;
|
||||
unfortunately, we have to cover the possibility of
|
||||
it targetting spaces so failing to make any change
|
||||
(we know that it must eventually target a nonspace
|
||||
because buf[] matches a valid artifact name) */
|
||||
Strcpy(bufcpy, buf);
|
||||
do {
|
||||
wipeout_text(buf, rnd(2), (unsigned)0);
|
||||
} while (!strcmp(buf, bufcpy));
|
||||
pline("While engraving, your %s slips.", body_part(HAND));
|
||||
display_nhwindow(WIN_MESSAGE, FALSE);
|
||||
You("engrave: \"%s\".",buf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user