forked from github/server
Show convoy in reports.
This commit is contained in:
parent
f4011af784
commit
4052cb71ff
|
@ -84,7 +84,7 @@ static char g_bigbuf[BUFFERSIZE];
|
|||
bool opt_cr_absolute_coords = false;
|
||||
|
||||
/* globals */
|
||||
#define C_REPORT_VERSION 66
|
||||
#define C_REPORT_VERSION 67
|
||||
|
||||
struct locale *crtag_locale(void) {
|
||||
static struct locale * lang;
|
||||
|
|
|
@ -1724,11 +1724,14 @@ nr_ship(struct stream *out, const region *r, const ship * sh, const faction * f,
|
|||
|
||||
if (captain && captain->faction == f) {
|
||||
int n = 0, p = 0;
|
||||
const char *stname;
|
||||
|
||||
getshipweight(sh, &n, &p);
|
||||
n = (n + 99) / 100; /* 1 Silber = 1 GE */
|
||||
|
||||
sbs_printf(&sbs, "%s, %s, (%d/%d)", shipname(sh),
|
||||
LOC(f->locale, sh->type->_name), n, ship_capacity(sh) / 100);
|
||||
stname = locale_plural(f->locale, sh->type->_name, sh->number, true);
|
||||
sbs_printf(&sbs, "%s, %d %s, (%d/%d)", shipname(sh), sh->number,
|
||||
stname, n, ship_capacity(sh) / 100);
|
||||
}
|
||||
else {
|
||||
sbs_printf(&sbs, "%s, %s", shipname(sh), LOC(f->locale, sh->type->_name));
|
||||
|
|
|
@ -129,6 +129,19 @@ const char *locale_getstring(const locale * lang, const char *key)
|
|||
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)
|
||||
{
|
||||
assert(lang);
|
||||
|
|
|
@ -32,6 +32,7 @@ extern "C" {
|
|||
const char *locale_getstring(const struct locale *lang,
|
||||
const char *key);
|
||||
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);
|
||||
const char *locale_name(const struct locale *lang);
|
||||
|
||||
|
|
Loading…
Reference in New Issue