forked from github/server
- illusionary buildings not showing up right Issue: 1456
This commit is contained in:
parent
67c4b861f1
commit
d2c88d6660
3 changed files with 10 additions and 18 deletions
|
@ -1772,41 +1772,33 @@ nr_building(FILE *F, const seen_region * sr, const building * b, const faction *
|
||||||
{
|
{
|
||||||
region * r = sr->r;
|
region * r = sr->r;
|
||||||
int i, bytes;
|
int i, bytes;
|
||||||
const char * bname;
|
const char * name, * bname, * billusion = NULL;
|
||||||
const struct locale * lang = NULL;
|
const struct locale * lang = NULL;
|
||||||
const building_type * type = b->type;
|
|
||||||
static const struct building_type * bt_illusion;
|
|
||||||
char buffer[8192], * bufp = buffer;
|
char buffer[8192], * bufp = buffer;
|
||||||
size_t size = sizeof(buffer) - 1;
|
size_t size = sizeof(buffer) - 1;
|
||||||
|
|
||||||
rnl(F);
|
rnl(F);
|
||||||
|
|
||||||
if (!bt_illusion) bt_illusion = bt_find("illusion");
|
|
||||||
if (f) lang = f->locale;
|
if (f) lang = f->locale;
|
||||||
|
|
||||||
bytes = snprintf(bufp, size, "%s, %s %d, ", buildingname(b), LOC(f->locale, "nr_size"), b->size);
|
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 (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER();
|
||||||
|
|
||||||
if (b->type==bt_illusion) {
|
report_building(b, &bname, &billusion);
|
||||||
attrib * a = a_find(b->attribs, &at_icastle);
|
name = LOC(lang, billusion?billusion:bname);
|
||||||
if (a!=NULL) {
|
bytes = (int)strlcpy(bufp, name, size);
|
||||||
type = ((icastle_data*)a->data.v)->type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bname = LOC(lang, buildingtype(type, b, b->size));
|
|
||||||
bytes = (int)strlcpy(bufp, bname, size);
|
|
||||||
if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER();
|
if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER();
|
||||||
if (type!=b->type) {
|
if (billusion) {
|
||||||
unit * owner = buildingowner(r, b);
|
unit * owner = buildingowner(r, b);
|
||||||
if (owner && owner->faction==f) {
|
if (owner && owner->faction==f) {
|
||||||
/* illusion. report real type */
|
/* illusion. report real type */
|
||||||
bname = LOC(lang, buildingtype(b->type, b, b->size));
|
name = LOC(lang, bname);
|
||||||
bytes = snprintf(bufp, size, " (%s)", bname);
|
bytes = snprintf(bufp, size, " (%s)", name);
|
||||||
if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER();
|
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);
|
bytes = (int)strlcpy(bufp, " (im Bau)", size);
|
||||||
if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER();
|
if (wrptr(&bufp, &size, bytes)!=0) WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,7 +466,7 @@ remove_building(building ** blist, building * b)
|
||||||
unit *u;
|
unit *u;
|
||||||
direction_t d;
|
direction_t d;
|
||||||
static const struct building_type * bt_caravan, * bt_dam, * bt_tunnel;
|
static const struct building_type * bt_caravan, * bt_dam, * bt_tunnel;
|
||||||
boolean init = false;
|
static boolean init = false;
|
||||||
|
|
||||||
if (!init) {
|
if (!init) {
|
||||||
init = true;
|
init = true;
|
||||||
|
|
|
@ -330,7 +330,7 @@ report_building(const struct building * b, const char ** name, const char ** ill
|
||||||
*illusion = NULL;
|
*illusion = NULL;
|
||||||
|
|
||||||
if (!init) {
|
if (!init) {
|
||||||
bt_illusion = bt_find("illusion");
|
bt_illusion = bt_find("illusioncastle");
|
||||||
init = 1;
|
init = 1;
|
||||||
}
|
}
|
||||||
if (bt_illusion && b->type==bt_illusion) {
|
if (bt_illusion && b->type==bt_illusion) {
|
||||||
|
|
Loading…
Reference in a new issue