diff --git a/src/economy.test.c b/src/economy.test.c index c67237c40..2de6265f0 100644 --- a/src/economy.test.c +++ b/src/economy.test.c @@ -382,7 +382,7 @@ static void test_make_item(CuTest *tc) { free(itype->construction->materials); itype->construction->materials = 0; rtype->flags |= RTF_LIMITED; - rmt = rmt_create(rtype, "rm_stone"); + rmt = rmt_create(rtype); rdata = rtype->limit = calloc(1, sizeof(resource_limit)); rdata->value = 0; add_resource(u->region, 1, 300, 150, rtype); diff --git a/src/kernel/resources.c b/src/kernel/resources.c index 1261417f1..e8be234a1 100644 --- a/src/kernel/resources.c +++ b/src/kernel/resources.c @@ -185,10 +185,21 @@ struct rawmaterial *rm_get(region * r, const struct resource_type *rtype) struct rawmaterial_type *rmt_find(const char *str) { + const char * replace[] = { "rm_tree", "log", NULL }; resource_type *rtype = rt_find(str); if (!rtype && strncmp(str, "rm_", 3) == 0) { - rtype = rt_find(str+3); + int i; + for (i = 0; replace[i]; i+=2) { + if (strcmp(replace[i], str) == 0) { + rtype = rt_find(replace[i+1]); + break; + } + } + if (!rtype) { + rtype = rt_find(str+3); + } } + assert(rtype); return rtype ? rtype->raw : NULL; } @@ -197,8 +208,7 @@ struct rawmaterial_type *rmt_get(const struct resource_type *rtype) return rtype->raw; } -struct rawmaterial_type *rmt_create(struct resource_type *rtype, - const char *name) +struct rawmaterial_type *rmt_create(struct resource_type *rtype) { rawmaterial_type *rmtype; diff --git a/src/kernel/resources.h b/src/kernel/resources.h index 9d248c0f8..3e93ea1de 100644 --- a/src/kernel/resources.h +++ b/src/kernel/resources.h @@ -82,8 +82,7 @@ extern "C" { void add_resource(struct region *r, int level, int base, int divisor, const struct resource_type *rtype); - struct rawmaterial_type *rmt_create(struct resource_type *rtype, - const char *name); + struct rawmaterial_type *rmt_create(struct resource_type *rtype); #ifdef __cplusplus } diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index 2d08f40a4..9ba05e101 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -983,7 +983,7 @@ static int parse_resources(xmlDocPtr doc) name = xmlGetProp(node, BAD_CAST "material"); if (name) { - rmt_create(rtype, (const char *)name); + rmt_create(rtype); xmlFree(name); }