1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 17:42:29 +01:00

Fix override offsets while loading LanguagePack

When loading language pack, a check is made not to double entries. This
check was wrong, because it tried to use offsets as pointers to strings.

These offsets are later rewritten to actual pointers in remaining part
of LanguagePack::LanguagePack
This commit is contained in:
Michał Janiszewski
2015-10-09 17:02:56 +02:00
parent 6dd04bbb1a
commit fb9a5833d6
2 changed files with 5 additions and 2 deletions

View File

@@ -125,7 +125,7 @@ private:
{
if (_capacity > capacity) return;
_capacity = Math::Max(8U, _capacity);
_capacity = Math::Max((size_t)8, _capacity);
while (_capacity < capacity) {
_capacity *= 2;
}

View File

@@ -187,7 +187,10 @@ LanguagePack::ScenarioOverride *LanguagePack::GetScenarioOverride(const utf8 *sc
for (size_t i = 0; i < _scenarioOverrides.size(); i++) {
ScenarioOverride *so = &_scenarioOverrides[i];
if (_stricmp(so->name, scenarioIdentifier) == 0) {
// At this point ScenarioOverrides were not yet rewritten to point at
// strings, but rather still hold offsets from base.
const utf8 *name = _stringDataSB.GetBuffer() + (size_t)so->name;
if (_stricmp(name, scenarioIdentifier) == 0) {
return so;
}
}