1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 13:33:02 +01:00

Remove use of gCurrentLanguage

This commit is contained in:
Ted John
2018-04-26 23:48:25 +01:00
parent 7b28078da2
commit 35df72e61f
15 changed files with 69 additions and 53 deletions

View File

@@ -19,6 +19,7 @@
#include "../core/String.hpp"
#include "../localisation/Language.h"
#include "../localisation/LanguagePack.h"
#include "../localisation/LocalisationService.h"
#include "Object.h"
#include "StringTable.h"
@@ -111,7 +112,8 @@ void StringTable::SetString(uint8 id, uint8 language, const std::string &text)
void StringTable::Sort()
{
std::sort(_strings.begin(), _strings.end(), [](const StringTableEntry &a, const StringTableEntry &b) -> bool
auto targetLanguage = LocalisationService_GetCurrentLanguage();
std::sort(_strings.begin(), _strings.end(), [targetLanguage](const StringTableEntry &a, const StringTableEntry &b) -> bool
{
if (a.Id == b.Id)
{
@@ -120,11 +122,11 @@ void StringTable::Sort()
return String::Compare(a.Text, b.Text, true) < 0;
}
if (a.LanguageId == gCurrentLanguage)
if (a.LanguageId == targetLanguage)
{
return true;
}
if (b.LanguageId == gCurrentLanguage)
if (b.LanguageId == targetLanguage)
{
return false;
}