diff --git a/eressea b/eressea
index 6b57791ac..2bf3c840a 160000
--- a/eressea
+++ b/eressea
@@ -1 +1 @@
-Subproject commit 6b57791acbe40b46392d178629b9fe805829ea71
+Subproject commit 2bf3c840aee51bce17302d4140440325ffa4cb36
diff --git a/game-e2/eressea.ini b/game-e2/eressea.ini
index 15eb20b5e..8e4eff430 100644
--- a/game-e2/eressea.ini
+++ b/game-e2/eressea.ini
@@ -10,7 +10,7 @@ locales = de,en
[config]
game = eressea
-source_dir = ../..
+source_dir = ..
maxnmrs = 10
[editor]
diff --git a/game-e2/setup.lua b/game-e2/setup.lua
index 391ecd9ad..a32fa437f 100644
--- a/game-e2/setup.lua
+++ b/game-e2/setup.lua
@@ -1,9 +1,9 @@
local srcpath = config.source_dir
-local respath = srcpath .. '/eressea/res'
+local respath = srcpath .. '/res'
local paths = {
+ 'scripts/?.lua',
'eressea/scripts/?.lua',
- 'shared/scripts/?.lua',
- 'external/lunit/?.lua'
+ 'lunit/?.lua'
}
for idx, path in pairs(paths) do
diff --git a/game-e3/eressea.ini b/game-e3/eressea.ini
index 4adfd84f6..98dd9fc1b 100644
--- a/game-e3/eressea.ini
+++ b/game-e3/eressea.ini
@@ -10,7 +10,7 @@ locales = de,en
[config]
game = e3a
-source_dir = ../..
+source_dir = ..
maxnmrs = 10
[editor]
diff --git a/game-e3/setup.lua b/game-e3/setup.lua
index 5175c8e84..8fb4074e2 100644
--- a/game-e3/setup.lua
+++ b/game-e3/setup.lua
@@ -1,9 +1,9 @@
local srcpath = config.source_dir
-local respath = srcpath .. '/eressea/res'
+local respath = srcpath .. '/res'
local paths = {
+ 'scripts/?.lua',
'eressea/scripts/?.lua',
- 'shared/scripts/?.lua',
- 'external/lunit/?.lua'
+ 'lunit/?.lua'
}
for idx, path in pairs(paths) do
diff --git a/res/catalog-e3a.xml b/res/catalog-e3a.xml
index 7cdc8196f..77e0f1210 100644
--- a/res/catalog-e3a.xml
+++ b/res/catalog-e3a.xml
@@ -6,5 +6,5 @@
+ rewritePrefix="../eressea/res/" />
diff --git a/res/catalog-eressea.xml b/res/catalog-eressea.xml
index 7cdc8196f..77e0f1210 100644
--- a/res/catalog-eressea.xml
+++ b/res/catalog-eressea.xml
@@ -6,5 +6,5 @@
+ rewritePrefix="../eressea/res/" />
diff --git a/res/e3a/spellbooks/draig.xml b/res/e3a/spellbooks/draig.xml
index 5478fc69d..e75363c71 100644
--- a/res/e3a/spellbooks/draig.xml
+++ b/res/e3a/spellbooks/draig.xml
@@ -28,6 +28,5 @@
-
diff --git a/res/e3a/spellbooks/gray.xml b/res/e3a/spellbooks/gray.xml
index 0ed647fa0..217bdb8b6 100644
--- a/res/e3a/spellbooks/gray.xml
+++ b/res/e3a/spellbooks/gray.xml
@@ -33,7 +33,6 @@
-
diff --git a/scripts/e3a/modules.lua b/scripts/e3a/modules.lua
index 2f95676c0..178527e74 100644
--- a/scripts/e3a/modules.lua
+++ b/scripts/e3a/modules.lua
@@ -5,12 +5,13 @@ require "e3a.markets"
local srcpath = config.source_dir
tests = {
- srcpath .. '/shared/scripts/tests/common.lua',
- srcpath .. '/shared/scripts/tests/spells.lua',
- srcpath .. '/shared/scripts/tests/bson.lua',
+ srcpath .. '/eressea/scripts/tests/common.lua',
srcpath .. '/eressea/scripts/tests/spells.lua',
- srcpath .. '/eressea/scripts/tests/castles.lua',
- srcpath .. '/eressea/scripts/tests/morale.lua',
- srcpath .. '/eressea/scripts/tests/e3a.lua',
- srcpath .. '/eressea/scripts/tests/stealth.lua',
+-- srcpath .. '/eressea/scripts/tests/bson.lua',
+-- srcpath .. '/eressea/scripts/tests/attrib.lua',
+ srcpath .. '/scripts/tests/spells.lua',
+ srcpath .. '/scripts/tests/castles.lua',
+ srcpath .. '/scripts/tests/morale.lua',
+ srcpath .. '/scripts/tests/e3a.lua',
+ srcpath .. '/scripts/tests/stealth.lua',
}
diff --git a/scripts/eressea/modules.lua b/scripts/eressea/modules.lua
index 2765b8d2e..1e27c889b 100644
--- a/scripts/eressea/modules.lua
+++ b/scripts/eressea/modules.lua
@@ -16,9 +16,10 @@ require "eressea.ents"
local srcpath = config.source_dir
tests = {
- srcpath .. '/shared/scripts/tests/common.lua',
- srcpath .. '/shared/scripts/tests/spells.lua',
- srcpath .. '/shared/scripts/tests/bson.lua',
+ srcpath .. '/eressea/scripts/tests/common.lua',
srcpath .. '/eressea/scripts/tests/spells.lua',
- srcpath .. '/eressea/scripts/tests/eressea.lua',
+-- srcpath .. '/eressea/scripts/tests/bson.lua',
+ srcpath .. '/scripts/tests/spells.lua',
+ srcpath .. '/scripts/tests/spells-e2.lua',
+ srcpath .. '/scripts/tests/eressea.lua',
}
diff --git a/scripts/tests/castles.lua b/scripts/tests/castles.lua
index f37955d98..056eede5e 100644
--- a/scripts/tests/castles.lua
+++ b/scripts/tests/castles.lua
@@ -1,6 +1,6 @@
require "lunit"
-module( "castles", package.seeall, lunit.testcase )
+module("tests.e3.castles", package.seeall, lunit.testcase )
function setup()
free_game()
diff --git a/scripts/tests/e3a.lua b/scripts/tests/e3a.lua
index 8d433826f..4b11d0888 100644
--- a/scripts/tests/e3a.lua
+++ b/scripts/tests/e3a.lua
@@ -1,61 +1,12 @@
require "lunit"
-module("e3", package.seeall, lunit.testcase)
+module("tests.e3.e3features", package.seeall, lunit.testcase)
function setup()
free_game()
settings.set("rules.economy.food", "0")
end
-function has_attrib(u, value)
- for a in u.attribs do
- if (a.data==value) then return true end
- end
- return false
-end
-
-function test_attrib_global()
- a = attrib.create('global', {})
- write_game('attrib.dat')
- free_game()
- read_game('attrib.dat')
-end
-
-function test_attrib()
- local r = region.create(0,0, "plain")
- local f = faction.create("noreply@eressea.de", "human", "de")
- local u = unit.create(f, r, 1)
- local u2 = unit.create(f, r, 1)
- data = { arr = { 'a', 'b', 'c' }, name = 'familiar', events = { die = 'familiar_died' }, data = { mage = u2 } }
- a = { 'a' }
- b = { 'a' }
- uno = u.id
- u2no = u2.id
- a = attrib.create(u, 12)
- a = attrib.create(u, "enno")
- a = attrib.create(u, u2)
- a = attrib.create(u, data)
- write_game("attrib.dat")
- free_game()
- read_game("attrib.dat")
- u = get_unit(uno)
- u2 = get_unit(u2no)
- assert_false(has_attrib(u, 42))
- assert_true(has_attrib(u, "enno"))
- assert_true(has_attrib(u, 12))
-
- for a in u.attribs do
- x = a.data
- if (type(x)=="table") then
- assert_equal('a', x.arr[1])
- assert_equal('familiar', x.name)
- assert_equal('familiar_died', x.events.die)
- assert_equal(u2, x.data.mage)
- break
- end
- end
-end
-
function test_no_stealth()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
diff --git a/scripts/tests/eressea.lua b/scripts/tests/eressea.lua
index 39d881952..9b3d1316d 100644
--- a/scripts/tests/eressea.lua
+++ b/scripts/tests/eressea.lua
@@ -1,6 +1,6 @@
require "lunit"
-module( "e2", package.seeall, lunit.testcase )
+module("tests.e3.e2features", package.seeall, lunit.testcase )
function setup()
free_game()
diff --git a/scripts/tests/morale.lua b/scripts/tests/morale.lua
index 0ac64d444..cb0672ac0 100644
--- a/scripts/tests/morale.lua
+++ b/scripts/tests/morale.lua
@@ -1,6 +1,6 @@
require "lunit"
-module( "morale", package.seeall, lunit.testcase )
+module("tests.e3.morale", package.seeall, lunit.testcase )
function setup()
free_game()
diff --git a/scripts/tests/spells-e2.lua b/scripts/tests/spells-e2.lua
new file mode 100644
index 000000000..9f6865c01
--- /dev/null
+++ b/scripts/tests/spells-e2.lua
@@ -0,0 +1,37 @@
+require "lunit"
+
+module("tests.e3.spells-e2", package.seeall, lunit.testcase)
+
+local r, f, u
+
+function setup()
+ free_game()
+ settings.set("magic.regeneration.enable", "0")
+ settings.set("magic.fumble.enable", "0")
+ settings.set("rules.economy.food", "4")
+
+ r = region.create(0, 0, "plain")
+ f = faction.create("spell_payment@eressea.de", "elf", "de")
+ u = unit.create(f, r, 1)
+ u.magic = "gray"
+ u:set_skill("magic", 12)
+end
+
+function test_create_magicherbbag()
+ u:add_spell('create_magicherbbag')
+ u:cast_spell('create_magicherbbag')
+ assert_equal(1, u:get_item("magicherbbag"))
+end
+
+function test_create_runesword()
+ u:add_spell('create_runesword')
+ u:cast_spell('create_runesword')
+ assert_equal(1, u:get_item("runesword"))
+end
+
+function test_create_firesword()
+ u:add_spell("create_firesword")
+ u:cast_spell('create_firesword', 1)
+ assert_equal(1, u:get_item("firesword"))
+end
+
diff --git a/scripts/tests/spells.lua b/scripts/tests/spells.lua
index e1e3b38b0..727658a35 100644
--- a/scripts/tests/spells.lua
+++ b/scripts/tests/spells.lua
@@ -1,6 +1,6 @@
require "lunit"
-module("tests.spells", package.seeall, lunit.testcase)
+module("tests.e3.spells", package.seeall, lunit.testcase)
function setup()
free_game()
diff --git a/scripts/tests/stealth.lua b/scripts/tests/stealth.lua
index c1ff9dcb2..4c169e9f8 100644
--- a/scripts/tests/stealth.lua
+++ b/scripts/tests/stealth.lua
@@ -1,24 +1,21 @@
require "lunit"
-module("e3-stealth", package.seeall, lunit.testcase)
+module("tests.e3.stealth", package.seeall, lunit.testcase)
-function setup_stealth()
- local result = {}
+local f
+local u
+
+function setup()
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
+ settings.set("rules.economy.food", "4")
+
+ local r = region.create(0,0, "plain")
+ f = faction.create("stealthy@eressea.de", "human", "de")
+ u = unit.create(f, r, 1)
+ f = faction.create("stealth@eressea.de", "human", "de")
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")
@@ -29,9 +26,6 @@ function test_stealth_faction_on()
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")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 82fa8c0fa..b57a782a8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,12 @@
cmake_minimum_required(VERSION 2.6)
project (server C)
+IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
+ELSE(CMAKE_COMPILER_IS_GNUCC)
+ MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+
find_package (Lua51 REQUIRED)
find_package (LibXml2 REQUIRED)
find_package (SQLite3 REQUIRED)
diff --git a/src/main.c b/src/main.c
index dfd61fe2e..c79f1e38b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,12 +2,15 @@
#include
#include
-#include
-#include
#include
#include
+#include
+#include
+
#include "races/races.h"
+#include "spells/spells.h"
+#include "curses.h"
#include
#include