Add a set of temporary std::strings which can be referenced by StringID

This commit is contained in:
Jonathan G Rennison
2022-06-28 00:33:11 +01:00
parent 4747e1d1d0
commit ae47b1636a
2 changed files with 9 additions and 0 deletions

View File

@@ -57,6 +57,8 @@ static uint64 _global_string_params_data[20]; ///< Global array of string pa
static WChar _global_string_params_type[20]; ///< Type of parameters stored in #_global_string_params static WChar _global_string_params_type[20]; ///< Type of parameters stored in #_global_string_params
StringParameters _global_string_params(_global_string_params_data, 20, _global_string_params_type); StringParameters _global_string_params(_global_string_params_data, 20, _global_string_params_type);
std::string _temp_special_strings[16];
/** Reset the type array. */ /** Reset the type array. */
void StringParameters::ClearTypeInformation() void StringParameters::ClearTypeInformation()
{ {
@@ -240,6 +242,9 @@ char *GetStringWithArgs(char *buffr, StringID string, StringParameters *args, co
if (index >= 0xE4 && !game_script) { if (index >= 0xE4 && !game_script) {
return GetSpecialNameString(buffr, index - 0xE4, args, last); return GetSpecialNameString(buffr, index - 0xE4, args, last);
} }
if (index < lengthof(_temp_special_strings) && !game_script) {
return FormatString(buffr, _temp_special_strings[index].c_str(), args, last, case_index);
}
break; break;
case TEXT_TAB_OLD_CUSTOM: case TEXT_TAB_OLD_CUSTOM:

View File

@@ -51,6 +51,8 @@ static const uint TAB_SIZE_GAMESCRIPT = TAB_SIZE * 32;
/** Number of strings for NewGRFs */ /** Number of strings for NewGRFs */
static const uint TAB_SIZE_NEWGRF = TAB_SIZE * 256; static const uint TAB_SIZE_NEWGRF = TAB_SIZE * 256;
extern std::string _temp_special_strings[16];
/** Special string constants */ /** Special string constants */
enum SpecialStrings { enum SpecialStrings {
@@ -86,6 +88,8 @@ enum SpecialStrings {
SPECSTR_SILLY_NAME = 0x70E5, SPECSTR_SILLY_NAME = 0x70E5,
SPECSTR_ANDCO_NAME = 0x70E6, SPECSTR_ANDCO_NAME = 0x70E6,
SPECSTR_PRESIDENT_NAME = 0x70E7, SPECSTR_PRESIDENT_NAME = 0x70E7,
SPECSTR_TEMP_START = 0x7000,
}; };
#endif /* STRINGS_TYPE_H */ #endif /* STRINGS_TYPE_H */