forked from github/server
remove pointless <resourcelimit/> wrapper from XML.
This commit is contained in:
parent
d4b973fea4
commit
6e27adb892
9 changed files with 68 additions and 93 deletions
|
@ -5,9 +5,7 @@
|
||||||
<item weight="200" score="200">
|
<item weight="200" score="200">
|
||||||
<construction skill="mining" minskill="8"/>
|
<construction skill="mining" minskill="8"/>
|
||||||
</item>
|
</item>
|
||||||
<resourcelimit>
|
<modifier type="require" building="mine"/>
|
||||||
<modifier type="require" building="mine"/>
|
|
||||||
</resourcelimit>
|
|
||||||
</resource>
|
</resource>
|
||||||
|
|
||||||
<resource name="adamantiumaxe">
|
<resource name="adamantiumaxe">
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<resource name="iron" limited="yes" material="yes">
|
<resource name="iron" limited="yes" material="yes">
|
||||||
<item weight="500" score="10">
|
<item weight="500" score="10">
|
||||||
<construction skill="mining" minskill="1"/>
|
<construction skill="mining" minskill="1"/>
|
||||||
</item>
|
</item>
|
||||||
<resourcelimit>
|
|
||||||
<modifier building="mine" type="skill" value="1"/>
|
<modifier building="mine" type="skill" value="1"/>
|
||||||
<modifier building="mine" type="material" value="0.5"/>
|
<modifier building="mine" type="material" value="0.5"/>
|
||||||
<modifier race="dwarf" type="material" value="0.60"/>
|
<modifier race="dwarf" type="material" value="0.60"/>
|
||||||
</resourcelimit>
|
|
||||||
</resource>
|
</resource>
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<resource name="laen" limited="yes" material="yes">
|
<resource name="laen" limited="yes" material="yes">
|
||||||
<item weight="200" score="100">
|
<item weight="200" score="100">
|
||||||
<construction skill="mining" minskill="7"/>
|
<construction skill="mining" minskill="7"/>
|
||||||
</item>
|
</item>
|
||||||
<resourcelimit>
|
|
||||||
<modifier type="require" building="mine"/>
|
<modifier type="require" building="mine"/>
|
||||||
</resourcelimit>
|
|
||||||
</resource>
|
</resource>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<resource name="log" limited="yes">
|
<resource name="log" limited="yes">
|
||||||
<item weight="500" score="10">
|
<item weight="500" score="10">
|
||||||
<construction skill="forestry" minskill="1"/>
|
<construction skill="forestry" minskill="1"/>
|
||||||
</item>
|
</item>
|
||||||
<resourcelimit>
|
|
||||||
<modifier building="sawmill" type="skill" value="1"/>
|
<modifier building="sawmill" type="skill" value="1"/>
|
||||||
<modifier building="sawmill" type="material" value="0.5"/>
|
<modifier building="sawmill" type="material" value="0.5"/>
|
||||||
</resourcelimit>
|
|
||||||
</resource>
|
</resource>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<resource name="mallorn" limited="yes">
|
<resource name="mallorn" limited="yes">
|
||||||
<item weight="500" score="30">
|
<item weight="500" score="30">
|
||||||
<construction skill="forestry" minskill="2"/>
|
<construction skill="forestry" minskill="2"/>
|
||||||
</item>
|
</item>
|
||||||
<resourcelimit>
|
|
||||||
<modifier building="sawmill" type="skill" value="1"/>
|
<modifier building="sawmill" type="skill" value="1"/>
|
||||||
<modifier building="sawmill" type="material" value="0.5"/>
|
<modifier building="sawmill" type="material" value="0.5"/>
|
||||||
</resourcelimit>
|
|
||||||
</resource>
|
</resource>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<resource name="stone" limited="yes" material="yes">
|
<resource name="stone" limited="yes" material="yes">
|
||||||
<item weight="6000" score="10" big="yes">
|
<item weight="6000" score="10" big="yes">
|
||||||
<construction skill="quarrying" minskill="1"/>
|
<construction skill="quarrying" minskill="1"/>
|
||||||
</item>
|
</item>
|
||||||
<resourcelimit>
|
|
||||||
<modifier building="quarry" type="skill" value="1"/>
|
<modifier building="quarry" type="skill" value="1"/>
|
||||||
<modifier building="quarry" type="material" value="0.5"/>
|
<modifier building="quarry" type="material" value="0.5"/>
|
||||||
<modifier race="troll" type="material" value="0.75"/>
|
<modifier race="troll" type="material" value="0.75"/>
|
||||||
</resourcelimit>
|
|
||||||
</resource>
|
</resource>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<resource name="iron" limited="yes" material="yes">
|
<resource name="iron" limited="yes" material="yes">
|
||||||
<item weight="500" score="10">
|
<item weight="500" score="10">
|
||||||
<construction skill="mining" minskill="1"/>
|
<construction skill="mining" minskill="1"/>
|
||||||
</item>
|
</item>
|
||||||
<resourcelimit>
|
|
||||||
<modifier building="mine" type="skill" value="1"/>
|
<modifier building="mine" type="skill" value="1"/>
|
||||||
<modifier building="mine" type="material" value="0.5"/>
|
<modifier building="mine" type="material" value="0.5"/>
|
||||||
</resourcelimit>
|
|
||||||
</resource>
|
</resource>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<resource name="stone" limited="yes" material="yes">
|
<resource name="stone" limited="yes" material="yes">
|
||||||
<item weight="6000" score="10" big="yes">
|
<item weight="6000" score="10" big="yes">
|
||||||
<construction skill="quarrying" minskill="1"/>
|
<construction skill="quarrying" minskill="1"/>
|
||||||
</item>
|
</item>
|
||||||
<resourcelimit>
|
|
||||||
<modifier building="quarry" type="skill" value="1"/>
|
<modifier building="quarry" type="skill" value="1"/>
|
||||||
<modifier building="quarry" type="material" value="0.5"/>
|
<modifier building="quarry" type="material" value="0.5"/>
|
||||||
</resourcelimit>
|
|
||||||
</resource>
|
</resource>
|
||||||
|
|
|
@ -983,65 +983,56 @@ static int parse_resources(xmlDocPtr doc)
|
||||||
if (xml_bvalue(node, "limited", false)) {
|
if (xml_bvalue(node, "limited", false)) {
|
||||||
rtype->flags |= RTF_LIMITED;
|
rtype->flags |= RTF_LIMITED;
|
||||||
}
|
}
|
||||||
/* reading eressea/resources/resource/resourcelimit */
|
/* reading eressea/resources/resource/modifier */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "resourcelimit", xpath);
|
result = xmlXPathEvalExpression(BAD_CAST "modifier", xpath);
|
||||||
assert(result->nodesetval->nodeNr <= 1);
|
if (result->nodesetval != NULL && result->nodesetval->nodeNr > 0) {
|
||||||
if (result->nodesetval->nodeNr != 0) {
|
rtype->modifiers =
|
||||||
xmlNodePtr limit = result->nodesetval->nodeTab[0];
|
calloc(result->nodesetval->nodeNr + 1, sizeof(resource_mod));
|
||||||
|
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
||||||
|
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||||
|
building_type *btype = NULL;
|
||||||
|
const race *rc = NULL;
|
||||||
|
|
||||||
xpath->node = limit;
|
propValue = xmlGetProp(node, BAD_CAST "race");
|
||||||
xmlXPathFreeObject(result);
|
if (propValue != NULL) {
|
||||||
|
rc = rc_find((const char *)propValue);
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "modifier", xpath);
|
if (rc == NULL)
|
||||||
if (result->nodesetval != NULL) {
|
rc = rc_get_or_create((const char *)propValue);
|
||||||
rtype->modifiers =
|
|
||||||
calloc(result->nodesetval->nodeNr + 1, sizeof(resource_mod));
|
|
||||||
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
|
|
||||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
|
||||||
building_type *btype = NULL;
|
|
||||||
const race *rc = NULL;
|
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "race");
|
|
||||||
if (propValue != NULL) {
|
|
||||||
rc = rc_find((const char *)propValue);
|
|
||||||
if (rc == NULL)
|
|
||||||
rc = rc_get_or_create((const char *)propValue);
|
|
||||||
xmlFree(propValue);
|
|
||||||
}
|
|
||||||
rtype->modifiers[k].race = rc;
|
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "building");
|
|
||||||
if (propValue != NULL) {
|
|
||||||
btype = bt_get_or_create((const char *)propValue);
|
|
||||||
xmlFree(propValue);
|
|
||||||
}
|
|
||||||
rtype->modifiers[k].btype = btype;
|
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "type");
|
|
||||||
assert(propValue != NULL);
|
|
||||||
if (strcmp((const char *)propValue, "skill") == 0) {
|
|
||||||
rtype->modifiers[k].value.i = xml_ivalue(node, "value", 0);
|
|
||||||
rtype->modifiers[k].flags = RMF_SKILL;
|
|
||||||
}
|
|
||||||
else if (strcmp((const char *)propValue, "material") == 0) {
|
|
||||||
rtype->modifiers[k].value = xml_fraction(node, "value");
|
|
||||||
rtype->modifiers[k].flags = RMF_SAVEMATERIAL;
|
|
||||||
}
|
|
||||||
else if (strcmp((const char *)propValue, "require") == 0) {
|
|
||||||
xmlChar *propBldg = xmlGetProp(node, BAD_CAST "building");
|
|
||||||
if (propBldg != NULL) {
|
|
||||||
btype = bt_get_or_create((const char *)propBldg);
|
|
||||||
rtype->modifiers[k].btype = btype;
|
|
||||||
rtype->modifiers[k].flags = RMF_REQUIREDBUILDING;
|
|
||||||
xmlFree(propBldg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
log_error("unknown type '%s' for resourcelimit-modifier '%s'\n", (const char *)propValue, rtype->_name);
|
|
||||||
}
|
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
}
|
}
|
||||||
|
rtype->modifiers[k].race = rc;
|
||||||
|
|
||||||
|
propValue = xmlGetProp(node, BAD_CAST "building");
|
||||||
|
if (propValue != NULL) {
|
||||||
|
btype = bt_get_or_create((const char *)propValue);
|
||||||
|
xmlFree(propValue);
|
||||||
|
}
|
||||||
|
rtype->modifiers[k].btype = btype;
|
||||||
|
|
||||||
|
propValue = xmlGetProp(node, BAD_CAST "type");
|
||||||
|
assert(propValue != NULL);
|
||||||
|
if (strcmp((const char *)propValue, "skill") == 0) {
|
||||||
|
rtype->modifiers[k].value.i = xml_ivalue(node, "value", 0);
|
||||||
|
rtype->modifiers[k].flags = RMF_SKILL;
|
||||||
|
}
|
||||||
|
else if (strcmp((const char *)propValue, "material") == 0) {
|
||||||
|
rtype->modifiers[k].value = xml_fraction(node, "value");
|
||||||
|
rtype->modifiers[k].flags = RMF_SAVEMATERIAL;
|
||||||
|
}
|
||||||
|
else if (strcmp((const char *)propValue, "require") == 0) {
|
||||||
|
xmlChar *propBldg = xmlGetProp(node, BAD_CAST "building");
|
||||||
|
if (propBldg != NULL) {
|
||||||
|
btype = bt_get_or_create((const char *)propBldg);
|
||||||
|
rtype->modifiers[k].btype = btype;
|
||||||
|
rtype->modifiers[k].flags = RMF_REQUIREDBUILDING;
|
||||||
|
xmlFree(propBldg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log_error("unknown type '%s' for resourcelimit-modifier '%s'\n", (const char *)propValue, rtype->_name);
|
||||||
|
}
|
||||||
|
xmlFree(propValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
|
|
Loading…
Reference in a new issue