val, ef_nameof(tabno), ef_nelem(tabno));
return -1;
}
+ /* laziness: assumes TABNO is EFF_MEM */
+ if (val >= 0 && !empobj_in_use(tabno, ef_ptr(tabno, val))) {
+ verify_fail(type, row, ca, idx,
+ "value %ld refers to missing element of table %s",
+ val, ef_nameof(tabno));
+ return -1;
+ }
}
return 0;
}
}
static void
-pln_zap_transient_flags(void)
+pln_zap_transient_flags(int may_put)
{
int i;
struct plnstr *pp;
*/
}
}
- if (dirty)
+ if (dirty && may_put)
ef_flush(EF_PLANE); /* pretty wasteful */
}
+/*
+ * Verify game state and configuration are sane.
+ * Correct minor problems, but write corrections to backing files only
+ * if MAY_PUT is non-zero.
+ * Return -1 if uncorrected problems remain, else 0.
+ */
int
-ef_verify(void)
+ef_verify(int may_put)
{
struct empfile *ep;
int retval = 0;
}
}
- pln_zap_transient_flags();
+ pln_zap_transient_flags(may_put);
return retval;
}