From c7ae070fa78f72d9f12dce4847719a81021171f5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 1 May 2018 07:02:55 +0200 Subject: [PATCH] nobody needs the construct_t enum. --- src/kernel/build.h | 7 ------- src/xmlreader.c | 13 ++++++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/kernel/build.h b/src/kernel/build.h index c201d900b..5f93884cd 100644 --- a/src/kernel/build.h +++ b/src/kernel/build.h @@ -37,14 +37,7 @@ extern "C" { int number; } requirement; - typedef enum construct_t { - CONS_OTHER, - CONS_ITEM, - CONS_BUILDING - } construct_t; - typedef struct construction { - construct_t type; skill_t skill; /* skill req'd per point of size */ int minskill; /* skill req'd per point of size */ diff --git a/src/xmlreader.c b/src/xmlreader.c index adddb808e..03f016986 100644 --- a/src/xmlreader.c +++ b/src/xmlreader.c @@ -214,9 +214,9 @@ xml_readrequirements(xmlNodePtr * nodeTab, int nodeNr, requirement ** reqArray) } } -void +static void xml_readconstruction(xmlXPathContextPtr xpath, xmlNodeSetPtr nodeSet, -construction ** consPtr, construct_t type) +construction ** consPtr, bool is_building) { xmlNodePtr pushNode = xpath->node; int k; @@ -243,13 +243,12 @@ construction ** consPtr, construct_t type) *consPtr = con = (construction *)calloc(sizeof(construction), 1); consPtr = &con->improvement; - con->type = type; con->skill = sk; con->maxsize = xml_ivalue(node, "maxsize", -1); con->minskill = xml_ivalue(node, "minskill", -1); con->reqsize = xml_ivalue(node, "reqsize", 1); - if (type == CONS_BUILDING) { + if (is_building) { propValue = xmlGetProp(node, BAD_CAST "name"); if (propValue != NULL) { con->name = str_strdup((const char *)propValue); @@ -342,7 +341,7 @@ static int parse_buildings(xmlDocPtr doc) /* reading eressea/buildings/building/construction */ xpath->node = node; 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); /* reading eressea/buildings/building/function */ @@ -442,7 +441,7 @@ static int parse_ships(xmlDocPtr doc) /* reading eressea/ships/ship/construction */ xpath->node = node; 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); 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 */ xpath->node = node; 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); /* reading item/weapon */