pln_zap_transient_flags() fixes up planes stuck in the air (commit
7ca4f412, v4.3.12). Since commit
4e9e58bf (v4.3.14), it writes back
the fixed planes. This is wrong for empdump.
empdump should touch data only on successful import. When it fails
because ef_verify() fails, and any planes are found stuck in the air,
the plane file gets rewritten.
Make parameter ef_verify() take parameter may_put to let empdump
suppress the plane write-back. The plane file still get written out
on successful import, along with the other imported game state.
extern int ef_flags(int);
extern int ef_byname(char *);
extern int ef_byname_from(char *, int *);
extern int ef_flags(int);
extern int ef_byname(char *);
extern int ef_byname_from(char *, int *);
-extern int ef_verify(void);
+extern int ef_verify(int);
extern int ef_elt_byname(int, char *);
extern struct empfile empfile[EF_MAX + 1];
extern int ef_elt_byname(int, char *);
extern struct empfile empfile[EF_MAX + 1];
-pln_zap_transient_flags(void)
+pln_zap_transient_flags(int may_put)
{
int i;
struct plnstr *pp;
{
int i;
struct plnstr *pp;
ef_flush(EF_PLANE); /* pretty wasteful */
}
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.
+ */
{
struct empfile *ep;
int retval = 0;
{
struct empfile *ep;
int retval = 0;
- pln_zap_transient_flags();
+ pln_zap_transient_flags(may_put);
nsc_init();
ef_open_srv();
nsc_init();
ef_open_srv();
exit(EXIT_FAILURE);
global_init();
unit_cargo_init();
exit(EXIT_FAILURE);
global_init();
unit_cargo_init();
exit(1);
/* export to stdout */
exit(1);
/* export to stdout */