From 1bc23beccc8d018e1bd5b2fecb06932e71c2b768 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 12 May 2017 22:12:22 +0200 Subject: [PATCH] remove btypr->name funcptr and btype->attribs. why weren't these already gone? --- src/kernel/building.c | 3 --- src/kernel/building.h | 4 ---- src/kernel/building.test.c | 3 +-- src/kernel/jsonconf.c | 5 ----- src/kernel/xmlreader.c | 9 +-------- src/spells.c | 7 +------ 6 files changed, 3 insertions(+), 28 deletions(-) diff --git a/src/kernel/building.c b/src/kernel/building.c index 431d44e9e..92a4fd6f1 100644 --- a/src/kernel/building.c +++ b/src/kernel/building.c @@ -196,9 +196,6 @@ const char *buildingtype(const building_type * btype, const building * b, int bs } } } - if (btype->name) { - return btype->name(btype, b, bsize); - } if (btype->construction && btype->construction->name) { if (b) { bsize = adjust_size(b, bsize); diff --git a/src/kernel/building.h b/src/kernel/building.h index 476424a92..04ad08262 100644 --- a/src/kernel/building.h +++ b/src/kernel/building.h @@ -68,10 +68,6 @@ extern "C" { struct maintenance *maintenance; /* array of requirements */ struct construction *construction; /* construction of 1 building-level */ struct resource_mod *modifiers; /* modify production skills */ - - const char *(*name) (const struct building_type *, - const struct building * b, int size); - struct attrib *attribs; } building_type; extern struct selist *buildingtypes; diff --git a/src/kernel/building.test.c b/src/kernel/building.test.c index c1255373b..588ec2937 100644 --- a/src/kernel/building.test.c +++ b/src/kernel/building.test.c @@ -294,9 +294,8 @@ static void test_btype_defaults(CuTest *tc) { CuAssertStrEquals(tc, "hodor", btype->_name); CuAssertPtrEquals(tc, 0, btype->maintenance); CuAssertPtrEquals(tc, 0, btype->construction); - CuAssertTrue(tc, !btype->name); - CuAssertTrue(tc, !btype->taxes); CuAssertDblEquals(tc, 1.0, btype->auraregen, 0.0); + CuAssertIntEquals(tc, 0, btype->taxes); CuAssertIntEquals(tc, -1, btype->maxsize); CuAssertIntEquals(tc, 1, btype->capacity); CuAssertIntEquals(tc, -1, btype->maxcapacity); diff --git a/src/kernel/jsonconf.c b/src/kernel/jsonconf.c index b7d79b64d..609e73aac 100644 --- a/src/kernel/jsonconf.c +++ b/src/kernel/jsonconf.c @@ -339,11 +339,6 @@ static void json_building(cJSON *json, building_type *bt) { } break; case cJSON_String: - if (strcmp(child->string, "name") == 0) { - bt->name = (const char *(*)(const struct building_type *, - const struct building *, int))get_function(child->valuestring); - break; - } log_error("building %s contains unknown attribute %s", json->string, child->string); break; default: diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index f595ec7a4..9953f7335 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -356,14 +356,7 @@ static int parse_buildings(xmlDocPtr doc) continue; } assert(propValue != NULL); - if (strcmp((const char *)propValue, "name") == 0) { - btype->name = - (const char *(*)(const struct building_type *, - const struct building *, int))fun; - } - else { - log_error("unknown function type '%s' for building %s\n", (const char *)propValue, btype->_name); - } + log_error("unknown function type '%s' for building %s\n", (const char *)propValue, btype->_name); xmlFree(propValue); } xmlXPathFreeObject(result); diff --git a/src/spells.c b/src/spells.c index c515c0144..b1e5c0591 100644 --- a/src/spells.c +++ b/src/spells.c @@ -4534,12 +4534,7 @@ int sp_icastle(castorder * co) b->size = ((rng_int() % (int)(power)) + 1) * 5; } - if (type->name == NULL) { - bname = LOC(mage->faction->locale, type->_name); - } - else { - bname = LOC(mage->faction->locale, buildingtype(type, b, 0)); - } + bname = LOC(mage->faction->locale, buildingtype(type, b, 0)); building_setname(b, bname); /* TODO: Auf timeout und action_destroy umstellen */