diff --git a/CMakeLists.txt b/CMakeLists.txt index 9730625b2..aaf07e2a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,5 +70,6 @@ add_subdirectory (quicklist) add_subdirectory (critbit) 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 "*.json") install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua") diff --git a/process/cron/backup-eressea b/process/backup-eressea similarity index 100% rename from process/cron/backup-eressea rename to process/backup-eressea diff --git a/process/cron/create-orders b/process/create-orders similarity index 100% rename from process/cron/create-orders rename to process/create-orders diff --git a/process/cron/crontab b/process/cron/crontab new file mode 100644 index 000000000..8bbabab53 --- /dev/null +++ b/process/cron/crontab @@ -0,0 +1,18 @@ +# Crontab for Eressea on gruenbaer.kn-bremen.de + +PATH=/home/eressea/bin:/opt/bin:/usr/local/bin:/usr/bin:/bin +ERESSEA=/home/eressea/eressea +ATLANTIS=/home/eressea/atlantis +ENABLED=yes +PREVIEW=yes +CONFIRM=yes + +# m h dom mon dow command +00 00 * * * $HOME/bin/fetchmail.cron +00 22 * * * $HOME/bin/backup-db.sh + +15 21 * * Sat [ "$ENABLED" = "yes" ] && $ERESSEA/server/bin/run-eressea.cron 3 +25 21 * * Sat [ "$ENABLED" = "yes" ] && $ERESSEA/server/bin/run-eressea.cron 4 +35 21 * * Sat [ "$ENABLED" = "yes" ] && $ERESSEA/server/bin/run-eressea.cron 2 +39 08 * * Sun [ "$PREVIEW" = "yes" ] && $ERESSEA/server/bin/preview.cron +*/5 * * * * [ "$CONFIRM" = "yes" ] && $ERESSEA/server/bin/orders.cron 2 3 4 diff --git a/process/cron/orders.cron b/process/cron/orders.cron new file mode 100755 index 000000000..be573fe86 --- /dev/null +++ b/process/cron/orders.cron @@ -0,0 +1,16 @@ +#!/bin/bash + +## this script processes incoming order files. +# files are delivered into an incoming queue by procmail, then cron runs +# this here script to make a non-blocking syntax check and reject or +# accept the order file. + +for GAME in $* +do + if [ "$GAME" == "eressea" ]; then GAME=2 ; fi + if [ "$GAME" == "e3a" ]; then GAME=3 ; fi + if [ -e $HOME/eressea/game-$GAME/orders.queue ] + then + $HOME/bin/orders-process $GAME + fi +done diff --git a/s/cron/previews.sh b/process/cron/preview.cron similarity index 100% rename from s/cron/previews.sh rename to process/cron/preview.cron diff --git a/process/cron/run-eressea b/process/cron/run-eressea.cron similarity index 100% rename from process/cron/run-eressea rename to process/cron/run-eressea.cron index e932378fc..471031237 100755 --- a/process/cron/run-eressea +++ b/process/cron/run-eressea.cron @@ -40,6 +40,6 @@ fi echo "sending reports for game $GAME, turn $TURN" $BIN/compress.sh $GAME $TURN $BIN/sendreports.sh $GAME -$BIN/backup-eressea $GAME $TURN [ $GAME -lt 4 ] && $BIN/send-summary $GAME +$BIN/backup-eressea $GAME $TURN rm -f test/execute.lock diff --git a/process/cron/run-turn b/process/run-turn similarity index 100% rename from process/cron/run-turn rename to process/run-turn diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml index e2003f997..999d59270 100644 --- a/res/core/de/strings.xml +++ b/res/core/de/strings.xml @@ -4345,6 +4345,14 @@ + + Erzeugt einen Ring der Regeneration. + Creates a ring of regeneration. + + + Erzeugt einen Aurafokus. + Creates an aurafocus crystal. + Tötet die Feinde mit Säure. Kills enemies with acid. diff --git a/res/core/messages.xml b/res/core/messages.xml index c8eba5cfb..ddd17856c 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -889,7 +889,7 @@ "Auf der Einheit $if($eq($left,1),"liegt","liegen") $int($left) Wirkung$if($eq($left,1),"","en") $resource($potion,1)." - "There are $int($left) use($eq($left,1),"s","") of $resource($potion,1) left." + "There $if($eq($left,1),"is","are") $int($left) $if($eq($left,1),"use","uses") of $resource($potion,1) left." @@ -3156,7 +3156,7 @@ "Der Vulkan in $region($regionv) bricht aus. Die Lavamassen verwüsten $region($regionn)." - "The volcano in $region($regionv) erupts. The lava devastates $region($region)." + "The volcano in $region($regionv) erupts. The lava devastates $region($regionn)." @@ -3461,16 +3461,16 @@ - "$unit($spy) gelang es, Informationen über $unit($target) herauszubekommen: Kampfstatus $status." - "$unit($spy) managed to gather information about $unit($target): combat status ($status)." + "$unit($spy) gelang es, Informationen über $unit($target) herauszubekommen: Kampfstatus ${status}." + "$unit($spy) managed to gather information about $unit($target): combat status ${status}." - "$unit($target) ist ein $type-Magier." - "$unit($target) is a $type-magician" + "$unit($target) ist ein ${type}-Magier." + "$unit($target) is a ${type}-magician" diff --git a/s/install b/s/install index 08d171849..39c91174a 100755 --- a/s/install +++ b/s/install @@ -8,6 +8,8 @@ while [ ! -d $ROOT/.git ]; do fi done +DEST=$(dirname $ROOT)/server + MACHINE=`uname -m` [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" @@ -17,3 +19,10 @@ BIN_DIR="build-$MACHINE-$CC-Debug" cd $ROOT/$BIN_DIR make install +[ -d $DEST/bin ] || mkdir -p $DEST/bin +install -v $ROOT/process/cron/*.cron $DEST/bin/ +programs="create-orders backup-eressea run-turn" +for prg in ${programs} ; do +install -v $ROOT/process/$prg $DEST/bin/ +done +crontab $ROOT/process/cron/crontab diff --git a/src/buildno.h b/src/buildno.h index 99749c6d0..be62c19a5 100644 --- a/src/buildno.h +++ b/src/buildno.h @@ -1,3 +1,3 @@ #define VERSION_MAJOR 3 #define VERSION_MINOR 4 -#define VERSION_BUILD 0 +#define VERSION_BUILD 5 diff --git a/src/laws.c b/src/laws.c index acb15e747..7fc04876b 100755 --- a/src/laws.c +++ b/src/laws.c @@ -1896,7 +1896,10 @@ int name_cmd(struct unit *u, struct order *ord) } if (s != NULL) { - return rename_cmd(u, ord, s, getstrtoken()); + const char *name = getstrtoken(); + if (name) { + rename_cmd(u, ord, s, name); + } } return 0; diff --git a/src/move.c b/src/move.c index b935789be..14c305c11 100644 --- a/src/move.c +++ b/src/move.c @@ -919,17 +919,17 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r) } if (guard) { prob += base_prob; /* 30% base chance */ - prob = +guard_count*guard_number_prob; + prob += guard_count*guard_number_prob; if (r->terrain == newterrain(T_GLACIER)) - prob = +region_type_prob * 2; + prob += region_type_prob * 2; if (r->terrain == newterrain(T_SWAMP)) - prob = +region_type_prob * 2; + prob += region_type_prob * 2; if (r->terrain == newterrain(T_MOUNTAIN)) - prob = +region_type_prob; + prob += region_type_prob; if (r->terrain == newterrain(T_VOLCANO)) - prob = +region_type_prob; + prob += region_type_prob; if (r->terrain == newterrain(T_VOLCANO_SMOKING)) - prob = +region_type_prob; + prob += region_type_prob; if (prob > 0 && chance(prob)) { return guard; diff --git a/src/tests.c b/src/tests.c index efab2ab8f..07dcef979 100644 --- a/src/tests.c +++ b/src/tests.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -239,22 +240,24 @@ const message_type *register_msg(const char *type, int n_param, ...) { void assert_messages(struct CuTest * tc, struct mlist *msglist, const message_type **types, int num_msgs, bool exact_match, ...) { + char buf[100]; va_list args; - int found = 0, argc = 0; + int found = 0, argc = -1; struct message *msg; bool match = true; va_start(args, exact_match); while (msglist) { + msg = msglist->msg; if (found >= num_msgs) { if (exact_match) { - CuFail(tc, "too many messages"); + slprintf(buf, sizeof(buf), "too many messages: %s", msg->type->name); + CuFail(tc, buf); } else { break; } } - msg = msglist->msg; if (exact_match || match) argc = va_arg(args, int); @@ -271,3 +274,8 @@ void assert_messages(struct CuTest * tc, struct mlist *msglist, const message_ty va_end(args); } + +void disabled_test(void *suite, void (*test)(CuTest *), const char *name) { + (void)test; + fprintf(stderr, "%s: SKIP\n", name); +} diff --git a/src/tests.h b/src/tests.h index e517a6fb7..3da238fdc 100644 --- a/src/tests.h +++ b/src/tests.h @@ -47,6 +47,10 @@ extern "C" { void assert_messages(struct CuTest * tc, struct mlist *msglist, const struct message_type **types, int num_msgs, bool exact_match, ...); + void disabled_test(void *suite, void (*)(struct CuTest *), const char *name); + +#define DISABLE_TEST(SUITE, TEST) disabled_test(SUITE, TEST, #TEST) + #ifdef __cplusplus } #endif diff --git a/src/util/language.c b/src/util/language.c index ec83b98b9..677832636 100644 --- a/src/util/language.c +++ b/src/util/language.c @@ -263,6 +263,7 @@ void init_translations(const struct locale *lang, int ut, const char * (*string_ assert(maxstrings > 0); tokens = get_translations(lang, ut); for (i = 0; i != maxstrings; ++i) { + // TODO: swap the name of s and key const char * s = string_cb(i); const char * key = s ? locale_string(lang, s, false) : 0; key = key ? key : s;