Merge branch 'master' of github.com:eressea/server

This commit is contained in:
Enno Rehling 2014-04-22 07:21:34 -07:00
commit 45168eb7e9
14 changed files with 346 additions and 89 deletions

16
game-e3/catalog.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../core/res/" />
<rewriteURI
uriStartString="config:///game/"
rewritePrefix="../res/e3a/" />
<rewriteURI
uriStartString="config:///default/"
rewritePrefix="../res/" />
</catalog>

183
game-e3/config.xml Normal file
View File

@ -0,0 +1,183 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config:///default/directions.xml"/>
<xi:include href="config:///core/messages.xml"/>
<xi:include href="config:///core/de/strings.xml"/>
<xi:include href="config:///core/en/strings.xml"/>
<xi:include href="config:///core/common/items.xml"/>
<xi:include href="config:///core/common/herbs.xml" />
<xi:include href="config:///core/spoils.xml"/>
<xi:include href="config:///core/prefixes.xml"/>
<xi:include href="config:///core/common/buildings.xml"/>
<xi:include href="config:///core/equipment.xml"/>
<xi:include href="config:///game/ships.xml"/>
<xi:include href="config:///game/shipnames.xml"/>
<xi:include href="config:///game/terrains.xml"/>
<xi:include href="config:///core/calendar.xml"/>
<xi:include href="config:///game/items.xml" />
<xi:include href="config:///game/strings.xml"/>
<xi:include href="config:///game/messages.xml"/>
<xi:include href="config:///game/races.xml"/>
<xi:include href="config:///game/buildings.xml"/>
<xi:include href="config:///game/equipment.xml"/>
<xi:include href="config:///game/spells.xml"/>
<xi:include href="config:///game/luxuries.xml" />
<xi:include href="config:///game/weapons.xml" />
<xi:include href="config:///game/armor.xml" />
<xi:include href="config:///game/resources.xml" />
<calendar name="thirdage" newyear="month_1" start="1"/>
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="10"/>
<item name="stone" amount="10"/>
<item name="money" amount="5000"/>
</set>
</equipment>
<xi:include href="config:///default/names-undead.xml"/>
<xi:include href="config:///default/names-skeletons.xml"/>
<xi:include href="config:///default/names-zombies.xml"/>
<xi:include href="config:///default/names-ghouls.xml"/>
<xi:include href="config:///default/names-dragons.xml"/>
<game name="E4">
<!-- Game specific settings -->
<param name="database.gameid" value="7"></param>
<order name="BELAGERE" disable="yes"/>
<order name="BEKLAUEN" disable="yes"/>
<order name="GM" disable="yes"/>
<order name="KAUFEN" disable="yes"/>
<order name="LEHREN" disable="yes"/>
<order name="SABOTIEREN" disable="yes"/>
<order name="SPIONIEREN" disable="yes"/>
<order name="TREIBEN" disable="yes"/>
<order name="UNTERHALTEN" disable="yes"/>
<order name="VERKAUFEN" disable="yes"/>
<skill name="armorer" enable="true"/>
<skill name="bow" enable="true"/>
<skill name="building" enable="true"/>
<skill name="cartmaking" enable="true"/>
<skill name="catapult" enable="true"/>
<skill name="crossbow" enable="true"/>
<skill name="forestry" enable="true"/>
<skill name="magic" enable="true"/>
<skill name="melee" enable="true"/>
<skill name="mining" enable="true"/>
<skill name="polearm" enable="true"/>
<skill name="quarrying" enable="true"/>
<skill name="riding" enable="true"/>
<skill name="roadwork" enable="true"/>
<skill name="sailing" enable="true"/>
<skill name="shipcraft" enable="true"/>
<skill name="stamina" enable="true"/>
<skill name="tactics" enable="true"/>
<skill name="training" enable="true"/>
<skill name="unarmed" enable="true"/>
<skill name="weaponsmithing" enable="true"/>
<skill name="herbalism" enable="false"/>
<skill name="alchemy" enable="false"/>
<skill name="entertainment" enable="false"/>
<skill name="espionage" enable="false"/>
<skill name="perception" enable="false"/>
<skill name="stealth" enable="false"/>
<skill name="taxation" enable="false"/>
<skill name="trade" enable="false"/>
<param name="NewbieImmunity" value="9"/> <!-- ends after turn 9 -->
<param name="modules.astralspace" value="0"/>
<param name="modules.wormholes" value="0"/>
<param name="modules.markets" value="1"/>
<!-- resource limitations -->
<param name="magic.regeneration" value="0.75"/>
<param name="magic.power" value="0.5"/>
<param name="resource.factor" value="0.25"/>
<param name="skills.cost.tactics" value="500"/>
<param name="entertain.base" value="0"/>
<param name="entertain.perlevel" value="20"/>
<param name="nmr.timeout" value="5"/>
<param name="nmr.removenewbie" value="0"/>
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="0"/>
<param name="hunger.demon.skill" value="1"/>
<param name="hunger.damage" value="1d9+9"/>
<param name="hunger.demons" value="1"/>
<param name="init_spells" value="0"/>
<param name="recruit.allow_merge" value="1"/>
<param name="study.expensivemigrants" value="1"/>
<param name="study.speedup" value="0"/>
<param name="world.era" value="3"/>
<param name="rules.migrants" value="0"/>
<param name="rules.transfermen" value="0"/>
<param name="rules.stealth.faction" value="1"/>
<param name="rules.stealth.anon_battle" value="0"/>
<param name="rules.check_overload" value="0"/>
<param name="rules.combat.goblinbonus" value="3"/>
<param name="rules.ship.damage_drift" value="0.00"/> <!-- percent damage from drifting-->
<param name="rules.alliances" value="1"/>
<param name="rules.combat.herospeed" value="3"/>
<param name="rules.combat.demon_vampire" value="5"/> <!-- regen 1 hp per X points of damage done -->
<param name="rules.combat.skill_bonus" value="0"/>
<!--param name="rules.combat.loot" value="5"/--> <!-- only self + others - keeploot -->
<param name="rules.items.loot_divisor" value="2"/> <!-- damage skims off 1/2 of goods transfers -->
<param name="rules.items.give_divisor" value="2"/> <!-- corruption skims off 1/2 of goods transfers -->
<param name="rules.move.owner_leave" value="1"/> <!-- owner must leave before moving -->
<param name="rules.region_owners" value="1"/>
<param name="rules.cavalry.skill" value="2"/>
<param name="rules.cavalry.mode" value="1"/>
<param name="rules.magic.multipotion" value="1"/>
<param name="rules.magic.wol_effect" value="5"/>
<param name="rules.magic.factionlist" value="1"/>
<param name="rules.magic.wol_type" value="2"/>
<param name="rules.magic.blessed_harvest" value="1"/>
<param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>
<param name="rules.build.other_buildings" value="1"/>
<param name="rules.economy.taxation" value="1"/>
<param name="rules.economy.food" value="2"/>
<param name="rules.economy.wages" value="1"/>
<param name="rules.economy.roqf" value="5"/>
<param name="rules.economy.herbrot" value="0"/>
<param name="rules.dwarf_castles" value="1"/>
<!-- param name="rules.nmr.destroy" value="1"/ -->
<param name="rules.limit.faction" value="250"/>
<!--param name="rules.give" value="15"/ --> <!-- self + peasants + herbs + lux - goods -->
<param name="rules.economy.grow" value="1"/>
<param name="rules.tactics.formula" value="1"/> <!-- 10% per skilldiff -->
<param name="rules.help.mask" value="fight guard money give"/>
<param name="movement.shipspeed.skillbonus" value="6"/>
<param name="alliance.auto" value="fight"/>
<param name="alliance.restricted" value="fight"/>
</game>
<rules>
<function name="wage" value="minimum_wage"/>
</rules>
<strings>
<string name="mailto">
<text locale="de">eressea-server@eressea.de</text>
<text locale="en">eressea-server@eressea.de</text>
</string>
<string name="newbie_info_1">
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff
ERESSEA 4 BEFEHLE an eressea-server@eressea.de zu senden.</text>
<text locale="en">Remember to send your orders to
eressea-server@eressea.de with the subject ERESSEA 4 ORDERS.</text>
</string>
<string name="mailcmd">
<text locale="de">ERESSEA 4 BEFEHLE</text>
<text locale="en">ERESSEA 4 ORDERS</text>
</string>
</strings>
</eressea>

