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 <some object>."

If there is a pile, it will describe the top item rather than whichever
cursed item the pet doesn't want to step on.
This commit is contained in:
PatR
2015-12-30 23:38:11 -08:00
parent 7be8e1f8bb
commit a236f9d5f6
2 changed files with 28 additions and 13 deletions

View File

@@ -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;