remove btypr->name funcptr and btype->attribs.

why weren't these already gone?
This commit is contained in:
Enno Rehling 2017-05-12 22:12:22 +02:00
parent 11d9afc62e
commit 1bc23beccc
6 changed files with 3 additions and 28 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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:

View file

@ -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);

View file

@ -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 */