From d6b5dea01405ad0c90534511eccff62ce439cd04 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 1 Dec 2019 17:16:12 +0100 Subject: [PATCH 1/4] version 3.22 is released --- src/kernel/version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel/version.c b/src/kernel/version.c index e0eda3631..756eb3be5 100644 --- a/src/kernel/version.c +++ b/src/kernel/version.c @@ -8,7 +8,7 @@ #ifndef ERESSEA_VERSION /* the version number, if it was not passed to make with -D */ -#define ERESSEA_VERSION "3.21.0" +#define ERESSEA_VERSION "3.22.0" #endif const char *eressea_version(void) { From 2573ab19b5d9d52710a5613a20b4f625a743e3d3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 1 Dec 2019 17:20:34 +0100 Subject: [PATCH 2/4] begin work on v3.23 --- src/kernel/version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel/version.c b/src/kernel/version.c index 756eb3be5..f57fb1ff4 100644 --- a/src/kernel/version.c +++ b/src/kernel/version.c @@ -8,7 +8,7 @@ #ifndef ERESSEA_VERSION /* the version number, if it was not passed to make with -D */ -#define ERESSEA_VERSION "3.22.0" +#define ERESSEA_VERSION "3.23.0" #endif const char *eressea_version(void) { From face5eeb31ff7c24475e89b1f4f5c5868ebc0a77 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 23 Dec 2019 15:20:39 +0100 Subject: [PATCH 3/4] increase maxfiles to 50, handle error when no file generated. --- process/accept-orders.py | 2 +- process/orders-accept | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/process/accept-orders.py b/process/accept-orders.py index 5a7124d43..7c22df8fc 100755 --- a/process/accept-orders.py +++ b/process/accept-orders.py @@ -52,7 +52,7 @@ hostname = socket.gethostname() orderbase = "orders.dir" sendmail = True # maximum number of reports per sender: -maxfiles = 30 +maxfiles = 50 # write headers to file? writeheaders = True # reject all html email? diff --git a/process/orders-accept b/process/orders-accept index dfadb3aea..b1e87eb1d 100755 --- a/process/orders-accept +++ b/process/orders-accept @@ -17,10 +17,13 @@ mkdir -p orders.dir cd orders.dir lockfile -r3 -l120 "$LOCKFILE" eval "$(python "$BIN/accept-orders.py" "$@")" -rm -f "$LOCKFILE" -filename=$(basename "$ACCEPT_FILE") -email="$ACCEPT_MAIL" -if [ -d "$ERESSEA/orders-php" ] +if [ -e "$ACCEPT_FILE" ] then - php "$ERESSEA/orders-php/cli.php" insert "$filename" "$lang" "$email" + rm -f "$LOCKFILE" + filename=$(basename "$ACCEPT_FILE") + email="$ACCEPT_MAIL" + if [ -d "$ERESSEA/orders-php" ] + then + php "$ERESSEA/orders-php/cli.php" insert "$filename" "$lang" "$email" + fi fi From 42e17f3ba9152ebc1b8abce54885df67c66c5ae0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 26 Jan 2020 00:34:31 +0100 Subject: [PATCH 4/4] bug 2221: buildings cannot exceed maxsize. * enable the allies.lua tests --- res/translations/strings.en.po | 2 +- scripts/tests/e2/buildings.lua | 19 +++++++++++++++++++ scripts/tests/e2/init.lua | 4 +++- src/kernel/build.c | 22 +++++----------------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/res/translations/strings.en.po b/res/translations/strings.en.po index 0eb8d3a37..eae203dbd 100644 --- a/res/translations/strings.en.po +++ b/res/translations/strings.en.po @@ -5519,7 +5519,7 @@ msgstr "aquarians" msgctxt "iteminfo" msgid "fairyboot" -msgstr "These leather boots are embroidere with unicorn hair and allow their wearer to walk at twice his normal speed." +msgstr "These leather boots are embroidered with unicorn hair and allow their wearer to walk at twice his normal speed." msgctxt "spell" msgid "skillmod" diff --git a/scripts/tests/e2/buildings.lua b/scripts/tests/e2/buildings.lua index eb49f0ee2..845c4ba7d 100644 --- a/scripts/tests/e2/buildings.lua +++ b/scripts/tests/e2/buildings.lua @@ -29,6 +29,25 @@ function test_castle_names() assert_equal("citadel", b:get_typename(6250)) end +function test_build_tunnel_limited() + -- bug 2221 + local r = region.create(0, 0, "plain") + local b = building.create(r, "tunnel") + local f = faction.create('human') + local u = unit.create(f, r, 2) + u:set_skill('building', 6, true) + u:add_item('stone', 22) + u:add_item('log', 10) + u:add_item('iron', 2) + u:add_item('money', 700) + u.building = b + u.name = 'Xolgrim' + u:add_order('MACHE 2 BURG ' .. itoa36(b.id)) + b.size = 99 + process_orders() + assert_equal(100, b.size) +end + function test_build_castle_one_stage() local r = region.create(0, 0, 'plain') local f = faction.create('human') diff --git a/scripts/tests/e2/init.lua b/scripts/tests/e2/init.lua index 0f377a991..3bd09bafc 100644 --- a/scripts/tests/e2/init.lua +++ b/scripts/tests/e2/init.lua @@ -1,3 +1,6 @@ +require 'tests.e2.buildings' +require 'tests.e2.allies' +require 'tests.e2.quit' require 'tests.e2.movement' require 'tests.e2.carts' require 'tests.e2.quit' @@ -5,7 +8,6 @@ require 'tests.e2.astral' require 'tests.e2.spells' require 'tests.e2.e2features' require 'tests.e2.insects' -require 'tests.e2.buildings' require 'tests.e2.production' require 'tests.e2.adamantium' require 'tests.e2.undead' diff --git a/src/kernel/build.c b/src/kernel/build.c index 7e97819dc..3eb9870de 100644 --- a/src/kernel/build.c +++ b/src/kernel/build.c @@ -810,25 +810,13 @@ build_building(unit * u, const building_type * btype, int id, int want, order * } built = b->size; } - if (n <= 0 || n == INT_MAX) { - if (b == NULL) { - if (btype->maxsize > 0) { - n = btype->maxsize - built; - } - else { - n = INT_MAX; - } - } - else { - if (b->type->maxsize > 0) { - n = b->type->maxsize - built; - } - else { - n = INT_MAX; - } + + if (btype->maxsize > 0) { + int remain = btype->maxsize - built; + if (remain < n) { + n = remain; } } - built = build_stages(u, btype, built, n, basesk, &skills); if (built < 0) {