From d2c88d6660ce55983678215a7c7771fcbf65fc88 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 12 Jul 2008 09:45:10 +0000 Subject: [PATCH] http://bugs.eressea.de/view.php?id=1456 - illusionary buildings not showing up right Issue: 1456 --- src/common/gamecode/report.c | 24 ++++++++---------------- src/common/kernel/building.c | 2 +- src/common/kernel/reports.c | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 94f86a598..26d9c86ff 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -1772,41 +1772,33 @@ nr_building(FILE *F, const seen_region * sr, const building * b, const faction * { region * r = sr->r; int i, bytes; - const char * bname; + const char * name, * bname, * billusion = NULL; const struct locale * lang = NULL; - const building_type * type = b->type; - static const struct building_type * bt_illusion; char buffer[8192], * bufp = buffer; size_t size = sizeof(buffer) - 1; rnl(F); - if (!bt_illusion) bt_illusion = bt_find("illusion"); if (f) lang = f->locale; bytes = snprintf(bufp, size, "%s, %s %d, ", buildingname(b), LOC(f->locale, "nr_size"), b->size); if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); - if (b->type==bt_illusion) { - attrib * a = a_find(b->attribs, &at_icastle); - if (a!=NULL) { - type = ((icastle_data*)a->data.v)->type; - } - } - bname = LOC(lang, buildingtype(type, b, b->size)); - bytes = (int)strlcpy(bufp, bname, size); + report_building(b, &bname, &billusion); + name = LOC(lang, billusion?billusion:bname); + bytes = (int)strlcpy(bufp, name, size); if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); - if (type!=b->type) { + if (billusion) { unit * owner = buildingowner(r, b); if (owner && owner->faction==f) { /* illusion. report real type */ - bname = LOC(lang, buildingtype(b->type, b, b->size)); - bytes = snprintf(bufp, size, " (%s)", bname); + name = LOC(lang, bname); + bytes = snprintf(bufp, size, " (%s)", name); if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); } } - if (b->size < type->maxsize) { + if (b->size < b->type->maxsize) { bytes = (int)strlcpy(bufp, " (im Bau)", size); if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER(); } diff --git a/src/common/kernel/building.c b/src/common/kernel/building.c index 7278a33d9..95d4ce00f 100644 --- a/src/common/kernel/building.c +++ b/src/common/kernel/building.c @@ -466,7 +466,7 @@ remove_building(building ** blist, building * b) unit *u; direction_t d; static const struct building_type * bt_caravan, * bt_dam, * bt_tunnel; - boolean init = false; + static boolean init = false; if (!init) { init = true; diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index 3ff39ecde..b5c73a1a9 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -330,7 +330,7 @@ report_building(const struct building * b, const char ** name, const char ** ill *illusion = NULL; if (!init) { - bt_illusion = bt_find("illusion"); + bt_illusion = bt_find("illusioncastle"); init = 1; } if (bt_illusion && b->type==bt_illusion) {