Structurize locatiuon info.
[open-adventure.git] / saveresume.c
index c6d0ba0f274d3e73271e92b171a95521caf96694..53278ae7ec23d902cee1d2e597101852899e2b04 100644 (file)
@@ -19,7 +19,7 @@
 #include "dungeon.h"
 
 /*
- * Use this to detect endianness mismatch.  Can't be unchanges by byte-swapping.
+ * Use this to detect endianness mismatch.  Can't be unchanged by byte-swapping.
  */
 #define ENDIAN_MAGIC   2317
 
@@ -109,7 +109,7 @@ int resume(void)
 #endif
     FILE *fp = NULL;
 
-    if (game.loc != LOC_START || game.abbrev[LOC_START] != 1) {
+    if (game.loc != LOC_START || game.locs[LOC_START].abbrev != 1) {
         rspeak(RESUME_ABANDON);
         if (!yes_or_no(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
             return GO_CLEAROBJ;
@@ -190,8 +190,8 @@ bool is_valid(struct game_t valgame)
     }
     /*  Bounds check for location arrays */
     for (int i = 0; i <= NDWARVES; i++) {
-        if (valgame.dloc[i]  < -1 || valgame.dloc[i]  > NLOCATIONS  ||
-            valgame.odloc[i] < -1 || valgame.odloc[i] > NLOCATIONS) {
+        if (valgame.dwarves[i].loc  < -1 || valgame.dwarves[i].loc  > NLOCATIONS  ||
+            valgame.dwarves[i].oldloc < -1 || valgame.dwarves[i].oldloc > NLOCATIONS) {
             return false;      // LCOV_EXCL_LINE
         }
     }
@@ -258,7 +258,7 @@ bool is_valid(struct game_t valgame)
 
     /* Check that values in linked lists for objects in locations are inside bounds */
     for (loc_t loc = LOC_NOWHERE; loc <= NLOCATIONS; loc++) {
-        if (valgame.atloc[loc] < NO_OBJECT || valgame.atloc[loc] > NOBJECTS * 2) {
+        if (valgame.locs[loc].atloc < NO_OBJECT || valgame.locs[loc].atloc > NOBJECTS * 2) {
             return false;      // LCOV_EXCL_LINE
         }
     }