- fixed string prioritization when a mod replaces the default language for a given string.

In this case it must override all localized content from previously loaded WADs because that is no longer matching the original text.
This commit is contained in:
Christoph Oelckers 2019-04-22 00:21:01 +02:00
parent 5b6bae409e
commit 68c33a6e43
1 changed files with 5 additions and 2 deletions

View File

@ -277,6 +277,8 @@ void FStringTable::LoadLanguage (int lumpnum, const TArray<uint8_t> &buffer)
bool errordone = false;
TArray<uint32_t> activeMaps;
FScanner sc;
bool hasDefaultEntry = false;
sc.OpenMem("LANGUAGE", buffer);
sc.SetCMode (true);
while (sc.GetString ())
@ -306,6 +308,7 @@ void FStringTable::LoadLanguage (int lumpnum, const TArray<uint8_t> &buffer)
{
activeMaps.Clear();
activeMaps.Push(default_table);
hasDefaultEntry = true;
}
else
{
@ -369,7 +372,7 @@ void FStringTable::LoadLanguage (int lumpnum, const TArray<uint8_t> &buffer)
}
if (!skip)
{
if (activeMaps[0] == default_table)
if (hasDefaultEntry)
{
DeleteForLabel(lumpnum, strName);
}
@ -427,7 +430,7 @@ void FStringTable::DeleteForLabel(int lumpnum, FName label)
void FStringTable::InsertString(int lumpnum, int langid, FName label, const FString &string)
{
const char *strlangid = (const char *)&langid;
TableElement te = { lumpnum, { string, string, string, string } };
TableElement te = { Wads.GetLumpFile(lumpnum), { string, string, string, string } };
long index;
while ((index = te.strings[0].IndexOf("@[")) >= 0)
{