]> granicus.if.org Git - nethack/commitdiff
Fix thinko in the shk litter indexing
authorPasi Kallinen <paxed@alt.org>
Fri, 25 Jun 2021 10:39:26 +0000 (13:39 +0300)
committerPasi Kallinen <paxed@alt.org>
Fri, 25 Jun 2021 10:39:59 +0000 (13:39 +0300)
src/shk.c

index 120078d103e8e6fd380a9327ff5c6fb09e026a94..f4075b7234427238bd9be7046e1efd2f48d1e37a 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -3643,8 +3643,8 @@ litter_scatter(xchar *litter, int k, xchar x, xchar y, struct monst *shkp)
                 /* otmp must be moved otherwise g.level.objects[x][y] will
                    never become Null and while-loop won't terminate */
                 do {
-                    i++;
-                } while (--trylimit && !(litter[i % 9] & LITTER_INSHOP));
+                    i = (i + 1) % 9;
+                } while (--trylimit && !(litter[i] & LITTER_INSHOP));
                 if ((litter[i] & (LITTER_OPEN | LITTER_INSHOP)) != 0) {
                     ix = x + horiz(i);
                     iy = y + vert(i);