fix logging for sp_igjarjuk, temporarily set log-levels for the game to error|warn|info

remove some code that accesses `verbosity` variable (todo: hide it more, fix logging)
This commit is contained in:
Enno Rehling 2015-09-12 19:48:03 +02:00
parent 28f17b6a08
commit 06a04d0e20
11 changed files with 57 additions and 76 deletions

View File

@ -9,6 +9,6 @@ fi
cd $ERESSEA/game-$GAME
echo "running turn $TURN, game $GAME"
$ERESSEA/server/bin/eressea -v1 -t $TURN run-turn.lua
$ERESSEA/server/bin/eressea -v3 -t $TURN run-turn.lua
mkdir -p log
ln -f eressea.log log/eressea.log.$TURN

View File

@ -81,7 +81,6 @@ without prior permission by the authors of Eressea.
#include <string.h>
/* imports */
extern int verbosity;
bool opt_cr_absolute_coords = false;
/* globals */

View File

@ -608,8 +608,7 @@ void remove_empty_factions(void)
ursprung *ur = f->ursprung;
while (ur && ur->id != 0)
ur = ur->next;
if (verbosity >= 2)
log_printf(stdout, "\t%s\n", factionname(f));
log_debug("dead: %s", factionname(f));
/* Einfach in eine Datei schreiben und später vermailen */

View File

