* new goblins

* allow late loading of xml files
This commit is contained in:
Enno Rehling 2009-08-01 22:40:05 +00:00
parent e21a670a93
commit 61b0c7228a
5 changed files with 45 additions and 3 deletions

View File

@ -378,8 +378,7 @@ parse_calendar(xmlDocPtr doc)
xpathCalendars = xmlXPathEvalExpression(BAD_CAST "/eressea/calendar", xpath);
nsetCalendars = xpathCalendars->nodesetval;
if (nsetCalendars==NULL || nsetCalendars->nodeNr!=1) {
log_error(("invalid or missing calendar data in %s\n", doc->name));
rv = -1;
/* rv = -1; */
} else {
xmlNodePtr calendar = nsetCalendars->nodeTab[0];
xmlXPathObjectPtr xpathWeeks, xpathMonths, xpathSeasons;
@ -1650,6 +1649,7 @@ parse_races(xmlDocPtr doc)
/* reading eressea/races/race/skill */
xpath->node = node;
result = xmlXPathEvalExpression(BAD_CAST "skill", xpath);
memset(rc->bonus, 0, sizeof(rc->bonus));
for (k=0;k!=result->nodesetval->nodeNr;++k) {
xmlNodePtr node = result->nodesetval->nodeTab[k];
int mod = xml_ivalue(node, "modifier", 0);

View File

@ -124,7 +124,9 @@ read_xml(const char * filename)
while (reader!=NULL) {
int i = reader->callback(doc);
if (i!=0) return i;
if (i!=0) {
return i;
}
reader = reader->next;
}
xmlFreeDoc(doc);

View File

@ -906,6 +906,15 @@ static int tolua_get_spells(lua_State* L)
lua_pushnil(L);
return 1;
}
int
tolua_read_xml(lua_State* L)
{
const char * filename = tolua_tostring(L, 1, 0);
read_xml(filename);
return 0;
}
int
tolua_eressea_open(lua_State* L)
{
@ -1023,6 +1032,9 @@ tolua_eressea_open(lua_State* L)
tolua_function(L, TOLUA_CAST "spells", tolua_get_spells);
tolua_function(L, TOLUA_CAST "write_spells", tolua_write_spells);
tolua_function(L, TOLUA_CAST "read_xml", tolua_read_xml);
}
tolua_endmodule(L);
return 1;

6
src/res/e3a-update.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<races>
<xi:include href="races/goblin-e3a.xml"/>
</races>
</eressea>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<race name="goblin" magres="-0.05" maxaura="1.0" regaura="1.0" recruitcost="60" maintenance="6" weight="600" capacity="440" speed="1.0" hp="16" damage="1d5" unarmedattack="-2" unarmeddefense="0" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
<ai splitsize="10000" moverandom="yes" learn="yes"/>
<function name="itemdrop" value="defaultdrops"/>
<param name="hunger.damage" value="1d8+7"/>
<param name="other_race" value="demon"/>
<param name="other_cost" value="500"/>
<param name="recruit_multi" value="0.5"/>
<skill name="cartmaking" modifier="-1"/>
<skill name="catapult" modifier="1"/>
<skill name="magic" modifier="-99"/>
<skill name="mining" modifier="1"/>
<skill name="roadwork" modifier="-2"/>
<skill name="sailing" modifier="-2"/>
<skill name="shipcraft" modifier="-2"/>
<skill name="tactics" modifier="-2"/>
<skill name="unarmed" modifier="-99"/>
<skill name="weaponsmithing" modifier="-1"/>
<attack type="1" damage="1d5"/>
<familiar race="rat" default="yes"/>
<familiar race="imp"/>
</race>