Merge branch 'feature/travis-migration' of https://github.com/ennorehling/eressea into ennorehling-feature/travis-migration

This commit is contained in:
Enno Rehling 2015-07-12 14:42:01 +02:00
commit 4682a4ec62
11 changed files with 42 additions and 1732 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.orig
eressea.ini
Debug
Release

View File

@ -1,30 +0,0 @@
sudo: false
language: c
compiler:
<<<<<<< HEAD
- gcc
- clang
before_install:
- sudo apt-get update -qq
install:
- sudo apt-get install -qq zlib1g-dev libtolua-dev liblua5.1-dev libncurses5-dev libsqlite3-dev libxml2-dev valgrind clang
script:
- s/travis-build
=======
- gcc
- clang
script: s/travis-build
addons:
apt:
packages:
- liblua5.2-dev
- libncurses5-dev
- libsqlite3-dev
- libxml2-dev
>>>>>>> hotfix-3.4.1
os:
- linux
- osx
notifications:
slack:
secure: F89aXLWaE125PaJIlETv12jT4EfH6wLXJmGCPZzrN3OcLn2ahDWqjwuzR7lOEDf2nAISmeMPyDZMhEHXLNHAE5qP6lg9yliYQw5hzGmDK9m1xUq/pPEne/b2Y7K3my1mkRZ6n3asbHgSmBWAfCIk1JN8R5Rv+rmbLuWLc+zofts=

View File

@ -1,48 +0,0 @@
#!/bin/sh
ROOT=`pwd`
while [ ! -d $ROOT/.git ]; do
ROOT=`dirname $ROOT`
done
<<<<<<< HEAD
[ -z $BUILD ] && BUILD=Debug
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"
BIN_DIR="build-$MACHINE-$CC-$BUILD"
=======
[ -z "$CC" ] && CC=clang
[ -z "$BUILD" ] && BUILD=Debug
>>>>>>> hotfix-3.4.1
[ -z "$JOBS" ] && [ "" != "which nproc" ] && JOBS=`nproc`
DISTCC=`which distcc`
if [ ! -z "$DISTCC" ] ; then
JOBS=`distcc -j`
if [ -z "$JOBS" ] ; then
JOBS=1
elif [ $JOBS -gt 1 ] ; then
CC="$DISTCC $CC"
MAKEOPTS=-j$JOBS
fi
fi
echo "Building with CC=$CC and $JOBS jobs"
if [ ! -d $ROOT/$BUILD ]; then
echo "cannot find build directory $BUILD in $ROOT. did you run cmake-init?"
exit
fi
git submodule update
if [ -z `which tolua` ]; then
echo "build tolua"
cd $ROOT/tolua ; make
fi
echo "build eressea"
cd $ROOT/$BUILD
make $MAKEOPTS && make test
cd $OLDPWD

View File

