]> granicus.if.org Git - nethack/commitdiff
fix bz265 - accessibility fix for reluctant pet
authorPatR <rankin@nethack.org>
Thu, 31 Dec 2015 07:38:11 +0000 (23:38 -0800)
committerPatR <rankin@nethack.org>
Thu, 31 Dec 2015 07:38:11 +0000 (23:38 -0800)
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.

doc/fixes36.1
src/dogmove.c

index 0ae0d278dbef1d3e5b40b91ebe11c160b3547793..35bbf53c2c2762f51eebb07e128d038f6577d672 100644 (file)
@@ -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
index 472e3e4164ea48002c433a334f3a11288404d0de..34fa4a2cd0b0654c4352f0c29f5102bfc7a45795 100644 (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;