From a4a3ebd633012d5977ee621fad00c953d661231e Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 21 Jul 2018 21:41:13 +0200 Subject: [PATCH 1/4] backup the reports, because sometimes I am an idiot --- process/backup-eressea | 3 +++ 1 file changed, 3 insertions(+) diff --git a/process/backup-eressea b/process/backup-eressea index 4914f5af0..4e5f69002 100755 --- a/process/backup-eressea +++ b/process/backup-eressea @@ -28,6 +28,9 @@ if [ -e orders.$TURN ]; then files="$files orders.$TURN" fi echo "backup turn $TURN, game $GAME, files: $files" +if [ -d reports ] ; then + tar cjf backup/$TURN-reports.tar.bz2 reports +fi tar cjf backup/$TURN.tar.bz2 $files echo "uploading game-$GAME/$TURN.tar.bz2" curl -s -n -T backup/$TURN.tar.bz2 https://dav.box.com/dav/Eressea/game-$GAME/$TURN.tar.bz2 From e7184add00e0d1e1de1629489bddd5537e88f023 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 24 Jul 2018 13:57:46 +0200 Subject: [PATCH 2/4] use system-wide muttrc --- process/send-bz2-report | 2 +- process/send-zip-report | 2 +- s/preview | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/process/send-bz2-report b/process/send-bz2-report index c9fb87840..51a8113bf 100755 --- a/process/send-bz2-report +++ b/process/send-bz2-report @@ -25,6 +25,6 @@ addr=$1 subj=$2 shift 2 -mutt -F "$ERESSEA/etc/muttrc" -s "$subj" -a "$@" -- "$addr" \ +mutt -s "$subj" -a "$@" -- "$addr" \ < "$ERESSEA/server/etc/$TEMPLATE" diff --git a/process/send-zip-report b/process/send-zip-report index 89f742b82..a6bd85246 100755 --- a/process/send-zip-report +++ b/process/send-zip-report @@ -44,6 +44,6 @@ addr=$1 subject=$2 shift 2 -mutt -F "$ERESSEA/etc/muttrc" -s "$subject" -a "$@" -- "$addr" \ +mutt -s "$subject" -a "$@" -- "$addr" \ < "$TEMPLATE" || echo "Sending failed for email/report: $2/$3" diff --git a/s/preview b/s/preview index 68fe6e39f..39d5466d0 100755 --- a/s/preview +++ b/s/preview @@ -93,7 +93,7 @@ email=$(grep "faction=$1:" reports.txt | cut -d: -f2 | sed 's/email=//') echo "sending reports to $1 / $email" info=/dev/null [ -e ../email.txt ] && info=../email.txt -cat $info | mutt -F $ERESSEA/etc/muttrc -s "Testauswertung Spiel $game Partei $1" -a $zip -- $email +cat $info | mutt -s "Testauswertung Spiel $game Partei $1" -a $zip -- $email } game=0 From ec571924037cc06b23eff622b828f865cd65a57b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 30 Jul 2018 22:19:40 +0200 Subject: [PATCH 3/4] equip_newunits got called twice. --- scripts/eressea/equipment.lua | 1 - scripts/tests/config.lua | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/eressea/equipment.lua b/scripts/eressea/equipment.lua index 8852dfb27..c7bfe7dad 100644 --- a/scripts/eressea/equipment.lua +++ b/scripts/eressea/equipment.lua @@ -2,7 +2,6 @@ local self = {} local function equip_first(u) - equip_newunits(u) name = 'seed_' .. u.race equip_unit(u, name, 255) end diff --git a/scripts/tests/config.lua b/scripts/tests/config.lua index 316a8ccca..733a8ee07 100644 --- a/scripts/tests/config.lua +++ b/scripts/tests/config.lua @@ -30,6 +30,26 @@ function test_first_troll() assert_equal(2, u:eff_skill('perception')) end +function test_first_human() + local f = faction.create('human') + local r = region.create(0, 0, "plain") + local u = unit.create(f, r, 1) + u:equip('first_unit') + assert_not_nil(u.building) + assert_equal('castle', u.building.type) + assert_equal(10, u.building.size) +end + +function test_first_aquarian() + local f = faction.create('aquarian') + local r = region.create(0, 0, "plain") + local u = unit.create(f, r, 1) + u:equip('first_unit') + assert_not_nil(u.ship) + assert_equal('boat', u.ship.type) + assert_equal(1, u:get_skill('sailing')) +end + function test_seed_unit() local r = region.create(0, 0, "plain") local f = faction.create('human') @@ -53,3 +73,4 @@ function test_seed_elf() assert_equal('castle', u.building.type) assert_equal(10, u.building.size) end + From 6f5f1651c7a1f86358929c1ebe404f310f5e6e17 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 9 Sep 2018 07:41:30 +0200 Subject: [PATCH 4/4] fix crashes when trying to trade on ocean. fix missing message sections. --- res/core/messages.xml | 6 +++--- src/economy.c | 5 +++-- src/kernel/region.c | 5 ++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/res/core/messages.xml b/res/core/messages.xml index d566c82e6..7e55e05f9 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -30,7 +30,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -46,7 +46,7 @@ - + diff --git a/src/economy.c b/src/economy.c index 3bb7b1066..4a6aa5672 100644 --- a/src/economy.c +++ b/src/economy.c @@ -1660,7 +1660,7 @@ static void buy(unit * u, econ_request ** buyorders, struct order *ord) return; } } - if (r_demand(r, ltype)) { + if (!r->land || r_demand(r, ltype)) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "luxury_notsold", "")); return; } @@ -1702,6 +1702,7 @@ static void expandselling(region * r, econ_request * sellorders, int limit) static int bt_cache; static const struct building_type *castle_bt, *harbour_bt, *caravan_bt; + assert(r->land); if (bt_changed(&bt_cache)) { castle_bt = bt_find("castle"); harbour_bt = bt_find("harbour"); @@ -1971,7 +1972,7 @@ static bool sell(unit * u, econ_request ** sellorders, struct order *ord) econ_request *o; int k, available; - if (!r_demand(r, ltype)) { + if (!r->land || !r_demand(r, ltype)) { cmistake(u, ord, 263, MSG_COMMERCE); return false; } diff --git a/src/kernel/region.c b/src/kernel/region.c index 7cb52c201..29f7222e1 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -716,7 +716,10 @@ const item_type *r_luxury(const region * r) int r_demand(const region * r, const luxury_type * ltype) { - struct demand *d = r->land->demands; + struct demand *d; + + assert(r && r->land); + d = r->land->demands; while (d && d->type != ltype) d = d->next; if (!d)