forked from github/server
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:
parent
6fbb9b46ca
commit
91ec503b43
|
@ -1 +1 @@
|
||||||
Subproject commit 699b35b22b35cf96072483d409458f45bbf6227e
|
Subproject commit ecf6596cf9d152cfcd4f98f2b792769d592c7e1a
|
24
s/setup
24
s/setup
|
@ -18,17 +18,10 @@ Usage: $u [-hf] [-d DIR] [-g <game>] [-r <rules>] [-s DIR]
|
||||||
USAGE
|
USAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
function ini_section() {
|
|
||||||
$SOURCE/bin/inifile eressea.ini add $1
|
|
||||||
}
|
|
||||||
|
|
||||||
function ini_add() {
|
|
||||||
$SOURCE/bin/inifile eressea.ini add $1 $2
|
|
||||||
}
|
|
||||||
|
|
||||||
game=0
|
game=0
|
||||||
force=0
|
force=0
|
||||||
src=server
|
src=server
|
||||||
|
|
||||||
while getopts :d:g:r:s:hf o; do
|
while getopts :d:g:r:s:hf o; do
|
||||||
case "${o}" in
|
case "${o}" in
|
||||||
h) usage ; exit 0 ;;
|
h) usage ; exit 0 ;;
|
||||||
|
@ -47,6 +40,11 @@ done
|
||||||
[ -d $SOURCE ] || abort "invalid source directory $SOURCE"
|
[ -d $SOURCE ] || abort "invalid source directory $SOURCE"
|
||||||
[ -z $rules ] && rules=e$game
|
[ -z $rules ] && rules=e$game
|
||||||
[ -z $dir ] && dir=game-$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
|
cd $ERESSEA
|
||||||
if [ -d $dir ] ; then
|
if [ -d $dir ] ; then
|
||||||
|
@ -56,10 +54,16 @@ mkdir -p $dir
|
||||||
cd $dir || abort "could not chdir to game-$game"
|
cd $dir || abort "could not chdir to game-$game"
|
||||||
mkdir -p data reports
|
mkdir -p data reports
|
||||||
|
|
||||||
|
function ini_sec() {
|
||||||
|
$INIFILE eressea.ini add $1
|
||||||
|
}
|
||||||
|
function ini_add() {
|
||||||
|
$INIFILE eressea.ini add $1 $2
|
||||||
|
}
|
||||||
touch eressea.ini
|
touch eressea.ini
|
||||||
ini_section eressea
|
ini_sec eressea
|
||||||
ini_add eressea:locales de,en
|
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:install $SOURCE
|
ini_add lua:install $SOURCE
|
||||||
ini_add lua:paths $SOURCE/scripts:$SOURCE/lunit
|
ini_add lua:paths $SOURCE/scripts:$SOURCE/lunit
|
||||||
|
|
|
@ -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')
|
|
@ -1,3 +1,4 @@
|
||||||
read_xml()
|
require 'eressea'
|
||||||
|
require 'eressea.xmlconf'
|
||||||
eressea.read_game(get_turn() .. ".dat")
|
eressea.read_game(get_turn() .. ".dat")
|
||||||
gmtool.editor()
|
gmtool.editor()
|
|
@ -182,16 +182,6 @@ function run_turn(rules)
|
||||||
return result
|
return result
|
||||||
end
|
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'
|
local path = 'scripts'
|
||||||
if config.install then
|
if config.install then
|
||||||
path = config.install .. '/' .. path
|
path = config.install .. '/' .. path
|
||||||
|
@ -199,6 +189,8 @@ end
|
||||||
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
||||||
|
|
||||||
require 'eressea'
|
require 'eressea'
|
||||||
|
require 'eressea.xmlconf' -- read xml data
|
||||||
|
|
||||||
local rules = {}
|
local rules = {}
|
||||||
if config.rules then
|
if config.rules then
|
||||||
rules = require('eressea.' .. config.rules)
|
rules = require('eressea.' .. config.rules)
|
||||||
|
@ -206,5 +198,4 @@ if config.rules then
|
||||||
else
|
else
|
||||||
eressea.log.warning('no rule modules loaded, specify a game in eressea.ini or with -r')
|
eressea.log.warning('no rule modules loaded, specify a game in eressea.ini or with -r')
|
||||||
end
|
end
|
||||||
|
|
||||||
run_turn(rules)
|
run_turn(rules)
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
require "setup"
|
|
||||||
run_turn()
|
|
Loading…
Reference in New Issue