@ -4064,11 +4064,10 @@ void process(void)
region *r;
processor *pglobal = proc;
if (verbosity >= 3)
printf("- Step %u\n", prio);
log_debug("- Step %u\n", prio);
while (proc && proc->priority == prio) {
if (proc->name && verbosity >= 1)
log_printf(stdout, " - %s\n", proc->name);
log_debug(" - %s\n", proc->name);
proc = proc->next;
}
@ -4164,8 +4163,7 @@ void process(void)
}
}
if (verbosity >= 3)
printf("\n - Leere Gruppen loeschen...\n");
log_debug("\n - Leere Gruppen loeschen...\n");
for (f = factions; f; f = f->next) {
group **gp = &f->groups;
while (*gp) {

View File

@ -88,9 +88,7 @@ list_selection *do_selection(list_selection * sel, const char *title,
width = (int)strlen(s->str);
}
++height;
if (verbosity >= 5) {
log_printf(stdout, "s %s w %d h %d\n", s->str, width, height);
}
log_debug("s %s w %d h %d\n", s->str, width, height);
}
if (height == 0 || width == 0)
return 0;
@ -99,8 +97,7 @@ list_selection *do_selection(list_selection * sel, const char *title,
if (height + 2 > SY)
height = SY - 2;
if (verbosity >= 5)
log_printf(stdout, "w %d h %d\n", width, height);
log_debug("w %d h %d\n", width, height);
wn =
newwin(height + 2, width + 4, (SY - height - 2) / 2, (SX - width - 4) / 2);

View File

@ -202,10 +202,10 @@ static int parse_args(int argc, char **argv, int *exitcode)
log_stderr = LOG_CPERROR | LOG_CPWARNING;
break;
case 3:
log_stderr = LOG_CPERROR | LOG_CPWARNING | LOG_CPDEBUG;
log_stderr = LOG_CPERROR | LOG_CPWARNING | LOG_CPINFO;
break;
default:
log_stderr = LOG_CPERROR | LOG_CPWARNING | LOG_CPDEBUG | LOG_CPINFO;
log_stderr = LOG_CPERROR | LOG_CPWARNING | LOG_CPINFO | LOG_CPDEBUG;
break;
}

View File

@ -943,11 +943,9 @@ void spawn_dragons(void)
fset(u, UFL_ISNEW | UFL_MOVED);
equip_unit(u, get_equipment("monster_dragon"));
if (verbosity >= 2) {
log_printf(stdout, "%d %s in %s.\n", u->number,
log_debug("spawning %d %s in %s.\n", u->number,
LOC(default_locale,
rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
}
name_unit(u);
@ -976,6 +974,7 @@ void spawn_undead(void)
/* Chance 0.1% * chaosfactor */
if (r->land && unburied > r->land->peasants / 20
&& rng_int() % 10000 < (100 + 100 * chaosfactor(r))) {
message *msg;
unit *u;
/* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen.
* Lieber sammeln lassen, bis sie mindestens 5% der Bevölkerung sind, und
@ -1018,14 +1017,10 @@ void spawn_undead(void)
deathcounts(r, -undead);
name_unit(u);
if (verbosity >= 2) {
log_printf(stdout, "%d %s in %s.\n", u->number,
log_debug("spawning %d %s in %s.\n", u->number,
LOC(default_locale,
rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
}
{
message *msg = msg_message("undeadrise", "region", r);
msg = msg_message("undeadrise", "region", r);
add_message(&r->msgs, msg);
for (u = r->units; u; u = u->next)
freset(u->faction, FFL_SELECT);
@ -1036,7 +1031,6 @@ void spawn_undead(void)
add_message(&u->faction->msgs, msg);
}
msg_release(msg);
}
}
else {
int i = deathcount(r);

View File

@ -1681,9 +1681,7 @@ int write_reports(faction * f, time_t ltime)
log_warning("errno was %d before writing reports", errno);
errno = 0;
}
if (verbosity >= 2) {
log_printf(stdout, "Reports for %s:", factionname(f));
}
log_debug("Reports for %s:", factionname(f));
for (rtype = report_types; rtype != NULL; rtype = rtype->next) {
if (f->options & rtype->flag) {
int error;
@ -1795,9 +1793,7 @@ int reports(void)
int retval = 0;
char path[MAX_PATH];
if (verbosity >= 1) {
log_printf(stdout, "Writing reports for turn %d:", turn);
}
log_info("Writing reports for turn %d:", turn);
report_donations();
remove_empty_units();

View File

@ -872,9 +872,7 @@ static fighter *summon_allies(const fighter *fi, const race *rc, int number) {
a->data.ca[1] = 100;
a_add(&u->attribs, a);
msg =
msg_message("sp_wolfhowl_effect", "mage amount race",
mage, u->number, rc);
msg = msg_message("sp_wolfhowl_effect", "mage amount race", mage, u->number, rc);
message_all(b, msg);
msg_release(msg);
@ -883,12 +881,12 @@ static fighter *summon_allies(const fighter *fi, const race *rc, int number) {
int sp_igjarjuk(castorder *co) {
unit *u;
fighter * fi = co->magician.fig;
fighter *fm = co->magician.fig, *fi;
const race *rc = get_race(RC_WYRM);
fi = summon_allies(fi, rc, 1);
fi = summon_allies(fm, rc, 1);
u = fi->unit;
unit_setname(u, "Igjarjuk");
log_debug("%s calls a wyrm in %s", unitname(fi->unit), regionname(u->region, 0));
log_info("%s summons Igjarjuk in %s", unitname(fm->unit), regionname(u->region, 0));
return co->level;
}

View File

@ -17,40 +17,40 @@
extern "C" {
#endif
struct fighter;
struct castorder;
/* Kampfzauber */
extern int sp_fumbleshield(struct castorder * co);
extern int sp_shadowknights(struct castorder * co);
extern int sp_combatrosthauch(struct castorder * co);
extern int sp_kampfzauber(struct castorder * co);
extern int sp_healing(struct castorder * co);
extern int sp_keeploot(struct castorder * co);
extern int sp_reanimate(struct castorder * co);
extern int sp_chaosrow(struct castorder * co);
extern int sp_flee(struct castorder * co);
extern int sp_berserk(struct castorder * co);
extern int sp_tiredsoldiers(struct castorder * co);
extern int sp_reeling_arrows(struct castorder * co);
extern int sp_denyattack(struct castorder * co);
extern int sp_sleep(struct castorder * co);
extern int sp_windshield(struct castorder * co);
extern int sp_strong_wall(struct castorder * co);
extern int sp_petrify(struct castorder * co);
extern int sp_hero(struct castorder * co);
extern int sp_frighten(struct castorder * co);
extern int sp_mindblast(struct castorder * co);
extern int sp_mindblast_temp(struct castorder * co);
extern int sp_speed(struct castorder * co);
extern int sp_wolfhowl(struct castorder * co);
extern int sp_igjarjuk(struct castorder * co);
extern int sp_dragonodem(struct castorder * co);
extern int sp_reduceshield(struct castorder * co);
extern int sp_armorshield(struct castorder * co);
extern int sp_stun(struct castorder * co);
extern int sp_undeadhero(struct castorder * co);
extern int sp_shadowcall(struct castorder * co);
extern int sp_immolation(struct castorder * co);
int sp_fumbleshield(struct castorder * co);
int sp_shadowknights(struct castorder * co);
int sp_combatrosthauch(struct castorder * co);
int sp_kampfzauber(struct castorder * co);
int sp_healing(struct castorder * co);
int sp_keeploot(struct castorder * co);
int sp_reanimate(struct castorder * co);
int sp_chaosrow(struct castorder * co);
int sp_flee(struct castorder * co);
int sp_berserk(struct castorder * co);
int sp_tiredsoldiers(struct castorder * co);
int sp_reeling_arrows(struct castorder * co);
int sp_denyattack(struct castorder * co);
int sp_sleep(struct castorder * co);
int sp_windshield(struct castorder * co);
int sp_strong_wall(struct castorder * co);
int sp_petrify(struct castorder * co);
int sp_hero(struct castorder * co);
int sp_frighten(struct castorder * co);
int sp_mindblast(struct castorder * co);
int sp_mindblast_temp(struct castorder * co);
int sp_speed(struct castorder * co);
int sp_wolfhowl(struct castorder * co);
int sp_igjarjuk(struct castorder * co);
int sp_dragonodem(struct castorder * co);
int sp_reduceshield(struct castorder * co);
int sp_armorshield(struct castorder * co);
int sp_stun(struct castorder * co);
int sp_undeadhero(struct castorder * co);
int sp_shadowcall(struct castorder * co);
int sp_immolation(struct castorder * co);
#ifdef __cplusplus
}

View File

@ -30,8 +30,8 @@ extern "C" {
#define LOG_FLUSH 0x01
#define LOG_CPWARNING 0x02
#define LOG_CPERROR 0x04
#define LOG_CPDEBUG 0x08
#define LOG_CPINFO 0x10
#define LOG_CPINFO 0x08
#define LOG_CPDEBUG 0x10
extern int log_flags;
extern int log_stderr;