]> granicus.if.org Git - nethack/commitdiff
Fix ball and chain sanity
authorPasi Kallinen <paxed@alt.org>
Tue, 8 Oct 2019 16:44:51 +0000 (19:44 +0300)
committerPasi Kallinen <paxed@alt.org>
Tue, 8 Oct 2019 16:47:51 +0000 (19:47 +0300)
Scatter did not consider the ball or chain, and moved them around, causing
ball and chain sanity error.

One way to trigger was being punished, with chain on a land mine and having
a monster trigger the mine. Now the chain will shatter, unpunishing the hero.

doc/fixes36.3
src/explode.c

index f9781a9a8d2017869752fd0ca361874821b01e4b..71572a4414198229522cd4676dd2dbd2a000f601 100644 (file)
@@ -177,6 +177,7 @@ avoid 'object lost' panic when polymorph causes loss of levitation boots or
        over but buffered output didn't show it until hero stopped, so it
        wasn't possible to tell where they were, unlike all other forms of
        multiple movement; stop running if/when an engraving is reached
+fix exploding land mine moving ball or chain and causing a sanity error
 
 
 Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
index 941d222019afcc4b1f18e3d66007869676f9a603..2c46178fd7eea4bd757f9527b46d7f26f1761cf7 100644 (file)
@@ -621,6 +621,13 @@ struct obj *obj; /* only scatter this obj        */
                    obj->ox, obj->oy, sx, sy);
 
     while ((otmp = (individual_object ? obj : level.objects[sx][sy])) != 0) {
+        if (otmp == uball || otmp == uchain) {
+            boolean waschain = (otmp == uchain);
+            pline_The("chain shatters!");
+            unpunish();
+            if (waschain)
+                continue;
+        }
         if (otmp->quan > 1L) {
             qtmp = otmp->quan - 1L;
             if (qtmp > LARGEST_INT)