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

This commit is contained in:
Enno Rehling 2014-04-24 05:43:44 -07:00
commit fece511afb
11 changed files with 59 additions and 71 deletions

2
cutest

@ -1 +1 @@
Subproject commit d83cec09a52835274ab8ed4849de16fb8658982a
Subproject commit 788659594ef87e9f497b8039da764182adfd2943

View File

@ -6,11 +6,11 @@
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../core/res/" />
rewritePrefix="config/core/" />
<rewriteURI
uriStartString="config:///game/"
rewritePrefix="../res/e3a/" />
rewritePrefix="config/game/" />
<rewriteURI
uriStartString="config:///default/"
rewritePrefix="../res/" />
rewritePrefix="config/default/" />
</catalog>

3
game-e3/runtests.lua Normal file
View File

@ -0,0 +1,3 @@
require "setup"
read_xml("config.xml", "catalog.xml")
run_tests()

36
res/adamantium.xml Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<resources>
<resource name="adamantium" limited="yes" material="rm_adamantium">
<item weight="200" score="200">
<construction skill="mining" minskill="8" reqsize="1"/>
</item>
<resourcelimit>
<modifier type="require" building="mine"/>
<guard flag="mining"/>
</resourcelimit>
</resource>
<resource name="adamantiumaxe">
<item weight="100" score="500">
<construction skill="weaponsmithing" minskill="8" reqsize="1">
<requirement type="adamantium" quantity="1"/>
<requirement type="log" quantity="1"/>
</construction>
<weapon cut="true" skill="melee" offmod="2" defmod="-2" magres="0.30">
<damage type="rider" value="3d4+15"/>
<damage type="footman" value="3d4+15"/>
</weapon>
</item>
</resource>
<resource name="adamantiumplate">
<item weight="100" score="2000">
<construction skill="armorer" minskill="10" reqsize="1">
<requirement type="adamantium" quantity="3"/>
</construction>
<armor ac="7" penalty="0.1"/>
</item>
</resource>
</resources>

View File

@ -30,6 +30,7 @@
<xi:include href="e3a/weapons.xml" />
<xi:include href="e3a/armor.xml" />
<xi:include href="e3a/resources.xml" />
<xi:include href="adamantium.xml"/>
<equipment>
<set name="first_unit">

View File

@ -31,6 +31,7 @@
<xi:include href="eressea/items.xml"/>
<xi:include href="eressea/spells.xml"/>
<xi:include href="eressea/strings.xml"/>
<xi:include href="adamantium.xml"/>
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>

View File

@ -164,36 +164,4 @@
</resource>
<!-- christmas items: end -->
<resource name="adamantium" limited="yes" material="rm_adamantium">
<item weight="200" score="200">
<construction skill="mining" minskill="8" reqsize="1"/>
</item>
<resourcelimit>
<modifier type="require" building="mine"/>
<guard flag="mining"/>
</resourcelimit>
</resource>
<resource name="adamantiumaxe">
<item weight="100" score="500">
<construction skill="weaponsmithing" minskill="8" reqsize="1">
<requirement type="adamantium" quantity="1"/>
<requirement type="log" quantity="1"/>
</construction>
<weapon cut="true" skill="melee" offmod="2" defmod="-2" magres="0.30">
<damage type="rider" value="3d4+15"/>
<damage type="footman" value="3d4+15"/>
</weapon>
</item>
</resource>
<resource name="adamantiumplate">
<item weight="100" score="2000">
<construction skill="armorer" minskill="10" reqsize="1">
<requirement type="adamantium" quantity="3"/>
</construction>
<armor ac="7" penalty="0.1"/>
</item>
</resource>
</resources>

View File

