diff --git a/conf/e4/config.json b/conf/e4/config.json index 58ff28be4..a32d7aab7 100644 --- a/conf/e4/config.json +++ b/conf/e4/config.json @@ -2,7 +2,7 @@ "include": [ "keywords.json", "prefixes.json", - "e3/terrains.xml" + "e3/terrains.json" ], "settings": { "game.id": 4, diff --git a/s/runtests b/s/runtests index a0f50df1e..78c26eac0 100755 --- a/s/runtests +++ b/s/runtests @@ -19,6 +19,7 @@ cd $ROOT $ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests.lua $ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e2.lua $ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e3.lua +$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e4.lua rm -rf data reports orders.txt cd $OLDWPD diff --git a/scripts/run-tests-e2.lua b/scripts/run-tests-e2.lua index 4a2b3e59e..84f5dc3f9 100644 --- a/scripts/run-tests-e2.lua +++ b/scripts/run-tests-e2.lua @@ -15,6 +15,7 @@ require 'eressea' require 'eressea.xmlconf' require 'eressea.path' require 'tests.e2' +require 'tests.xmas' require 'lunit' rules = require('eressea.' .. config.rules) diff --git a/scripts/run-tests-e3.lua b/scripts/run-tests-e3.lua index 47bcca60b..1e48cd40e 100644 --- a/scripts/run-tests-e3.lua +++ b/scripts/run-tests-e3.lua @@ -15,6 +15,7 @@ require 'eressea' require 'eressea.path' require 'eressea.xmlconf' require 'tests.e3' +require 'tests.xmas' require 'lunit' eressea.settings.set("rules.alliances", "0") diff --git a/scripts/run-tests-e4.lua b/scripts/run-tests-e4.lua new file mode 100644 index 000000000..f827baec0 --- /dev/null +++ b/scripts/run-tests-e4.lua @@ -0,0 +1,23 @@ +-- Tests that work in E3. With game config of E3. +-- Tests are under scripts/test/e3 and all files must be in scripts/test/e3/init.lua + +path = 'scripts' +if config.install then + path = config.install .. '/' .. path + package.path = package.path .. ';' .. config.install .. '/lunit/?.lua' + --needed to find lunit if not run form eressea root. Needs right [lua] install setting in eressea.ini (point to eressea root from the start folder) +end +package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua' + +config.rules = 'e4' + +require 'eressea' +require 'eressea.path' +require 'eressea.xmlconf' +require 'tests.e3' +require 'lunit' + +eressea.settings.set("rules.alliances", "0") +rules = require('eressea.' .. config.rules) +result = lunit.main() +return result.errors + result.failed diff --git a/scripts/tests/e3/rules.lua b/scripts/tests/e3/rules.lua index 81bd1abe9..28b14fe10 100644 --- a/scripts/tests/e3/rules.lua +++ b/scripts/tests/e3/rules.lua @@ -199,27 +199,6 @@ function test_seecast() assert_equal(8, u2.region.x) end -local function use_tree(terrain) - local r = region.create(0,0, terrain) - local f = faction.create("noreply@eressea.de", "human", "de") - local u1 = unit.create(f, r, 5) - r:set_resource("tree", 0) - u1:add_item("xmastree", 1) - u1:clear_orders() - u1:add_order("BENUTZEN 1 Weihnachtsbaum") - process_orders() - return r -end - -function test_xmastree() - local r - r = use_tree("ocean") - assert_equal(0, r:get_resource("tree")) - eressea.free_game() - r = use_tree("plain") - assert_equal(10, r:get_resource("tree")) -end - function test_fishing() eressea.settings.set("rules.food.flags", "0") local r = region.create(0,0, "ocean") diff --git a/scripts/tests/xmas.lua b/scripts/tests/xmas.lua new file mode 100644 index 000000000..07df8dde8 --- /dev/null +++ b/scripts/tests/xmas.lua @@ -0,0 +1,20 @@ +local function use_tree(terrain) + local r = region.create(0,0, terrain) + local f = faction.create("noreply@eressea.de", "human", "de") + local u1 = unit.create(f, r, 5) + r:set_resource("tree", 0) + u1:add_item("xmastree", 1) + u1:clear_orders() + u1:add_order("BENUTZEN 1 Weihnachtsbaum") + process_orders() + return r +end + +function test_xmastree() + local r + r = use_tree("ocean") + assert_equal(0, r:get_resource("tree")) + eressea.free_game() + r = use_tree("plain") + assert_equal(10, r:get_resource("tree")) +end diff --git a/src/laws.c b/src/laws.c index c3e895757..62c3a002a 100755 --- a/src/laws.c +++ b/src/laws.c @@ -861,24 +861,6 @@ static int modify(int i) } } -static void inactivefaction(faction * f) -{ - FILE *inactiveFILE; - char zText[128]; - - sprintf(zText, "%s/%s", datapath(), "inactive"); - inactiveFILE = fopen(zText, "a"); - - if (inactiveFILE) { - fprintf(inactiveFILE, "%s:%s:%d:%d\n", - factionid(f), - LOC(default_locale, rc_name_s(f->race, NAME_PLURAL)), - modify(count_all(f)), turn - f->lastorders); - - fclose(inactiveFILE); - } -} - /* test if the unit can slip through a siege undetected. * returns 0 if siege is successful, or 1 if the building is either * not besieged or the unit can slip through the siege due to better stealth. @@ -1279,11 +1261,6 @@ static void remove_idle_players(void) sprintf(info, "%d Einheiten, %d Personen, %d Silber", f->no_units, f->num_total, f->money); } - - if (NMRTimeout() > 0 && turn - f->lastorders >= (NMRTimeout() - 1)) { - inactivefaction(f); - continue; - } } log_info(" - beseitige Spieler, die sich nach der Anmeldung nicht gemeldet haben..."); diff --git a/tests/runtests.bat b/tests/runtests.bat index 3bb41c982..e070bac2d 100644 --- a/tests/runtests.bat +++ b/tests/runtests.bat @@ -5,5 +5,6 @@ SET SERVER=%BUILD%\eressea.exe %SERVER% ..\scripts\run-tests.lua %SERVER% ..\scripts\run-tests-e2.lua %SERVER% ..\scripts\run-tests-e3.lua +%SERVER% ..\scripts\run-tests-e4.lua PAUSE RMDIR /s /q reports