diff --git a/src/openrct2/localisation/LanguagePack.cpp b/src/openrct2/localisation/LanguagePack.cpp index 54eb93e5b7..edbc61ce12 100644 --- a/src/openrct2/localisation/LanguagePack.cpp +++ b/src/openrct2/localisation/LanguagePack.cpp @@ -36,9 +36,6 @@ private: uint16_t const _id; std::vector _strings; - // Parsing work data - std::string _currentGroup; - public: static std::unique_ptr 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(stringId) >= _strings.size()) { - // Make sure the list is big enough to contain this string id - if (static_cast(stringId) >= _strings.size()) - { - _strings.resize(stringId + 1); - } - _strings[stringId] = s; + _strings.resize(stringId + 1); } + _strings[stringId] = s; } }; diff --git a/test/tests/LanguagePackTest.cpp b/test/tests/LanguagePackTest.cpp index c63dd51830..7598ac5210 100644 --- a/test/tests/LanguagePackTest.cpp +++ b/test/tests/LanguagePackTest.cpp @@ -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.