From a3ebddeae41b4faf88a44aba14e1ada9b75c693d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 26 May 2017 13:52:55 +0200 Subject: [PATCH 1/3] update cron to check environment for switches use server/bin instead of ~/bin --- etc/report-mail.de.txt | 10 ++++++++++ etc/report-mail.en.txt | 6 ++++++ etc/report-mail.txt | 14 ++++++++++++++ process/cron/crontab | 17 ----------------- process/cron/orders.cron | 4 ++++ process/cron/preview.cron | 4 +++- process/cron/run-eressea.cron | 20 ++++++++++++++++++-- process/orders.cron | 16 ---------------- process/run-turn | 3 +++ process/run-turn.sh | 22 ---------------------- 10 files changed, 58 insertions(+), 58 deletions(-) create mode 100644 etc/report-mail.de.txt create mode 100644 etc/report-mail.en.txt create mode 100644 etc/report-mail.txt delete mode 100644 process/cron/crontab delete mode 100755 process/orders.cron delete mode 100755 process/run-turn.sh diff --git a/etc/report-mail.de.txt b/etc/report-mail.de.txt new file mode 100644 index 000000000..e40d86b53 --- /dev/null +++ b/etc/report-mail.de.txt @@ -0,0 +1,10 @@ +Freust Du Dich, dass es diese Woche wieder einen Eressea-Report gibt? +Möchtest Du dazu beitragen, dass das auch nächste Woche wieder passiert? +Eressea ist ein freiwilliges gratis-Angebot, und die Spielleitung bezahlt +seit Jahren die Entwicklung und das Hosting aus eigener Tasche. Wenn Dir +das etwas wert ist, kannst Du das auf +https://flattr.com/thing/681354/Eressea zum Ausdruck bringen. + +Diese Mail enthält ein Attachment mit Deinem Eressea-Report in +komprimierter Form. Um ihn zu entpacken benötigst Du ein Programm, +das ZIP-Archive öffnen kann, wie z.B. 7-Zip (http://www.7-zip.org/) diff --git a/etc/report-mail.en.txt b/etc/report-mail.en.txt new file mode 100644 index 000000000..58a8e0c19 --- /dev/null +++ b/etc/report-mail.en.txt @@ -0,0 +1,6 @@ +If you feel that getting a report every weekend is worth something to you, +why not flattr Eressea at https://flattr.com/thing/681354/Eressea ? + +This email contains an Attachment with your Eressea report in compressed +form. To open the attachment, you will need a program that can extract +ZIP files, e.g. 7-Zip (http://www.7-zip.org/). diff --git a/etc/report-mail.txt b/etc/report-mail.txt new file mode 100644 index 000000000..4101243e7 --- /dev/null +++ b/etc/report-mail.txt @@ -0,0 +1,14 @@ +Freust Du Dich, dass es diese Woche wieder einen Eressea-Report gibt? +Möchtest Du dazu beitragen, dass das auch nächste Woche wieder passiert? +Eressea ist ein freiwilliges gratis-Angebot, und die Spielleitung bezahlt +seit Jahren die Entwicklung und das Hosting aus eigener Tasche. Wenn Dir +das etwas wert ist, kannst Du das auf +https://flattr.com/thing/681354/Eressea zum Ausdruck bringen. + +Diese Mail enthält ein Attachment mit Deinem Eressea-Report in +komprimierter Form. Um ihn zu entpacken benötigst Du ein Programm, +das ZIP-Archive öffnen kann, wie z.B. 7-Zip (http://www.7-zip.org/) + +This email contains an attachment with your Eressea report in compressed +form. To open the attachment, you will need a program that can extract +ZIP files, e.g. 7-Zip (http://www.7-zip.org/). diff --git a/process/cron/crontab b/process/cron/crontab deleted file mode 100644 index 9d7e155cb..000000000 --- a/process/cron/crontab +++ /dev/null @@ -1,17 +0,0 @@ -# Crontab for Eressea on gruenbaer.kn-bremen.de - -PATH=/home/eressea/bin:/opt/bin:/usr/local/bin:/usr/bin:/bin -ERESSEA=/home/eressea/eressea -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 -30 07 * * 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 index be573fe86..114a870a5 100755 --- a/process/cron/orders.cron +++ b/process/cron/orders.cron @@ -5,6 +5,10 @@ # this here script to make a non-blocking syntax check and reject or # accept the order file. +if [ "yes" != "$CONFIRM" ] ; then + exit +fi + for GAME in $* do if [ "$GAME" == "eressea" ]; then GAME=2 ; fi diff --git a/process/cron/preview.cron b/process/cron/preview.cron index 985ddf40b..71ebd0571 100755 --- a/process/cron/preview.cron +++ b/process/cron/preview.cron @@ -1,6 +1,8 @@ #!/bin/bash -[ -z ${ERESSEA} ] && ERESSEA=~/eressea +[ "$PREVIEW" != "yes" ] && exit +[ -z ${ERESSEA} ] && ERESSEA=$HOME/eressea + branch="develop" if [ -e ${ERESSEA}/build/.preview ]; then branch=`cat ${ERESSEA}/build/.preview` diff --git a/process/cron/run-eressea.cron b/process/cron/run-eressea.cron index 8b506a633..4ea38184c 100755 --- a/process/cron/run-eressea.cron +++ b/process/cron/run-eressea.cron @@ -1,7 +1,11 @@ #!/bin/bash GAME=$1 -BIN=$HOME/bin -export ERESSEA=$HOME/eressea + +[ "$ENABLED" != "yes" ] && exit +[ -z ${ERESSEA} ] && ERESSEA=$HOME/eressea + +export ERESSEA +BIN=$ERESSEA/server/bin TURN=$(cat $ERESSEA/game-$GAME/turn) if [ ! -e $ERESSEA/game-$GAME/data/$TURN.dat ]; then echo "data file $TURN is missing, cannot run turn for game $GAME" @@ -14,6 +18,18 @@ fi mkdir $REPORTS cd $ERESSEA/game-$GAME + +# wait for the queue lock to go away +maxt=5 +to=5 +while [ -e orders.queue.lock ] ; do + echo "waiting for orders to finish processing." + sleep $to + let to=$to+$to + let mast=$maxt-1 + [ $maxt -lt 0 ] && break +done + if [ -d test ]; then touch test/execute.lock fi diff --git a/process/orders.cron b/process/orders.cron deleted file mode 100755 index be573fe86..000000000 --- a/process/orders.cron +++ /dev/null @@ -1,16 +0,0 @@ -#!/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/process/run-turn b/process/run-turn index 0c5ee8fd2..c0d0d6a40 100755 --- a/process/run-turn +++ b/process/run-turn @@ -1,3 +1,5 @@ +#!/bin/sh + GAME=$1 TURN=$2 @@ -12,3 +14,4 @@ echo "running turn $TURN, game $GAME" $ERESSEA/server/bin/eressea -v3 -t $TURN run-turn.lua mkdir -p log ln -f eressea.log log/eressea.log.$TURN + diff --git a/process/run-turn.sh b/process/run-turn.sh deleted file mode 100755 index 9cc4e4ffd..000000000 --- a/process/run-turn.sh +++ /dev/null @@ -1,22 +0,0 @@ -GAME=$1 -TURN=$2 - -if [ ! -d $ERESSEA/game-$GAME ] ; then - echo "No such game: $GAME" - exit 1 -fi - -cd $ERESSEA/game-$GAME -if [ -z $TURN ]; then - TURN=$(cat turn) -fi - -echo "running turn $TURN, game $GAME" -if [ -d orders.dir.$TURN ]; then - echo "orders.dir.$TURN already exists" -else - mv orders.dir orders.dir.$TURN - mkdir -p orders.dir -fi -ls -1rt orders.dir.$TURN/turn-* | xargs cat > orders.$TURN -$ERESSEA/bin/eressea -t $TURN run-turn.lua From 9e213d3bcd1c4b66b4aa2444166e223795a7168d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 26 May 2017 19:05:46 +0200 Subject: [PATCH 2/3] minor optimization and using fraction code --- s/install | 5 ----- src/magic.c | 2 +- src/reports.c | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/s/install b/s/install index 962961063..27cf185af 100755 --- a/s/install +++ b/s/install @@ -16,8 +16,3 @@ BIN_DIR="Debug" cd $ROOT/$BIN_DIR make install - -# install crontab, but only on the eressea server: -# in fact, never do this, because it overwrites hand-edits -#WHOAMI=`whoami`@`hostname` -#[ "eressea@gruenbaer" = "$WHOAMI" ] && crontab $ROOT/process/cron/crontab diff --git a/src/magic.c b/src/magic.c index a20fbc477..81a797e1c 100644 --- a/src/magic.c +++ b/src/magic.c @@ -1107,7 +1107,7 @@ variant magic_resistance(unit * target) const plane *pl = rplane(target->region); if (rc == get_race(RC_HIRNTOETER) && !pl) { - prob.sa[1] *= 2; + prob = frac_mul(prob, frac_make(1, 2)); } assert(target->number > 0); /* Magier haben einen Resistenzbonus vom Magietalent * 5% */ diff --git a/src/reports.c b/src/reports.c index 9af18c1d2..ba0302c6c 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1221,7 +1221,7 @@ static void add_seen_nb(faction *f, region *r, seen_mode mode) { for (d = 0; d != MAXDIRECTIONS; ++d) { region *rn = next[d]; if (rn && rn->seen.modeseen.mode = seen_neighbour; if (first->index>rn->index) first = rn; if (last->indexindex) last = rn; } From b2665097469fcc4519f3e1b734070ccbf85d2e12 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 27 May 2017 20:07:36 +0200 Subject: [PATCH 3/3] Einheitenlimit anheben (3000 und 500) --- conf/e2/config.json | 2 +- conf/e3/config.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/e2/config.json b/conf/e2/config.json index 84265b78f..fb231e2eb 100644 --- a/conf/e2/config.json +++ b/conf/e2/config.json @@ -27,7 +27,7 @@ "rules.reserve.twophase": true, "rules.give.max_men": -1, "rules.check_overload": false, - "rules.limit.faction": 2500, + "rules.limit.faction": 3000, "rules.maxskills.magic": 5, "rules.guard.base_stop_prob": 0.30, "rules.guard.skill_stop_prob": 0.05, diff --git a/conf/e3/config.json b/conf/e3/config.json index adbfa3526..bfd1bd0fc 100644 --- a/conf/e3/config.json +++ b/conf/e3/config.json @@ -88,7 +88,7 @@ "rules.economy.herbrot": 0, "rules.region_owner_pay_building": "market harbour lighthouse", "rules.dwarf_castles": true, - "rules.limit.faction": 250, + "rules.limit.faction": 500, "rules.grow.formula": 1, "rules.tactics.formula": 1, "rules.help.mask": "fight guard money give",