- illusionary buildings not showing up right
Issue: 1456
This commit is contained in:
Enno Rehling 2008-07-12 09:45:10 +00:00
parent 67c4b861f1
commit d2c88d6660
3 changed files with 10 additions and 18 deletions

View File

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

View File

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

View File

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