forked from github/server
unnecessary xpath searches.
1. item does not have functions. 2. resourcelimit is gone.
This commit is contained in:
parent
b868a54f0b
commit
4812fa1c41
1 changed files with 0 additions and 24 deletions
|
@ -696,7 +696,6 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
|
||||||
item_type *itype = NULL;
|
item_type *itype = NULL;
|
||||||
unsigned int flags = ITF_NONE;
|
unsigned int flags = ITF_NONE;
|
||||||
xmlXPathObjectPtr result;
|
xmlXPathObjectPtr result;
|
||||||
int k;
|
|
||||||
|
|
||||||
if (xml_bvalue(node, "cursed", false))
|
if (xml_bvalue(node, "cursed", false))
|
||||||
flags |= ITF_CURSED;
|
flags |= ITF_CURSED;
|
||||||
|
@ -769,27 +768,8 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(result);
|
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);
|
itype->score = xml_ivalue(node, "score", 0);
|
||||||
if (!itype->score) itype->score = default_score(itype);
|
if (!itype->score) itype->score = default_score(itype);
|
||||||
xmlXPathFreeObject(result);
|
|
||||||
|
|
||||||
return itype;
|
return itype;
|
||||||
}
|
}
|
||||||
|
@ -869,10 +849,6 @@ static int parse_resources(xmlDocPtr doc)
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "modifier", xpath);
|
result = xmlXPathEvalExpression(BAD_CAST "modifier", xpath);
|
||||||
rtype->modifiers = xml_readmodifiers(result, node);
|
rtype->modifiers = xml_readmodifiers(result, node);
|
||||||
xmlXPathFreeObject(result);
|
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 */
|
/* reading eressea/resources/resource/item */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
|
|
Loading…
Reference in a new issue