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

Commit b5c8418

Browse files
committed
Fixed SoundOverlapMode and SoundSelectionCycleMode ini handling
1 parent 62ccbba commit b5c8418

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Entities/SoundContainer.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ namespace RTE {
6666
m_TopLevelSoundSet.AddSoundSet(soundSetToAdd);
6767
} else if (propName == "SoundSelectionCycleMode" || propName == "CycleMode") {
6868
m_TopLevelSoundSet.SetSoundSelectionCycleMode(SoundSet::ReadSoundSelectionCycleMode(reader));
69-
} else if (propName == "OverlapMode") {
70-
std::string overlapModeString = reader.ReadPropValue();
71-
if (c_SoundOverlapModeMap.find(overlapModeString) != c_SoundOverlapModeMap.end()) {
72-
m_SoundOverlapMode = c_SoundOverlapModeMap.find(overlapModeString)->second;
69+
} else if (propName == "SoundOverlapMode") {
70+
std::string soundOverlapModeString = reader.ReadPropValue();
71+
if (c_SoundOverlapModeMap.find(soundOverlapModeString) != c_SoundOverlapModeMap.end()) {
72+
m_SoundOverlapMode = c_SoundOverlapModeMap.find(soundOverlapModeString)->second;
73+
} else if (std::stoi(soundOverlapModeString)) {
74+
m_SoundOverlapMode = static_cast<SoundOverlapMode>(std::stoi(soundOverlapModeString));
7375
} else {
74-
reader.ReportError("Cycle mode " + overlapModeString + " is invalid.");
76+
reader.ReportError("Cycle mode " + soundOverlapModeString + " is invalid.");
7577
}
7678
} else if (propName == "Immobile") {
7779
reader >> m_Immobile;
@@ -107,7 +109,7 @@ namespace RTE {
107109
writer.NewProperty("SoundSelectionCycleMode");
108110
SoundSet::SaveSoundSelectionCycleMode(writer, m_TopLevelSoundSet.GetSoundSelectionCycleMode());
109111

110-
writer.NewProperty("OverlapMode");
112+
writer.NewProperty("SoundOverlapMode");
111113
std::list<std::pair<const std::string, SoundOverlapMode>>::const_iterator overlapModeMapEntry = std::find_if(c_SoundOverlapModeMap.begin(), c_SoundOverlapModeMap.end(), [&soundOverlapMode = m_SoundOverlapMode](auto element) { return element.second == soundOverlapMode; });
112114
if (overlapModeMapEntry != c_SoundOverlapModeMap.end()) {
113115
writer << overlapModeMapEntry->first;

Entities/SoundSet.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ namespace RTE {
106106
std::unordered_map<std::string, SoundSelectionCycleMode>::const_iterator soundSelectionCycleMode = c_SoundSelectionCycleModeMap.find(soundSelectionCycleModeString);
107107
if (soundSelectionCycleMode != c_SoundSelectionCycleModeMap.end()) {
108108
return soundSelectionCycleMode->second;
109+
} else if (std::stoi(soundSelectionCycleModeString)) {
110+
return static_cast<SoundSelectionCycleMode>(std::stoi(soundSelectionCycleModeString));
109111
}
110112

111113
reader.ReportError("Sound selection cycle mode " + soundSelectionCycleModeString + " is invalid.");

0 commit comments

Comments
 (0)