@ -1,80 +0,0 @@
#!/bin/sh
ROOT=$(pwd)
while [ ! -d $ROOT/.git ]; do
ROOT=$(dirname $ROOT)
if [ "$ROOT" == "/" ; then
echo "could not find root, are you in the git repository?"
exit
fi
done
[ -z $BUILD ] && BUILD=Debug
MACHINE=`uname -m`
<<<<<<< HEAD
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
=======
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="clang"
>>>>>>> hotfix-3.4.1
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BIN_DIR="$ROOT/build-$MACHINE-$CC-$BUILD"
mkdir -p $BIN_DIR
ln -sf $BIN_DIR $BUILD
MACHINE=$(gcc -dumpmachine)
rm -f CMakeCache.txt
# use anything installed in /opt or /usr
LIBRARY_PATH=/opt/lib:/opt/lib/$MACHINE:/usr/lib/$MACHINE
INCLUDE_PATH=/opt/include:/usr/include
PREFIX_PATH=/opt
# I like to put stuff in ~/usr if I don't have permission to install packages on the machine:
if [ -d $HOME/usr ]; then
LIBRARY_PATH=$HOME/usr/lib:$HOME/usr/lib/$MACHINE:$LIBRARY_PATH
INCLUDE_PATH=$HOME/usr/include:$HOME/usr/include/$MACHINE:$INCLUDE_PATH
PREFIX_PATH=$HOME/usr:$HOME/usr/local:$PREFIX_PATH
fi
<<<<<<< HEAD
if [ -z $PC_LUA ] && [ -e /opt/include/lua.h ]; then
PC_LUA=/opt/include
fi
if [ -z $PC_TOLUA ] && [ -e /opt/include/tolua.h ]; then
PC_TOLUA=/opt/include
fi
if [ ! -z $PC_TOLUA ]; then
PC_ARGS="$PC_ARGS -DPC_TOLUA_INCLUDEDIR=$PC_TOLUA/include -DPC_TOLUA_LIBDIR=$PC_TOLUA/lib"
fi
if [ ! -z $PC_LUA ]; then
PC_ARGS="$PC_ARGS -DPC_LUA_INCLUDEDIR=$PC_LUA/include -DPC_LUA_LIBDIR=$PC_LUA/lib"
fi
cmake .. $PC_ARGS \
-DCMAKE_MODULE_PATH=$PWD/../cmake/Modules \
=======
ARGS=" -DCMAKE_MODULE_PATH=$ROOT/cmake/Modules \
>>>>>>> hotfix-3.4.1
-DCMAKE_BUILD_TYPE=$BUILD \
-DCMAKE_LIBRARY_PATH=$LIBRARY_PATH \
-DCMAKE_INCLUDE_PATH=$INCLUDE_PATH \
-DCMAKE_PREFIX_PATH=$PREFIX_PATH \
-DCMAKE_INSTALL_PREFIX=$HOME/eressea/server"
path="$(which tolua)"
if [ "$HAVE_TOLUA" = "0" ] || [ -z $path ] ; then
echo "tolua is not installed, building from source"
cd $ROOT/tolua ; make
ARGS="$ARGS -DPC_TOLUA_DIR=$ROOT/tolua"
else
echo "tolua is $path"
fi
unset path
set -e
cd $BIN_DIR
cmake .. $ARGS $*
cd $OLDPWD

View File

@ -1,37 +0,0 @@
#!/bin/bash
set -e
ROOT=$(pwd)
while [ ! -d $ROOT/.git ]; do
ROOT=$(dirname $ROOT)
done
<<<<<<< HEAD
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"
BIN_DIR="build-$MACHINE-$CC-Debug"
=======
[ -z $BUILD ] && BUILD=Debug ; export BUILD
>>>>>>> hotfix-3.4.1
if [ ! -e $ROOT/$BUILD ]; then
echo "cannot find build directory $BUILD in $ROOT. did you run cmake-init?"
exit
fi
$ROOT/$BUILD/eressea/test_eressea
cd $ROOT
[ -e eressea.ini ] || ln -sf conf/eressea.ini
<<<<<<< HEAD
$ROOT/$BIN_DIR/eressea/eressea -v0 scripts/run-tests.lua
$ROOT/$BIN_DIR/eressea/eressea -v0 scripts/run-tests-e2.lua
$ROOT/$BIN_DIR/eressea/eressea -v0 scripts/run-tests-e3.lua
=======
$ROOT/$BUILD/eressea/eressea -v0 sacripts/run-tests.lua
$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e3.lua
>>>>>>> hotfix-3.4.1
cd $OLDWPD

View File

@ -1,83 +0,0 @@
#!/bin/sh
<<<<<<< HEAD
set -e
ROOT=`pwd`
SUPP=../share/ubuntu-12_04.supp
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
BUILD="$ROOT/build-$MACHINE-$CC-Debug"
=======
ROOT=`pwd`
>>>>>>> hotfix-3.4.1
inifile() {
cd $ROOT
if [ ! -e eressea.ini ]; then
cp conf/eressea.ini .
$BUILD/iniparser/inifile eressea.ini add lua:paths lunit:scripts
fi
}
<<<<<<< HEAD
build() {
cd $BUILD
cmake -DCMAKE_MODULE_PATH=$ROOT/cmake/Modules -DCMAKE_BUILD_TYPE=Debug ..
scan-build make
}
test_valgrind_report () {
cd $ROOT/tests
ln -sf ../scripts/config.lua
valgrind --suppressions=$SUPP --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/reports.lua
}
test_valgrind_turn () {
cd $ROOT/tests
ln -sf ../scripts/config.lua
valgrind --suppressions=$SUPP --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/run-turn.lua
}
test_unittests() {
$BUILD/eressea/test_eressea
}
cleanup() {
cd $ROOT/tests
rm -rf reports score eressea.log* config.lua data/185.dat datum passwd parteien parteien.full turn
}
test_server() {
cd $ROOT
inifile
$BUILD/eressea/eressea -v0 scripts/run-tests.lua
$BUILD/eressea/eressea -v0 scripts/run-tests-e2.lua
$BUILD/eressea/eressea -v0 scripts/run-tests-e3.lua
}
# information
echo "* base directory: $ROOT"
echo "* build directory: $BUILD"
echo "* lsb_release:"
lsb_release -a
echo "* zlib1g-dev package:"
dpkg -l zlib1g-dev
echo
# build the code
[ -d $BUILD ] || mkdir $BUILD
build
test_unittests
test_server
test_valgrind_report
test_valgrind_turn
cleanup
=======
[ -z $BUILD ] && BUILD=Debug ; export BUILD
s/cmake-init
s/build
cd $ROOT
inifile
s/runtests
>>>>>>> hotfix-3.4.1

View File

@ -2339,8 +2339,9 @@ void do_regenerate(fighter * af)
ta.index = af->fighting;
while (ta.index--) {
af->person[ta.index].hp += effskill(au, SK_STAMINA);
af->person[ta.index].hp = _min(unit_max_hp(au), af->person[ta.index].hp);
struct person *p = af->person + ta.index;
p->hp += effskill(au, SK_STAMINA);
p->hp = _min(unit_max_hp(au), p->hp);
}
}

View File

