diff --git a/game/eressea.ini b/game/eressea.ini
index e9a95cb15..8ff5504ac 100644
--- a/game/eressea.ini
+++ b/game/eressea.ini
@@ -1,17 +1,17 @@
-[eressea]
-base = .
-load = setup.lua
-report = reports
-verbose = 0
-lomem = 0
-debug = 0
-memcheck = 0
-locales = de,en
-
-[config]
-game = example
-source_dir = ../..
-maxnmrs = 10
-
-[editor]
-color = 1
+[eressea]
+base = .
+load = setup.lua
+report = reports
+verbose = 0
+lomem = 0
+debug = 0
+memcheck = 0
+locales = de,en
+
+[config]
+game = example
+source_dir = ../..
+maxnmrs = 10
+
+[editor]
+color = 1
diff --git a/game/setup.lua b/game/setup.lua
index 0c9f0ca3d..98012f20e 100644
--- a/game/setup.lua
+++ b/game/setup.lua
@@ -1,15 +1,15 @@
-local srcpath = config.source_dir
-local respath = srcpath .. '/example/res'
-local paths = {
- 'example/scripts/?.lua',
- 'server/scripts/?.lua',
- 'external/lunit/?.lua'
-}
-
-for idx, path in pairs(paths) do
- package.path = srcpath .. '/' .. path .. ';' .. package.path
-end
-
-read_xml(respath..'/config-example.xml', respath..'/catalog-example.xml')
-
-require "init"
+local srcpath = config.source_dir
+local respath = srcpath .. '/example/res'
+local paths = {
+ 'example/scripts/?.lua',
+ 'server/scripts/?.lua',
+ 'external/lunit/?.lua'
+}
+
+for idx, path in pairs(paths) do
+ package.path = srcpath .. '/' .. path .. ';' .. package.path
+end
+
+read_xml(respath..'/config-example.xml', respath..'/catalog-example.xml')
+
+require "init"
diff --git a/res/armor.xml b/res/armor.xml
index bfd1b851a..f24ddcd35 100644
--- a/res/armor.xml
+++ b/res/armor.xml
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/buildings.xml b/res/buildings.xml
index eddaf42bc..3d128a12c 100644
--- a/res/buildings.xml
+++ b/res/buildings.xml
@@ -1,4 +1,4 @@
-
-
-
-
+
+
+
+
diff --git a/res/buildings/castle.xml b/res/buildings/castle.xml
index 071fb13fc..296d1f716 100644
--- a/res/buildings/castle.xml
+++ b/res/buildings/castle.xml
@@ -1,26 +1,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/catalog-example.xml b/res/catalog-example.xml
index 2b16bf737..661a6cedb 100644
--- a/res/catalog-example.xml
+++ b/res/catalog-example.xml
@@ -1,10 +1,10 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/res/items.xml b/res/items.xml
index c526081c0..e8fa7246a 100644
--- a/res/items.xml
+++ b/res/items.xml
@@ -1,3 +1,3 @@
-
-
-
+
+
+
diff --git a/res/races.xml b/res/races.xml
index c79f3d002..09ce2212e 100644
--- a/res/races.xml
+++ b/res/races.xml
@@ -1,14 +1,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/races/aquarian.xml b/res/races/aquarian.xml
index 0b53b588c..0bd11c8c3 100644
--- a/res/races/aquarian.xml
+++ b/res/races/aquarian.xml
@@ -1,20 +1,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/races/cat.xml b/res/races/cat.xml
index f1ac0f5ee..d71d41b92 100644
--- a/res/races/cat.xml
+++ b/res/races/cat.xml
@@ -1,27 +1,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/races/demon.xml b/res/races/demon.xml
index 9b5802450..24f89c515 100644
--- a/res/races/demon.xml
+++ b/res/races/demon.xml
@@ -1,33 +1,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/races/dwarf.xml b/res/races/dwarf.xml
index d1efbfc21..a718581a7 100644
--- a/res/races/dwarf.xml
+++ b/res/races/dwarf.xml
@@ -1,33 +1,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/races/elf.xml b/res/races/elf.xml
index 07e6cd3c0..678422652 100644
--- a/res/races/elf.xml
+++ b/res/races/elf.xml
@@ -1,29 +1,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/races/goblin.xml b/res/races/goblin.xml
index 50f15b5e0..b68137353 100644
--- a/res/races/goblin.xml
+++ b/res/races/goblin.xml
@@ -1,27 +1,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/races/halfling.xml b/res/races/halfling.xml
index 4104c7199..0e61aa55d 100644
--- a/res/races/halfling.xml
+++ b/res/races/halfling.xml
@@ -1,34 +1,34 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/races/human.xml b/res/races/human.xml
index d8fea87f4..0d689b4ac 100644
--- a/res/races/human.xml
+++ b/res/races/human.xml
@@ -1,17 +1,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/races/insect.xml b/res/races/insect.xml
index 42617ce9b..d727e1ee4 100644
--- a/res/races/insect.xml
+++ b/res/races/insect.xml
@@ -1,30 +1,30 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/races/orc.xml b/res/races/orc.xml
index bf23a4e7f..2caaaf8e5 100644
--- a/res/races/orc.xml
+++ b/res/races/orc.xml
@@ -1,31 +1,31 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/races/troll.xml b/res/races/troll.xml
index b75169f15..3761e17ec 100644
--- a/res/races/troll.xml
+++ b/res/races/troll.xml
@@ -1,32 +1,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/ships.xml b/res/ships.xml
index c25b573de..f5577c2f4 100644
--- a/res/ships.xml
+++ b/res/ships.xml
@@ -1,4 +1,4 @@
-
-
-
-
+
+
+
+
diff --git a/res/ships/boat.xml b/res/ships/boat.xml
index bbcdcb1f3..c19d18529 100644
--- a/res/ships/boat.xml
+++ b/res/ships/boat.xml
@@ -1,18 +1,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/spells.xml b/res/spells.xml
index 4883fce74..0bdcc4693 100644
--- a/res/spells.xml
+++ b/res/spells.xml
@@ -1,166 +1,166 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/terrains.xml b/res/terrains.xml
index 5cc812a9a..5fb289d3b 100644
--- a/res/terrains.xml
+++ b/res/terrains.xml
@@ -1,57 +1,57 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/weapons.xml b/res/weapons.xml
index 5efef2831..0cab11ad0 100644
--- a/res/weapons.xml
+++ b/res/weapons.xml
@@ -1,25 +1,25 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scripts/example/main.lua b/scripts/example/main.lua
index 5601ee47d..c58fd654d 100644
--- a/scripts/example/main.lua
+++ b/scripts/example/main.lua
@@ -1,50 +1,50 @@
--- Enno was here
-require "multis"
-
-function process(orders)
- local confirmed_multis = { }
- local suspected_multis = { }
-
- if open_game(get_turn())~=0 then
- print("could not read game")
- return -1
- end
- init_summary()
-
- -- kill multi-players (external script)
- kill_multis(confirmed_multis, false)
- mark_multis(suspected_multis, false)
-
- -- run the turn:
- if read_orders(orders) ~= 0 then
- print("could not read " .. orders)
- return -1
- end
-
- -- plan_monsters()
-
- if nmr_check(config.maxnmrs or 80)~=0 then
- return -1
- end
-
- process_orders()
-
- -- create new monsters:
- spawn_braineaters(0.25)
-
- -- post-turn updates:
- update_guards()
- update_scores()
-
- local localechange = { de = { "ii" } }
- change_locales(localechange)
-
- write_files(config.locales)
-
- file = "" .. get_turn() .. ".dat"
- if write_game(file, "binary")~=0 then
- print("could not write game")
- return -1
- end
- return 0
-end
+-- Enno was here
+require "multis"
+
+function process(orders)
+ local confirmed_multis = { }
+ local suspected_multis = { }
+
+ if open_game(get_turn())~=0 then
+ print("could not read game")
+ return -1
+ end
+ init_summary()
+
+ -- kill multi-players (external script)
+ kill_multis(confirmed_multis, false)
+ mark_multis(suspected_multis, false)
+
+ -- run the turn:
+ if read_orders(orders) ~= 0 then
+ print("could not read " .. orders)
+ return -1
+ end
+
+ -- plan_monsters()
+
+ if nmr_check(config.maxnmrs or 80)~=0 then
+ return -1
+ end
+
+ process_orders()
+
+ -- create new monsters:
+ spawn_braineaters(0.25)
+
+ -- post-turn updates:
+ update_guards()
+ update_scores()
+
+ local localechange = { de = { "ii" } }
+ change_locales(localechange)
+
+ write_files(config.locales)
+
+ file = "" .. get_turn() .. ".dat"
+ if write_game(file, "binary")~=0 then
+ print("could not write game")
+ return -1
+ end
+ return 0
+end
diff --git a/scripts/example/modules.lua b/scripts/example/modules.lua
index 8f08dcbe5..e03c836ce 100644
--- a/scripts/example/modules.lua
+++ b/scripts/example/modules.lua
@@ -1,6 +1,6 @@
-require "example.rules"
-
-local srcpath = config.source_dir
-tests = {
- srcpath .. '/server/scripts/tests/common.lua',
-}
+require "example.rules"
+
+local srcpath = config.source_dir
+tests = {
+ srcpath .. '/server/scripts/tests/common.lua',
+}
diff --git a/scripts/example/rules.lua b/scripts/example/rules.lua
index 9b3706a55..5866a8ffc 100644
--- a/scripts/example/rules.lua
+++ b/scripts/example/rules.lua
@@ -1,8 +1,8 @@
-function item_canuse(u, iname)
- local race = u.race
- if iname=="greatbow" then
- -- only elves use greatbow
- return race=="elf"
- end
- return true
-end
+function item_canuse(u, iname)
+ local race = u.race
+ if iname=="greatbow" then
+ -- only elves use greatbow
+ return race=="elf"
+ end
+ return true
+end
diff --git a/src/main.c b/src/main.c
index 1ecdece18..c82347fcd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,171 +1,171 @@
-/*
-Copyright (c) 1998-2010, Enno Rehling
- Katja Zedel
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-**/
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include
-
-static const char * luafile = "setup.lua";
-static const char * entry_point = NULL;
-static const char * inifile = "eressea.ini";
-static int memdebug = 0;
-
-static void parse_config(const char * filename)
-{
- dictionary * d = iniparser_new(filename);
- if (d) {
- load_inifile(d);
-
- memdebug = iniparser_getint(d, "eressea:memcheck", memdebug);
- entry_point = iniparser_getstring(d, "eressea:run", entry_point);
- luafile = iniparser_getstring(d, "eressea:load", luafile);
-
- /* only one value in the [editor] section */
- force_color = iniparser_getint(d, "editor:color", force_color);
- }
- global.inifile = d;
-}
-
-static int
-usage(const char * prog, const char * arg)
-{
- if (arg) {
- fprintf(stderr, "unknown argument: %s\n\n", arg);
- }
- fprintf(stderr, "Usage: %s [options]\n"
- "-t : read this datafile, not the most current one\n"
- "-q : be quite (same as -v 0)\n"
- "-v : verbosity level\n"
- "-C : run in interactive mode\n"
- "--color : force curses to use colors even when not detected\n"
- "--tests : run test suite\n"
- "--help : help\n", prog);
- return -1;
-}
-
-static int
-parse_args(int argc, char **argv, int * exitcode)
-{
- int i, run_tests = 0;
-
- for (i=1;i!=argc;++i) {
- if (argv[i][0]!='-') {
- return usage(argv[0], argv[i]);
- } else if (argv[i][1]=='-') { /* long format */
- if (strcmp(argv[i]+2, "version")==0) {
- printf("\n%s PBEM host\n"
- "Copyright (C) 1996-2005 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n"
- "Compilation: " __DATE__ " at " __TIME__ "\nVersion: %f\n\n", global.gamename, version());
- }
- else if (strcmp(argv[i]+2, "color")==0) {
- /* force the editor to have colors */
- force_color = 1;
- }
- else if (strcmp(argv[i]+2, "help")==0) {
- return usage(argv[0], NULL);
- }
- else if (strcmp(argv[i]+2, "tests")==0) {
- run_tests = 1;
- }
- else {
- return usage(argv[0], argv[i]);
- }
- } else switch(argv[i][1]) {
- case 'C':
- entry_point = NULL;
- break;
- case 'e':
- entry_point = argv[++i];
- break;
- case 't':
- turn = atoi(argv[++i]);
- break;
- case 'q':
- verbosity = 0;
- break;
- case 'v':
- verbosity = atoi(argv[++i]);
- break;
- case 'h':
- usage(argv[0], NULL);
- return 1;
- default:
- *exitcode = -1;
- usage(argv[0], argv[i]);
- return 1;
- }
- }
-
- if (run_tests) {
- *exitcode = RunAllTests();
- return 1;
- }
-
- return 0;
-}
-
-
-void locale_init(void)
-{
- setlocale(LC_CTYPE, "");
- setlocale(LC_NUMERIC, "C");
- assert(towlower(0xC4)==0xE4); /* Ä => ä */
-}
-
-int main(int argc, char ** argv)
-{
- int err, result = 0;
-
- parse_config(inifile);
-
- log_open("eressea.log");
- locale_init();
-
- err = parse_args(argc, argv, &result);
- if (err) {
- return result;
- }
-
- err = eressea_init();
- if (err) {
- log_error(("initialization failed with code %d\n", err));
- return err;
- }
-
- err = eressea_run(luafile, entry_point);
- if (err) {
- log_error(("server execution failed with code %d\n", err));
- return err;
- }
-
- eressea_done();
- log_close();
- return 0;
-}
+/*
+Copyright (c) 1998-2010, Enno Rehling
+ Katja Zedel
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+**/
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+static const char * luafile = "setup.lua";
+static const char * entry_point = NULL;
+static const char * inifile = "eressea.ini";
+static int memdebug = 0;
+
+static void parse_config(const char * filename)
+{
+ dictionary * d = iniparser_new(filename);
+ if (d) {
+ load_inifile(d);
+
+ memdebug = iniparser_getint(d, "eressea:memcheck", memdebug);
+ entry_point = iniparser_getstring(d, "eressea:run", entry_point);
+ luafile = iniparser_getstring(d, "eressea:load", luafile);
+
+ /* only one value in the [editor] section */
+ force_color = iniparser_getint(d, "editor:color", force_color);
+ }
+ global.inifile = d;
+}
+
+static int
+usage(const char * prog, const char * arg)
+{
+ if (arg) {
+ fprintf(stderr, "unknown argument: %s\n\n", arg);
+ }
+ fprintf(stderr, "Usage: %s [options]\n"
+ "-t : read this datafile, not the most current one\n"
+ "-q : be quite (same as -v 0)\n"
+ "-v : verbosity level\n"
+ "-C : run in interactive mode\n"
+ "--color : force curses to use colors even when not detected\n"
+ "--tests : run test suite\n"
+ "--help : help\n", prog);
+ return -1;
+}
+
+static int
+parse_args(int argc, char **argv, int * exitcode)
+{
+ int i, run_tests = 0;
+
+ for (i=1;i!=argc;++i) {
+ if (argv[i][0]!='-') {
+ return usage(argv[0], argv[i]);
+ } else if (argv[i][1]=='-') { /* long format */
+ if (strcmp(argv[i]+2, "version")==0) {
+ printf("\n%s PBEM host\n"
+ "Copyright (C) 1996-2005 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n"
+ "Compilation: " __DATE__ " at " __TIME__ "\nVersion: %f\n\n", global.gamename, version());
+ }
+ else if (strcmp(argv[i]+2, "color")==0) {
+ /* force the editor to have colors */
+ force_color = 1;
+ }
+ else if (strcmp(argv[i]+2, "help")==0) {
+ return usage(argv[0], NULL);
+ }
+ else if (strcmp(argv[i]+2, "tests")==0) {
+ run_tests = 1;
+ }
+ else {
+ return usage(argv[0], argv[i]);
+ }
+ } else switch(argv[i][1]) {
+ case 'C':
+ entry_point = NULL;
+ break;
+ case 'e':
+ entry_point = argv[++i];
+ break;
+ case 't':
+ turn = atoi(argv[++i]);
+ break;
+ case 'q':
+ verbosity = 0;
+ break;
+ case 'v':
+ verbosity = atoi(argv[++i]);
+ break;
+ case 'h':
+ usage(argv[0], NULL);
+ return 1;
+ default:
+ *exitcode = -1;
+ usage(argv[0], argv[i]);
+ return 1;
+ }
+ }
+
+ if (run_tests) {
+ *exitcode = RunAllTests();
+ return 1;
+ }
+
+ return 0;
+}
+
+
+void locale_init(void)
+{
+ setlocale(LC_CTYPE, "");
+ setlocale(LC_NUMERIC, "C");
+ assert(towlower(0xC4)==0xE4); /* Ä => ä */
+}
+
+int main(int argc, char ** argv)
+{
+ int err, result = 0;
+
+ parse_config(inifile);
+
+ log_open("eressea.log");
+ locale_init();
+
+ err = parse_args(argc, argv, &result);
+ if (err) {
+ return result;
+ }
+
+ err = eressea_init();
+ if (err) {
+ log_error(("initialization failed with code %d\n", err));
+ return err;
+ }
+
+ err = eressea_run(luafile, entry_point);
+ if (err) {
+ log_error(("server execution failed with code %d\n", err));
+ return err;
+ }
+
+ eressea_done();
+ log_close();
+ return 0;
+}
diff --git a/src/server.c b/src/server.c
index ce69a67a3..7b33adda1 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1,3 +1,3 @@
-#include "stdafx.h"
-#include "main.c"
-#include "tests.c"
+#include "stdafx.h"
+#include "main.c"
+#include "tests.c"