1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-03 04:05:49 +01:00

Remove broken support for object string overrides as well

This commit is contained in:
Aaron van Geffen
2024-10-30 22:04:51 +01:00
parent f8ea776dba
commit 8aeb1d2b98
2 changed files with 8 additions and 70 deletions

View File

@@ -36,9 +36,6 @@ private:
uint16_t const _id;
std::vector<std::string> _strings;
// Parsing work data
std::string _currentGroup;
public:
static std::unique_ptr<LanguagePack> FromFile(uint16_t id, const utf8* path)
{
@@ -84,9 +81,6 @@ public:
{
ParseLine(&reader);
}
// Clean up the parsing work data
_currentGroup.clear();
}
uint16_t GetId() const override
@@ -211,9 +205,6 @@ private:
case '#':
SkipToEndOfLine(reader);
break;
case '[':
ParseGroupObject(reader);
break;
case '\r':
case '\n':
break;
@@ -226,29 +217,6 @@ private:
}
}
void ParseGroupObject(IStringReader* reader)
{
// THIS IS NO LONGER USED SO WE ARE JUST SKIPPING OVER
codepoint_t codepoint;
// Should have already deduced that the next codepoint is a [
reader->Skip();
// Read string up to ] or line end
while (reader->TryPeek(&codepoint))
{
if (IsNewLine(codepoint))
break;
reader->Skip();
if (codepoint == ']')
{
break;
}
}
_currentGroup.clear();
}
void ParseString(IStringReader* reader)
{
auto sb = StringBuilder();
@@ -288,33 +256,10 @@ private:
const utf8* identifier = sb.GetBuffer();
int32_t stringId;
if (_currentGroup.empty())
if (sscanf(identifier, "STR_%4d", &stringId) != 1)
{
if (sscanf(identifier, "STR_%4d", &stringId) != 1)
{
// Ignore line entirely
return;
}
}
else
{
if (String::Equals(identifier, "STR_NAME"))
{
stringId = 0;
}
else if (String::Equals(identifier, "STR_DESC"))
{
stringId = 1;
}
else if (String::Equals(identifier, "STR_CPTY"))
{
stringId = 2;
}
else
{
// Ignore line entirely
return;
}
// Ignore line entirely
return;
}
// Rest of the line is the actual string
@@ -336,15 +281,12 @@ private:
s = std::string(sb.GetBuffer(), sb.GetLength());
}
if (_currentGroup.empty())
// Make sure the list is big enough to contain this string id
if (static_cast<size_t>(stringId) >= _strings.size())
{
// Make sure the list is big enough to contain this string id
if (static_cast<size_t>(stringId) >= _strings.size())
{
_strings.resize(stringId + 1);
}
_strings[stringId] = s;
_strings.resize(stringId + 1);
}
_strings[stringId] = s;
}
};

View File

@@ -66,11 +66,7 @@ const utf8* LanguagePackTest::LanguageEnGB = "# STR_XXXX part is read and XXXX b
"STR_0000 :\n"
"STR_0001 :{STRINGID} {COMMA16}\n"
"STR_0002 :Spiral Roller Coaster\n"
"STR_0003 :Stand-up Roller Coaster\n"
"[CONDORRD]\n"
"STR_NAME :my test ride\n"
"STR_DESC :ride description\n"
"STR_CPTY :ride capacity\n";
"STR_0003 :Stand-up Roller Coaster\n";
// This includes a few entries extracted from zh-TW localisation.
// It has to be declared as `unsigned char`, or else the values overflow signed byte.