fix github issue #1020 - unicorn horn vs blindness

Reported by argrath:  the test for whether blindness could be fixed
by applying a unicorn horn got broken by the recent change to the
Blinded macro.

While in there, undefine macros once they stop being useful.  I put
these #undef lines closer to their #define instead of at end of file.

Also, remove an out of date comment about encoding property troubles.
It became obsolete when unicorn horn stop fixing lost Str, Dex, &c.

Fixes #1020
This commit is contained in:
PatR
2023-05-07 00:37:51 -07:00
parent ca02bc4898
commit 76fbca7d25
2 changed files with 14 additions and 8 deletions

View File

@@ -1574,6 +1574,7 @@ the fuzzer could get stuck in a loop if hero died in a way where life-saving
just resulted in a repeat death (cited case was burning up in lava,
where life-saving teleports you out of it; if the level is full, the
teleport will fail and you'll immediately burn up again)
fix unicorn horn's ability to repair blindness
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository

View File

@@ -662,6 +662,8 @@ magic_whistled(struct obj *obj)
return;
}
#undef HowMany
boolean
um_dist(coordxy x, coordxy y, xint16 n)
{
@@ -885,6 +887,8 @@ mleashed_next2u(struct monst *mtmp)
return FALSE;
}
#undef MAXLEASHED
boolean
next_to_u(void)
{
@@ -1163,6 +1167,7 @@ use_mirror(struct obj *obj)
pline("%s ignores %s reflection.", Monnam(mtmp), mhis(mtmp));
}
return ECMD_TIME;
#undef SEENMON
}
static void
@@ -2163,8 +2168,9 @@ use_tinning_kit(struct obj *obj)
useup(corpse);
} else {
if (costly_spot(corpse->ox, corpse->oy) && !corpse->no_charge) {
struct monst *shkp VOICEONLY = shop_keeper(*in_rooms(corpse->ox,
corpse->oy, SHOPBASE));
struct monst *shkp VOICEONLY
= shop_keeper(*in_rooms(corpse->ox, corpse->oy, SHOPBASE));
SetVoice(shkp, 0, 80, 0);
verbalize(you_buy_it);
}
@@ -2224,9 +2230,6 @@ use_unicorn_horn(struct obj **optr)
return;
}
/*
* Entries in the trouble list use a very simple encoding scheme.
*/
#define prop_trouble(X) trouble_list[trouble_count++] = (X)
#define TimedTrouble(P) (((P) && !((P) & ~TIMEOUT)) ? ((P) & TIMEOUT) : 0L)
@@ -2235,7 +2238,7 @@ use_unicorn_horn(struct obj **optr)
/* collect property troubles */
if (TimedTrouble(Sick))
prop_trouble(SICK);
if (TimedTrouble(Blinded) > (long) u.ucreamed && !PermaBlind
if (TimedTrouble(HBlinded) > (long) u.ucreamed
&& !(u.uswallow
&& attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)))
prop_trouble(BLINDED);
@@ -3416,6 +3419,8 @@ use_pole(struct obj *obj, boolean autohit)
return ECMD_TIME;
}
#undef glyph_is_poleable
static int
use_cream_pie(struct obj *obj)
{
@@ -3693,12 +3698,11 @@ use_grapple(struct obj *obj)
return ECMD_TIME;
}
#define BY_OBJECT ((struct monst *) 0)
/* return 1 if the wand is broken, hence some time elapsed */
static int
do_break_wand(struct obj *obj)
{
#define BY_OBJECT ((struct monst *) 0)
static const char nothing_else_happens[] = "But nothing else happens...";
register int i;
coordxy x, y;
@@ -3930,6 +3934,7 @@ do_break_wand(struct obj *obj)
delobj(obj);
nomul(0);
return ECMD_TIME;
#undef BY_OBJECT
}
/* getobj callback for object to apply - this is more complex than most other