Merge pull request #299 from ennorehling/master

fix logging for sp_igjarjuk
This commit is contained in:
Enno Rehling 2015-09-12 22:44:40 +02:00
commit b93a75c529
18 changed files with 73 additions and 106 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

@ -3757,8 +3757,6 @@ static int battle_report(battle * b)
}
}
if (verbosity > 0)
log_printf(stdout, " %d", b->turn);
fflush(stdout);
for (bf = b->factions; bf; bf = bf->next) {
@ -4349,8 +4347,7 @@ void do_battle(region * r)
do_combatmagic(b, DO_PRECOMBATSPELL);
print_stats(b); /* gibt die Kampfaufstellung aus */
if (verbosity > 0)
log_printf(stdout, "%s (%d, %d) : ", rname(r, default_locale), r->x, r->y);
log_debug("battle in %s (%d, %d) : ", regionname(r, 0), r->x, r->y);
for (; battle_report(b) && b->turn <= max_turns; ++b->turn) {
if (bdebug) {
@ -4362,9 +4359,6 @@ void do_battle(region * r)
}
if (verbosity > 0)
log_printf(stdout, "\n");
/* Auswirkungen berechnen: */
aftermath(b);
if (rule_force_leave(FORCE_LEAVE_POSTCOMBAT)) {

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

@ -438,8 +438,6 @@ static attrib_type at_npcfaction = {
ATF_UNIQUE
};
int verbosity = 1;
FILE *debug;
/* ----------------------------------------------------------------------- */

View File

@ -313,28 +313,10 @@ extern "C" {
extern bool battledebug;
extern bool sqlpatch;
extern bool lomem; /* save memory */
extern int turn;
extern int verbosity;
/** report options **/
extern const char *options[MAXOPTIONS];
extern struct helpmode helpmodes[];
extern const char *parameters[];
extern const char *localenames[];
extern settings global;
extern bool battledebug;
extern bool sqlpatch;
extern bool lomem; /* save memory */
extern int turn;
extern int verbosity;
extern bool getunitpeasants;
/** report options **/
extern const char *options[MAXOPTIONS];
extern const char *options[MAXOPTIONS]; /* report options */
#ifdef __cplusplus
}

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", prio);
while (proc && proc->priority == prio) {
if (proc->name && verbosity >= 1)
log_printf(stdout, " - %s\n", proc->name);
if (proc->name)
log_debug(" - %s", 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

@ -44,6 +44,7 @@ static const char *logfile = "eressea.log";
static const char *luafile = 0;
static const char *inifile = "eressea.ini";
static int memdebug = 0;
static int verbosity = 1;
static void load_inifile(dictionary * d)
{
@ -202,10 +203,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,
LOC(default_locale,
rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL)), regionname(r, NULL));
}
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,
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);
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));
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

@ -96,7 +96,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <limits.h>
#include <stdlib.h>
extern int verbosity;
extern int *storms;
extern int weeks_per_month;
extern int months_per_year;

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;

BIN
tests/data/test.dat Normal file

Binary file not shown.

3
tests/orders.txt Normal file
View File

@ -0,0 +1,3 @@
ERESSEA 72vx "naeg86"
EINHEIT nqLx
BENENNEN EINHEIT 'Goldene Herde'

9
tests/runtests.bat Normal file
View File

@ -0,0 +1,9 @@
@ECHO OFF
SET BUILD=..\build-vs12\eressea\Debug\
SET SERVER=%BUILD%\eressea.exe
%BUILD%\test_eressea.exe
%SERVER% ..\scripts\run-tests.lua
%SERVER% ..\scripts\run-tests-e2.lua
%SERVER% ..\scripts\run-tests-e3.lua
PAUSE
RMDIR /s /q reports