From: PatR Date: Thu, 31 Dec 2015 07:38:11 +0000 (-0800) Subject: fix bz265 - accessibility fix for reluctant pet X-Git-Tag: NetHack-3.6.1_RC01~1092 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a236f9d5f664e9043c2d964c750e57c5a6cc9980;p=nethack fix bz265 - accessibility fix for reluctant pet Requested by a blind player. The message "Fido moves only reluctantly" didn't convey enough information to be useful. Describe the reason why the move is reluctant: "Fido steps reluctantly over ." If there is a pile, it will describe the top item rather than whichever cursed item the pet doesn't want to step on. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 0ae0d278d..35bbf53c2 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -75,6 +75,8 @@ teleporting or polymorphing a sink via ring drop shouldn't depend upon being change "unlockable chest" to "broken chest" so that it won't be misunderstood ("capable of being unlocked" vs intended "not capable of being locked") use doname instead of xname when using '/' or ';' to look at objects on map +when a pet moves reluctantly, name the top item of the pile it is reluctant + to step on if the hero sees or remembers any object(s) at that spot Platform- and/or Interface-Specific Fixes diff --git a/src/dogmove.c b/src/dogmove.c index 472e3e416..34fa4a2cd 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -405,9 +405,10 @@ int udist; omx = mtmp->mx; omy = mtmp->my; - /* if we are carrying something then we drop it (perhaps near @) */ - /* Note: if apport == 1 then our behaviour is independent of udist */ - /* Use udist+1 so steed won't cause divide by zero */ + /* If we are carrying something then we drop it (perhaps near @). + * Note: if apport == 1 then our behaviour is independent of udist. + * Use udist+1 so steed won't cause divide by zero. + */ if (droppables(mtmp)) { if (!rn2(udist + 1) || !rn2(edog->apport)) if (rn2(10) < edog->apport) { @@ -459,7 +460,7 @@ int udist; return 0; } -/* set dog's goal -- gtyp, gx, gy +/* set dog's goal -- gtyp, gx, gy; returns -1/0/1 (dog's desire to approach player) or -2 (abort move) */ STATIC_OVL int dog_goal(mtmp, edog, after, udist, whappr) @@ -613,7 +614,7 @@ int after, udist, whappr; int dog_move(mtmp, after) register struct monst *mtmp; -register int after; /* this is extra fast monster movement */ +int after; /* this is extra fast monster movement */ { int omx, omy; /* original mtmp position */ int appr, whappr, udist; @@ -794,6 +795,7 @@ register int after; /* this is extra fast monster movement */ && better_with_displacing && !undesirable_disp(mtmp, nx, ny)) { int mstatus; register struct monst *mtmp2 = m_at(nx, ny); + mstatus = mdisplacem(mtmp, mtmp2, FALSE); /* displace monster */ if (mstatus & MM_DEF_DIED) return 2; @@ -814,12 +816,13 @@ register int after; /* this is extra fast monster movement */ if (mtmp->mleashed) { if (!Deaf) whimper(mtmp); - } else + } else { /* 1/40 chance of stepping on it anyway, in case * it has to pass one to follow the player... */ if (trap->tseen && rn2(40)) - continue; + continue; + } } } @@ -827,9 +830,9 @@ register int after; /* this is extra fast monster movement */ /* (minion isn't interested; `cursemsg' stays FALSE) */ if (has_edog) for (obj = level.objects[nx][ny]; obj; obj = obj->nexthere) { - if (obj->cursed) + if (obj->cursed) { cursemsg[i] = TRUE; - else if ((otyp = dogfood(mtmp, obj)) < MANFOOD + } else if ((otyp = dogfood(mtmp, obj)) < MANFOOD && (otyp < ACCFOOD || edog->hungrytime <= monstermoves)) { /* Note: our dog likes the food so much that he @@ -906,13 +909,23 @@ newdogpos: wasseen = canseemon(mtmp); remove_monster(omx, omy); place_monster(mtmp, nix, niy); - if (cursemsg[chi] && (wasseen || canseemon(mtmp))) - pline("%s moves only reluctantly.", noit_Monnam(mtmp)); + if (cursemsg[chi] && (wasseen || canseemon(mtmp))) { + /* describe top item of pile, not necessarily cursed item itself; + don't use glyph_at() here--it would return the pet but we want + to know whether an object is remembered at this map location */ + struct obj *o = (!Hallucination + && glyph_is_object(levl[nix][niy].glyph)) + ? vobj_at(nix, niy) : 0; + const char *what = o ? distant_name(o, doname) : something; + + pline("%s %s reluctantly over %s.", noit_Monnam(mtmp), + vtense((char *) 0, locomotion(mtmp->data, "step")), what); + } for (j = MTSZ - 1; j > 0; j--) mtmp->mtrack[j] = mtmp->mtrack[j - 1]; mtmp->mtrack[0].x = omx; mtmp->mtrack[0].y = omy; - /* We have to know if the pet's gonna do a combined eat and + /* We have to know if the pet's going to do a combined eat and * move before moving it, but it can't eat until after being * moved. Thus the do_eat flag. */ @@ -1012,7 +1025,7 @@ xchar mx, my, fx, fy; return FALSE; } -/*ARGSUSED*/ /* do_clear_area client */ +/* do_clear_area client */ STATIC_PTR void wantdoor(x, y, distance) int x, y;