forked from github/server
Traumschlößchen verschwindet nicht und funktioniert nicht Verschwinden tut es wohl immer noch nicht, aber immerhin funktioniert es.
This commit is contained in:
parent
659d32e5f3
commit
41708ce703
|
@ -531,31 +531,37 @@ cr_output_messages(FILE * F, message_list *msgs, faction * f)
|
|||
|
||||
/* prints a building */
|
||||
static void
|
||||
cr_output_buildings(FILE * F, building * b, unit * u, int fno, faction *f)
|
||||
cr_output_buildings(FILE * F, building * b, const unit * owner, int fno, faction *f)
|
||||
{
|
||||
const building_type * type = b->type;
|
||||
const char * bname = buildingtype(b, b->size);
|
||||
const char * bname;
|
||||
static const struct building_type * bt_illusion;
|
||||
const building_type * type = b->type;
|
||||
|
||||
if (!bt_illusion) bt_illusion = bt_find("illusion");
|
||||
|
||||
fprintf(F, "BURG %d\n", b->no);
|
||||
if (!u || u->faction != f) {
|
||||
const attrib * a = a_find(b->attribs, &at_icastle);
|
||||
if (a) type = ((icastle_data*)a->data.v)->type;
|
||||
}
|
||||
fprintf(F, "\"%s\";Typ\n", add_translation(bname, LOC(f->locale, bname)));
|
||||
fprintf(F, "\"%s\";Name\n", b->name);
|
||||
|
||||
if (b->type==bt_illusion) {
|
||||
const attrib * a = a_findc(b->attribs, &at_icastle);
|
||||
if (a!=NULL) {
|
||||
type = ((icastle_data*)a->data.v)->type;
|
||||
}
|
||||
bname = buildingtype(b->type, b, b->size);
|
||||
if (owner!=NULL && owner->faction==f) {
|
||||
fprintf(F, "\"%s\";wahrerTyp\n", add_translation(bname, LOC(f->locale, bname)));
|
||||
}
|
||||
}
|
||||
bname = buildingtype(type, b, b->size);
|
||||
fprintf(F, "\"%s\";Typ\n", add_translation(bname, LOC(f->locale, bname)));
|
||||
fprintf(F, "\"%s\";Name\n", b->name);
|
||||
if (b->display && strlen(b->display))
|
||||
fprintf(F, "\"%s\";Beschr\n", b->display);
|
||||
if (b->size)
|
||||
fprintf(F, "%d;Groesse\n", b->size);
|
||||
if (u)
|
||||
fprintf(F, "%d;Besitzer\n", u ? u->no : -1);
|
||||
if (owner)
|
||||
fprintf(F, "%d;Besitzer\n", owner ? owner->no : -1);
|
||||
if (fno >= 0)
|
||||
fprintf(F, "%d;Partei\n", fno);
|
||||
#ifdef TODO
|
||||
int cost = buildingdaten[b->type].per_size * b->size + buildingdaten[b->type].unterhalt;
|
||||
if (u && u->faction == f && cost)
|
||||
fprintf(F, "%d;Unterhalt\n", cost);
|
||||
#endif
|
||||
if (b->besieged)
|
||||
fprintf(F, "%d;Belagerer\n", b->besieged);
|
||||
print_curses(F, f, b, TYP_BUILDING);
|
||||
|
|
|
@ -1863,20 +1863,36 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
|
|||
{
|
||||
int i;
|
||||
unit *u;
|
||||
attrib * a = a_find(b->attribs, &at_icastle);
|
||||
const char * bname;
|
||||
const struct locale * lang = NULL;
|
||||
const building_type * type = b->type;
|
||||
static const struct building_type * bt_illusion;
|
||||
|
||||
if (!bt_illusion) bt_illusion = bt_find("illusion");
|
||||
if (f) lang = f->locale;
|
||||
|
||||
if (a!=NULL) {
|
||||
type = ((icastle_data*)a->data.v)->type;
|
||||
} else {
|
||||
type = b->type;
|
||||
}
|
||||
sprintf(buf, "%s, %s %d, ", buildingname(b), LOC(f->locale, "nr_size"),
|
||||
b->size);
|
||||
|
||||
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));
|
||||
strcat(buf, bname);
|
||||
if (type!=b->type) {
|
||||
unit * owner = buildingowner(r, b);
|
||||
if (owner && owner->faction==f) {
|
||||
/* illusion. report real type */
|
||||
char lbuf[32];
|
||||
bname = LOC(lang, buildingtype(b->type, b, b->size));
|
||||
sprintf(lbuf, " (%s)", bname);
|
||||
strcat(buf, lbuf);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(buf, "%s, %s %d, %s", buildingname(b), LOC(f->locale, "nr_size"),
|
||||
b->size, LOC(lang, buildingtype(b, b->size)));
|
||||
if (b->size < type->maxsize) {
|
||||
scat(" (im Bau)");
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "unit.h"
|
||||
#include "region.h"
|
||||
#include "skill.h"
|
||||
#include "magic.h"
|
||||
#include "save.h"
|
||||
|
||||
/* util includes */
|
||||
|
@ -170,15 +171,17 @@ attrib_type at_building_generic_type = {
|
|||
};
|
||||
|
||||
const char *
|
||||
buildingtype(const building * b, int bsize)
|
||||
buildingtype(const building_type * btype, const building * b, int bsize)
|
||||
{
|
||||
const char * s = NULL;
|
||||
const building_type * btype = b->type;
|
||||
static const struct building_type * bt_generic;
|
||||
if (!bt_generic) bt_generic = bt_find("generic");
|
||||
assert(bt_generic);
|
||||
|
||||
if (btype == bt_generic) {
|
||||
if (!bt_generic) {
|
||||
bt_generic = bt_find("generic");
|
||||
assert(bt_generic);
|
||||
}
|
||||
|
||||
if (btype == bt_generic) {
|
||||
const attrib *a = a_find(b->attribs, &at_building_generic_type);
|
||||
if (a) s = (const char*)a->data.v;
|
||||
}
|
||||
|
@ -457,7 +460,7 @@ new_building(const struct building_type * btype, region * r, const struct locale
|
|||
if (b->type->name)
|
||||
sprintf(buffer, "%s", locale_string(lang, btype->_name));
|
||||
else
|
||||
sprintf(buffer, "%s", LOC(lang, buildingtype(b, 0)));
|
||||
sprintf(buffer, "%s", LOC(lang, buildingtype(btype, b, 0)));
|
||||
set_string(&b->name, buffer);
|
||||
}
|
||||
return b;
|
||||
|
|
|
@ -110,7 +110,7 @@ extern void free_buildinglist(building_list *bl);
|
|||
extern void add_buildinglist(building_list **bl, struct building *b);
|
||||
|
||||
extern struct attrib_type at_building_generic_type;
|
||||
extern const char * buildingtype(const struct building * b, int bsize);
|
||||
extern const char * buildingtype(const building_type * btype, const struct building * b, int bsize);
|
||||
extern const char * buildingname(const struct building * b);
|
||||
extern int buildingcapacity(const struct building * b);
|
||||
extern struct building *new_building(const struct building_type * typ, struct region * r, const struct locale * lang);
|
||||
|
|
|
@ -5161,14 +5161,14 @@ sp_icastle(castorder *co)
|
|||
b = new_building(bt_find("illusion"), r, mage->faction->locale);
|
||||
|
||||
/* Größe festlegen. */
|
||||
if(type == bt_find("illusion")) {
|
||||
if (type == bt_find("illusion")) {
|
||||
b->size = (rand()%(int)((power*power)+1)*10);
|
||||
} else if (b->type->maxsize == -1) {
|
||||
} else if (type->maxsize == -1) {
|
||||
b->size = ((rand()%(int)(power))+1)*5;
|
||||
} else {
|
||||
b->size = b->type->maxsize;
|
||||
b->size = type->maxsize;
|
||||
}
|
||||
sprintf(buf, "%s %s", LOC(mage->faction->locale, buildingtype(b, 0)), buildingid(b));
|
||||
sprintf(buf, "%s %s", LOC(mage->faction->locale, buildingtype(type, b, 0)), buildingid(b));
|
||||
set_string(&b->name, buf);
|
||||
|
||||
/* TODO: Auf timeout und action_destroy umstellen */
|
||||
|
|
|
@ -69,7 +69,7 @@ Buildingid(building * b)
|
|||
{
|
||||
static char buf[35];
|
||||
sprintf(buf, "\002%s (%s), Größe %d",
|
||||
buildingtype(b, b->size /*, NULL */),
|
||||
buildingtype(b->type, b, b->size /*, NULL */),
|
||||
buildingid(b), b->size);
|
||||
return buf;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ BuildingName(building * b)
|
|||
{
|
||||
static char buf[35];
|
||||
sprintf(buf, "%s (%s)",
|
||||
buildingtype(b, b->size /*, NULL*/), buildingid(b));
|
||||
buildingtype(b->type, b, b->size /*, NULL*/), buildingid(b));
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -952,10 +952,11 @@ showunits(region * r)
|
|||
|
||||
for (b = r->buildings; b; b = b->next) {
|
||||
if (b->type == bt_find("castle")) {
|
||||
sprintf(lbuf, "\002%s, Größe %d, %s", buildingname(b), b->size, buildingtype(b, b->size /*, NULL */));
|
||||
sprintf(lbuf, "\002%s, Größe %d, %s", buildingname(b), b->size,
|
||||
buildingtype(b->type, b, b->size /*, NULL */));
|
||||
} else {
|
||||
sprintf(lbuf, "\002%s, Größe %d, %s", buildingname(b),
|
||||
b->size, buildingtype(b, b->size /*, NULL */));
|
||||
b->size, buildingtype(b->type, b, b->size /*, NULL */));
|
||||
if (b->type->maxsize > 0 &&
|
||||
b->size < b->type->maxsize) {
|
||||
sncat(lbuf, " (im Bau)", BUFSIZE);
|
||||
|
|
Loading…
Reference in New Issue