Fix #11640: Object shows with blank description (#11641)

This commit is contained in:
Michael Steenbeek 2020-05-05 18:49:58 +02:00 committed by GitHub
parent 362ea7bbc0
commit 097b90a3db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View file

@ -20,6 +20,7 @@
- Fix: [#11405] Building a path through walls does not always remove the walls.
- Fix: [#11450] Rides with unsuitable track can't be opened even with "Enable all drawable track pieces" cheat.
- Fix: [#11455] Object Selection window cuts off scenery names.
- Fix: [#11640] Objects with a blank description in one language do not fall back to other languages anymore.
- Fix: RCT1 scenarios have more items in the object list than are present in the park or the research list.
- Improved: [#6530] Allow water and land height changes on park borders.
- Improved: [#11390] Build hash written to screenshot metadata.

View file

@ -56,21 +56,18 @@ void StringTable::Read(IReadObjectContext* context, IStream* stream, uint8_t id)
{
uint8_t languageId = (rct2LanguageId <= RCT2_LANGUAGE_ID_PORTUGUESE) ? RCT2ToOpenRCT2LanguageId[rct2LanguageId]
: static_cast<uint8_t>(LANGUAGE_UNDEFINED);
StringTableEntry entry{};
entry.Id = id;
entry.LanguageId = languageId;
std::string stringAsWin1252 = stream->ReadStdString();
auto stringAsUtf8 = rct2_to_utf8(stringAsWin1252, rct2LanguageId);
if (StringIsBlank(stringAsUtf8.data()))
if (!StringIsBlank(stringAsUtf8.data()))
{
entry.LanguageId = LANGUAGE_UNDEFINED;
stringAsUtf8 = String::Trim(stringAsUtf8);
StringTableEntry entry{};
entry.Id = id;
entry.LanguageId = languageId;
entry.Text = stringAsUtf8;
_strings.push_back(entry);
}
stringAsUtf8 = String::Trim(stringAsUtf8);
entry.Text = stringAsUtf8;
_strings.push_back(entry);
}
}
catch (const std::exception&)