Skip to content

Commit 2d20bcc

Browse files
authored
[CORE] Improve audio file lookup in AudioEventRTS::adjustForLocalization() (#1336)
1 parent 62d54eb commit 2d20bcc

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,23 +800,22 @@ AsciiString AudioEventRTS::generateFilenameExtension( AudioType audioTypeToPlay
800800
//-------------------------------------------------------------------------------------------------
801801
void AudioEventRTS::adjustForLocalization(AsciiString &strToAdjust)
802802
{
803-
const char *str = strToAdjust.reverseFind('\\');
804-
if (!str) {
805-
return;
803+
const char *filename = strToAdjust.reverseFind('\\');
804+
if (filename) {
805+
filename += 1;
806+
} else {
807+
filename = strToAdjust.str();
806808
}
807809

808-
// try the localized version first so that we're guarenteed to get it
810+
// try the localized version first so that we're guaranteed to get it
809811
// even if the generic data directory holds a version of the file
810812
AsciiString localizedFilePath = generateFilenamePrefix(m_eventInfo->m_soundType, TRUE);
811-
AsciiString filename = str;
812813
localizedFilePath.concat(filename);
813814

814815
if (TheFileSystem->doesFileExist(localizedFilePath.str())) {
815816
strToAdjust = localizedFilePath;
816817
}
817818
// else there was no localized version, so leave the path we received unchanged
818-
819-
return;
820819
}
821820

822821
//-------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)