forked from github/server
more factionstealth testing.
This commit is contained in:
parent
6d9387f6c2
commit
295614643a
|
@ -763,12 +763,9 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
stream_printf(out, "\"%s\";Beschr\n", str);
|
stream_printf(out, "\"%s\";Beschr\n", str);
|
||||||
}
|
}
|
||||||
/* print faction information */
|
/* print faction information */
|
||||||
sf = visible_faction(f, u);
|
sf = visible_faction(NULL, u);
|
||||||
prefix = raceprefix(u);
|
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 faction *otherfaction =
|
|
||||||
a_otherfaction ? get_otherfaction(a_otherfaction) : NULL;
|
|
||||||
/* my own faction, full info */
|
/* my own faction, full info */
|
||||||
const attrib *a = NULL;
|
const attrib *a = NULL;
|
||||||
unit *mage;
|
unit *mage;
|
||||||
|
@ -780,12 +777,12 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
stream_printf(out, "%d;gruppe\n", g->gid);
|
stream_printf(out, "%d;gruppe\n", g->gid);
|
||||||
}
|
}
|
||||||
stream_printf(out, "%d;Partei\n", u->faction->no);
|
stream_printf(out, "%d;Partei\n", u->faction->no);
|
||||||
if (sf != u->faction)
|
if (sf && sf != u->faction) {
|
||||||
stream_printf(out, "%d;Verkleidung\n", sf->no);
|
stream_printf(out, "%d;Verkleidung\n", sf->no);
|
||||||
if (fval(u, UFL_ANON_FACTION))
|
stream_printf(out, "%d;Anderepartei\n", sf->no);
|
||||||
stream_printf(out, "%d;Parteitarnung\n", (u->flags & UFL_ANON_FACTION)!=0);
|
}
|
||||||
if (otherfaction && otherfaction != u->faction) {
|
if (fval(u, UFL_ANON_FACTION)) {
|
||||||
stream_printf(out, "%d;Anderepartei\n", otherfaction->no);
|
stream_printf(out, "%d;Parteitarnung\n", (u->flags & UFL_ANON_FACTION) != 0);
|
||||||
}
|
}
|
||||||
mage = get_familiar_mage(u);
|
mage = get_familiar_mage(u);
|
||||||
if (mage) {
|
if (mage) {
|
||||||
|
@ -798,17 +795,14 @@ void cr_output_unit(stream *out, const region * r, const faction * f,
|
||||||
stream_printf(out, "%d;Parteitarnung\n", (u->flags & UFL_ANON_FACTION) != 0);
|
stream_printf(out, "%d;Parteitarnung\n", (u->flags & UFL_ANON_FACTION) != 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const attrib *a_otherfaction = a_find(u->attribs, &at_otherfaction);
|
|
||||||
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 */
|
||||||
stream_printf(out, "%d;Partei\n", sf->no);
|
stream_printf(out, "%d;Partei\n", sf ? sf->no : f->no);
|
||||||
if (sf == f) {
|
if (sf == f) {
|
||||||
stream_printf(out, "1;Verraeter\n");
|
stream_printf(out, "1;Verraeter\n");
|
||||||
}
|
}
|
||||||
if (otherfaction && otherfaction != u->faction) {
|
if (sf && sf != u->faction) {
|
||||||
if (alliedunit(u, f, HELP_FSTEALTH)) {
|
if (alliedunit(u, f, HELP_FSTEALTH)) {
|
||||||
stream_printf(out, "%d;Anderepartei\n", otherfaction->no);
|
stream_printf(out, "%d;Anderepartei\n", sf->no);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "travelthru.h"
|
#include "travelthru.h"
|
||||||
#include "keyword.h"
|
#include "keyword.h"
|
||||||
|
|
||||||
|
#include <kernel/ally.h>
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
|
@ -67,6 +68,7 @@ static void test_cr_factionstealth(CuTest *tc) {
|
||||||
faction *f1, *f2;
|
faction *f1, *f2;
|
||||||
region *r;
|
region *r;
|
||||||
unit *u;
|
unit *u;
|
||||||
|
ally *al;
|
||||||
|
|
||||||
test_setup();
|
test_setup();
|
||||||
mstream_init(&strm);
|
mstream_init(&strm);
|
||||||
|
@ -93,6 +95,14 @@ static void test_cr_factionstealth(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, f2->no, cr_get_int(&strm, ";Anderepartei", -1));
|
CuAssertIntEquals(tc, f2->no, cr_get_int(&strm, ";Anderepartei", -1));
|
||||||
CuAssertIntEquals(tc, 1, cr_get_int(&strm, ";Verraeter", -1));
|
CuAssertIntEquals(tc, 1, cr_get_int(&strm, ";Verraeter", -1));
|
||||||
|
|
||||||
|
al = ally_add(&f1->allies, f2);
|
||||||
|
al->status = HELP_FSTEALTH;
|
||||||
|
|
||||||
|
cr_output_unit(&strm, u->region, f2, u, seen_unit);
|
||||||
|
CuAssertIntEquals(tc, f1->no, cr_get_int(&strm, ";Partei", -1));
|
||||||
|
CuAssertIntEquals(tc, f2->no, cr_get_int(&strm, ";Anderepartei", -1));
|
||||||
|
CuAssertIntEquals(tc, 1, cr_get_int(&strm, ";Verraeter", -1));
|
||||||
|
|
||||||
mstream_done(&strm);
|
mstream_done(&strm);
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue