From b078015e858361571b1bf63bbea3cd78a7f8af77 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 26 Nov 2017 18:16:34 +0100 Subject: [PATCH 1/3] prefer sqlite over berkeley --- conf/eressea.ini | 1 - src/kernel/CMakeLists.txt | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/conf/eressea.ini b/conf/eressea.ini index aed9c219c..17547f8f9 100644 --- a/conf/eressea.ini +++ b/conf/eressea.ini @@ -4,7 +4,6 @@ sender = Eressea Server name = Eressea report = reports verbose = 0 -lomem = 0 memcheck = 0 locales = de,en diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index dc8d14abd..99db2db27 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -38,14 +38,14 @@ jsonconf.test.c SET(_DBFILES db/critbit.c) -IF(SQLITE3_FOUND) -SET(_DBFILES db/sqlite.c) -ENDIF(SQLITE3_FOUND) - IF(DB_FOUND) SET(_DBFILES db/berkeley.c) ENDIF(DB_FOUND) +IF(SQLITE3_FOUND) +SET(_DBFILES db/sqlite.c) +ENDIF(SQLITE3_FOUND) + SET(_FILES ${_DBFILES} alliance.c From 55db0d98c80984240719986fd8f0968d43964ae2 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 2 Dec 2017 21:17:34 +0100 Subject: [PATCH 2/3] syntax error --- process/create-orders | 1 - 1 file changed, 1 deletion(-) diff --git a/process/create-orders b/process/create-orders index b0ca292f4..04d923d68 100755 --- a/process/create-orders +++ b/process/create-orders @@ -23,6 +23,5 @@ if [ -e orders.queue ] ; then mv orders.queue orders.dir.$TURN/orders.queue fi rm -f orders.queue.lock -fi From ac9d5a8019873763c1266ae7b10c8399109d94a0 Mon Sep 17 00:00:00 2001 From: Steffen Mecke Date: Wed, 13 Dec 2017 17:53:05 +0100 Subject: [PATCH 3/3] test movement capacity examples from rules --- scripts/tests/e2/movement.lua | 82 +++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/scripts/tests/e2/movement.lua b/scripts/tests/e2/movement.lua index b17d369f4..232782e8e 100644 --- a/scripts/tests/e2/movement.lua +++ b/scripts/tests/e2/movement.lua @@ -111,3 +111,85 @@ function test_follow_ship() assert_equal(2, u1.region.x) assert_equal(2, u2.region.x) end + +function assert_nomove(text, u) + if text == nil then text = "" else text = text .. "; " end + local r = u.region + u:add_order("NACH O O") + process_orders() + assert_equal(r, u.region, text .. "unit should never move") +end + +function assert_capacity(text, u, silver, r1, r2, rx) + if text == nil then text = "" else text = text .. "; " end + if rx == nil then rx = r1 end + u.region = r1 + u:add_item("money", silver-u:get_item("money")) + u:add_order("NACH O O") + process_orders() + assert_equal(r2, u.region, text .. "unit should move") + + u.region = r1 + u:add_item("money", 1) + process_orders() + assert_equal(rx, u.region, text .. "unit should not move") +end + +function test_dwarf_example() + local r1 = region.create(0, 0, "plain") + local r2 = region.create(1, 0, "plain") + region.create(2, 0, "plain") + local f = faction.create("dwarf", "dwarf@example.com", "de") + local u = unit.create(f, r1, 5) + u:add_item("horse", 5) + u:add_item("cart", 2) + + -- 5 dwarves + 5 horse - 2 carts = 27 + 100 - 80 = 47.00 + assert_capacity("dwarves", u, 4700, r1, r2) + + u:set_skill("riding", 3) + assert_equal(1, u:eff_skill("riding")) + -- 5 dwarves + 5 horses + 2 carts = 327.00 + assert_capacity("riding", u, 32700, r1, r2) + +end + +function test_troll_example() + local r1 = region.create(0, 0, "plain") + local r2 = region.create(1, 0, "plain") + local r3 = region.create(2, 0, "plain") + local f = faction.create("troll", "troll@example.com", "de") + local u1 = unit.create(f, r1, 3) + + u1:add_item("cart", 1) + u1:clear_orders() + + -- 3 trolls - 1 cart = 320, but not allowed? + assert_nomove("3 trolls", u1) + + u1.number = 4 + + -- 4 trolls + 1 cart = 14320 + assert_capacity("1 cart", u1, 14320, r1, r2) + + + u1:add_item("horse", 4) + -- 4 horses, 4 trolls, 1 cart + assert_capacity("4 horses", u1, 22320, r1, r2) + + + u1:add_item("cart", 1) + + -- 4 horses + 4 trolls + 1 cart - 1 cart + assert_capacity("2 carts", u1, 18320, r1, r2) + + u1:set_skill("riding", 3) + assert_equal(1, u1:eff_skill("riding")) + + -- 4 horses + 4 trolls + 2 carts = 323.20 + assert_capacity("walking", u1, 32320, r1, r2) + + -- 4 horses + 2 carts - 4 trolls = 200.00 + assert_capacity("riding", u1, 20000, r1, r3, r2) + +end