2565 Leerzeile nach Helfe-Status.

Helfestatus an das Ende des Reports.
This commit is contained in:
Enno Rehling 2019-03-11 21:32:59 +01:00
parent a4b4ba3859
commit ef81a20c6e
3 changed files with 19 additions and 22 deletions

2
cJSON

@ -1 +1 @@
Subproject commit 22a4fc9be31f0426e622f5bc9ebd7a1550845001
Subproject commit 8df81fb497cc48b089a57fcdc3a9933540ebc7c9

View File

@ -1545,7 +1545,7 @@ static int show_allies_cb(struct allies *all, faction *af, int status, void *uda
}
}
if (show->num_allies == show->num_listed) {
sbs_strcat(sbp, ").");
sbs_strcat(sbp, ").\n");
pump_paragraph(sbp, show->out, show->maxlen, true);
}
else {
@ -1577,11 +1577,24 @@ void report_allies(struct stream *out, size_t maxlen, const struct faction * f,
}
}
static void rpline(struct stream *out)
{
static char line[REPORTWIDTH + 1];
if (line[0] != '-') {
memset(line, '-', sizeof(line));
line[REPORTWIDTH] = '\n';
}
swrite(line, sizeof(line), 1, out);
}
static void allies(struct stream *out, const faction * f)
{
const group *g = f->groups;
char prefix[64];
centre(out, LOC(f->locale, "nr_alliances"), false);
newline(out);
if (f->allies) {
snprintf(prefix, sizeof(prefix), "%s ", LOC(f->locale, "faction_help"));
report_allies(out, REPORTWIDTH, f, f->allies, prefix);
@ -1594,6 +1607,7 @@ static void allies(struct stream *out, const faction * f)
}
g = g->next;
}
rpline(out);
}
static void guards(struct stream *out, const region * r, const faction * see)
@ -1660,16 +1674,6 @@ static void guards(struct stream *out, const region * r, const faction * see)
}
}
static void rpline(struct stream *out)
{
static char line[REPORTWIDTH + 1];
if (line[0] != '-') {
memset(line, '-', sizeof(line));
line[REPORTWIDTH] = '\n';
}
swrite(line, sizeof(line), 1, out);
}
static void list_address(struct stream *out, const faction * uf, selist * seenfactions)
{
int qi = 0;
@ -2114,14 +2118,6 @@ report_plaintext(const char *filename, report_context * ctx,
}
}
newline(out);
ERRNO_CHECK();
centre(out, LOC(f->locale, "nr_alliances"), false);
newline(out);
allies(out, f);
rpline(out);
ERRNO_CHECK();
anyunits = 0;
@ -2249,6 +2245,7 @@ report_plaintext(const char *filename, report_context * ctx,
paragraph(out, LOC(f->locale, "nr_youaredead"), 0, 2, 0);
}
else {
allies(out, f);
list_address(out, f, ctx->addresses);
}
}

View File

@ -192,7 +192,7 @@ static void test_report_allies(CuTest *tc) {
f1 = test_create_faction(NULL);
f2 = test_create_faction(NULL);
f3 = test_create_faction(NULL);
snprintf(exp, sizeof(exp), "Wir helfen %s (%s).\n",
snprintf(exp, sizeof(exp), "Wir helfen %s (%s).\n\n",
factionname(f1),
LOC(lang, parameters[P_GUARD]));
ally_set(&f->allies, f1, HELP_GUARD);
@ -211,7 +211,7 @@ static void test_report_allies(CuTest *tc) {
factionname(f2),
LOC(lang, parameters[P_GIVE]));
linebreak = strlen(exp);
snprintf(exp, sizeof(exp), "Wir helfen %s (%s), %s (%s)\nund %s (%s).\n",
snprintf(exp, sizeof(exp), "Wir helfen %s (%s), %s (%s)\nund %s (%s).\n\n",
factionname(f1),
LOC(lang, parameters[P_GUARD]),
factionname(f2),