Unlike objects, player doesn't go to -1 when destroyed. 264/head
authorNHOrus <jy6x2b32pie9@yahoo.com>
Wed, 13 Sep 2017 16:34:35 +0000 (19:34 +0300)
committerNHOrus <jy6x2b32pie9@yahoo.com>
Wed, 13 Sep 2017 16:34:35 +0000 (19:34 +0300)
Tighten bounds check.

saveresume.c

index 8bd4418f9e51ac8e2ca0f2ef41b4b4b7cf4e5f00..d4940159216ee17e37087233260647c896e9c175 100644 (file)
@@ -153,10 +153,10 @@ bool is_valid(struct game_t* valgame)
     /*  Bounds check for locations */
     if ( 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->oldlc2 < -1 || valgame->oldlc2 > NLOCATIONS) {
+         valgame->loc    <  0 || valgame->loc    > NLOCATIONS ||
+         valgame->newloc <  0 || valgame->newloc > NLOCATIONS ||
+         valgame->oldloc <  0 || valgame->oldloc > NLOCATIONS ||
+         valgame->oldlc2 <  0 || valgame->oldlc2 > NLOCATIONS) {
         return false;
     }
     /*  Bounds check for location arrays */