- Einheiten mit otherfaction==u->faction
This commit is contained in:
Enno Rehling 2005-02-05 19:05:47 +00:00
parent 2079db13cf
commit f55639c4e7
3 changed files with 46 additions and 16 deletions

View File

@ -645,8 +645,11 @@ cr_output_unit(FILE * F, const region * r,
if (sf!=u->faction) fprintf(F, "%d;Verkleidung\n", sf->no);
if (fval(u, UFL_PARTEITARNUNG))
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, UFL_PARTEITARNUNG)));
if (otherfaction)
if (otherfaction) {
if (otherfaction!=u->faction) {
fprintf(F, "%d;Anderepartei\n", otherfaction->no);
}
}
} else {
if (fval(u, UFL_PARTEITARNUNG)) {
/* faction info is hidden */
@ -659,9 +662,13 @@ cr_output_unit(FILE * F, const region * r,
if (sf == f) {
fprintf(F, "1;Verraeter\n");
}
if (a_otherfaction && alliedunit(u, f, HELP_FSTEALTH)) {
if (a_otherfaction) {
if (otherfaction!=u->faction) {
if (alliedunit(u, f, HELP_FSTEALTH)) {
fprintf(F, "%d;Anderepartei\n", otherfaction->no);
}
}
}
}
}
if (prefix) {

View File

@ -2235,8 +2235,7 @@ display_item(faction *f, unit *u, const item_type * itype)
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(default_locale), name);
fp = fopen(filename, "r");
}
if (!fp) return false;
if (fp!=NULL) {
buf[0]='\0';
while (fgets(t, NAMESIZE, fp) != NULL) {
if (t[strlen(t) - 1] == '\n') {
@ -2246,6 +2245,9 @@ display_item(faction *f, unit *u, const item_type * itype)
}
fclose(fp);
info = buf;
} else {
info = "Keine Informationen.";
}
}
ADDMSG(&f->msgs, msg_message("displayitem", "weight item description",
itype->weight/1000, itype->rtype, strdup(info)));

View File

@ -482,6 +482,26 @@ fix_firewalls(void)
}
}
static void
fix_otherfaction(void)
{
int count = 0;
region * r;
for (r=regions;r;r=r->next) {
unit * u;
for (u=r->units;u;u=u->next) {
attrib * a = a_find(u->attribs, &at_otherfaction);
faction * f = (faction*)a->data.v;
if (f==u->faction) {
a_remove(&u->attribs, a);
++ncount;
}
}
r = r->next;
}
if (count) log_warning(("%u units had otherfaction=own faction.\n"));
}
extern attrib * make_atgmcreate(const struct item_type * itype);
extern attrib * make_atpermissions(void);
extern struct attrib_type at_permissions;
@ -1093,6 +1113,7 @@ korrektur(void)
* to be on the safe side:
*/
fix_demand();
fix_otherfaction();
/* trade_orders(); */
/* immer ausführen, wenn neue Sprüche dazugekommen sind, oder sich