diff --git a/.gitignore b/.gitignore
index 18c434a75..fe7235a1d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,6 @@ bin/
*.suo
*.sdf
*.bak
+*.opensdf
+ipch/
+*.log
diff --git a/res/config-e3a.xml b/res/config-e3a.xml
index a42b5ffdb..7037ffd24 100644
--- a/res/config-e3a.xml
+++ b/res/config-e3a.xml
@@ -64,7 +64,6 @@
-
@@ -131,7 +130,8 @@
-
+
+
diff --git a/res/config-eressea.xml b/res/config-eressea.xml
index 291277c6f..e28a6ece5 100644
--- a/res/config-eressea.xml
+++ b/res/config-eressea.xml
@@ -100,7 +100,8 @@
-
+
+
diff --git a/res/e3a/ships.xml b/res/e3a/ships.xml
index 0c8c184e0..1174eda8e 100644
--- a/res/e3a/ships.xml
+++ b/res/e3a/ships.xml
@@ -3,6 +3,7 @@
+
@@ -10,8 +11,6 @@
-
-
@@ -20,6 +19,7 @@
+
@@ -30,6 +30,7 @@
+
@@ -37,8 +38,6 @@
-
-
@@ -47,6 +46,7 @@
+
@@ -54,8 +54,6 @@
-
-
@@ -65,6 +63,7 @@
+
@@ -72,8 +71,6 @@
-
-
@@ -83,6 +80,7 @@
+
@@ -93,6 +91,7 @@
+
@@ -101,6 +100,7 @@
+
@@ -111,6 +111,7 @@
+
@@ -121,6 +122,7 @@
+
@@ -133,6 +135,7 @@
+
@@ -144,6 +147,7 @@
+
diff --git a/res/e3a/strings.xml b/res/e3a/strings.xml
index 3e4c3e9d1..3b368a28e 100644
--- a/res/e3a/strings.xml
+++ b/res/e3a/strings.xml
@@ -13,6 +13,15 @@
the third age
+
+ Packeis
+ fast ice
+
+
+ %s
+ %s
+
+
Urkunden
Certificates
diff --git a/res/e3a/terrains.xml b/res/e3a/terrains.xml
index 512536c38..f473fd500 100644
--- a/res/e3a/terrains.xml
+++ b/res/e3a/terrains.xml
@@ -1,6 +1,6 @@
-
+
@@ -44,19 +44,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/res/eressea/spells.xml b/res/eressea/spells.xml
index 08f43a0ac..7c4816912 100644
--- a/res/eressea/spells.xml
+++ b/res/eressea/spells.xml
@@ -292,7 +292,7 @@
-
+
@@ -301,10 +301,10 @@
-
+
-
+
@@ -368,16 +368,16 @@
-
+
-
+
-
+
-
+
diff --git a/scripts/e3a/frost.lua b/scripts/e3a/frost.lua
new file mode 100644
index 000000000..31bf9fe6f
--- /dev/null
+++ b/scripts/e3a/frost.lua
@@ -0,0 +1,52 @@
+module('frost', package.seeall)
+
+local function is_winter(turn)
+ local season = get_season(turn)
+ return season == "calendar::winter"
+end
+
+local function is_spring(turn)
+ local season = get_season(turn)
+ return season == "calendar::spring"
+end
+
+local function freeze(r, chance)
+ for i, rn in ipairs(r.adj) do
+ -- each region has a chance to freeze
+ if rn.terrain=="ocean" and (chance>=100 or math.mod(rng_int(), 100)=100 or math.mod(rng_int(), 100)=h+100)
- assert_equal(m1-221-10*u1.number, u1:get_item("money"))
- assert_equal(m2+110-10*u2.number, u2:get_item("money"))
+ assert_true(r:get_resource("horse")>=h+100)
+ assert_equal(m1-221, u1:get_item("money"))
+ assert_equal(m2+110, u2:get_item("money"))
end
function test_give_100_percent_of_items()
- local u1, u2 = two_units(region.create(0, 0, "plain"), two_factions())
- local r = u2.region
+ r = region.create(0, 0, "plain")
+ local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
+ local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)
u1.faction.age = 10
u2.faction.age = 10
u1:add_item("money", 500)
@@ -552,43 +571,65 @@ function test_market_action()
assert_equal(70, u:get_item("h2"))
end
--- function test_process_execute()
- -- local i = 0
- -- local f = faction.create("noreply@eressea.de", "human", "de")
- -- local r = region.create(0, 0, "plain")
- -- local u = unit.create(f, r, 1)
- -- local r1, u1
+local function setup_packice(x, onfoot)
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ local plain = region.create(0,0, "plain")
+ local ice = region.create(1,0, "packice")
+ local ocean = region.create(2,0, "ocean")
+ local u = unit.create(f, get_region(x, 0), 2)
+ if not onfoot then
+ local s = ship.create(u.region, "cutter")
+ u:set_skill("sailing", 3)
+ u.ship = s
+ end
+ u:add_item("money", 400)
- -- function a() i = 2 end
- -- function b() i = i * 2 end
- -- function c(r) r1 = r i = i + 1 end
- -- function d(u) u1 = u i = i * 3 end
- -- process.execute({a, b}, {c}, {d})
- -- assert_equal(15, i)
- -- assert_equal(r, r1)
- -- assert_equal(u, u1)
--- end
+ return u
+end
--- function test_new_orders()
- -- local i = 0
- -- local f = faction.create("noreply@eressea.de", "human", "de")
- -- local r = region.create(0, 0, "plain")
- -- local u = unit.create(f, r, 1)
- -- local r1, u1
+function test_no_sailing_through_packice()
+ local u = setup_packice(0)
+ u:clear_orders()
+ u:add_order("NACH O O")
+ process_orders()
+ assert_equal(0, u.region.x)
+end
- -- function a() i = 2 end
- -- function b() i = i * 2 end
- -- function c(r) r1 = r i = i + 1 end
- -- function d(u) u1 = u i = i * 3 end
+function test_can_sail_from_packice_to_ocean()
+ local u = setup_packice(1)
- -- process.setup()
- -- process.push(a)
- -- process.push(b)
- -- process.push(c, "region")
- -- process.push(d, "unit")
- -- process.start()
+ u:clear_orders()
+ u:add_order("NACH W")
+ process_orders()
+ assert_equal(1, u.region.x)
+
+ u:clear_orders()
+ u:add_order("NACH O")
+ process_orders()
+ assert_equal(2, u.region.x)
+end
+
+function test_can_sail_into_packice()
+ local u = setup_packice(2)
+ u:clear_orders()
+ u:add_order("NACH W W")
+ process_orders()
+ assert_equal(1, u.region.x)
+end
+
+function test_can_walk_into_packice()
+ local u = setup_packice(0, true)
+ u:clear_orders()
+ u:add_order("NACH O")
+ process_orders()
+ assert_equal(1, u.region.x)
+end
+
+function test_cannot_walk_into_ocean()
+ local u = setup_packice(1, true)
+ u:clear_orders()
+ u:add_order("NACH O")
+ process_orders()
+ assert_equal(1, u.region.x)
+end
- -- assert_equal(15, i)
- -- assert_equal(r, r1)
- -- assert_equal(u, u1)
--- end
diff --git a/scripts/tests/eressea.lua b/scripts/tests/eressea.lua
index 06e1fd701..8a0060088 100644
--- a/scripts/tests/eressea.lua
+++ b/scripts/tests/eressea.lua
@@ -4,6 +4,45 @@ module( "e2", package.seeall, lunit.testcase )
function setup()
free_game()
+ settings.set("nmr.timeout", "0")
+ settings.set("rules.economy.food", "4")
+end
+
+function test_learn()
+ settings.set("study.random_progress", "0")
+ local r = region.create(0, 0, "plain")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ f.age = 20
+ local u = unit.create(f, r)
+ u:clear_orders()
+ u:add_order("@LERNEN Reiten")
+ process_orders()
+ assert_equal(1, u:get_skill("riding"))
+ process_orders()
+ process_orders()
+ assert_equal(2, u:get_skill("riding"))
+ process_orders()
+ process_orders()
+ process_orders()
+ assert_equal(3, u:get_skill("riding"))
+end
+
+function test_teach()
+ settings.set("study.random_progress", "0")
+ local r = region.create(0, 0, "plain")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ f.age = 20
+ local u = unit.create(f, r, 10)
+ local u2 = unit.create(f, r)
+ u:clear_orders()
+ u:add_order("@LERNEN reiten")
+ u2:clear_orders()
+ u2:add_order("LEHREN " .. itoa36(u.id))
+ u2:set_skill("riding", 4)
+ process_orders()
+ assert_equal(1, u:get_skill("riding"))
+ process_orders()
+ assert_equal(2, u:get_skill("riding"))
end
function test_rename()
@@ -79,6 +118,7 @@ function test_ship_capacity()
u4:add_order("NACH O O")
process_orders()
+
-- print(s.region, u.region, r2)
assert_equal(r2.id, u1.region.id, "boat with 5 humans did not move")
assert_not_equal(r2.id, u2.region.id, "boat with too many people has moved")
@@ -142,3 +182,21 @@ function test_no_uruk()
local f1 = faction.create("noreply@eressea.de", "uruk", "de")
assert_equal(f1.race, "orc")
end
+
+function test_snowman()
+ local r = region.create(0, 0, "glacier")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ local u = unit.create(f, r, 1)
+ u:add_item("snowman", 1)
+ u:clear_orders()
+ u:add_order("BENUTZEN 1 Schneemann")
+ process_orders()
+ for u2 in r.units do
+ if u2~=u then
+ assert_equal(u2.race, "snowman")
+ u = nil
+ break
+ end
+ end
+ assert_equal(nil, u)
+end
diff --git a/scripts/tests/stealth.lua b/scripts/tests/stealth.lua
new file mode 100644
index 000000000..c1ff9dcb2
--- /dev/null
+++ b/scripts/tests/stealth.lua
@@ -0,0 +1,42 @@
+require "lunit"
+
+module("e3-stealth", package.seeall, lunit.testcase)
+
+function setup_stealth()
+ local result = {}
+ free_game()
+ result.r = region.create(0,0, "plain")
+ result.f1 = faction.create("noreply@eressea.de", "human", "de")
+ result.f2 = faction.create("noreply@eressea.de", "human", "de")
+ result.u1 = unit.create(result.f1, result.r, 1)
+ result.u2 = unit.create(result.f2, result.r, 1)
+ result.u1:add_item("money", 1000)
+ result.u2:add_item("money", 1000)
+ return result
+end
+
+function test_stealth_faction_on()
+ local result = setup_stealth()
+ local f = result.f2
+ local u = result.u1
+ u:clear_orders()
+ u:add_order("TARNEN PARTEI")
+
+ settings.set("rules.stealth.faction", 1)
+ process_orders()
+ assert_not_match("Partei", report.report_unit(u, f))
+ assert_match("anonym", report.report_unit(u, f))
+end
+
+function test_stealth_faction_off()
+ local result = setup_stealth()
+ local f = result.f2
+ local u = result.u1
+ u:clear_orders()
+ u:add_order("TARNEN PARTEI")
+
+ settings.set("rules.stealth.faction", 0)
+ process_orders()
+ assert_match("Partei", report.report_unit(u, f))
+ assert_not_match("anonym", report.report_unit(u, f))
+end
diff --git a/src/eressea.vcxproj b/src/eressea.vcxproj
index 640685a1c..6bc2b8490 100644
--- a/src/eressea.vcxproj
+++ b/src/eressea.vcxproj
@@ -11,7 +11,7 @@
- amalgamation-eressea
+ eressea
{AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}
build
Win32Proj
@@ -186,4 +186,4 @@
-
+
\ No newline at end of file
diff --git a/src/eressea.vcxproj.filters b/src/eressea.vcxproj.filters
index f3457e733..4af32df31 100644
--- a/src/eressea.vcxproj.filters
+++ b/src/eressea.vcxproj.filters
@@ -53,35 +53,35 @@
Source Files
-
- Source Files
-
Source Files
Source Files
-
- Unity Build
-
-
- Unity Build
-
-
- Unity Build
-
-
- Unity Build
-
Unity Build
-
- Unity Build
+
+ Source Files
-
- Unity Build
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
@@ -106,15 +106,15 @@
Header Files
-
- Header Files
-
-
- Header Files
-
Header Files
+
+ Header Files
+
+
+ Header Files
+
diff --git a/src/monsters.c b/src/monsters.c
index c80915ee7..c956350e8 100644
--- a/src/monsters.c
+++ b/src/monsters.c
@@ -543,7 +543,7 @@ monster_attacks(unit * u)
unit * u2;
for (u2=r->units;u2;u2=u2->next) {
- if (u2->faction!=u->faction && chance(0.75)) {
+ if (cansee(u->faction, r, u2, 0) && u2->faction!=u->faction && chance(0.75)) {
order * ord = monster_attack(u, u2);
if (ord) addlist(&u->orders, ord);
}