Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit b30e762

Browse files
committed
Made audio SoundSelectionCycleMode ini reading not case sensitive
Added soundcyclemode to abort message if it's invalid Cleaned up original changelog entry for it since it's misleading and no proper update was ever documented (oops)
1 parent 9398f91 commit b30e762

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
838838
AddSoundContainer = SoundContainer // Note that SoundContainers replace Sounds, so this can be used for things like FireSound = SoundContainer
839839
PresetName = Preset Name Here
840840

841-
CycleMode = MODE_RANDOM (default) | MODE_FORWARDS // How the SoundContainer will cycle through its `SoundSets` whenever it's told to select a new one. The former is prior behaviour, the latter cycles through SoundSets in the order they were added.
841+
SoundSelectionCycleMode = RANDOM (default) | FORWARDS | ALL // How the SoundContainer will cycle through its `SoundSets` whenever it's told to select a new one. The first is prior behaviour of picking sounds at random, the second cycles through SoundSets in the order they were added, and the third plays all SoundSets at once.
842842

843843
LoopSetting = -1 | 0 (default) | 1+ // How the SoundContainer loops its sounds. -1 means it loops forever, 0 means it plays once, any number > 0 means it plays once and loops that many times.
844844

Entities/SoundSet.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace RTE {
88
const std::string SoundSet::m_sClassName = "SoundSet";
99

1010
const std::unordered_map<std::string, SoundSet::SoundSelectionCycleMode> SoundSet::c_SoundSelectionCycleModeMap = {
11-
{"Random", SoundSelectionCycleMode::RANDOM},
12-
{"Forwards", SoundSelectionCycleMode::FORWARDS},
13-
{"All", SoundSelectionCycleMode::ALL}
11+
{"random", SoundSelectionCycleMode::RANDOM},
12+
{"forwards", SoundSelectionCycleMode::FORWARDS},
13+
{"all", SoundSelectionCycleMode::ALL}
1414
};
1515

1616
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -103,6 +103,8 @@ namespace RTE {
103103
SoundSet::SoundSelectionCycleMode SoundSet::ReadSoundSelectionCycleMode(Reader &reader) {
104104
SoundSelectionCycleMode soundSelectionCycleModeToReturn;
105105
std::string soundSelectionCycleModeString = reader.ReadPropValue();
106+
std::locale locale;
107+
for (char &character : soundSelectionCycleModeString) { character = std::tolower(character, locale); }
106108

107109
std::unordered_map<std::string, SoundSelectionCycleMode>::const_iterator soundSelectionCycleMode = c_SoundSelectionCycleModeMap.find(soundSelectionCycleModeString);
108110
if (soundSelectionCycleMode != c_SoundSelectionCycleModeMap.end()) {
@@ -297,7 +299,7 @@ namespace RTE {
297299
selectSoundForwards();
298300
break;
299301
default:
300-
RTEAbort("Invalid sound selection sound cycle mode.");
302+
RTEAbort("Invalid sound selection sound cycle mode. " + m_SoundSelectionCycleMode);
301303
break;
302304
}
303305
RTEAssert(m_CurrentSelection.second >= 0 && m_CurrentSelection.second < selectedVectorSize, "Failed to select next sound, either none was selected or the selected sound was invalid.");

0 commit comments

Comments
 (0)