From 794dae11cf73b272c76867bc82643778351c5c6f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 24 Feb 2017 14:29:14 +0100 Subject: [PATCH] remove artsculpture and genericbuilding. deal with buildings having an unknown type. --- res/core/common/buildings.xml | 3 +-- res/core/de/strings.xml | 2 +- res/core/en/strings.xml | 2 +- res/core/fr/strings.xml | 2 +- src/kernel/building.c | 9 +++++++-- src/kernel/save.c | 5 +++++ 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/res/core/common/buildings.xml b/res/core/common/buildings.xml index cf183086b..17f779843 100644 --- a/res/core/common/buildings.xml +++ b/res/core/common/buildings.xml @@ -4,9 +4,8 @@ - + - diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml index 97ded6e8d..002727630 100644 --- a/res/core/de/strings.xml +++ b/res/core/de/strings.xml @@ -912,7 +912,7 @@ Traumschlößchen - + Struktur diff --git a/res/core/en/strings.xml b/res/core/en/strings.xml index d80c742b9..063194c5d 100644 --- a/res/core/en/strings.xml +++ b/res/core/en/strings.xml @@ -310,7 +310,7 @@ dam - + structure diff --git a/res/core/fr/strings.xml b/res/core/fr/strings.xml index 7eb091570..c69bb5b75 100644 --- a/res/core/fr/strings.xml +++ b/res/core/fr/strings.xml @@ -324,7 +324,7 @@ barrage - + bâtiment diff --git a/src/kernel/building.c b/src/kernel/building.c index 3c21f4dbe..6d0db8f43 100644 --- a/src/kernel/building.c +++ b/src/kernel/building.c @@ -325,8 +325,13 @@ const building_type *findbuildingtype(const char *name, building_type *btype = (building_type *)selist_get(ql, qi); const char *n = LOC(lang, btype->_name); - type.v = (void *)btype; - addtoken((struct tnode **)&bn->names, n, type); + if (!n) { + log_error("building type %s has no translation in %s", + btype->_name, locale_name(lang)); + } else { + type.v = (void *)btype; + addtoken((struct tnode **)&bn->names, n, type); + } } bnames = bn; } diff --git a/src/kernel/save.c b/src/kernel/save.c index 21ec98e76..8316121f3 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1529,6 +1529,11 @@ struct building *read_building(gamedata *data) { READ_INT(store, &b->size); READ_STR(store, name, sizeof(name)); b->type = bt_find(name); + if (!b->type) { + log_error("building %d has unknown type %s", b->no, name); + b->type = bt_find("building"); + assert(b->type); + } read_attribs(data, &b->attribs, b); /* repairs, bug 2221: */