- Neue Option -R erstellt nur die Reports neu.

This commit is contained in:
Christian Schlittchen 2003-11-10 09:19:07 +00:00
parent 9a3c1cbae7
commit 7734965ed6
1 changed files with 13 additions and 49 deletions

View File

@ -125,6 +125,7 @@ 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;
static boolean opt_reportonly = false;
struct settings global = { struct settings global = {
"Eressea", /* gamename */ "Eressea", /* gamename */
@ -497,6 +498,7 @@ usage(const char * prog, const char * arg)
"-t turn : read this datafile, not the most current one\n" "-t turn : read this datafile, not the most current one\n"
"-o reportdir : gibt das reportverzeichnis an\n" "-o reportdir : gibt das reportverzeichnis an\n"
"-l logfile : specify an alternative logfile\n" "-l logfile : specify an alternative logfile\n"
"-R : erstellt nur die Reports neu\n"
"--noeiswald : beruhigt ungemein\n" "--noeiswald : beruhigt ungemein\n"
"--nomsg : keine Messages (RAM sparen)\n" "--nomsg : keine Messages (RAM sparen)\n"
"--nobattle : keine Kämpfe\n" "--nobattle : keine Kämpfe\n"
@ -593,6 +595,9 @@ read_args(int argc, char **argv)
case 'w': case 'w':
g_writemap = true; g_writemap = true;
break; break;
case 'R':
opt_reportonly = true;
break;
default: default:
usage(argv[0], argv[i]); usage(argv[0], argv[i]);
} }
@ -733,59 +738,18 @@ main(int argc, char *argv[])
for (u=r->units;u;u=u->next) scale_number(u, 1); for (u=r->units;u;u=u->next) scale_number(u, 1);
} }
} }
if (g_writemap) return crwritemap();
if (demonfix==2) { if (opt_reportonly) {
FILE * F = fopen("demons.fix", "r"); reports();
for (;;) { return 0;
int x, y, id, fno, size, age, number;
unit * u;
if (fscanf(F, "%d %d %d %d %d %d %d", &id, &age, &fno, &x, &y, &size, &number)<=0) break;
u = findunit(id);
if (u==NULL || u->faction->no!=fno) {
region * r = findregion(x, y);
if (r) for (u=r->units;u;u=u->next) if (u->number==number && u->age==age && u->faction->no==fno) break;
}
if (!u) {
log_error(("could not find unit %s and fix it!\n", itoa36(id)));
}
else u->skill_size = 0;
while (size--) {
int sk, value, weeks;
if (fscanf(F, "%d %d %d", &sk, &value, &weeks)<=0) break;
if (u) {
skill * sv = add_skill(u, (skill_t)sk);
sv->level = (unsigned char)value;
sv->weeks = (unsigned char)weeks;
}
else {
log_error((" %s[%u] : %u/%u\n", skillname((skill_t)sk, default_locale), sk, value, weeks));
}
}
}
fclose(F);
} }
if ((i=processturn(orders))!=0) return i; if (g_writemap) {
return crwritemap();
}
if (demonfix==1) { if ((i=processturn(orders))!=0) {
region * r; return i;
FILE * F = fopen("demons.fix", "w");
for (r=regions;r;r=r->next) {
unit * u;
for (u=r->units;u;u=u->next) {
if (u->number && fval(u, UFL_DEBUG)) {
skill * sv;
fprintf(F, "%d %d %d %d %d %d %d\n", u->no, u->age, u->faction->no, r->x, r->y, u->skill_size, u->number);
for (sv=u->skills;sv!=u->skills+u->skill_size;++sv) {
fprintf(F, "%d %d %d\n", sv->id, sv->level, sv->weeks);
}
fputc('\n', F);
}
}
}
fclose(F);
exit(0);
} }
#ifdef CLEANUP_CODE #ifdef CLEANUP_CODE