forked from github/server
lua write_reports() kann jetzt theoretisch einen Fehler zurückliefern, aber tut das (noch) nicht, weil ich dafür Fehlerchecks in den Report-Routinen brauche. Hier ist aber definitiv die nächste Baustelle, auch das gezielte Schreiben einzelner Reports ist wirklich an der Zeit.
This commit is contained in:
parent
1e17981a1f
commit
0bcac1de15
6 changed files with 48 additions and 42 deletions
|
@ -1083,7 +1083,7 @@ get_seen_interval(region ** first, region ** last)
|
|||
}
|
||||
|
||||
/* main function of the creport. creates the header and traverses all regions */
|
||||
void
|
||||
int
|
||||
report_computer(FILE * F, faction * f, const faction_list * addresses,
|
||||
const time_t report_time)
|
||||
{
|
||||
|
@ -1525,4 +1525,5 @@ report_computer(FILE * F, faction * f, const faction_list * addresses,
|
|||
report_crtypes(F, f->locale);
|
||||
write_translations(F);
|
||||
reset_translations();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ extern "C" {
|
|||
struct faction_list;
|
||||
struct seen_region;
|
||||
struct faction;
|
||||
extern void report_computer(FILE * F, struct faction * f,
|
||||
extern int report_computer(FILE * F, struct faction * f,
|
||||
const struct faction_list * addresses, const time_t report_time);
|
||||
extern void creport_cleanup(void);
|
||||
extern void creport_init(void);
|
||||
|
|
|
@ -1575,7 +1575,7 @@ buildingmaintenance(const building * b, const resource_type * rtype)
|
|||
return cost;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
order_template(FILE * F, faction * f)
|
||||
{
|
||||
region *r;
|
||||
|
@ -1690,6 +1690,7 @@ order_template(FILE * F, faction * f)
|
|||
sprintf(buf, LOC(f->locale, parameters[P_NEXT]));
|
||||
rps_nowrap(F, buf);
|
||||
rnl(F);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1978,7 +1979,7 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
|
|||
rpunit(F, f, u, 6, mode);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
report(FILE *F, faction * f, const faction_list * addresses,
|
||||
const char * pzTime)
|
||||
{
|
||||
|
@ -2408,6 +2409,7 @@ report(FILE *F, faction * f, const faction_list * addresses,
|
|||
list_address(F, f, addresses);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
FILE *
|
||||
|
@ -2685,7 +2687,7 @@ struct fsee {
|
|||
} * see;
|
||||
} * fsee[FMAXHASH];
|
||||
|
||||
void
|
||||
int
|
||||
reports(void)
|
||||
{
|
||||
faction *f;
|
||||
|
@ -2741,9 +2743,10 @@ reports(void)
|
|||
sprintf(buf, "%s/%d-%s.nr", reportpath(), turn, factionid(f));
|
||||
F = cfopen(buf, "wt");
|
||||
if (F) {
|
||||
report(F, f, addresses, pzTime);
|
||||
int status = report(F, f, addresses, pzTime);
|
||||
fclose(F);
|
||||
gotit = true;
|
||||
if (status!=0) return status; /* catch errors */
|
||||
}
|
||||
}
|
||||
/* CR schreiben: */
|
||||
|
@ -2751,9 +2754,10 @@ reports(void)
|
|||
sprintf(buf, "%s/%d-%s.cr", reportpath(), turn, factionid(f));
|
||||
F = cfopen(buf, "wt");
|
||||
if (F) {
|
||||
report_computer(F, f, addresses, ltime);
|
||||
int status = report_computer(F, f, addresses, ltime);
|
||||
fclose(F);
|
||||
gotit = true;
|
||||
if (status!=0) return status; /* catch errors */
|
||||
}
|
||||
}
|
||||
/* ZV schreiben: */
|
||||
|
@ -2761,8 +2765,9 @@ reports(void)
|
|||
sprintf(buf, "%s/%d-%s.txt", reportpath(), turn, factionid(f));
|
||||
F = cfopen(buf, "wt");
|
||||
if (F) {
|
||||
order_template(F, f);
|
||||
int status = order_template(F, f);
|
||||
fclose(F);
|
||||
if (status!=0) return status; /* catch errors */
|
||||
}
|
||||
}
|
||||
if (f->no > 0 && f->email && BAT) {
|
||||
|
@ -2895,6 +2900,7 @@ reports(void)
|
|||
closebatch(BAT);
|
||||
current_faction = NULL;
|
||||
seen_done();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3024,7 +3030,7 @@ typedef struct summary {
|
|||
} summary;
|
||||
|
||||
summary *
|
||||
make_summary(boolean count_new)
|
||||
make_summary(void)
|
||||
{
|
||||
faction *f;
|
||||
region *r;
|
||||
|
@ -3045,8 +3051,14 @@ make_summary(boolean count_new)
|
|||
f->nregions = 0;
|
||||
f->num_total = 0;
|
||||
f->money = 0;
|
||||
if (f->alive && (count_new || f->age > 0)) s->factions++;
|
||||
}
|
||||
if (f->alive && f->units) {
|
||||
s->factions++;
|
||||
/* Problem mit Monsterpartei ... */
|
||||
if (f->no!=MONSTER_FACTION) {
|
||||
s->factionrace[old_race(f->race)]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Alles zählen */
|
||||
|
||||
|
@ -3142,13 +3154,6 @@ make_summary(boolean count_new)
|
|||
}
|
||||
}
|
||||
|
||||
/* jetzt noch parteienweise zählen */
|
||||
/* Problem mit Monsterpartei ... */
|
||||
for (f = factions; f; f = f->next) if (f->no!=MONSTER_FACTION) {
|
||||
if (f->alive && (count_new || f->age > 0)) {
|
||||
s->factionrace[old_race(f->race)]++;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,13 +46,13 @@ const char *hp_status(const struct unit * u);
|
|||
extern void spskill(const struct locale * lang, const struct unit * u, skill_t sk, int *dh, int days); /* mapper */
|
||||
extern void spunit(struct strlist ** SP, const struct faction * f, const struct unit * u, int indent, int mode);
|
||||
|
||||
void reports(void);
|
||||
int reports(void);
|
||||
|
||||
extern const struct unit *ucansee(const struct faction *f, const struct unit *u, const struct unit *x);
|
||||
|
||||
struct summary;
|
||||
extern void report_summary(struct summary * n, struct summary * o, boolean full);
|
||||
extern struct summary * make_summary(boolean count_new);
|
||||
extern struct summary * make_summary();
|
||||
|
||||
int hat_in_region(item_t itm, struct region * r, struct faction * f);
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ processturn(char *filename)
|
|||
#ifdef SHORTPWDS
|
||||
readshortpwds("passwords");
|
||||
#endif
|
||||
begin = make_summary(false);
|
||||
begin = make_summary();
|
||||
printf(" - Korrekturen Runde %d\n", turn);
|
||||
korrektur();
|
||||
turn++;
|
||||
|
@ -310,7 +310,7 @@ processturn(char *filename)
|
|||
free_units();
|
||||
puts(" - Beseitige leere Parteien");
|
||||
remove_empty_factions(true);
|
||||
end = make_summary(true);
|
||||
end = make_summary();
|
||||
report_summary(end, begin, false);
|
||||
report_summary(end, begin, true);
|
||||
free(end);
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<buildings>
|
||||
<building name="illusioncastle" capacity="0" maxcapacity="0" maxsize="0" nobuild="yes" auraregen="1.00"/>
|
||||
<building name="xmas_exit" maxsize="10" maxcapacity="2" nobuild="yes" nodestroy="yes" unique="yes" auraregen="1.00"/>
|
||||
<building name="caldera" capacity="1" nodestroy="yes" nobuild="yes" auraregen="1.00"/>
|
||||
<building name="genericbuilding" maxsize="1" nobuild="yes" auraregen="1.00"/>
|
||||
<building name="artacademy" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes" auraregen="1.00"/>
|
||||
<building name="artsculpture" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes" auraregen="1.00"/>
|
||||
<building name="illusioncastle" capacity="0" maxcapacity="0" maxsize="0" nobuild="yes"/>
|
||||
<building name="xmas_exit" maxsize="10" maxcapacity="2" nobuild="yes" nodestroy="yes" unique="yes"/>
|
||||
<building name="caldera" capacity="1" nodestroy="yes" nobuild="yes"/>
|
||||
<building name="genericbuilding" maxsize="1" nobuild="yes"/>
|
||||
<building name="artacademy" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes"/>
|
||||
<building name="artsculpture" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes"/>
|
||||
<building name="blessedstonecircle" maxcapacity="3" maxsize="100" nobuild="yes" magic="yes" magres="60" magresbonus="30" auraregen="1.50">
|
||||
<construction skill="sk_building" minskill="2" reqsize="100" maxsize="100">
|
||||
<requirement type="log" recycle="0.5" quantity="500"/>
|
||||
<requirement type="stone" recycle="0.5" quantity="500"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="stonecircle" maxsize="100" auraregen="1.00">
|
||||
<building name="stonecircle" maxsize="100">
|
||||
<construction skill="sk_building" minskill="2" reqsize="100" maxsize="100">
|
||||
<requirement type="log" recycle="0.5" quantity="500"/>
|
||||
<requirement type="stone" recycle="0.5" quantity="500"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="inn" capacity="1" auraregen="1.00">
|
||||
<building name="inn" capacity="1">
|
||||
<maintenance type="money" amount="5" variable="yes" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="2" reqsize="10">
|
||||
<requirement type="iron" recycle="0.5" quantity="10"/>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<requirement type="money" quantity="2000"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="tunnel" capacity="1" maxsize="100" auraregen="1.00">
|
||||
<building name="tunnel" capacity="1" maxsize="100">
|
||||
<maintenance type="stone" recycle="0.5" amount="2"/>
|
||||
<maintenance type="money" amount="100" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="6" reqsize="100" maxsize="100">
|
||||
|
@ -37,7 +37,7 @@
|
|||
<requirement type="money" quantity="30000"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="caravan" capacity="1" maxsize="10" auraregen="1.00">
|
||||
<building name="caravan" capacity="1" maxsize="10">
|
||||
<maintenance type="horse" amount="2"/>
|
||||
<maintenance type="money" amount="3000" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="2" reqsize="10" maxsize="10">
|
||||
|
@ -47,7 +47,7 @@
|
|||
<requirement type="money" quantity="5000"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="dam" capacity="1" maxsize="50" auraregen="1.00">
|
||||
<building name="dam" capacity="1" maxsize="50">
|
||||
<maintenance type="log" recycle="0.5" amount="3"/>
|
||||
<maintenance type="money" amount="1000" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="4" reqsize="50" maxsize="50">
|
||||
|
@ -57,7 +57,7 @@
|
|||
<requirement type="money" quantity="25000"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="monument" capacity="1" auraregen="1.00">
|
||||
<building name="monument" capacity="1">
|
||||
<construction skill="sk_building" minskill="4" reqsize="1">
|
||||
<requirement type="log" recycle="0.5" quantity="1"/>
|
||||
<requirement type="stone" recycle="0.5" quantity="1"/>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<requirement type="money" quantity="400"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="stables" capacity="1" auraregen="1.00">
|
||||
<building name="stables" capacity="1">
|
||||
<maintenance type="money" amount="150" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="2" reqsize="1">
|
||||
<requirement type="log" recycle="0.5" quantity="4"/>
|
||||
|
@ -74,7 +74,7 @@
|
|||
<requirement type="money" quantity="100"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="sawmill" capacity="1" auraregen="1.00">
|
||||
<building name="sawmill" capacity="1">
|
||||
<maintenance type="money" amount="250" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="3" reqsize="1">
|
||||
<requirement type="log" recycle="0.5" quantity="5"/>
|
||||
|
@ -83,7 +83,7 @@
|
|||
<requirement type="money" quantity="200"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="smithy" capacity="1" auraregen="1.00">
|
||||
<building name="smithy" capacity="1">
|
||||
<function name="init" value="init_smithy"/>
|
||||
<maintenance type="money" amount="300" vital="yes"/>
|
||||
<maintenance type="log" recycle="0.5" amount="1"/>
|
||||
|
@ -105,7 +105,7 @@
|
|||
<requirement type="money" quantity="25000"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="academy" maxcapacity="25" maxsize="25" auraregen="1.00">
|
||||
<building name="academy" maxcapacity="25" maxsize="25">
|
||||
<maintenance type="money" amount="1000" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="3" reqsize="25" maxsize="25">
|
||||
<requirement type="log" recycle="0.5" quantity="125"/>
|
||||
|
@ -114,7 +114,7 @@
|
|||
<requirement type="money" quantity="12500"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="harbour" capacity="1" maxcapacity="25" maxsize="25" auraregen="1.00">
|
||||
<building name="harbour" capacity="1" maxcapacity="25" maxsize="25">
|
||||
<maintenance type="money" amount="250" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="3" reqsize="25" maxsize="25">
|
||||
<requirement type="log" recycle="0.5" quantity="125"/>
|
||||
|
@ -122,7 +122,7 @@
|
|||
<requirement type="money" quantity="6250"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="quarry" capacity="1" auraregen="1.00">
|
||||
<building name="quarry" capacity="1">
|
||||
<maintenance type="money" amount="250" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="2" reqsize="1">
|
||||
<requirement type="iron" recycle="0.5" quantity="1"/>
|
||||
|
@ -131,7 +131,7 @@
|
|||
<requirement type="money" quantity="250"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="mine" capacity="1" auraregen="1.00">
|
||||
<building name="mine" capacity="1">
|
||||
<maintenance type="money" amount="500" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="4" reqsize="1">
|
||||
<requirement type="iron" recycle="0.5" quantity="1"/>
|
||||
|
@ -140,7 +140,7 @@
|
|||
<requirement type="money" quantity="250"/>
|
||||
</construction>
|
||||
</building>
|
||||
<building name="lighthouse" capacity="1" maxcapacity="4" auraregen="1.00">
|
||||
<building name="lighthouse" capacity="1" maxcapacity="4">
|
||||
<maintenance type="money" amount="100" vital="yes"/>
|
||||
<construction skill="sk_building" minskill="3" reqsize="1">
|
||||
<requirement type="iron" recycle="0.5" quantity="1"/>
|
||||
|
|
Loading…
Reference in a new issue