remove data_turn and gamename from global settings.

make run-turn.sh work without valgrind
This commit is contained in:
Enno Rehling 2017-03-13 09:19:37 +01:00
parent ba3f3a17d3
commit 8cfcffc4aa
6 changed files with 6 additions and 13 deletions

View File

@ -2,11 +2,9 @@
email = eressea-server@kn-bremen.de email = eressea-server@kn-bremen.de
sender = Eressea Server sender = Eressea Server
name = Eressea name = Eressea
base = .
report = reports report = reports
verbose = 0 verbose = 0
lomem = 0 lomem = 0
debug = 0
memcheck = 0 memcheck = 0
locales = de,en locales = de,en

View File

@ -93,9 +93,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
struct settings global = { struct settings global;
"Eressea", /* gamename */
};
bool lomem = false; bool lomem = false;
int turn = -1; int turn = -1;
@ -841,7 +839,7 @@ void free_gamedata(void)
const char * game_name(void) const char * game_name(void)
{ {
const char * param = config_get("game.name"); const char * param = config_get("game.name");
return param ? param : global.gamename; return param ? param : "Eressea";
} }
const char * game_mailcmd(void) const char * game_mailcmd(void)

View File

@ -108,9 +108,7 @@ extern "C" {
/* globale settings des Spieles */ /* globale settings des Spieles */
typedef struct settings { typedef struct settings {
const char *gamename;
struct attrib *attribs; struct attrib *attribs;
unsigned int data_turn;
void *vm_state; void *vm_state;
struct global_functions { struct global_functions {
int(*wage) (const struct region * r, const struct faction * f, int(*wage) (const struct region * r, const struct faction * f,

View File

@ -244,7 +244,7 @@ static faction *factionorders(void)
/* TODO: +1 ist ein Workaround, weil cturn erst in process_orders /* TODO: +1 ist ein Workaround, weil cturn erst in process_orders
* incrementiert wird. */ * incrementiert wird. */
f->lastorders = global.data_turn + 1; f->lastorders = turn + 1;
} }
else { else {
@ -1633,7 +1633,6 @@ int read_game(gamedata *data) {
} }
read_attribs(data, &global.attribs, NULL); read_attribs(data, &global.attribs, NULL);
READ_INT(store, &turn); READ_INT(store, &turn);
global.data_turn = turn;
log_debug(" - reading turn %d", turn); log_debug(" - reading turn %d", turn);
rng_init(turn); rng_init(turn);
READ_INT(store, NULL); /* max_unique_id = ignore */ READ_INT(store, NULL); /* max_unique_id = ignore */

View File

@ -76,7 +76,6 @@ int update_nmrs(void)
{ {
int i, newplayers = 0; int i, newplayers = 0;
faction *f; faction *f;
int turn = global.data_turn;
int timeout = NMRTimeout(); int timeout = NMRTimeout();
if (timeout>0) { if (timeout>0) {

View File

@ -28,12 +28,12 @@ while [ ! -d $ROOT/.git ]; do
ROOT=`dirname $ROOT` ROOT=`dirname $ROOT`
done done
set -e
cd $ROOT/tests cd $ROOT/tests
setup setup
cleanup cleanup
VALGRIND=`which valgrind` VALGRIND=`which valgrind`
SERVER=../Debug/eressea/eressea SERVER=../Debug/eressea/eressea
set -e
if [ -n "$VALGRIND" ]; then if [ -n "$VALGRIND" ]; then
SUPP=../share/ubuntu-12_04.supp SUPP=../share/ubuntu-12_04.supp
SERVER="$VALGRIND --track-origins=yes --gen-suppressions=all --suppressions=$SUPP --error-exitcode=1 --leak-check=no $SERVER" SERVER="$VALGRIND --track-origins=yes --gen-suppressions=all --suppressions=$SUPP --error-exitcode=1 --leak-check=no $SERVER"
@ -53,6 +53,7 @@ assert_grep_count reports/$CRFILE '^BURG' 1
assert_grep_count reports/$CRFILE '^EINHEIT' 2 assert_grep_count reports/$CRFILE '^EINHEIT' 2
assert_grep_count reports/$CRFILE '^GEGENSTAENDE' 2 assert_grep_count reports/$CRFILE '^GEGENSTAENDE' 2
assert_grep_count reports/185-heg.cr '185;Runde' 1
assert_grep_count reports/185-heg.cr ';Baeume' 4 assert_grep_count reports/185-heg.cr ';Baeume' 4
assert_grep_count reports/185-heg.cr '"B.ume";type' 4 assert_grep_count reports/185-heg.cr '"B.ume";type' 4
assert_grep_count reports/185-heg.cr '"Pferde";type' 6 assert_grep_count reports/185-heg.cr '"Pferde";type' 6
@ -62,4 +63,4 @@ assert_grep_count reports/185-heg.cr '"neighbour";visibility' 11
assert_grep_count reports/185-6rLo.cr '^EINHEIT' 2 assert_grep_count reports/185-6rLo.cr '^EINHEIT' 2
assert_grep_count reports/185-6rLo.cr '^REGION' 13 assert_grep_count reports/185-6rLo.cr '^REGION' 13
echo "integration tests: PASS" echo "integration tests: PASS"
#cleanup cleanup