forked from github/server
Merge branch 'develop' of https://github.com/ennorehling/eressea.git
This commit is contained in:
commit
48bece3257
9 changed files with 53 additions and 36 deletions
|
@ -6,7 +6,7 @@ if [ -z $ERESSEA ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GAME=$ERESSEA/game-$1
|
GAME=$ERESSEA/game-$1
|
||||||
GAME_NAME=$(grep name $GAME/eressea.ini | sed 's/.*=\s*//')
|
GAME_NAME=$(grep -w name $GAME/eressea.ini | sed 's/.*=\s*//')
|
||||||
|
|
||||||
TURN=$2
|
TURN=$2
|
||||||
if [ -z $TURN ]
|
if [ -z $TURN ]
|
||||||
|
|
11
s/build
11
s/build
|
@ -1,8 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
ROOT=`pwd`
|
ROOT=$(git rev-parse --show-toplevel)
|
||||||
while [ ! -d $ROOT/.git ]; do
|
|
||||||
ROOT=`dirname $ROOT`
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -z "$BUILD" ] && BUILD=Debug
|
[ -z "$BUILD" ] && BUILD=Debug
|
||||||
if [ -z "$JOBS" ] ; then
|
if [ -z "$JOBS" ] ; then
|
||||||
|
@ -35,7 +32,13 @@ fi
|
||||||
|
|
||||||
echo "build eressea"
|
echo "build eressea"
|
||||||
cd $ROOT/$BUILD
|
cd $ROOT/$BUILD
|
||||||
|
BRANCH=$(git status -s -b | head -1 | cut -d\ -f 2 | sed 's/\..*//')
|
||||||
|
if [ "$BRANCH" == "master" ] ; then
|
||||||
VERSION=$(git describe --match 'v*.*.*' --tags | sed 's/^v//')
|
VERSION=$(git describe --match 'v*.*.*' --tags | sed 's/^v//')
|
||||||
cmake -DERESSEA_VERSION="$VERSION" ..
|
cmake -DERESSEA_VERSION="$VERSION" ..
|
||||||
|
else
|
||||||
|
REV=$(git rev-parse --short HEAD)
|
||||||
|
cmake -DERESSEA_BUILDNO="$REV" ..
|
||||||
|
fi
|
||||||
make $MAKEOPTS && make test
|
make $MAKEOPTS && make test
|
||||||
cd $OLDPWD
|
cd $OLDPWD
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
#!/bin/sh
|
#!/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
|
|
||||||
|
|
||||||
|
ROOT=$(git rev-parse --show-toplevel)
|
||||||
[ -z $BUILD ] && BUILD=Debug
|
[ -z $BUILD ] && BUILD=Debug
|
||||||
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
||||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
ROOT=$(pwd)
|
ROOT=$(git rev-parse --show-toplevel)
|
||||||
while [ ! -d $ROOT/.git ]; do
|
|
||||||
ROOT=$(dirname $ROOT)
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -z $BUILD ] && BUILD=Debug ; export BUILD
|
[ -z $BUILD ] && BUILD=Debug ; export BUILD
|
||||||
|
|
||||||
if [ ! -e $ROOT/$BUILD ]; then
|
if [ ! -e $ROOT/$BUILD ]; then
|
||||||
|
|
|
@ -15,6 +15,11 @@ set_source_files_properties(kernel/version.c PROPERTIES
|
||||||
COMPILE_DEFINITIONS ERESSEA_VERSION="${ERESSEA_VERSION}")
|
COMPILE_DEFINITIONS ERESSEA_VERSION="${ERESSEA_VERSION}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(DEFINED ERESSEA_BUILDNO)
|
||||||
|
set_source_files_properties(kernel/version.c PROPERTIES
|
||||||
|
COMPILE_DEFINITIONS ERESSEA_BUILDNO="${ERESSEA_BUILDNO}")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF (CMAKE_COMPILER_IS_GNUCC)
|
IF (CMAKE_COMPILER_IS_GNUCC)
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
|
@ -5,15 +5,18 @@
|
||||||
|
|
||||||
#ifndef ERESSEA_VERSION
|
#ifndef ERESSEA_VERSION
|
||||||
// the version number, if it was not passed to make with -D
|
// the version number, if it was not passed to make with -D
|
||||||
#define ERESSEA_VERSION "3.11.0-devel"
|
#define ERESSEA_VERSION "3.11.0"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *eressea_version(void) {
|
const char *eressea_version(void) {
|
||||||
|
#ifdef ERESSEA_BUILDNO
|
||||||
|
return ERESSEA_VERSION "-" ERESSEA_BUILDNO;
|
||||||
|
#endif
|
||||||
return ERESSEA_VERSION;
|
return ERESSEA_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
int version_no(const char *str) {
|
int version_no(const char *str) {
|
||||||
int maj = 0, min = 0, bld = 0;
|
int maj = 0, min = 0, pat = 0;
|
||||||
sscanf(str, "%d.%d.%d", &maj, &min, &bld);
|
sscanf(str, "%d.%d.%d", &maj, &min, &pat);
|
||||||
return (maj << 16) | (min << 8) | bld;
|
return (maj << 16) | (min << 8) | pat;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,18 +75,6 @@ static void xml_readtext(xmlNodePtr node, struct locale **lang, xmlChar ** text)
|
||||||
*text = xmlNodeListGetString(node->doc, node->children, 1);
|
*text = xmlNodeListGetString(node->doc, node->children, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const spell *xml_spell(xmlNode * node, const char *name)
|
|
||||||
{
|
|
||||||
const spell *sp = NULL;
|
|
||||||
xmlChar *propValue = xmlGetProp(node, BAD_CAST name);
|
|
||||||
if (propValue != NULL) {
|
|
||||||
sp = find_spell((const char *)propValue);
|
|
||||||
assert(sp);
|
|
||||||
xmlFree(propValue);
|
|
||||||
}
|
|
||||||
return sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static spellref *xml_spellref(xmlNode * node, const char *name)
|
static spellref *xml_spellref(xmlNode * node, const char *name)
|
||||||
{
|
{
|
||||||
xmlChar *propValue = xmlGetProp(node, BAD_CAST name);
|
xmlChar *propValue = xmlGetProp(node, BAD_CAST name);
|
||||||
|
|
|
@ -461,8 +461,8 @@ int teach_cmd(unit * u, struct order *ord)
|
||||||
* Lehrer seines Gebietes */
|
* Lehrer seines Gebietes */
|
||||||
sc_mage *mage1 = get_mage(u);
|
sc_mage *mage1 = get_mage(u);
|
||||||
sc_mage *mage2 = get_mage(u2);
|
sc_mage *mage2 = get_mage(u2);
|
||||||
if (!mage2 || !mage1 || (mage2->magietyp != M_GRAY
|
if (mage2 && mage1 && mage2->magietyp != M_GRAY
|
||||||
&& mage1->magietyp != mage2->magietyp)) {
|
&& mage1->magietyp != mage2->magietyp) {
|
||||||
if (feedback) {
|
if (feedback) {
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
|
ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
|
||||||
"error_different_magic", "target", u2));
|
"error_different_magic", "target", u2));
|
||||||
|
|
|
@ -385,6 +385,34 @@ static void test_study_cost(CuTest *tc) {
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_teach_magic(CuTest *tc) {
|
||||||
|
unit *u, *ut;
|
||||||
|
faction *f;
|
||||||
|
const struct item_type *itype;
|
||||||
|
|
||||||
|
test_setup();
|
||||||
|
init_resources();
|
||||||
|
itype = get_resourcetype(R_SILVER)->itype;
|
||||||
|
f = test_create_faction(0);
|
||||||
|
f->magiegebiet = M_GWYRRD;
|
||||||
|
u = test_create_unit(f, test_create_region(0, 0, 0));
|
||||||
|
u->thisorder = create_order(K_STUDY, f->locale, "%s", skillnames[SK_MAGIC]);
|
||||||
|
i_change(&u->items, itype, study_cost(u, SK_MAGIC));
|
||||||
|
ut = test_create_unit(f, u->region);
|
||||||
|
set_level(ut, SK_MAGIC, TEACHDIFFERENCE);
|
||||||
|
create_mage(ut, M_GWYRRD);
|
||||||
|
ut->thisorder = create_order(K_TEACH, f->locale, "%s", itoa36(u->no));
|
||||||
|
learn_inject();
|
||||||
|
teach_cmd(ut, ut->thisorder);
|
||||||
|
study_cmd(u, u->thisorder);
|
||||||
|
learn_reset();
|
||||||
|
CuAssertPtrEquals(tc, u, log_learners[0].u);
|
||||||
|
CuAssertIntEquals(tc, SK_MAGIC, log_learners[0].sk);
|
||||||
|
CuAssertIntEquals(tc, STUDYDAYS*2, log_learners[0].days);
|
||||||
|
CuAssertIntEquals(tc, 0, i_get(u->items, itype));
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
static void test_teach_cmd(CuTest *tc) {
|
static void test_teach_cmd(CuTest *tc) {
|
||||||
unit *u, *ut;
|
unit *u, *ut;
|
||||||
test_setup();
|
test_setup();
|
||||||
|
@ -596,6 +624,7 @@ CuSuite *get_study_suite(void)
|
||||||
SUITE_ADD_TEST(suite, test_study_cost);
|
SUITE_ADD_TEST(suite, test_study_cost);
|
||||||
SUITE_ADD_TEST(suite, test_study_magic);
|
SUITE_ADD_TEST(suite, test_study_magic);
|
||||||
SUITE_ADD_TEST(suite, test_teach_cmd);
|
SUITE_ADD_TEST(suite, test_teach_cmd);
|
||||||
|
SUITE_ADD_TEST(suite, test_teach_magic);
|
||||||
SUITE_ADD_TEST(suite, test_teach_two);
|
SUITE_ADD_TEST(suite, test_teach_two);
|
||||||
SUITE_ADD_TEST(suite, test_teach_one_to_many);
|
SUITE_ADD_TEST(suite, test_teach_one_to_many);
|
||||||
SUITE_ADD_TEST(suite, test_teach_many_to_one);
|
SUITE_ADD_TEST(suite, test_teach_many_to_one);
|
||||||
|
|
Loading…
Reference in a new issue