diff --git a/res/catalog-e3a.xml b/game-e2/catalog.xml
similarity index 56%
rename from res/catalog-e3a.xml
rename to game-e2/catalog.xml
index 96dbf8d9d..a6c2882c8 100644
--- a/res/catalog-e3a.xml
+++ b/game-e2/catalog.xml
@@ -5,6 +5,12 @@
+
+
diff --git a/res/config-eressea.xml b/game-e2/config.xml
similarity index 64%
rename from res/config-eressea.xml
rename to game-e2/config.xml
index 579e7e94a..72c1563ab 100644
--- a/res/config-eressea.xml
+++ b/game-e2/config.xml
@@ -1,37 +1,37 @@
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -44,11 +44,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/game-e2/runtests.lua b/game-e2/runtests.lua
new file mode 100644
index 000000000..423094391
--- /dev/null
+++ b/game-e2/runtests.lua
@@ -0,0 +1,2 @@
+require "setup"
+run_tests()
diff --git a/game-e2/setup.lua b/game-e2/setup.lua
index d9dea3541..ccd43719d 100644
--- a/game-e2/setup.lua
+++ b/game-e2/setup.lua
@@ -10,6 +10,5 @@ for idx, path in pairs(paths) do
package.path = srcpath .. '/' .. path .. ';' .. package.path
end
-read_xml(respath..'/config-eressea.xml', respath..'/catalog-eressea.xml')
-
+assert(read_xml())
require "init"
diff --git a/game-e3/catalog.xml b/game-e3/catalog.xml
index 93cda3505..3d82919cd 100644
--- a/game-e3/catalog.xml
+++ b/game-e3/catalog.xml
@@ -4,13 +4,13 @@
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
-
+
diff --git a/game-e3/runtests.lua b/game-e3/runtests.lua
index 9a167d039..423094391 100644
--- a/game-e3/runtests.lua
+++ b/game-e3/runtests.lua
@@ -1,3 +1,2 @@
require "setup"
-read_xml("config.xml", "catalog.xml")
run_tests()
diff --git a/game-e3/setup.lua b/game-e3/setup.lua
index e93f64a48..ccd43719d 100644
--- a/game-e3/setup.lua
+++ b/game-e3/setup.lua
@@ -10,6 +10,5 @@ for idx, path in pairs(paths) do
package.path = srcpath .. '/' .. path .. ';' .. package.path
end
-read_xml(respath..'/config-e3a.xml', respath..'/catalog-e3a.xml')
-
+assert(read_xml())
require "init"
diff --git a/res/catalog-eressea.xml b/res/catalog-eressea.xml
deleted file mode 100644
index 96dbf8d9d..000000000
--- a/res/catalog-eressea.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
diff --git a/res/config-e3a.xml b/res/config-e3a.xml
deleted file mode 100644
index 22c3bd645..000000000
--- a/res/config-e3a.xml
+++ /dev/null
@@ -1,190 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- eressea-server@eressea.de
- eressea-server@eressea.de
-
-
- Bitte denke daran, deine Befehle mit dem Betreff
- E3 BEFEHLE an eressea-server@eressea.de zu senden.
- Remember to send your orders to
- eressea-server@eressea.de with the subject E3 ORDERS.
-
-
- E3 BEFEHLE
- E3 ORDERS
-
-
-
diff --git a/src/bindings.c b/src/bindings.c
index 6b45bfb2f..3bd2db543 100755
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -462,9 +462,14 @@ static int tolua_init_reports(lua_State * L)
static int tolua_write_report(lua_State * L)
{
faction *f = (faction *) tolua_tousertype(L, 1, 0);
- time_t ltime = time(0);
- int result = write_reports(f, ltime);
- tolua_pushnumber(L, (lua_Number) result);
+ if (f) {
+ time_t ltime = time(0);
+ int result = write_reports(f, ltime);
+ tolua_pushnumber(L, (lua_Number)result);
+ }
+ else {
+ tolua_pushstring(L, "function expects a faction, got nil");
+ }
return 1;
}
@@ -997,8 +1002,8 @@ int tolua_read_xml(lua_State * L)
{
const char *filename = tolua_tostring(L, 1, "config.xml");
const char *catalog = tolua_tostring(L, 2, "catalog.xml");
- init_data(filename, catalog);
- return 0;
+ lua_pushinteger(L, init_data(filename, catalog));
+ return 1;
}
typedef struct event_args {
@@ -1204,9 +1209,13 @@ int eressea_run(lua_State *L, const char *luafile)
/* run the main script */
if (luafile) {
log_debug("executing script %s\n", luafile);
+
+ lua_getglobal(L, "debug");
+ lua_getfield(L, -1, "traceback");
+ lua_remove(L, -2);
lua_getglobal(L, "dofile");
lua_pushstring(L, luafile);
- err = lua_pcall(L, 1, 1, 0);
+ err = lua_pcall(L, 1, 1, -3);
if (err != 0) {
log_lua_error(L);
abort();
diff --git a/src/util/xml.c b/src/util/xml.c
index b1647838e..0755e7331 100644
--- a/src/util/xml.c
+++ b/src/util/xml.c
@@ -108,29 +108,28 @@ int read_xml(const char *filename, const char *catalog)
{
xml_reader *reader = xmlReaders;
xmlDocPtr doc;
+ int result;
if (catalog) {
xmlLoadCatalog(catalog);
}
-#ifdef XML_PARSE_XINCLUDE
- doc = xmlReadFile(filename, NULL, XML_PARSE_XINCLUDE|XML_PARSE_NONET|XML_PARSE_PEDANTIC);
-#else
- doc = xmlParseFile(filename);
-#endif
+ doc = xmlReadFile(filename, NULL, XML_PARSE_XINCLUDE | XML_PARSE_NONET | XML_PARSE_PEDANTIC | XML_PARSE_COMPACT);
if (doc == NULL) {
log_error("could not open '%s'\n", filename);
return -1;
}
- xmlXIncludeProcess(doc);
-
- while (reader != NULL) {
- int i = reader->callback(doc);
- if (i != 0) {
- return i;
- }
- reader = reader->next;
+ result = xmlXIncludeProcessFlags(doc, XML_PARSE_XINCLUDE | XML_PARSE_NONET | XML_PARSE_PEDANTIC | XML_PARSE_COMPACT);
+ if (result >= 0) {
+ while (reader != NULL) {
+ int i = reader->callback(doc);
+ if (i != 0) {
+ return i;
+ }
+ reader = reader->next;
+ }
+ result = 0;
}
xmlFreeDoc(doc);
- return 0;
+ return result;
}