@@ -121,17 +121,12 @@ static const StringID _cargo_string_list
STR_NOTHING,
STR_LITERS,
STR_NOTHING
}
};
static char *str_cat(char *dst, const char *src)
{
while ((*dst++ = *src++) != '\0') {}
return dst - 1;
static const char *GetStringPtr(StringID string)
return _langpack_offs[_langtab_start[string >> 11] + (string & 0x7FF)];
@@ -461,27 +456,24 @@ static char *DecodeString(char *buff, co
buff = FormatGenericCurrency(buff, &_currency_specs[_opt_ptr->currency], GetParamInt32(), true);
break;
case 1: /* {INT32} */
buff = FormatNoCommaNumber(buff, GetParamInt32());
case 2: /* {REV} */
buff = str_cat(buff, _openttd_revision);
buff = strecpy(buff, _openttd_revision, NULL);
case 3: { /* {SHORTCARGO} */
// Short description of cargotypes. Layout:
// 8-bit = cargo type
// 16-bit = cargo count
const char *s;
StringID cargo_str = _cargo_string_list[_opt_ptr->landscape][(byte)GetParamInt8()];
uint16 multiplier = (cargo_str == STR_LITERS) ? 1000 : 1;
// liquid type of cargo is multiplied by 100 to get correct amount
buff = FormatCommaNumber(buff, GetParamInt16() * multiplier);
s = GetStringPtr(cargo_str);
memcpy(buff++, " ", 1);
while (*s) *buff++ = *s++;
buff = strecpy(buff, " ", NULL);
buff = strecpy(buff, GetStringPtr(cargo_str), NULL);
} break;
case 4: /* {CURRCOMPACT64} */
// 64 bit compact currency-unit
buff = FormatGenericCurrency(buff, &_currency_specs[_opt_ptr->currency], GetParamInt64(), true);
@@ -491,20 +483,17 @@ static char *DecodeString(char *buff, co
case 0x86: // {SKIP}
GetParamInt16();
//assert(0);
case 0x87: { // {VOLUME}
case 0x87: // {VOLUME}
buff = FormatCommaNumber(buff, GetParamInt16() * 1000);
s = GetStringPtr(STR_LITERS);
buff = strecpy(buff, GetStringPtr(STR_LITERS), NULL);
case 0x88: // {STRING}
buff = GetString(buff, (uint16)GetParamUint16());
case 0x99: { // {CARGO}
@@ -681,14 +670,14 @@ static char *GenAndCoName(char *buff)
num = 29;
if (_opt_ptr->landscape == LT_CANDY) {
base = num;
num = 12;
buff = str_cat(buff, _surname_list[base + ((num * (byte)(x >> 16)) >> 8)]);
buff = str_cat(buff, " & Co.");
buff = strecpy(buff, _surname_list[base + (num * GB(x, 16, 8) >> 8)], NULL);
buff = strecpy(buff, " & Co.", NULL);
return buff;
static char *GenPlayerName_4(char *buff)
@@ -712,13 +701,13 @@ static char *GenPlayerName_4(char *buff)
static const char * const _song_names[] = {
"Tycoon DELUXE Theme",
@@ -746,46 +735,47 @@ static const char * const _song_names[]
static char *GetSpecialPlayerNameString(char *buff, int ind)
switch (ind) {
case 1: // not used
return str_cat(buff, _silly_company_names[GetParamInt32() & 0xFFFF]);
return strecpy(buff, _silly_company_names[GetParamInt32() & 0xFFFF], NULL);
case 2: // used for Foobar & Co company names
return GenAndCoName(buff);
case 3: // President name
return GenPlayerName_4(buff);
case 4: // song names
return str_cat(buff, _song_names[GetParamUint16() - 1]);
return strecpy(buff, _song_names[GetParamUint16() - 1], NULL);
// town name?
if (IS_INT_INSIDE(ind - 6, 0, SPECSTR_TOWNNAME_LAST-SPECSTR_TOWNNAME_START + 1)) {
buff = GetSpecialTownNameString(buff, ind - 6);
return str_cat(buff, " Transport");
return strecpy(buff, " Transport", NULL);
// language name?
if (IS_INT_INSIDE(ind, (SPECSTR_LANGUAGE_START - 0x70E4), (SPECSTR_LANGUAGE_END - 0x70E4) + 1)) {
int i = ind - (SPECSTR_LANGUAGE_START - 0x70E4);
return str_cat(buff, i == _dynlang.curr ? _langpack->own_name : _dynlang.ent[i].name);
return strecpy(buff,
i == _dynlang.curr ? _langpack->own_name : _dynlang.ent[i].name, NULL);
// resolution size?
if (IS_INT_INSIDE(ind, (SPECSTR_RESOLUTION_START - 0x70E4), (SPECSTR_RESOLUTION_END - 0x70E4) + 1)) {
int i = ind - (SPECSTR_RESOLUTION_START - 0x70E4);
return buff + sprintf(buff, "%dx%d", _resolutions[i][0], _resolutions[i][1]);
// screenshot format name?
if (IS_INT_INSIDE(ind, (SPECSTR_SCREENSHOT_START - 0x70E4), (SPECSTR_SCREENSHOT_END - 0x70E4) + 1)) {
int i = ind - (SPECSTR_SCREENSHOT_START - 0x70E4);
return str_cat(buff, GetScreenshotFormatDesc(i));
return strecpy(buff, GetScreenshotFormatDesc(i), NULL);
assert(0);
return NULL;
Status change: