From ae68a1beaf5d4a39a467427c22e3ec5943c4ac98 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 12 Apr 2014 05:25:21 +0200 Subject: [PATCH] add a script that runs all tests clean up the build scripta bit bind ship type --- cutest | 2 +- s/build | 5 +++-- s/runtests | 24 ++++++++++++++++++++++++ src/bind_ship.c | 9 ++++++++- 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100755 s/runtests diff --git a/cutest b/cutest index d83cec09a..788659594 160000 --- a/cutest +++ b/cutest @@ -1 +1 @@ -Subproject commit d83cec09a52835274ab8ed4849de16fb8658982a +Subproject commit 788659594ef87e9f497b8039da764182adfd2943 diff --git a/s/build b/s/build index cd2b7d8cc..b6701cb87 100755 --- a/s/build +++ b/s/build @@ -4,9 +4,12 @@ while [ ! -d $ROOT/.git ]; do ROOT=$(dirname $ROOT) done +MACHINE=`uname -m` [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" [ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" +BIN_DIR="build-$MACHINE-$CC-Debug" + [ -z "$JOBS" ] && JOBS=$(nproc) DISTCC=`which distcc` if [ ! -z "$DISTCC" ] ; then @@ -20,8 +23,6 @@ fi fi echo "Building with $CC and $JOBS jobs" -MACHINE=`uname -m` -BIN_DIR="build-$MACHINE-$CC-Debug" if [ ! -d $ROOT/$BIN_DIR ]; then echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?" exit diff --git a/s/runtests b/s/runtests new file mode 100755 index 000000000..1ad5a0b0a --- /dev/null +++ b/s/runtests @@ -0,0 +1,24 @@ +#!/bin/bash +ROOT=$(pwd) +while [ ! -d $ROOT/.git ]; do + ROOT=$(dirname $ROOT) +done + +MACHINE=`uname -m` +[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" +[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" +[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" +BIN_DIR="build-$MACHINE-$CC-Debug" + +if [ ! -d $ROOT/$BIN_DIR ]; then + echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?" + exit +fi + +echo $ROOT +$ROOT/$BIN_DIR/eressea/test_eressea +pushd $ROOT/game-e2 +$ROOT/$BIN_DIR/eressea/eressea -e run_tests +cd $ROOT/game-e3 +$ROOT/$BIN_DIR/eressea/eressea -e run_tests +popd diff --git a/src/bind_ship.c b/src/bind_ship.c index bcab0d794..d268c88c6 100644 --- a/src/bind_ship.c +++ b/src/bind_ship.c @@ -177,6 +177,13 @@ static int tolua_ship_get_coast(lua_State * L) return 0; } +static int tolua_ship_get_type(lua_State * L) +{ + ship *self = (ship *) tolua_tousertype(L, 1, 0); + tolua_pushstring(L, self->type->name[0]); + return 1; +} + void tolua_ship_open(lua_State * L) { /* register user types */ @@ -201,8 +208,8 @@ void tolua_ship_open(lua_State * L) tolua_ship_set_region); tolua_variable(L, TOLUA_CAST "coast", tolua_ship_get_coast, tolua_ship_set_coast); + tolua_variable(L, TOLUA_CAST "type", tolua_ship_get_type, 0); #ifdef TODO - .property("type", &ship_gettype) .property("weight", &ship_getweight) .property("capacity", &ship_getcapacity) .property("maxsize", &ship_maxsize)