improve logging information (missing race, log levels)

do nothing when thre is no peasant blood
This commit is contained in:
Enno Rehling 2014-06-01 11:07:22 +02:00
parent 5ee99f97d2
commit 6f29e4dab5
4 changed files with 16 additions and 7 deletions

View File

@ -2,7 +2,6 @@
GAME=$1
BIN=$HOME/bin
export ERESSEA=$HOME/eressea
export PATH
TURN=$(cat $ERESSEA/game-$GAME/turn)
if [ ! -e $ERESSEA/game-$GAME/data/$TURN.dat ]; then
echo "data file $TURN is missing, cannot run turn for game $GAME"
@ -13,6 +12,7 @@ if [ -d $REPORTS ]; then
rm -rf $REPORTS
fi
mkdir $REPORTS
$BIN/backup-eressea $GAME
$BIN/run-turn.sh $GAME
if [ ! -s $ERESSEA/game-$GAME/orders.$TURN ]; then
echo "server did not create orders for turn $TURN in game $GAME"
@ -29,3 +29,4 @@ if [ ! -s $REPORTS/reports.txt ]; then
fi
$BIN/compress.sh $GAME $TURN
$BIN/sendreports.sh $GAME
$BIN/backup-eressea $GAME

View File

@ -1269,6 +1269,9 @@ faction *readfaction(struct gamedata * data)
READ_INT(data->store, &f->age);
READ_STR(data->store, name, sizeof(name));
f->race = rc_find(name);
if (!f->race) {
log_error("unknown race in data: %s\n", name);
}
assert(f->race);
READ_INT(data->store, &n);
f->magiegebiet = (magic_t)n;

View File

@ -307,8 +307,10 @@ void get_food(region * r)
while (donor != NULL && hungry > 0) {
int blut = get_effect(donor, pt_blood);
blut = _min(blut, hungry);
if (blut) {
change_effect(donor, pt_blood, -blut);
hungry -= blut;
}
if (donor == u)
donor = r->units;
while (donor != NULL) {
@ -3496,6 +3498,9 @@ int checkunitnumber(const faction * f, int add)
number of units allowed in an alliance */
faction *f2;
int unitsinalliance = fno;
if (unitsinalliance > alimit) {
return 1;
}
for (f2 = factions; f2; f2 = f2->next) {
if (f != f2 && f->alliance == f2->alliance) {

View File

@ -236,7 +236,7 @@ int findtoken(const void * root, const char *key, variant * result)
if (ret != 0) {
/* encoding is broken. youch */
log_debug("findtoken | encoding error in '%s'\n", key);
log_error("findtoken | encoding error in '%s'\n", key);
return E_TOK_NOMATCH;
}
#if NODEHASHSIZE == 8
@ -249,7 +249,7 @@ int findtoken(const void * root, const char *key, variant * result)
ref = ref->nexthash;
str += len;
if (!ref) {
log_debug("findtoken | token not found '%s'\n", key);
log_info("findtoken | token not found '%s'\n", key);
return E_TOK_NOMATCH;
}
tk = ref->node;
@ -258,6 +258,6 @@ int findtoken(const void * root, const char *key, variant * result)
*result = tk->id;
return E_TOK_SUCCESS;
}
log_debug("findtoken | token not found '%s'\n", key);
log_info("findtoken | token not found '%s'\n", key);
return E_TOK_NOMATCH;
}