]> granicus.if.org Git - nethack/commitdiff
displacing grid bugs (trunk only)
authornethack.rankin <nethack.rankin>
Fri, 13 Jul 2007 23:40:43 +0000 (23:40 +0000)
committernethack.rankin <nethack.rankin>
Fri, 13 Jul 2007 23:40:43 +0000 (23:40 +0000)
     From a bug report, you could swap places with a pet grid bug when
you're making a diagonal move.  Now you can't.  [Completely ignored:  it
is possible to swap places with pets which are incapable of movement....]

     This imposes the same restriction on the astral Riders when they're
exchanging places with monsters in their way.

doc/fixes35.0
src/hack.c
src/mon.c

index b1fa18e7b713ac3740616c3893c0b93eb0d37095..7e7b7b3fa4498c00a2bf47cdc864dfd75cc4621f 100644 (file)
@@ -254,6 +254,7 @@ sometimes got "you trip over it" after intervening messages following the
 wizard mode: WIZKIT wishes could overflow inventory's 52 slots
 when loading bones files, censor suspect characters from player-supplied
        strings such as pet and fruit names
+can't swap places with tame grid bug when moving diagonally
 
 
 Platform- and/or Interface-Specific Fixes
index 0976d536d70f993d363dd10e98c67071e38d8abf..de3bb16cb5725ecd23f1cddf3b1fb67f3e6e5451 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)hack.c     3.5     2007/04/16      */
+/*     SCCS Id: @(#)hack.c     3.5     2007/07/13      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1401,6 +1401,11 @@ domove()
                    sobj_at(BOULDER, trap->tx, trap->ty)) {
                /* can't swap places with pet pinned in a pit by a boulder */
                u.ux = u.ux0,  u.uy = u.uy0;    /* didn't move after all */
+           } else if (u.ux0 != x && u.uy0 != y && NODIAG(mtmp->data - mons)) {
+               /* can't swap places when pet can't move to your spot */
+               u.ux = u.ux0,  u.uy = u.uy0;
+               You("stop.  %s can't move diagonally.",
+                   upstart(y_monnam(mtmp)));
            } else if (u.ux0 != x && u.uy0 != y &&
                       bad_rock(mtmp->data, x, u.uy0) &&
                       bad_rock(mtmp->data, u.ux0, y) &&
index 44f1d871332e71a0c90e4d7bb0d0b7aecdaa3d3d..96b78daa2324cf74142e6fcd514933a96199dcdb 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mon.c      3.5     2007/03/30      */
+/*     SCCS Id: @(#)mon.c      3.5     2007/07/13      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1259,6 +1259,9 @@ struct monst *magr,       /* monster that is currently deciding where to move */
           again when defender gets its chance to move */
        if ((pa->mflags3 & M3_DISPLACES) != 0 &&
            (pd->mflags3 & M3_DISPLACES) == 0 &&
+           /* no displacing grid bugs diagonally */
+           !(magr->mx != mdef->mx && magr->my != mdef->my &&
+               NODIAG(monsndx(pd))) &&
            /* no displacing trapped monsters or multi-location longworms */
            !mdef->mtrapped && (!mdef->wormno || !count_wsegs(mdef)) &&
            /* riders can move anything; others, same size or smaller only */