unnecessary xpath searches.

1. item does not have functions.
2. resourcelimit is gone.
This commit is contained in:
Enno Rehling 2018-04-28 21:25:26 +02:00
parent b868a54f0b
commit 4812fa1c41

View file

@ -696,7 +696,6 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
item_type *itype = NULL;
unsigned int flags = ITF_NONE;
xmlXPathObjectPtr result;
int k;
if (xml_bvalue(node, "cursed", false))
flags |= ITF_CURSED;
@ -769,27 +768,8 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
}
xmlXPathFreeObject(result);
/* reading item/function */
xpath->node = node;
result = xmlXPathEvalExpression(BAD_CAST "function", xpath);
for (k = 0; k != result->nodesetval->nodeNr; ++k) {
xmlNodePtr node = result->nodesetval->nodeTab[k];
xmlChar *propValue;
pf_generic fun;
parse_function(node, &fun, &propValue);
if (fun == NULL) {
log_error("unknown function name '%s' for item '%s'\n", (const char *)propValue, rtype->_name);
xmlFree(propValue);
continue;
}
assert(propValue != NULL);
log_error("unknown function type '%s' for item '%s'\n", (const char *)propValue, rtype->_name);
xmlFree(propValue);
}
itype->score = xml_ivalue(node, "score", 0);
if (!itype->score) itype->score = default_score(itype);
xmlXPathFreeObject(result);
return itype;
}
@ -869,10 +849,6 @@ static int parse_resources(xmlDocPtr doc)
result = xmlXPathEvalExpression(BAD_CAST "modifier", xpath);
rtype->modifiers = xml_readmodifiers(result, node);
xmlXPathFreeObject(result);
/* reading eressea/resources/resource/resourcelimit/function */
xpath->node = node;
result = xmlXPathEvalExpression(BAD_CAST "resourcelimit/function", xpath);
xmlXPathFreeObject(result);
/* reading eressea/resources/resource/item */
xpath->node = node;