Show convoy in reports.

This commit is contained in:
Enno Rehling 2019-10-07 22:01:02 +02:00
parent f4011af784
commit 4052cb71ff
4 changed files with 20 additions and 3 deletions

View File

@ -84,7 +84,7 @@ static char g_bigbuf[BUFFERSIZE];
bool opt_cr_absolute_coords = false; bool opt_cr_absolute_coords = false;
/* globals */ /* globals */
#define C_REPORT_VERSION 66 #define C_REPORT_VERSION 67
struct locale *crtag_locale(void) { struct locale *crtag_locale(void) {
static struct locale * lang; static struct locale * lang;

View File

@ -1724,11 +1724,14 @@ nr_ship(struct stream *out, const region *r, const ship * sh, const faction * f,
if (captain && captain->faction == f) { if (captain && captain->faction == f) {
int n = 0, p = 0; int n = 0, p = 0;
const char *stname;
getshipweight(sh, &n, &p); getshipweight(sh, &n, &p);
n = (n + 99) / 100; /* 1 Silber = 1 GE */ n = (n + 99) / 100; /* 1 Silber = 1 GE */
sbs_printf(&sbs, "%s, %s, (%d/%d)", shipname(sh), stname = locale_plural(f->locale, sh->type->_name, sh->number, true);
LOC(f->locale, sh->type->_name), n, ship_capacity(sh) / 100); sbs_printf(&sbs, "%s, %d %s, (%d/%d)", shipname(sh), sh->number,
stname, n, ship_capacity(sh) / 100);
} }
else { else {
sbs_printf(&sbs, "%s, %s", shipname(sh), LOC(f->locale, sh->type->_name)); sbs_printf(&sbs, "%s, %s", shipname(sh), LOC(f->locale, sh->type->_name));

View File

@ -129,6 +129,19 @@ const char *locale_getstring(const locale * lang, const char *key)
return NULL; return NULL;
} }
const char *locale_plural(const struct locale *lang, const char *key, int n, bool warn) {
assert(lang);
assert(key);
if (n != 1) {
char plural[32];
snprintf(plural, 32, "%s_p", key);
plural[31] = '\0';
return locale_string(lang, plural, warn);
}
return locale_string(lang, key, warn);
}
const char *locale_string(const locale * lang, const char *key, bool warn) const char *locale_string(const locale * lang, const char *key, bool warn)
{ {
assert(lang); assert(lang);

View File

@ -32,6 +32,7 @@ extern "C" {
const char *locale_getstring(const struct locale *lang, const char *locale_getstring(const struct locale *lang,
const char *key); const char *key);
const char *locale_string(const struct locale *lang, const char *key, bool warn); /* does fallback */ const char *locale_string(const struct locale *lang, const char *key, bool warn); /* does fallback */
const char *locale_plural(const struct locale *lang, const char *key, int n, bool warn);
unsigned int locale_index(const struct locale *lang); unsigned int locale_index(const struct locale *lang);
const char *locale_name(const struct locale *lang); const char *locale_name(const struct locale *lang);