forked from github/server
nobody needs the construct_t enum.
This commit is contained in:
parent
969c28692f
commit
c7ae070fa7
2 changed files with 6 additions and 14 deletions
|
@ -37,14 +37,7 @@ extern "C" {
|
||||||
int number;
|
int number;
|
||||||
} requirement;
|
} requirement;
|
||||||
|
|
||||||
typedef enum construct_t {
|
|
||||||
CONS_OTHER,
|
|
||||||
CONS_ITEM,
|
|
||||||
CONS_BUILDING
|
|
||||||
} construct_t;
|
|
||||||
|
|
||||||
typedef struct construction {
|
typedef struct construction {
|
||||||
construct_t type;
|
|
||||||
skill_t skill; /* skill req'd per point of size */
|
skill_t skill; /* skill req'd per point of size */
|
||||||
int minskill; /* skill req'd per point of size */
|
int minskill; /* skill req'd per point of size */
|
||||||
|
|
||||||
|
|
|
@ -214,9 +214,9 @@ xml_readrequirements(xmlNodePtr * nodeTab, int nodeNr, requirement ** reqArray)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
xml_readconstruction(xmlXPathContextPtr xpath, xmlNodeSetPtr nodeSet,
|
xml_readconstruction(xmlXPathContextPtr xpath, xmlNodeSetPtr nodeSet,
|
||||||
construction ** consPtr, construct_t type)
|
construction ** consPtr, bool is_building)
|
||||||
{
|
{
|
||||||
xmlNodePtr pushNode = xpath->node;
|
xmlNodePtr pushNode = xpath->node;
|
||||||
int k;
|
int k;
|
||||||
|
@ -243,13 +243,12 @@ construction ** consPtr, construct_t type)
|
||||||
*consPtr = con = (construction *)calloc(sizeof(construction), 1);
|
*consPtr = con = (construction *)calloc(sizeof(construction), 1);
|
||||||
consPtr = &con->improvement;
|
consPtr = &con->improvement;
|
||||||
|
|
||||||
con->type = type;
|
|
||||||
con->skill = sk;
|
con->skill = sk;
|
||||||
con->maxsize = xml_ivalue(node, "maxsize", -1);
|
con->maxsize = xml_ivalue(node, "maxsize", -1);
|
||||||
con->minskill = xml_ivalue(node, "minskill", -1);
|
con->minskill = xml_ivalue(node, "minskill", -1);
|
||||||
con->reqsize = xml_ivalue(node, "reqsize", 1);
|
con->reqsize = xml_ivalue(node, "reqsize", 1);
|
||||||
|
|
||||||
if (type == CONS_BUILDING) {
|
if (is_building) {
|
||||||
propValue = xmlGetProp(node, BAD_CAST "name");
|
propValue = xmlGetProp(node, BAD_CAST "name");
|
||||||
if (propValue != NULL) {
|
if (propValue != NULL) {
|
||||||
con->name = str_strdup((const char *)propValue);
|
con->name = str_strdup((const char *)propValue);
|
||||||
|
@ -342,7 +341,7 @@ static int parse_buildings(xmlDocPtr doc)
|
||||||
/* reading eressea/buildings/building/construction */
|
/* reading eressea/buildings/building/construction */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "construction", xpath);
|
result = xmlXPathEvalExpression(BAD_CAST "construction", xpath);
|
||||||
xml_readconstruction(xpath, result->nodesetval, &btype->construction, CONS_BUILDING);
|
xml_readconstruction(xpath, result->nodesetval, &btype->construction, true);
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
/* reading eressea/buildings/building/function */
|
/* reading eressea/buildings/building/function */
|
||||||
|
@ -442,7 +441,7 @@ static int parse_ships(xmlDocPtr doc)
|
||||||
/* reading eressea/ships/ship/construction */
|
/* reading eressea/ships/ship/construction */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "construction", xpath);
|
result = xmlXPathEvalExpression(BAD_CAST "construction", xpath);
|
||||||
xml_readconstruction(xpath, result->nodesetval, &st->construction, CONS_OTHER);
|
xml_readconstruction(xpath, result->nodesetval, &st->construction, false);
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
for (child = node->children; child; child = child->next) {
|
for (child = node->children; child; child = child->next) {
|
||||||
|
@ -688,7 +687,7 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
|
||||||
/* reading item/construction */
|
/* reading item/construction */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "construction", xpath);
|
result = xmlXPathEvalExpression(BAD_CAST "construction", xpath);
|
||||||
xml_readconstruction(xpath, result->nodesetval, &itype->construction, CONS_ITEM);
|
xml_readconstruction(xpath, result->nodesetval, &itype->construction, false);
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
|
|
||||||
/* reading item/weapon */
|
/* reading item/weapon */
|
||||||
|
|
Loading…
Reference in a new issue