forked from github/server
reorganizing the way configuration data is read (WIP)
This commit is contained in:
parent
ae68a1beaf
commit
fa5dc43b98
2
cutest
2
cutest
|
@ -1 +1 @@
|
||||||
Subproject commit 788659594ef87e9f497b8039da764182adfd2943
|
Subproject commit d83cec09a52835274ab8ed4849de16fb8658982a
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<buildings xmlns:xi="http://www.w3.org/2001/XInclude">
|
<buildings xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
|
||||||
<xi:include href="../buildings/castle-2.xml" />
|
<xi:include href="config:///default/buildings/castle-2.xml" />
|
||||||
|
|
||||||
<building name="watch" capacity="1" maxsize="10">
|
<building name="watch" capacity="1" maxsize="10">
|
||||||
<function name="name" value="fort_name"/>
|
<function name="name" value="fort_name"/>
|
||||||
|
|
|
@ -3,10 +3,34 @@
|
||||||
|
|
||||||
<!-- begin main races -->
|
<!-- begin main races -->
|
||||||
|
|
||||||
<xi:include href="../races/goblin-3.xml"/>
|
<xi:include href="config:///default/races/goblin-3.xml"/>
|
||||||
<xi:include href="../races/wyrm.xml"/>
|
<xi:include href="config:///default/races/wyrm.xml"/>
|
||||||
<xi:include href="../races/dragon.xml"/>
|
<xi:include href="config:///default/races/dragon.xml"/>
|
||||||
<xi:include href="../races/youngdragon.xml"/>
|
<xi:include href="config:///default/races/youngdragon.xml"/>
|
||||||
|
|
||||||
|
<race name="lynx" magres="0.000000" maxaura="0.000000" regaura="0.000000" weight="500" capacity="540" speed="1.0" hp="20" damage="2d3" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="5" walk="yes" teach="no" giveitem="yes" getitem="yes">
|
||||||
|
<ai splitsize="99999"/>
|
||||||
|
<function name="initfamiliar" value="oldfamiliars"/>
|
||||||
|
<skill name="crossbow" modifier="-99"/>
|
||||||
|
<skill name="mining" modifier="-99"/>
|
||||||
|
<skill name="bow" modifier="-99"/>
|
||||||
|
<skill name="building" modifier="-99"/>
|
||||||
|
<skill name="forestry" modifier="-99"/>
|
||||||
|
<skill name="catapult" modifier="-99"/>
|
||||||
|
<skill name="training" modifier="1"/>
|
||||||
|
<skill name="riding" modifier="-99"/>
|
||||||
|
<skill name="armorer" modifier="-99"/>
|
||||||
|
<skill name="shipcraft" modifier="-99"/>
|
||||||
|
<skill name="melee" modifier="-99"/>
|
||||||
|
<skill name="sailing" modifier="-99"/>
|
||||||
|
<skill name="polearm" modifier="-99"/>
|
||||||
|
<skill name="quarrying" modifier="-99"/>
|
||||||
|
<skill name="roadwork" modifier="-99"/>
|
||||||
|
<skill name="tactics" modifier="-99"/>
|
||||||
|
<skill name="weaponsmithing" modifier="-99"/>
|
||||||
|
<skill name="cartmaking" modifier="-99"/>
|
||||||
|
<attack type="4" damage="2d3"/>
|
||||||
|
</race>
|
||||||
|
|
||||||
<race name="human" magres="0.000000" maxaura="1.0" regaura="1.0" recruitcost="100" maintenance="10" weight="1000" capacity="540" speed="1.0" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
<race name="human" magres="0.000000" maxaura="1.0" regaura="1.0" recruitcost="100" maintenance="10" weight="1000" capacity="540" speed="1.0" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||||
|
@ -583,29 +607,6 @@
|
||||||
<attack type="4" damage="3d20"/>
|
<attack type="4" damage="3d20"/>
|
||||||
<attack type="8" damage="1d10"/>
|
<attack type="8" damage="1d10"/>
|
||||||
</race>
|
</race>
|
||||||
<race name="lynx" magres="0.000000" maxaura="0.000000" regaura="0.000000" weight="500" capacity="540" speed="1.0" hp="20" damage="2d3" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="5" walk="yes" teach="no" giveitem="yes" getitem="yes">
|
|
||||||
<ai splitsize="99999"/>
|
|
||||||
<function name="initfamiliar" value="oldfamiliars"/>
|
|
||||||
<skill name="crossbow" modifier="-99"/>
|
|
||||||
<skill name="mining" modifier="-99"/>
|
|
||||||
<skill name="bow" modifier="-99"/>
|
|
||||||
<skill name="building" modifier="-99"/>
|
|
||||||
<skill name="forestry" modifier="-99"/>
|
|
||||||
<skill name="catapult" modifier="-99"/>
|
|
||||||
<skill name="training" modifier="1"/>
|
|
||||||
<skill name="riding" modifier="-99"/>
|
|
||||||
<skill name="armorer" modifier="-99"/>
|
|
||||||
<skill name="shipcraft" modifier="-99"/>
|
|
||||||
<skill name="melee" modifier="-99"/>
|
|
||||||
<skill name="sailing" modifier="-99"/>
|
|
||||||
<skill name="polearm" modifier="-99"/>
|
|
||||||
<skill name="quarrying" modifier="-99"/>
|
|
||||||
<skill name="roadwork" modifier="-99"/>
|
|
||||||
<skill name="tactics" modifier="-99"/>
|
|
||||||
<skill name="weaponsmithing" modifier="-99"/>
|
|
||||||
<skill name="cartmaking" modifier="-99"/>
|
|
||||||
<attack type="4" damage="2d3"/>
|
|
||||||
</race>
|
|
||||||
<race name="direwolf" magres="0.000000" maxaura="0.000000" regaura="0.000000" weight="500" capacity="540" speed="1.0" hp="20" damage="2d4" unarmedattack="0" unarmeddefense="0" attackmodifier="3" defensemodifier="1" walk="yes" teach="no" giveperson="yes">
|
<race name="direwolf" magres="0.000000" maxaura="0.000000" regaura="0.000000" weight="500" capacity="540" speed="1.0" hp="20" damage="2d4" unarmedattack="0" unarmeddefense="0" attackmodifier="3" defensemodifier="1" walk="yes" teach="no" giveperson="yes">
|
||||||
<function name="initfamiliar" value="oldfamiliars"/>
|
<function name="initfamiliar" value="oldfamiliars"/>
|
||||||
<ai splitsize="5000"/>
|
<ai splitsize="5000"/>
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
|
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
<!-- this file contains resources that can be mined in some way (anything with a resourcelimit) -->
|
<!-- this file contains resources that can be mined in some way (anything with a resourcelimit) -->
|
||||||
|
|
||||||
<xi:include href="eressea:///core/resources/cart.xml"/>
|
<xi:include href="config:///core/resources/cart.xml"/>
|
||||||
<xi:include href="eressea:///core/resources/horse.xml"/>
|
<xi:include href="config:///core/resources/horse.xml"/>
|
||||||
<xi:include href="eressea:///core/resources/hp.xml"/>
|
<xi:include href="config:///core/resources/hp.xml"/>
|
||||||
<xi:include href="eressea:///core/resources/laen.xml"/>
|
<xi:include href="config:///core/resources/laen.xml"/>
|
||||||
<xi:include href="eressea:///core/resources/log.xml"/>
|
<xi:include href="config:///core/resources/log.xml"/>
|
||||||
<xi:include href="eressea:///core/resources/mallorn.xml"/>
|
<xi:include href="config:///core/resources/mallorn.xml"/>
|
||||||
<xi:include href="eressea:///core/resources/peasant.xml"/>
|
<xi:include href="config:///core/resources/peasant.xml"/>
|
||||||
<xi:include href="resources/iron.xml"/>
|
<xi:include href="resources/iron.xml"/>
|
||||||
<xi:include href="resources/mallornseed.xml"/>
|
<xi:include href="resources/mallornseed.xml"/>
|
||||||
<xi:include href="resources/seed.xml"/>
|
<xi:include href="resources/seed.xml"/>
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
|
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
<xi:include href="eressea:///core/weapons/axe.xml"/>
|
<xi:include href="config:///core/weapons/axe.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/bow.xml"/>
|
<xi:include href="config:///core/weapons/bow.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/catapult.xml"/>
|
<xi:include href="config:///core/weapons/catapult.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/lance.xml"/>
|
<xi:include href="config:///core/weapons/lance.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/mallornbow.xml"/>
|
<xi:include href="config:///core/weapons/mallornbow.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/mallornspear.xml"/>
|
<xi:include href="config:///core/weapons/mallornspear.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/rep_crossbow.xml"/>
|
<xi:include href="config:///core/weapons/rep_crossbow.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/runesword.xml"/>
|
<xi:include href="config:///core/weapons/runesword.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/rustyaxe.xml"/>
|
<xi:include href="config:///core/weapons/rustyaxe.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/rustysword.xml"/>
|
<xi:include href="config:///core/weapons/rustysword.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/spear.xml"/>
|
<xi:include href="config:///core/weapons/spear.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/sword.xml"/>
|
<xi:include href="config:///core/weapons/sword.xml"/>
|
||||||
<xi:include href="eressea:///core/weapons/firesword.xml"/>
|
<xi:include href="config:///core/weapons/firesword.xml"/>
|
||||||
<xi:include href="weapons/crossbow.xml"/>
|
<xi:include href="config:///game/weapons/crossbow.xml"/>
|
||||||
<xi:include href="weapons/greatbow.xml"/>
|
<xi:include href="config:///game/weapons/greatbow.xml"/>
|
||||||
<xi:include href="weapons/greatsword.xml"/>
|
<xi:include href="config:///game/weapons/greatsword.xml"/>
|
||||||
<xi:include href="weapons/halberd.xml"/>
|
<xi:include href="config:///game/weapons/halberd.xml"/>
|
||||||
<xi:include href="weapons/laensword.xml"/>
|
<xi:include href="config:///game/weapons/laensword.xml"/>
|
||||||
<xi:include href="weapons/mallorncrossbow.xml"/>
|
<xi:include href="config:///game/weapons/mallorncrossbow.xml"/>
|
||||||
<xi:include href="weapons/mallornlance.xml"/>
|
<xi:include href="config:///game/weapons/mallornlance.xml"/>
|
||||||
<xi:include href="weapons/rustygreatsword.xml"/>
|
<xi:include href="config:///game/weapons/rustygreatsword.xml"/>
|
||||||
<xi:include href="weapons/rustyhalberd.xml"/>
|
<xi:include href="config:///game/weapons/rustyhalberd.xml"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/sh
|
||||||
|
ROOT=$(pwd)
|
||||||
|
while [ ! -d $ROOT/.git ]; do
|
||||||
|
ROOT=$(dirname $ROOT)
|
||||||
|
if [ "$ROOT" == "/" ; then
|
||||||
|
echo "could not find root, are you in the git repository?"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
MACHINE=`uname -m`
|
||||||
|
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||||
|
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
||||||
|
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
||||||
|
BIN_DIR="build-$MACHINE-$CC-Debug"
|
||||||
|
|
||||||
|
cd $ROOT/$BIN_DIR
|
||||||
|
make install
|
||||||
|
cd -
|
|
@ -1198,33 +1198,36 @@ lua_State *lua_init(void) {
|
||||||
|
|
||||||
int eressea_run(lua_State *L, const char *luafile, const char *entry_point)
|
int eressea_run(lua_State *L, const char *luafile, const char *entry_point)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
global.vm_state = L;
|
global.vm_state = L;
|
||||||
/* run the main script */
|
/* run the main script */
|
||||||
if (luafile) {
|
if (luafile) {
|
||||||
log_debug("executing script %s\n", luafile);
|
log_debug("executing script %s\n", luafile);
|
||||||
lua_getglobal(L, "dofile");
|
lua_getglobal(L, "dofile");
|
||||||
lua_pushstring(L, luafile);
|
lua_pushstring(L, luafile);
|
||||||
err = lua_pcall(L, 1, 0, 0);
|
err = lua_pcall(L, 1, 0, 0);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
log_lua_error(L);
|
log_lua_error(L);
|
||||||
abort();
|
abort();
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (entry_point) {
|
||||||
if (entry_point) {
|
if (strcmp("console", entry_point)==0) {
|
||||||
lua_getglobal(L, entry_point);
|
return lua_console(L);
|
||||||
if (lua_isfunction(L, -1)) {
|
}
|
||||||
log_debug("calling entry-point: %s\n", entry_point);
|
lua_getglobal(L, entry_point);
|
||||||
err = lua_pcall(L, 0, 1, 0);
|
if (lua_isfunction(L, -1)) {
|
||||||
if (err != 0) {
|
log_debug("calling entry-point: %s\n", entry_point);
|
||||||
log_lua_error(L);
|
err = lua_pcall(L, 0, 1, 0);
|
||||||
}
|
if (err != 0) {
|
||||||
return err;
|
log_lua_error(L);
|
||||||
} else {
|
}
|
||||||
log_error("unknown entry-point: %s\n", entry_point);
|
return err;
|
||||||
|
} else {
|
||||||
|
log_error("unknown entry-point: %s\n", entry_point);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return 0;
|
||||||
return lua_console(L);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ static int usage(const char *prog, const char *arg)
|
||||||
}
|
}
|
||||||
fprintf(stderr, "Usage: %s [options]\n"
|
fprintf(stderr, "Usage: %s [options]\n"
|
||||||
"-t <turn> : read this datafile, not the most current one\n"
|
"-t <turn> : read this datafile, not the most current one\n"
|
||||||
|
"-f <script.lua> : execute a lua script\n"
|
||||||
"-q : be quite (same as -v 0)\n"
|
"-q : be quite (same as -v 0)\n"
|
||||||
"-v <level> : verbosity level\n"
|
"-v <level> : verbosity level\n"
|
||||||
"-C : run in interactive mode\n"
|
"-C : run in interactive mode\n"
|
||||||
|
@ -117,7 +118,10 @@ static int parse_args(int argc, char **argv, int *exitcode)
|
||||||
const char *arg;
|
const char *arg;
|
||||||
switch (argv[i][1]) {
|
switch (argv[i][1]) {
|
||||||
case 'C':
|
case 'C':
|
||||||
entry_point = NULL;
|
entry_point = "console";
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
i = get_arg(argc, argv, 2, i, &luafile, 0);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
i = get_arg(argc, argv, 2, i, &logfile, 0);
|
i = get_arg(argc, argv, 2, i, &logfile, 0);
|
||||||
|
|
|
@ -118,7 +118,7 @@ int read_xml(const char *filename, const char *catalog)
|
||||||
doc = xmlParseFile(filename);
|
doc = xmlParseFile(filename);
|
||||||
#endif
|
#endif
|
||||||
if (doc == NULL) {
|
if (doc == NULL) {
|
||||||
log_error("could not open %s\n", filename);
|
log_error("could not open '%s'\n", filename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue