fix the mapper script.

1. move xml configuration reading to a separate module, it's compliated.
2. move the map file to the main scripts folder.
This commit is contained in:
Enno Rehling 2014-08-12 22:54:55 +02:00
parent 6fbb9b46ca
commit 91ec503b43
7 changed files with 27 additions and 25 deletions

@ -1 +1 @@
Subproject commit 699b35b22b35cf96072483d409458f45bbf6227e
Subproject commit ecf6596cf9d152cfcd4f98f2b792769d592c7e1a

24
s/setup
View File

@ -18,17 +18,10 @@ Usage: $u [-hf] [-d DIR] [-g <game>] [-r <rules>] [-s DIR]
USAGE
}
function ini_section() {
$SOURCE/bin/inifile eressea.ini add $1
}
function ini_add() {
$SOURCE/bin/inifile eressea.ini add $1 $2
}
game=0
force=0
src=server
while getopts :d:g:r:s:hf o; do
case "${o}" in
h) usage ; exit 0 ;;
@ -47,6 +40,11 @@ done
[ -d $SOURCE ] || abort "invalid source directory $SOURCE"
[ -z $rules ] && rules=e$game
[ -z $dir ] && dir=game-$game
[ -z $TOOLS ] && TOOLS=$SOURCE/build-x86_64-gcc-Debug
[ -e $TOOLS ] || TOOLS=$SOURCE/bin
[ -z $INIFILE ] && INIFILE=$TOOLS/inifile
[ -e $INIFILE ] || INIFILE=$TOOLS/iniparser/inifile
[ -e $INIFILE ] || abort "tool is not installed: $INIFILE"
cd $ERESSEA
if [ -d $dir ] ; then
@ -56,10 +54,16 @@ mkdir -p $dir
cd $dir || abort "could not chdir to game-$game"
mkdir -p data reports
function ini_sec() {
$INIFILE eressea.ini add $1
}
function ini_add() {
$INIFILE eressea.ini add $1 $2
}
touch eressea.ini
ini_section eressea
ini_sec eressea
ini_add eressea:locales de,en
ini_section lua
ini_sec lua
ini_add lua:install $SOURCE
ini_add lua:install $SOURCE
ini_add lua:paths $SOURCE/scripts:$SOURCE/lunit

View File

@ -0,0 +1,8 @@
local confdir = 'conf/'
if config.rules then
confdir = confdir .. config.rules .. '/'
end
if config.install then
confdir = config.install .. '/' .. confdir
end
read_xml(confdir .. 'config.xml', confdir .. 'catalog.xml')

View File

@ -1,3 +1,4 @@
read_xml()
require 'eressea'
require 'eressea.xmlconf'
eressea.read_game(get_turn() .. ".dat")
gmtool.editor()

View File

@ -182,16 +182,6 @@ function run_turn(rules)
return result
end
local confdir = 'conf/'
if config.rules then
confdir = confdir .. config.rules .. '/'
end
if config.install then
confdir = config.install .. '/' .. confdir
end
read_xml(confdir .. 'config.xml', confdir .. 'catalog.xml')
local path = 'scripts'
if config.install then
path = config.install .. '/' .. path
@ -199,6 +189,8 @@ end
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
require 'eressea'
require 'eressea.xmlconf' -- read xml data
local rules = {}
if config.rules then
rules = require('eressea.' .. config.rules)
@ -206,5 +198,4 @@ if config.rules then
else
eressea.log.warning('no rule modules loaded, specify a game in eressea.ini or with -r')
end
run_turn(rules)

View File

@ -1,2 +0,0 @@
require "setup"
run_turn()