From c3b0b9e8b339fee47f065e67762aef0d5d0a4af9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 26 Feb 2017 13:47:22 +0100 Subject: [PATCH] fix missing limit-flags. --- res/core/resources/horse.xml | 4 ---- res/core/resources/log.xml | 4 +--- res/core/resources/mallorn.xml | 4 +--- res/core/resources/mallornseed.xml | 4 ---- res/core/resources/seed.xml | 4 ---- src/economy.c | 3 +-- src/kernel/xmlreader.c | 4 +++- 7 files changed, 6 insertions(+), 21 deletions(-) diff --git a/res/core/resources/horse.xml b/res/core/resources/horse.xml index d7f794491..243b547db 100644 --- a/res/core/resources/horse.xml +++ b/res/core/resources/horse.xml @@ -4,8 +4,4 @@ - - - - diff --git a/res/core/resources/log.xml b/res/core/resources/log.xml index 48662878f..3a1e8db50 100644 --- a/res/core/resources/log.xml +++ b/res/core/resources/log.xml @@ -1,12 +1,10 @@ - + - - diff --git a/res/core/resources/mallorn.xml b/res/core/resources/mallorn.xml index 96892b802..39a0230d1 100644 --- a/res/core/resources/mallorn.xml +++ b/res/core/resources/mallorn.xml @@ -1,12 +1,10 @@ - + - - diff --git a/res/core/resources/mallornseed.xml b/res/core/resources/mallornseed.xml index 01b8a3416..7a5a0310f 100644 --- a/res/core/resources/mallornseed.xml +++ b/res/core/resources/mallornseed.xml @@ -3,8 +3,4 @@ - - - - diff --git a/res/core/resources/seed.xml b/res/core/resources/seed.xml index 2bda26eeb..99f5f5804 100644 --- a/res/core/resources/seed.xml +++ b/res/core/resources/seed.xml @@ -3,8 +3,4 @@ - - - - diff --git a/src/economy.c b/src/economy.c index b1b9afb32..f7f23eb16 100644 --- a/src/economy.c +++ b/src/economy.c @@ -930,7 +930,6 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want) * Materialverbrauch hat: */ assert(itype != NULL && (itype->construction == NULL || itype->construction->materials == NULL)); - assert(rdata != NULL); if (!rtype->raw) { int avail = limit_resource(r, rtype); @@ -945,7 +944,7 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want) return; } - if (rdata->modifiers) { + if (rdata && rdata->modifiers) { message *msg = get_modifiers(u, rdata->modifiers, &save_mod, &skill_mod); if (msg) { ADDMSG(&u->faction->msgs, msg); diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index ae8a76163..d4c31001e 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -980,6 +980,9 @@ static int parse_resources(xmlDocPtr doc) rmt_create(rtype); } + if (xml_bvalue(node, "limited", false)) { + rtype->flags |= RTF_LIMITED; + } /* reading eressea/resources/resource/resourcelimit */ xpath->node = node; result = xmlXPathEvalExpression(BAD_CAST "resourcelimit", xpath); @@ -988,7 +991,6 @@ static int parse_resources(xmlDocPtr doc) resource_limit *rdata = rtype->limit = calloc(1, sizeof(resource_limit)); xmlNodePtr limit = result->nodesetval->nodeTab[0]; - rtype->flags |= RTF_LIMITED; xpath->node = limit; xmlXPathFreeObject(result);