From: PatR Date: Wed, 14 Apr 2021 19:51:20 +0000 (-0700) Subject: remove curse vs saddle X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf62687630184fa44e2993e26864033e88883784;p=nethack remove curse vs saddle Prayer reward can already uncurse a cursed saddle because hero is stuck on it. Allow scroll/spell of remove curse to do so too. The original riding implementation in slash'em operated with the saddle in hero's inventory rather than in the steed's, so it would have handled this without any extra effort. Presumeably that was overlooked when incorporating riding into nethack changed it to have saddle be part of the steed's inventory instead of hero's. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 59452ef65..a9b39b928 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -454,6 +454,7 @@ if a branch has only one level (Fort Ludios), prevent creation of any level wishing could attempt to place one) opening/unlocking magic zapped at monster holding the hero will release hold (zap at engulfer already expels hero); zapping at self has same effect +when riding, allow scroll of remove curse to affect to affect steed's saddle Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/potion.c b/src/potion.c index e8cb131bd..22c21c060 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1214,12 +1214,13 @@ bottlename(void) /* handle item dipped into water potion or steed saddle splashed by same */ static boolean -H2Opotion_dip(struct obj *potion, struct obj *targobj, - boolean useeit, - const char *objphrase) /* "Your widget glows" or "Steed's saddle - glows" */ +H2Opotion_dip(struct obj *potion, /* water */ + struct obj *targobj, /* item being dipped into the water */ + boolean useeit, /* will hero see the glow/aura? */ + const char *objphrase) /* "Your widget glows" or + * "Steed's saddle glows" */ { - void (*func)(OBJ_P) = 0; + void (*func)(struct obj *) = 0; const char *glowcolor = 0; #define COST_alter (-2) #define COST_none (-1) diff --git a/src/read.c b/src/read.c index 5489258cb..4e9e70971 100644 --- a/src/read.c +++ b/src/read.c @@ -935,7 +935,7 @@ display_stinking_cloud_positions(int state) /* scroll effects; return 1 if we use up the scroll and possibly make it become discovered, 0 if caller should take care of those side-effects */ int -seffects(struct obj* sobj) /* sobj - scroll, or fake spellbook object for scroll-like spell */ +seffects(struct obj *sobj) /* sobj - scroll or fake spellbook for spell */ { int cval, otyp = sobj->otyp; boolean confused = (Confusion != 0), sblessed = sobj->blessed, @@ -1300,9 +1300,26 @@ seffects(struct obj* sobj) /* sobj - scroll, or fake spellbook object for scroll known not to be, make the scroll known; it's trivial to identify anyway by comparing inventory before and after */ - if (obj->bknown && otyp == SCR_REMOVE_CURSE) { + if (obj->bknown && otyp == SCR_REMOVE_CURSE) learnscrolltyp(SCR_REMOVE_CURSE); - } + } + } + } + /* if riding, treat steed's saddle as if part of hero's invent */ + if (u.usteed && (obj = which_armor(u.usteed, W_SADDLE)) != 0) { + if (confused) { + blessorcurse(obj, 2); + obj->bknown = 0; /* skip set_bknown() */ + } else if (obj->cursed) { + uncurse(obj); + /* like rndcurse(sit.c), effect on regular inventory + doesn't show things glowing but saddle does */ + if (!Blind) { + pline("%s %s.", Yobjnam2(obj, "glow"), + hcolor("amber")); + obj->bknown = Hallucination ? 0 : 1; + } else { + obj->bknown = 0; /* skip set_bknown() */ } } } diff --git a/src/sit.c b/src/sit.c index abaf704b2..ac22bbbe4 100644 --- a/src/sit.c +++ b/src/sit.c @@ -394,7 +394,9 @@ rndcurse(void) if (!Blind) { pline("%s %s.", Yobjnam2(otmp, "glow"), hcolor(otmp->cursed ? NH_BLACK : (const char *) "brown")); - otmp->bknown = 1; /* ok to bypass set_bknown() here */ + otmp->bknown = Hallucination ? 0 : 1; /* bypass set_bknown() */ + } else { + otmp->bknown = 0; /* bypass set_bknown() */ } } } diff --git a/src/steed.c b/src/steed.c index 93b12d58e..f3b3f2904 100644 --- a/src/steed.c +++ b/src/steed.c @@ -58,7 +58,8 @@ use_saddle(struct obj* otmp) } /* Is this a valid monster? */ - if (mtmp->misc_worn_check & W_SADDLE || which_armor(mtmp, W_SADDLE)) { + if ((mtmp->misc_worn_check & W_SADDLE) != 0L + || which_armor(mtmp, W_SADDLE)) { pline("%s doesn't need another one.", Monnam(mtmp)); return 1; }