@ -26,6 +26,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" {
#endif
struct curse;
struct curse_type;
/* Sprueche in der struct region und auf Einheiten, Schiffen oder Burgen
* (struct attribute)
*/
@ -179,18 +182,6 @@ extern "C" {
/* ------------------------------------------------------------- */
/* Allgemeine Zauberwirkungen */
typedef struct curse {
struct curse *nexthash;
int no; /* 'Einheitennummer' dieses Curse */
const struct curse_type *type; /* Zeiger auf ein curse_type-struct */
int flags; /* WARNING: these are XORed with type->flags! */
int duration; /* Dauer der Verzauberung. Wird jede Runde vermindert */
double vigour; /* Stärke der Verzauberung, Widerstand gegen Antimagie */
struct unit *magician; /* Pointer auf den Magier, der den Spruch gewirkt hat */
double effect;
variant data; /* pointer auf spezielle curse-unterstructs */
} curse;
#define c_flags(c) ((c)->type->flags ^ (c)->flags)
/* ------------------------------------------------------------- */
@ -200,17 +191,29 @@ extern "C" {
int typ;
int flags;
int mergeflags;
struct message *(*curseinfo) (const void *, objtype_t, const struct curse *,
int);
void(*change_vigour) (curse *, double);
int(*read) (struct storage * store, curse * c, void *target);
int(*write) (struct storage * store, const struct curse * c,
struct message *(*curseinfo) (const void *, objtype_t,
const struct curse *, int);
void(*change_vigour) (struct curse *, double);
int(*read) (struct storage * store, struct curse *, void *target);
int(*write) (struct storage * store, const struct curse *,
const void *target);
int(*cansee) (const struct faction *, const void *, objtype_t,
const struct curse *, int);
int(*age) (curse *);
int(*age) (struct curse *);
} curse_type;
typedef struct curse {
variant data; /* pointer auf spezielle curse-unterstructs */
struct curse *nexthash;
const curse_type *type; /* Zeiger auf ein curse_type-struct */
struct unit *magician; /* Pointer auf den Magier, der den Spruch gewirkt hat */
double vigour; /* Stärke der Verzauberung, Widerstand gegen Antimagie */
double effect;
int no; /* 'Einheitennummer' dieses Curse */
int flags; /* WARNING: these are XORed with type->flags! */
int duration; /* Dauer der Verzauberung. Wird jede Runde vermindert */
} curse;
extern struct attrib_type at_curse;
void curse_write(const struct attrib *a, const void *owner,
struct storage *store);

File diff suppressed because it is too large Load Diff

View File

@ -76,6 +76,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
#include <errno.h>
#include <math.h>
const char *magic_school[MAXMAGIETYP] = {
@ -2560,7 +2561,7 @@ static castorder *cast_cmd(unit * u, order * ord)
}
s = gettoken(token, sizeof(token));
}
if (!s || !s[0] || strlen(s) == 0) {
if (!s || !s[0]) {
/* Fehler "Es wurde kein Zauber angegeben" */
cmistake(u, ord, 172, MSG_MAGIC);
return 0;
@ -2571,7 +2572,7 @@ static castorder *cast_cmd(unit * u, order * ord)
/* Vertraute können auch Zauber sprechen, die sie selbst nicht
* können. unit_getspell findet aber nur jene Sprüche, die
* die Einheit beherrscht. */
if (!sp && is_familiar(u)) {
if (!sp && is_familiar(u)) {
caster = get_familiar_mage(u);
if (caster) {
familiar = u;
@ -2695,8 +2696,16 @@ static castorder *cast_cmd(unit * u, order * ord)
if (!s || *s == 0)
break;
if (p + 1 >= size) {
size *= 2;
params = (char**)realloc(params, sizeof(char *) * size);
char ** tmp;
tmp = (char**)realloc(params, sizeof(char *) * size * 2);
if (tmp) {
size *= 2;
params = tmp;
}
else {
log_error("error allocationg %d bytes: %s", size * 2, strerror(errno));
break;
}
}
params[p++] = _strdup(s);
}

View File

@ -29,7 +29,7 @@ typedef struct wallcurse {
connection *wall;
} wallcurse;
void cw_init(attrib * a)
static void cw_init(attrib * a)
{
curse *c;
curse_init(a);
@ -37,7 +37,7 @@ void cw_init(attrib * a)
c->data.v = calloc(sizeof(wallcurse), 1);
}
void cw_write(const attrib * a, const void *target, storage * store)
static void cw_write(const attrib * a, const void *target, storage * store)
{
connection *b = ((wallcurse *)((curse *)a->data.v)->data.v)->wall;
curse_write(a, target, store);
@ -86,7 +86,7 @@ static int cw_read(attrib * a, void *target, storage * store)
* Was fuer eine Wirkung hat die?
*/
void wall_vigour(curse * c, double delta)
static void wall_vigour(curse * c, double delta)
{
wallcurse *wc = (wallcurse *)c->data.v;
assert(wc->buddy->vigour == c->vigour);
@ -105,7 +105,7 @@ const curse_type ct_firewall = {
wall_vigour /* change_vigour */
};
attrib_type at_cursewall = {
static attrib_type at_cursewall = {
"cursewall",
cw_init,
curse_done,