@ -995,8 +995,8 @@ static int tolua_get_spells(lua_State * L)
int tolua_read_xml(lua_State * L)
{
const char *filename = tolua_tostring(L, 1, 0);
const char *catalog = tolua_tostring(L, 2, 0);
const char *filename = tolua_tostring(L, 1, "config.xml");
const char *catalog = tolua_tostring(L, 2, "catalog.xml");
init_data(filename, catalog);
return 0;
}
@ -1196,7 +1196,7 @@ lua_State *lua_init(void) {
return L;
}
int eressea_run(lua_State *L, const char *luafile, const char *entry_point)
int eressea_run(lua_State *L, const char *luafile)
{
int err = 0;
@ -1206,28 +1206,17 @@ int eressea_run(lua_State *L, const char *luafile, const char *entry_point)
log_debug("executing script %s\n", luafile);
lua_getglobal(L, "dofile");
lua_pushstring(L, luafile);
err = lua_pcall(L, 1, 0, 0);
err = lua_pcall(L, 1, 1, 0);
if (err != 0) {
log_lua_error(L);
abort();
} else {
if (lua_isnumber(L, -1)) {
err = (int)lua_tonumber(L, -1);
}
lua_pop(L, 1);
}
return err;
}
}
if (entry_point) {
if (strcmp("console", entry_point)==0) {
return lua_console(L);
}
lua_getglobal(L, entry_point);
if (lua_isfunction(L, -1)) {
log_debug("calling entry-point: %s\n", entry_point);
err = lua_pcall(L, 0, 1, 0);
if (err != 0) {
log_lua_error(L);
}
return err;
} else {
log_error("unknown entry-point: %s\n", entry_point);
}
}
return 0;
}

View File

@ -29,7 +29,7 @@ extern "C" {
void lua_done(struct lua_State *L);
struct lua_State *lua_init(void);
int eressea_run(struct lua_State *L, const char *luafile, const char *entry_point);
int eressea_run(struct lua_State *L, const char *luafile);
#ifdef __cplusplus
}

View File

@ -39,7 +39,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
static const char *logfile= "eressea.log";
static const char *luafile = 0;
static const char *entry_point = NULL;
static const char *inifile = "eressea.ini";
static int memdebug = 0;
@ -51,8 +50,6 @@ static void parse_config(const char *filename)
log_debug("reading from configuration file %s\n", filename);
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);
@ -99,7 +96,7 @@ static int parse_args(int argc, char **argv, int *exitcode)
for (i = 1; i != argc; ++i) {
if (argv[i][0] != '-') {
return usage(argv[0], argv[i]);
luafile = argv[i];
} else if (argv[i][1] == '-') { /* long format */
if (strcmp(argv[i] + 2, "version") == 0) {
printf("\n%s PBEM host\n"
@ -117,18 +114,12 @@ static int parse_args(int argc, char **argv, int *exitcode)
} else {
const char *arg;
switch (argv[i][1]) {
case 'C':
entry_point = "console";
break;
case 'f':
i = get_arg(argc, argv, 2, i, &luafile, 0);
break;
case 'l':
i = get_arg(argc, argv, 2, i, &logfile, 0);
break;
case 'e':
i = get_arg(argc, argv, 2, i, &entry_point, 0);
break;
case 't':
i = get_arg(argc, argv, 2, i, &arg, 0);
turn = atoi(arg);
@ -137,7 +128,6 @@ static int parse_args(int argc, char **argv, int *exitcode)
verbosity = 0;
break;
case 'r':
entry_point = "run_turn";
i = get_arg(argc, argv, 2, i, &arg, 0);
turn = atoi(arg);
break;
@ -270,7 +260,7 @@ int main(int argc, char **argv)
register_spells();
bind_monsters(L);
err = eressea_run(L, luafile, entry_point);
err = eressea_run(L, luafile);
if (err) {
log_error("server execution failed with code %d\n", err);
return err;

View File

@ -113,7 +113,7 @@ int read_xml(const char *filename, const char *catalog)
xmlLoadCatalog(catalog);
}
#ifdef XML_PARSE_XINCLUDE
doc = xmlReadFile(filename, NULL, XML_PARSE_XINCLUDE);
doc = xmlReadFile(filename, NULL, XML_PARSE_XINCLUDE|XML_PARSE_NONET|XML_PARSE_PEDANTIC);
#else
doc = xmlParseFile(filename);
#endif