mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Remove unused/obscure strgen feature for relative offsets in plural/gender choice lists.
parent
4fc0900865
commit
f8292a8d11
|
@ -235,25 +235,16 @@ void EmitSingleChar(Buffer *buffer, char *buf, int value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The plural specifier looks like
|
/* The plural specifier looks like
|
||||||
* {NUM} {PLURAL -1 passenger passengers} then it picks either passenger/passengers depending on the count in NUM */
|
* {NUM} {PLURAL <ARG#> passenger passengers} then it picks either passenger/passengers depending on the count in NUM */
|
||||||
static bool ParseRelNum(char **buf, int *value, int *offset)
|
static bool ParseRelNum(char **buf, int *value, int *offset)
|
||||||
{
|
{
|
||||||
const char *s = *buf;
|
const char *s = *buf;
|
||||||
char *end;
|
char *end;
|
||||||
bool rel = false;
|
|
||||||
|
|
||||||
while (*s == ' ' || *s == '\t') s++;
|
while (*s == ' ' || *s == '\t') s++;
|
||||||
if (*s == '+') {
|
|
||||||
rel = true;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
int v = std::strtol(s, &end, 0);
|
int v = std::strtol(s, &end, 0);
|
||||||
if (end == s) return false;
|
if (end == s) return false;
|
||||||
if (rel || v < 0) {
|
|
||||||
*value += v;
|
|
||||||
} else {
|
|
||||||
*value = v;
|
*value = v;
|
||||||
}
|
|
||||||
if (offset != nullptr && *end == ':') {
|
if (offset != nullptr && *end == ':') {
|
||||||
/* Take the Nth within */
|
/* Take the Nth within */
|
||||||
s = end + 1;
|
s = end + 1;
|
||||||
|
|
Loading…
Reference in New Issue