forked from github/server
improve logging information (missing race, log levels)
do nothing when thre is no peasant blood
This commit is contained in:
parent
5ee99f97d2
commit
6f29e4dab5
|
@ -2,7 +2,6 @@
|
||||||
GAME=$1
|
GAME=$1
|
||||||
BIN=$HOME/bin
|
BIN=$HOME/bin
|
||||||
export ERESSEA=$HOME/eressea
|
export ERESSEA=$HOME/eressea
|
||||||
export PATH
|
|
||||||
TURN=$(cat $ERESSEA/game-$GAME/turn)
|
TURN=$(cat $ERESSEA/game-$GAME/turn)
|
||||||
if [ ! -e $ERESSEA/game-$GAME/data/$TURN.dat ]; then
|
if [ ! -e $ERESSEA/game-$GAME/data/$TURN.dat ]; then
|
||||||
echo "data file $TURN is missing, cannot run turn for game $GAME"
|
echo "data file $TURN is missing, cannot run turn for game $GAME"
|
||||||
|
@ -13,6 +12,7 @@ if [ -d $REPORTS ]; then
|
||||||
rm -rf $REPORTS
|
rm -rf $REPORTS
|
||||||
fi
|
fi
|
||||||
mkdir $REPORTS
|
mkdir $REPORTS
|
||||||
|
$BIN/backup-eressea $GAME
|
||||||
$BIN/run-turn.sh $GAME
|
$BIN/run-turn.sh $GAME
|
||||||
if [ ! -s $ERESSEA/game-$GAME/orders.$TURN ]; then
|
if [ ! -s $ERESSEA/game-$GAME/orders.$TURN ]; then
|
||||||
echo "server did not create orders for turn $TURN in game $GAME"
|
echo "server did not create orders for turn $TURN in game $GAME"
|
||||||
|
@ -29,3 +29,4 @@ if [ ! -s $REPORTS/reports.txt ]; then
|
||||||
fi
|
fi
|
||||||
$BIN/compress.sh $GAME $TURN
|
$BIN/compress.sh $GAME $TURN
|
||||||
$BIN/sendreports.sh $GAME
|
$BIN/sendreports.sh $GAME
|
||||||
|
$BIN/backup-eressea $GAME
|
||||||
|
|
|
@ -1269,7 +1269,10 @@ faction *readfaction(struct gamedata * data)
|
||||||
READ_INT(data->store, &f->age);
|
READ_INT(data->store, &f->age);
|
||||||
READ_STR(data->store, name, sizeof(name));
|
READ_STR(data->store, name, sizeof(name));
|
||||||
f->race = rc_find(name);
|
f->race = rc_find(name);
|
||||||
assert(f->race);
|
if (!f->race) {
|
||||||
|
log_error("unknown race in data: %s\n", name);
|
||||||
|
}
|
||||||
|
assert(f->race);
|
||||||
READ_INT(data->store, &n);
|
READ_INT(data->store, &n);
|
||||||
f->magiegebiet = (magic_t)n;
|
f->magiegebiet = (magic_t)n;
|
||||||
|
|
||||||
|
|
|
@ -307,8 +307,10 @@ void get_food(region * r)
|
||||||
while (donor != NULL && hungry > 0) {
|
while (donor != NULL && hungry > 0) {
|
||||||
int blut = get_effect(donor, pt_blood);
|
int blut = get_effect(donor, pt_blood);
|
||||||
blut = _min(blut, hungry);
|
blut = _min(blut, hungry);
|
||||||
change_effect(donor, pt_blood, -blut);
|
if (blut) {
|
||||||
hungry -= blut;
|
change_effect(donor, pt_blood, -blut);
|
||||||
|
hungry -= blut;
|
||||||
|
}
|
||||||
if (donor == u)
|
if (donor == u)
|
||||||
donor = r->units;
|
donor = r->units;
|
||||||
while (donor != NULL) {
|
while (donor != NULL) {
|
||||||
|
@ -3496,6 +3498,9 @@ int checkunitnumber(const faction * f, int add)
|
||||||
number of units allowed in an alliance */
|
number of units allowed in an alliance */
|
||||||
faction *f2;
|
faction *f2;
|
||||||
int unitsinalliance = fno;
|
int unitsinalliance = fno;
|
||||||
|
if (unitsinalliance > alimit) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
for (f2 = factions; f2; f2 = f2->next) {
|
for (f2 = factions; f2; f2 = f2->next) {
|
||||||
if (f != f2 && f->alliance == f2->alliance) {
|
if (f != f2 && f->alliance == f2->alliance) {
|
||||||
|
|
|
@ -236,7 +236,7 @@ int findtoken(const void * root, const char *key, variant * result)
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
/* encoding is broken. youch */
|
/* 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;
|
return E_TOK_NOMATCH;
|
||||||
}
|
}
|
||||||
#if NODEHASHSIZE == 8
|
#if NODEHASHSIZE == 8
|
||||||
|
@ -249,7 +249,7 @@ int findtoken(const void * root, const char *key, variant * result)
|
||||||
ref = ref->nexthash;
|
ref = ref->nexthash;
|
||||||
str += len;
|
str += len;
|
||||||
if (!ref) {
|
if (!ref) {
|
||||||
log_debug("findtoken | token not found '%s'\n", key);
|
log_info("findtoken | token not found '%s'\n", key);
|
||||||
return E_TOK_NOMATCH;
|
return E_TOK_NOMATCH;
|
||||||
}
|
}
|
||||||
tk = ref->node;
|
tk = ref->node;
|
||||||
|
@ -258,6 +258,6 @@ int findtoken(const void * root, const char *key, variant * result)
|
||||||
*result = tk->id;
|
*result = tk->id;
|
||||||
return E_TOK_SUCCESS;
|
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;
|
return E_TOK_NOMATCH;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue