forked from github/server
- Prüfung passende xml-Resourcendatei
This commit is contained in:
parent
9ab04459c0
commit
7af84866ed
|
@ -79,6 +79,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/* exported variables */
|
/* exported variables */
|
||||||
|
char *xmlfile;
|
||||||
region *regions;
|
region *regions;
|
||||||
faction *factions;
|
faction *factions;
|
||||||
settings global;
|
settings global;
|
||||||
|
|
|
@ -164,7 +164,9 @@ struct xml_stack;
|
||||||
#define ALLIANCES_VERSION 313
|
#define ALLIANCES_VERSION 313
|
||||||
#define DBLINK_VERSION 314
|
#define DBLINK_VERSION 314
|
||||||
#define CURSEVIGOURISFLOAT_VERSION 315
|
#define CURSEVIGOURISFLOAT_VERSION 315
|
||||||
#define REGIONOWNERS_VERSION 316
|
#define SAVEXMLNAME_VERSION 316
|
||||||
|
|
||||||
|
#define REGIONOWNERS_VERSION 317
|
||||||
|
|
||||||
#define MIN_VERSION ALLIANCES_VERSION
|
#define MIN_VERSION ALLIANCES_VERSION
|
||||||
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
|
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
|
||||||
|
@ -172,7 +174,7 @@ struct xml_stack;
|
||||||
#ifdef REGIONOWNERS
|
#ifdef REGIONOWNERS
|
||||||
# define RELEASE_VERSION REGIONOWNERS_VERSION
|
# define RELEASE_VERSION REGIONOWNERS_VERSION
|
||||||
#else
|
#else
|
||||||
# define RELEASE_VERSION CURSEVIGOURISFLOAT_VERSION
|
# define RELEASE_VERSION SAVEXMLNAME_VERSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if RESOURCE_CONVERSION
|
#if RESOURCE_CONVERSION
|
||||||
|
@ -888,6 +890,7 @@ typedef struct request {
|
||||||
} request;
|
} request;
|
||||||
|
|
||||||
extern int turn;
|
extern int turn;
|
||||||
|
extern char *xmlfile;
|
||||||
|
|
||||||
/* parteinummern */
|
/* parteinummern */
|
||||||
extern int *used_faction_ids;
|
extern int *used_faction_ids;
|
||||||
|
|
|
@ -887,7 +887,32 @@ readgame(const char * filename, int backup)
|
||||||
#else
|
#else
|
||||||
assert(global.data_version >= NEWSOURCE_VERSION);
|
assert(global.data_version >= NEWSOURCE_VERSION);
|
||||||
#endif
|
#endif
|
||||||
if (global.data_version >= GLOBAL_ATTRIB_VERSION) a_read(F, &global.attribs);
|
if(global.data_version >= SAVEXMLNAME_VERSION) {
|
||||||
|
char basefile[1024];
|
||||||
|
char *basearg;
|
||||||
|
|
||||||
|
rs(F, basefile);
|
||||||
|
if(xmlfile != NULL) {
|
||||||
|
basearg = strrchr(xmlfile, '/');
|
||||||
|
if(!basearg) {
|
||||||
|
basearg = xmlfile;
|
||||||
|
} else {
|
||||||
|
basearg++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
basearg = "(null)";
|
||||||
|
}
|
||||||
|
if(strcmp(basearg, basefile)) {
|
||||||
|
printf("WARNING: xmlfile mismatch:\n");
|
||||||
|
printf("WARNING: datafile contains %s\n", basefile);
|
||||||
|
printf("WARNING: argument/default is %s\n", basearg);
|
||||||
|
printf("WARNING: any key to continue, Ctrl-C to stop\n");
|
||||||
|
getchar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (global.data_version >= GLOBAL_ATTRIB_VERSION) {
|
||||||
|
a_read(F, &global.attribs);
|
||||||
|
}
|
||||||
#ifndef COMPATIBILITY
|
#ifndef COMPATIBILITY
|
||||||
if (global.data_version < ITEMTYPE_VERSION) {
|
if (global.data_version < ITEMTYPE_VERSION) {
|
||||||
fprintf(stderr, "kann keine alten datenfiles einlesen");
|
fprintf(stderr, "kann keine alten datenfiles einlesen");
|
||||||
|
@ -1308,6 +1333,7 @@ export_players(const char * path)
|
||||||
int
|
int
|
||||||
writegame(const char *filename, char quiet)
|
writegame(const char *filename, char quiet)
|
||||||
{
|
{
|
||||||
|
char *base;
|
||||||
int i,n;
|
int i,n;
|
||||||
faction *f;
|
faction *f;
|
||||||
region *r;
|
region *r;
|
||||||
|
@ -1340,6 +1366,14 @@ writegame(const char *filename, char quiet)
|
||||||
wi(F, RELEASE_VERSION);
|
wi(F, RELEASE_VERSION);
|
||||||
wnl(F);
|
wnl(F);
|
||||||
|
|
||||||
|
base = strrchr(xmlfile, '/');
|
||||||
|
if(base) {
|
||||||
|
ws(F, base+1);
|
||||||
|
} else {
|
||||||
|
ws(F, xmlfile);
|
||||||
|
}
|
||||||
|
wnl(F);
|
||||||
|
|
||||||
a_write(F, global.attribs);
|
a_write(F, global.attribs);
|
||||||
wnl(F);
|
wnl(F);
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,6 @@ extern int fuzzy_hits;
|
||||||
** global variables that we are exporting
|
** global variables that we are exporting
|
||||||
**/
|
**/
|
||||||
static char * orders = NULL;
|
static char * orders = NULL;
|
||||||
static char * xmlfile = NULL;
|
|
||||||
static int nowrite = 0;
|
static int nowrite = 0;
|
||||||
static boolean g_writemap = false;
|
static boolean g_writemap = false;
|
||||||
static boolean g_killeiswald = false;
|
static boolean g_killeiswald = false;
|
||||||
|
@ -522,6 +521,9 @@ static int
|
||||||
read_args(int argc, char **argv)
|
read_args(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
xmlfile = NULL;
|
||||||
|
|
||||||
for (i=1;i!=argc;++i) {
|
for (i=1;i!=argc;++i) {
|
||||||
if (argv[i][0]!='-') {
|
if (argv[i][0]!='-') {
|
||||||
return usage(argv[0], argv[i]);
|
return usage(argv[0], argv[i]);
|
||||||
|
|
|
@ -132,7 +132,6 @@ extern int fuzzy_hits;
|
||||||
** global variables that we are exporting
|
** global variables that we are exporting
|
||||||
**/
|
**/
|
||||||
static char * orders = NULL;
|
static char * orders = NULL;
|
||||||
static char * xmlfile = NULL;
|
|
||||||
static int nowrite = 0;
|
static int nowrite = 0;
|
||||||
static boolean g_writemap = false;
|
static boolean g_writemap = false;
|
||||||
static boolean opt_reportonly = false;
|
static boolean opt_reportonly = false;
|
||||||
|
|
|
@ -76,8 +76,6 @@ extern int maxregions;
|
||||||
extern boolean dirtyload;
|
extern boolean dirtyload;
|
||||||
char datafile[256];
|
char datafile[256];
|
||||||
|
|
||||||
static char * xmlfile = NULL;
|
|
||||||
|
|
||||||
/* -------------------- resizeterm ------------------------------------- */
|
/* -------------------- resizeterm ------------------------------------- */
|
||||||
|
|
||||||
short Signals = 0;
|
short Signals = 0;
|
||||||
|
|
Loading…
Reference in New Issue