mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-17 01:12:39 +01:00
Codechange: Treat reading incorrect parameter type as a string error.
Previously reading a string as a number would return 0 instead.
This commit is contained in:
committed by
Peter Nelson
parent
3d8d0e0d26
commit
d1463f415f
@@ -253,14 +253,24 @@ void GetStringWithArgs(StringBuilder &builder, StringID string, StringParameters
|
||||
switch (tab) {
|
||||
case TEXT_TAB_TOWN:
|
||||
if (index >= 0xC0 && !game_script) {
|
||||
GetSpecialTownNameString(builder, index - 0xC0, args.GetNextParameter<uint32_t>());
|
||||
try {
|
||||
GetSpecialTownNameString(builder, index - 0xC0, args.GetNextParameter<uint32_t>());
|
||||
} catch (const std::runtime_error &e) {
|
||||
Debug(misc, 0, "GetStringWithArgs: {}", e.what());
|
||||
builder += "(invalid string parameter)";
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case TEXT_TAB_SPECIAL:
|
||||
if (index >= 0xE4 && !game_script) {
|
||||
GetSpecialNameString(builder, index - 0xE4, args);
|
||||
try {
|
||||
GetSpecialNameString(builder, index - 0xE4, args);
|
||||
} catch (const std::runtime_error &e) {
|
||||
Debug(misc, 0, "GetStringWithArgs: {}", e.what());
|
||||
builder += "(invalid string parameter)";
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user