View File

@ -1,6 +1,5 @@
[eressea] [eressea]
base = . base = .
load = setup.lua
report = reports report = reports
verbose = 0 verbose = 0
lomem = 0 lomem = 0

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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>

View File

@ -4,9 +4,12 @@ while [ ! -d $ROOT/.git ]; do
ROOT=$(dirname $ROOT) ROOT=$(dirname $ROOT)
done done
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc" [ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc" [ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc" [ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BIN_DIR="build-$MACHINE-$CC-Debug"
[ -z "$JOBS" ] && JOBS=$(nproc) [ -z "$JOBS" ] && JOBS=$(nproc)
DISTCC=`which distcc` DISTCC=`which distcc`
if [ ! -z "$DISTCC" ] ; then if [ ! -z "$DISTCC" ] ; then
@ -20,8 +23,6 @@ fi
fi fi
echo "Building with $CC and $JOBS jobs" echo "Building with $CC and $JOBS jobs"
MACHINE=`uname -m`
BIN_DIR="build-$MACHINE-$CC-Debug"
if [ ! -d $ROOT/$BIN_DIR ]; then if [ ! -d $ROOT/$BIN_DIR ]; then
echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?" echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?"
exit exit

19
s/install Executable file
View File

@ -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 -

24
s/runtests Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
ROOT=$(pwd)
while [ ! -d $ROOT/.git ]; do
ROOT=$(dirname $ROOT)
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"
if [ ! -d $ROOT/$BIN_DIR ]; then
echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?"
exit
fi
echo $ROOT
$ROOT/$BIN_DIR/eressea/test_eressea
pushd $ROOT/game-e2
$ROOT/$BIN_DIR/eressea/eressea -e run_tests
cd $ROOT/game-e3
$ROOT/$BIN_DIR/eressea/eressea -e run_tests
popd

View File

@ -177,6 +177,13 @@ static int tolua_ship_get_coast(lua_State * L)
return 0; return 0;
} }
static int tolua_ship_get_type(lua_State * L)
{
ship *self = (ship *) tolua_tousertype(L, 1, 0);
tolua_pushstring(L, self->type->name[0]);
return 1;
}
void tolua_ship_open(lua_State * L) void tolua_ship_open(lua_State * L)
{ {
/* register user types */ /* register user types */
@ -201,8 +208,8 @@ void tolua_ship_open(lua_State * L)
tolua_ship_set_region); tolua_ship_set_region);
tolua_variable(L, TOLUA_CAST "coast", tolua_ship_get_coast, tolua_variable(L, TOLUA_CAST "coast", tolua_ship_get_coast,
tolua_ship_set_coast); tolua_ship_set_coast);
tolua_variable(L, TOLUA_CAST "type", tolua_ship_get_type, 0);
#ifdef TODO #ifdef TODO
.property("type", &ship_gettype)
.property("weight", &ship_getweight) .property("weight", &ship_getweight)
.property("capacity", &ship_getcapacity) .property("capacity", &ship_getcapacity)
.property("maxsize", &ship_maxsize) .property("maxsize", &ship_maxsize)

View File

@ -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);
} }

View File

@ -73,6 +73,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"
@ -118,7 +119,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);

View File

@ -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;
} }