Fixed copy-paste errors
authorNHOrus <jy6x2b32pie9@yahoo.com>
Thu, 24 Aug 2017 11:41:21 +0000 (14:41 +0300)
committerNHOrus <jy6x2b32pie9@yahoo.com>
Thu, 24 Aug 2017 11:41:21 +0000 (14:41 +0300)
main.c
saveresume.c

diff --git a/main.c b/main.c
index 6f154c1821cbd6f184abbf44cec24238a444882e..0f245a2d0e6d971279ebaab0e7b6157f7a39106d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1175,7 +1175,9 @@ Lookup:
         default: // LCOV_EXCL_LINE
             BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3); // LCOV_EXCL_LINE
         }
-
+        if (!is_valid(game)) {
+            exit(1);
+        }
         switch (action(command)) {
         case GO_TERMINATE:
             return true;
index fdb9ffb2fbafdca479db816fc0efde60f2fde7bc..cf1dd6c287115f7790fe92f0ac25a0542cd5dcee 100644 (file)
@@ -141,11 +141,11 @@ bool is_valid(struct game_t valgame)
 
     /*  Bounds check for locations */
     if ( valgame.chloc < -1  || valgame.chloc > NLOCATIONS  ||
-         valgame.chloc < -1  || valgame.chloc > NLOCATIONS  ||
+         valgame.chloc2 < -1  || valgame.chloc2 > NLOCATIONS  ||
          valgame.loc < -1    || valgame.loc > NLOCATIONS    ||
          valgame.newloc < -1 || valgame.newloc > NLOCATIONS ||
          valgame.oldloc < -1 || valgame.oldloc > NLOCATIONS ||
-         valgame.oldloc < -1 || valgame.oldloc > NLOCATIONS) {
+         valgame.oldlc2 < -1 || valgame.oldlc2 > NLOCATIONS) {
         return false;
     }
     /*  Bounds check for location arrays */