mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 14:24:33 +01:00
Remove localisation object overrides
This commit is contained in:
@@ -182,27 +182,6 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StringId GetObjectOverrideStringId(std::string_view legacyIdentifier, uint8_t index) override
|
||||
{
|
||||
Guard::Assert(index < ObjectOverrideMaxStringCount);
|
||||
|
||||
int32_t ooIndex = 0;
|
||||
for (const ObjectOverride& objectOverride : _objectOverrides)
|
||||
{
|
||||
if (std::string_view(objectOverride.name, 8) == legacyIdentifier)
|
||||
{
|
||||
if (objectOverride.strings[index].empty())
|
||||
{
|
||||
return STR_NONE;
|
||||
}
|
||||
return ObjectOverrideBase + (ooIndex * ObjectOverrideMaxStringCount) + index;
|
||||
}
|
||||
ooIndex++;
|
||||
}
|
||||
|
||||
return STR_NONE;
|
||||
}
|
||||
|
||||
StringId GetScenarioOverrideStringId(const utf8* scenarioFilename, uint8_t index) override
|
||||
{
|
||||
Guard::ArgumentNotNull(scenarioFilename);
|
||||
@@ -226,17 +205,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectOverride* GetObjectOverride(const std::string& objectIdentifier)
|
||||
{
|
||||
for (auto& oo : _objectOverrides)
|
||||
{
|
||||
if (strncmp(oo.name, objectIdentifier.c_str(), 8) == 0)
|
||||
{
|
||||
return &oo;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ScenarioOverride* GetScenarioOverride(const std::string& scenarioIdentifier)
|
||||
{
|
||||
@@ -376,31 +344,6 @@ private:
|
||||
}
|
||||
sb.Append(codepoint);
|
||||
}
|
||||
|
||||
if (closedCorrectly)
|
||||
{
|
||||
while (sb.GetLength() < 8)
|
||||
{
|
||||
sb.Append(' ');
|
||||
}
|
||||
if (sb.GetLength() == 8)
|
||||
{
|
||||
_currentGroup = sb.GetStdString();
|
||||
_currentObjectOverride = GetObjectOverride(_currentGroup);
|
||||
_currentScenarioOverride = nullptr;
|
||||
if (_currentObjectOverride == nullptr)
|
||||
{
|
||||
if (_objectOverrides.size() == MAX_OBJECT_OVERRIDES)
|
||||
{
|
||||
LOG_WARNING("Maximum number of localised object strings exceeded.");
|
||||
}
|
||||
|
||||
_objectOverrides.emplace_back();
|
||||
_currentObjectOverride = &_objectOverrides[_objectOverrides.size() - 1];
|
||||
std::copy_n(_currentGroup.c_str(), 8, _currentObjectOverride->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ParseGroupScenario(IStringReader* reader)
|
||||
|
||||
@@ -26,7 +26,6 @@ struct ILanguagePack
|
||||
virtual void RemoveString(StringId stringId) abstract;
|
||||
virtual void SetString(StringId stringId, const std::string& str) abstract;
|
||||
virtual const utf8* GetString(StringId stringId) const abstract;
|
||||
virtual StringId GetObjectOverrideStringId(std::string_view legacyIdentifier, uint8_t index) abstract;
|
||||
virtual StringId GetScenarioOverrideStringId(const utf8* scenarioFilename, uint8_t index) abstract;
|
||||
};
|
||||
|
||||
|
||||
@@ -153,15 +153,6 @@ std::tuple<StringId, StringId, StringId> LocalisationService::GetLocalisedScenar
|
||||
return std::make_tuple(result0, result1, result2);
|
||||
}
|
||||
|
||||
StringId LocalisationService::GetObjectOverrideStringId(std::string_view legacyIdentifier, uint8_t index) const
|
||||
{
|
||||
if (_loadedLanguages.empty())
|
||||
{
|
||||
return STR_NONE;
|
||||
}
|
||||
return _loadedLanguages[0]->GetObjectOverrideStringId(legacyIdentifier, index);
|
||||
}
|
||||
|
||||
StringId LocalisationService::AllocateObjectString(const std::string& target)
|
||||
{
|
||||
if (_availableObjectStringIds.empty())
|
||||
|
||||
@@ -59,7 +59,6 @@ namespace OpenRCT2::Localisation
|
||||
|
||||
const char* GetString(StringId id) const;
|
||||
std::tuple<StringId, StringId, StringId> GetLocalisedScenarioStrings(const std::string& scenarioFilename) const;
|
||||
StringId GetObjectOverrideStringId(std::string_view legacyIdentifier, uint8_t index) const;
|
||||
std::string GetLanguagePath(uint32_t languageId) const;
|
||||
|
||||
void OpenLanguage(int32_t id);
|
||||
|
||||
@@ -115,28 +115,9 @@ void Object::PopulateTablesFromJson(IReadObjectContext* context, json_t& root)
|
||||
_usesFallbackImages = _imageTable.ReadJson(context, root);
|
||||
}
|
||||
|
||||
std::string Object::GetOverrideString(uint8_t index) const
|
||||
{
|
||||
auto legacyIdentifier = GetLegacyIdentifier();
|
||||
const auto& localisationService = OpenRCT2::GetContext()->GetLocalisationService();
|
||||
auto stringId = localisationService.GetObjectOverrideStringId(legacyIdentifier, index);
|
||||
|
||||
const utf8* result = nullptr;
|
||||
if (stringId != STR_NONE)
|
||||
{
|
||||
result = LanguageGetString(stringId);
|
||||
}
|
||||
return String::ToStd(result);
|
||||
}
|
||||
|
||||
std::string Object::GetString(ObjectStringID index) const
|
||||
{
|
||||
auto sz = GetOverrideString(static_cast<uint8_t>(index));
|
||||
if (sz.empty())
|
||||
{
|
||||
sz = GetStringTable().GetString(index);
|
||||
}
|
||||
return sz;
|
||||
return GetStringTable().GetString(index);
|
||||
}
|
||||
|
||||
std::string Object::GetString(int32_t language, ObjectStringID index) const
|
||||
|
||||
@@ -220,7 +220,6 @@ protected:
|
||||
*/
|
||||
void PopulateTablesFromJson(IReadObjectContext* context, json_t& root);
|
||||
|
||||
std::string GetOverrideString(uint8_t index) const;
|
||||
std::string GetString(ObjectStringID index) const;
|
||||
std::string GetString(int32_t language, ObjectStringID index) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user