From 6031dff6850ec50b61d1f937383cce353390fcbb Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 25 Feb 2017 19:50:32 +0100 Subject: [PATCH] resource_limit.value is always zero, never initialized. kill it. --- clibs | 2 +- src/economy.c | 4 ++-- src/economy.test.c | 1 - src/kernel/resources.h | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/clibs b/clibs index 27c8b3202..b91413316 160000 --- a/clibs +++ b/clibs @@ -1 +1 @@ -Subproject commit 27c8b3202b52766465743c3324fc0b52c5ba4b11 +Subproject commit b91413316ce13044c555084a9f605983586107b4 diff --git a/src/economy.c b/src/economy.c index f0a693eca..f9ded29de 100644 --- a/src/economy.c +++ b/src/economy.c @@ -1123,7 +1123,7 @@ attrib_allocation(const resource_type * rtype, region * r, allocation * alist) allocation *al; int nreq = 0; resource_limit *rdata = get_resourcelimit(rtype); - int avail = rdata->value; + int avail = 0; for (al = alist; al; al = al->next) { nreq += required(al->want, al->save); @@ -1165,7 +1165,7 @@ static allocate_function get_allocator(const struct resource_type *rtype) resource_limit *rdata = get_resourcelimit(rtype); if (rdata) { - if (rdata->value > 0 || rdata->limit != NULL) { + if (rdata->limit != NULL) { return attrib_allocation; } return leveled_allocation; diff --git a/src/economy.test.c b/src/economy.test.c index 4ddd20105..aea42491d 100644 --- a/src/economy.test.c +++ b/src/economy.test.c @@ -384,7 +384,6 @@ static void test_make_item(CuTest *tc) { rtype->flags |= RTF_LIMITED; rmt = rmt_create(rtype); rdata = rtype->limit = calloc(1, sizeof(resource_limit)); - rdata->value = 0; add_resource(u->region, 1, 300, 150, rtype); u->region->resources->amount = 300; /* there are 300 stones at level 1 */ set_level(u, SK_ALCHEMY, 10); diff --git a/src/kernel/resources.h b/src/kernel/resources.h index 3e93ea1de..d7c0e5bfd 100644 --- a/src/kernel/resources.h +++ b/src/kernel/resources.h @@ -58,7 +58,6 @@ extern "C" { typedef struct resource_limit { rlimit_limit limit; rlimit_produce produce; - int value; resource_mod *modifiers; } resource_limit;