forked from github/server
- Einheiten mit otherfaction==u->faction
This commit is contained in:
parent
2079db13cf
commit
f55639c4e7
|
@ -633,7 +633,7 @@ cr_output_unit(FILE * F, const region * r,
|
||||||
const faction * sf = visible_faction(f, u);
|
const faction * sf = visible_faction(f, u);
|
||||||
const char * prefix = raceprefix(u);
|
const char * prefix = raceprefix(u);
|
||||||
if (u->faction == f || omniscient(f)) {
|
if (u->faction == f || omniscient(f)) {
|
||||||
const attrib *a_otherfaction = a_find(u->attribs, &at_otherfaction);
|
const attrib * a_otherfaction = a_find(u->attribs, &at_otherfaction);
|
||||||
const faction * otherfaction = a_otherfaction?get_otherfaction(a_otherfaction):NULL;
|
const faction * otherfaction = a_otherfaction?get_otherfaction(a_otherfaction):NULL;
|
||||||
/* my own faction, full info */
|
/* my own faction, full info */
|
||||||
const attrib *a = a_find(u->attribs, &at_group);
|
const attrib *a = a_find(u->attribs, &at_group);
|
||||||
|
@ -645,22 +645,29 @@ cr_output_unit(FILE * F, const region * r,
|
||||||
if (sf!=u->faction) fprintf(F, "%d;Verkleidung\n", sf->no);
|
if (sf!=u->faction) fprintf(F, "%d;Verkleidung\n", sf->no);
|
||||||
if (fval(u, UFL_PARTEITARNUNG))
|
if (fval(u, UFL_PARTEITARNUNG))
|
||||||
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, UFL_PARTEITARNUNG)));
|
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, UFL_PARTEITARNUNG)));
|
||||||
if (otherfaction)
|
if (otherfaction) {
|
||||||
fprintf(F, "%d;Anderepartei\n", otherfaction->no);
|
if (otherfaction!=u->faction) {
|
||||||
} else {
|
fprintf(F, "%d;Anderepartei\n", otherfaction->no);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (fval(u, UFL_PARTEITARNUNG)) {
|
if (fval(u, UFL_PARTEITARNUNG)) {
|
||||||
/* faction info is hidden */
|
/* faction info is hidden */
|
||||||
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, UFL_PARTEITARNUNG)));
|
fprintf(F, "%d;Parteitarnung\n", i2b(fval(u, UFL_PARTEITARNUNG)));
|
||||||
} else {
|
} else {
|
||||||
const attrib *a_otherfaction = a_find(u->attribs, &at_otherfaction);
|
const attrib * a_otherfaction = a_find(u->attribs, &at_otherfaction);
|
||||||
const faction * otherfaction = a_otherfaction?get_otherfaction(a_otherfaction):NULL;
|
const faction * otherfaction = a_otherfaction?get_otherfaction(a_otherfaction):NULL;
|
||||||
/* other unit. show visible faction, not u->faction */
|
/* other unit. show visible faction, not u->faction */
|
||||||
fprintf(F, "%d;Partei\n", sf->no);
|
fprintf(F, "%d;Partei\n", sf->no);
|
||||||
if (sf == f) {
|
if (sf == f) {
|
||||||
fprintf(F, "1;Verraeter\n");
|
fprintf(F, "1;Verraeter\n");
|
||||||
}
|
}
|
||||||
if (a_otherfaction && alliedunit(u, f, HELP_FSTEALTH)) {
|
if (a_otherfaction) {
|
||||||
fprintf(F, "%d;Anderepartei\n", otherfaction->no);
|
if (otherfaction!=u->faction) {
|
||||||
|
if (alliedunit(u, f, HELP_FSTEALTH)) {
|
||||||
|
fprintf(F, "%d;Anderepartei\n", otherfaction->no);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2235,17 +2235,19 @@ display_item(faction *f, unit *u, const item_type * itype)
|
||||||
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(default_locale), name);
|
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(default_locale), name);
|
||||||
fp = fopen(filename, "r");
|
fp = fopen(filename, "r");
|
||||||
}
|
}
|
||||||
if (!fp) return false;
|
if (fp!=NULL) {
|
||||||
|
buf[0]='\0';
|
||||||
buf[0]='\0';
|
while (fgets(t, NAMESIZE, fp) != NULL) {
|
||||||
while (fgets(t, NAMESIZE, fp) != NULL) {
|
if (t[strlen(t) - 1] == '\n') {
|
||||||
if (t[strlen(t) - 1] == '\n') {
|
t[strlen(t) - 1] = 0;
|
||||||
t[strlen(t) - 1] = 0;
|
}
|
||||||
|
strcat(buf, t);
|
||||||
}
|
}
|
||||||
strcat(buf, t);
|
fclose(fp);
|
||||||
|
info = buf;
|
||||||
|
} else {
|
||||||
|
info = "Keine Informationen.";
|
||||||
}
|
}
|
||||||
fclose(fp);
|
|
||||||
info = buf;
|
|
||||||
}
|
}
|
||||||
ADDMSG(&f->msgs, msg_message("displayitem", "weight item description",
|
ADDMSG(&f->msgs, msg_message("displayitem", "weight item description",
|
||||||
itype->weight/1000, itype->rtype, strdup(info)));
|
itype->weight/1000, itype->rtype, strdup(info)));
|
||||||
|
|
|
@ -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_atgmcreate(const struct item_type * itype);
|
||||||
extern attrib * make_atpermissions(void);
|
extern attrib * make_atpermissions(void);
|
||||||
extern struct attrib_type at_permissions;
|
extern struct attrib_type at_permissions;
|
||||||
|
@ -1093,6 +1113,7 @@ korrektur(void)
|
||||||
* to be on the safe side:
|
* to be on the safe side:
|
||||||
*/
|
*/
|
||||||
fix_demand();
|
fix_demand();
|
||||||
|
fix_otherfaction();
|
||||||
/* trade_orders(); */
|
/* trade_orders(); */
|
||||||
|
|
||||||
/* immer ausführen, wenn neue Sprüche dazugekommen sind, oder sich
|
/* immer ausführen, wenn neue Sprüche dazugekommen sind, oder sich
|
||||||
|
|
Loading…
Reference in New Issue