Merge pull request #228 from badgerman/develop

fix open github issues
This commit is contained in:
Enno Rehling 2015-06-17 14:25:28 +02:00
commit d541e8b1e3
8 changed files with 26 additions and 9 deletions

View File

@ -73,4 +73,4 @@ add_subdirectory (src eressea)
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.xml") install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.xml")
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.json") install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.json")
install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua") install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY share DESTINATION ${CMAKE_INSTALL_PREFIX})

View File

@ -6,6 +6,7 @@ done
[ -z $BUILD ] && BUILD=Debug [ -z $BUILD ] && BUILD=Debug
MACHINE=`uname -m` MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" [ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"

View File

@ -2,7 +2,7 @@
ROOT=$(pwd) ROOT=$(pwd)
while [ ! -d $ROOT/.git ]; do while [ ! -d $ROOT/.git ]; do
ROOT=$(dirname $ROOT) ROOT=$(dirname $ROOT)
if [ "$ROOT" == "/" ; then if [ "/" = "$ROOT" ]; then
echo "could not find root, are you in the git repository?" echo "could not find root, are you in the git repository?"
exit exit
fi fi
@ -25,4 +25,8 @@ programs="create-orders backup-eressea run-turn"
for prg in ${programs} ; do for prg in ${programs} ; do
install -v $ROOT/process/$prg $DEST/bin/ install -v $ROOT/process/$prg $DEST/bin/
done done
crontab $ROOT/process/cron/crontab
# install crontab, but only on the eressea server:
HOST=`hostname`
[ "gruenbaer" = "$HOST" ] && crontab $ROOT/process/cron/crontab

View File

@ -1,5 +1,12 @@
#!/bin/bash #!/bin/bash
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BUILD="build-$MACHINE-$CC-Debug"
function usage() { function usage() {
cat <<HEREDOC cat <<HEREDOC
usage: $0 [-t <turn>] [-g <game>] [-f <file>] command [args] usage: $0 [-t <turn>] [-g <game>] [-f <file>] command [args]
@ -80,10 +87,11 @@ ln -f $LIVE/data/$turn.dat data/
rm -rf reports rm -rf reports
mkdir -p reports mkdir -p reports
SERVER="$SOURCE/build-x86_64-gcc-Debug/eressea/eressea" SUPP="$SOURCE/share/ubuntu-12_04.supp"
SERVER="$SOURCE/$BUILD/eressea/eressea"
VALGRIND=$(which valgrind) VALGRIND=$(which valgrind)
if [ ! -z $VALGRIND ]; then if [ ! -z $VALGRIND ]; then
SERVER="$VALGRIND --leak-check=no $SERVER" SERVER="$VALGRIND --suppressions=$SUPP --error-exitcode=1 --leak-check=no $SERVER"
fi fi
$SERVER -v$verbose -t$turn -re$game $SOURCE/scripts/run-turn.lua $SERVER -v$verbose -t$turn -re$game $SOURCE/scripts/run-turn.lua
let turn=$turn+1 let turn=$turn+1
@ -147,7 +155,7 @@ case "$1" in
;; ;;
"run") "run")
if [ $turn -eq 0 ]; then if [ $turn -eq 0 ]; then
[ -f $LIVE/turn ] || abort "missing turn file, and no turn specified" [ -f $LIVE/turn ] || abort "missing turn file in $LIVE, and no turn specified"
let turn=$(cat $LIVE/turn)-1 let turn=$(cat $LIVE/turn)-1
fi fi
run run

View File

@ -7,6 +7,7 @@ while [ ! -d $ROOT/.git ]; do
done done
MACHINE=`uname -m` MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" [ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"

View File

@ -2,6 +2,7 @@
set -e set -e
ROOT=`pwd` ROOT=`pwd`
SUPP=../share/ubuntu-12_04.supp
MACHINE=`uname -m` MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
@ -25,13 +26,13 @@ make
test_valgrind_report () { test_valgrind_report () {
cd $ROOT/tests cd $ROOT/tests
ln -sf ../scripts/config.lua ln -sf ../scripts/config.lua
valgrind --suppressions=ubuntu-12_04.supp --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/reports.lua valgrind --suppressions=$SUPP --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/reports.lua
} }
test_valgrind_turn () { test_valgrind_turn () {
cd $ROOT/tests cd $ROOT/tests
ln -sf ../scripts/config.lua ln -sf ../scripts/config.lua
valgrind --suppressions=ubuntu-12_04.supp --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/run-turn.lua valgrind --suppressions=$SUPP --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/run-turn.lua
} }
test_unittests() { test_unittests() {

View File

@ -901,7 +901,9 @@ static void rmtroop(troop dt)
rmfighter(df, 1); rmfighter(df, 1);
assert(dt.index >= 0 && dt.index < df->unit->number); assert(dt.index >= 0 && dt.index < df->unit->number);
if (dt.index!=df->alive-df->removed) {
df->person[dt.index] = df->person[df->alive - df->removed]; df->person[dt.index] = df->person[df->alive - df->removed];
}
if (df->removed) { if (df->removed) {
df->person[df->alive - df->removed] = df->person[df->alive]; df->person[df->alive - df->removed] = df->person[df->alive];
} }