remove global variable `verbosity` in favor of static in main.c (use log_* functions everywhere)

This commit is contained in:
Enno Rehling 2015-09-12 20:58:09 +02:00
parent 06a04d0e20
commit a027139057
9 changed files with 18 additions and 32 deletions

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

@ -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

@ -4064,10 +4064,10 @@ void process(void)
region *r;
processor *pglobal = proc;
log_debug("- Step %u\n", prio);
log_debug("- Step %u", prio);
while (proc && proc->priority == prio) {
if (proc->name && verbosity >= 1)
log_debug(" - %s\n", proc->name);
if (proc->name)
log_debug(" - %s", proc->name);
proc = proc->next;
}

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)
{

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;

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