Change empdump to export even when game state looks bad
Just print a warning then. Gives deities another tool to fix up a bad game state.
This commit is contained in:
parent
d63b0e1a7b
commit
2a5d12be54
1 changed files with 12 additions and 6 deletions
|
@ -27,7 +27,7 @@
|
|||
* empdump.c: Export/import Empire game state
|
||||
*
|
||||
* Known contributors to this file:
|
||||
* Markus Armbruster, 2008-2010
|
||||
* Markus Armbruster, 2008-2011
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -56,7 +56,7 @@ main(int argc, char *argv[])
|
|||
int export = 0;
|
||||
int private = 0;
|
||||
int human = 1;
|
||||
int opt, i, lineno, type;
|
||||
int opt, i, lineno, type, verified;
|
||||
FILE *impf = NULL;
|
||||
int dirty[EF_MAX];
|
||||
|
||||
|
@ -128,6 +128,8 @@ main(int argc, char *argv[])
|
|||
argv[0], gamedir, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if (ef_verify_config() < 0)
|
||||
exit(1);
|
||||
global_init();
|
||||
|
||||
for (i = 0; i < EF_MAX; i++) {
|
||||
|
@ -150,10 +152,7 @@ main(int argc, char *argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if (ef_verify_config() < 0)
|
||||
exit(1);
|
||||
if (ef_verify_state(0) < 0)
|
||||
exit(1);
|
||||
verified = ef_verify_state(0) >= 0;
|
||||
|
||||
/* export to stdout */
|
||||
if (export) {
|
||||
|
@ -169,6 +168,13 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (!verified && export)
|
||||
fprintf(stderr,
|
||||
"%s: warning: export has errors, not importable as is\n",
|
||||
argv[0]);
|
||||
if (!verified && import)
|
||||
exit(1);
|
||||
|
||||
/* write out imported data */
|
||||
for (i = 0; i < EF_MAX; i++) {
|
||||
if (!EF_IS_GAME_STATE(i))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue