]> granicus.if.org Git - nethack/commitdiff
github pull request #113 - shopkeeper placement
authorPatR <rankin@nethack.org>
Thu, 5 Jul 2018 02:26:59 +0000 (19:26 -0700)
committerPatR <rankin@nethack.org>
Thu, 5 Jul 2018 02:26:59 +0000 (19:26 -0700)
Fixes #113

Incorporate the contents of pull request #113 to fix shopkeeper setup
for irregularly shaped shop rooms.  Code intending to adjust the Y
coordinate was erroneously incrementing the X one instead.  (I'm not
sure whether we have any irregular shops at all but if so, they don't
have the necessary orientation to trigger this bug.)

And add a couple of formatting tweaks in the vicinity....

doc/fixes36.2
src/shknam.c

index d4fbba9f259c6b7c1d35ddce14a8f0dcf0f1f6ea..ff9b89d18b88e84a95b7df86bd10271a09ad7d58 100644 (file)
@@ -62,6 +62,9 @@ special level loader didn't support populating several types of special rooms
        (ant hole, cockatrice nest, leprechaun hall)
 eating rings while polymorphed didn't handle bonus/penalty for increase damage,
        increase accuracy, or protection correctly
+shopkeeper's position in front of shop door didn't correctly handle bottom
+       edge of irregularly shaped shop due to typo or copy+paste error
+       (latent bug; no such shops are present in 3.6.x)
 
 
 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
index 43ab8651e99b7f2b52d4ecc7cd76cf97903f7a8b..a36b67ec44ab3eba83f310fec53ed939b474e313 100644 (file)
@@ -602,6 +602,7 @@ struct mkroom *sroom;
     /* check that the shopkeeper placement is sane */
     if (sroom->irregular) {
         int rmno = (int) ((sroom - rooms) + ROOMOFFSET);
+
         if (isok(sx - 1, sy) && !levl[sx - 1][sy].edge
             && (int) levl[sx - 1][sy].roomno == rmno)
             sx--;
@@ -613,18 +614,18 @@ struct mkroom *sroom;
             sy--;
         else if (isok(sx, sy + 1) && !levl[sx][sy + 1].edge
                  && (int) levl[sx][sy + 1].roomno == rmno)
-            sx++;
+            sy++;
         else
             goto shk_failed;
-    } else if (sx == sroom->lx - 1)
+    } else if (sx == sroom->lx - 1) {
         sx++;
-    else if (sx == sroom->hx + 1)
+    } else if (sx == sroom->hx + 1) {
         sx--;
-    else if (sy == sroom->ly - 1)
+    } else if (sy == sroom->ly - 1) {
         sy++;
-    else if (sy == sroom->hy + 1)
+    } else if (sy == sroom->hy + 1) {
         sy--;
-    else {
+    else {
     shk_failed:
 #ifdef DEBUG
         /* Said to happen sometimes, but I have never seen it. */