diff --git a/cJSON b/cJSON index 22a4fc9be..8df81fb49 160000 --- a/cJSON +++ b/cJSON @@ -1 +1 @@ -Subproject commit 22a4fc9be31f0426e622f5bc9ebd7a1550845001 +Subproject commit 8df81fb497cc48b089a57fcdc3a9933540ebc7c9 diff --git a/src/report.c b/src/report.c index 7ea25c8d6..65c13492f 100644 --- a/src/report.c +++ b/src/report.c @@ -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); } } diff --git a/src/report.test.c b/src/report.test.c index 59148d3a2..b6696ea1b 100644 --- a/src/report.test.c +++ b/src/report.test.c @@ -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),