Return if the arrow hit something after moving randomly
[wumpus.git] / wumpus.c
index 3afd5680919e03d6844c30872fd13d5c22ff3f1c..2adc696d8179cc80d44252a4f5f6eba73d01e469 100644 (file)
--- a/wumpus.c
+++ b/wumpus.c
@@ -25,6 +25,8 @@
  *
  * So, pretend for a little while that your workstation is an ASR-33 and
  * limber up your fingers for a trip to nostalgia-land...
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
  */
 
 #include <stdio.h>
@@ -353,6 +355,7 @@ badrange:
                check_shot();
                if (finished != NOT)
                    return;
+               goto nextpath;
            }
 
            /* 820 NEXT K1                                              */
@@ -364,11 +367,13 @@ badrange:
 
        /* 835 GOTO 900                                                 */
        check_shot();
+       if (finished != NOT)
+           return;
 
        /* 840 NEXT K                                                   */
+       nextpath: ;
     }
 
-ammo:
     if (finished == NOT)
     {
        /* 845 PRINT "MISSED"                                           */
@@ -523,7 +528,7 @@ goodmove:
     }
 }
 
-main(argc, argv)
+int main(argc, argv)
 int argc;
 char *argv[];
 {