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

Commit 3d44ee1

Browse files
committed
Fixed an issue where soundset random selection mode wouldn't pick randomly the first time, if there were only 2 sounds in the soundset
1 parent 2f18a13 commit 3d44ee1

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Entities/SoundSet.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace RTE {
1717

1818
void SoundSet::Clear() {
1919
m_SoundSelectionCycleMode = SoundSelectionCycleMode::RANDOM;
20-
m_CurrentSelection = {false, 0};
20+
m_CurrentSelection = {false, -1};
2121

2222
m_SoundData.clear();
2323
m_SubSoundSets.clear();
@@ -286,9 +286,7 @@ namespace RTE {
286286
case 0:
287287
return false;
288288
case 1:
289-
break;
290-
case 2:
291-
selectSoundForwards();
289+
m_CurrentSelection.second = 0;
292290
break;
293291
default:
294292
switch (m_SoundSelectionCycleMode) {

Entities/SoundSet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ namespace RTE {
210210
static const std::unordered_map<std::string, SoundSet::SoundSelectionCycleMode> c_SoundSelectionCycleModeMap; //!< A map of strings to SoundSelectionCycleModes to support string parsing for the SoundCycleMode enum. Populated in the implementing cpp file.
211211

212212
SoundSelectionCycleMode m_SoundSelectionCycleMode; //!< The SoundSelectionCycleMode for this SoundSet.
213-
std::pair<bool, int> m_CurrentSelection; //!< Whether the currently selection is in the SoundData (false) or SoundSet (true) vector, and its index in the appropriate vector.
213+
std::pair<bool, int> m_CurrentSelection; //!< Whether the current selection is in the SoundData (false) or SoundSet (true) vector, and its index in the appropriate vector.
214214

215215
std::vector<SoundData> m_SoundData; //!< The SoundData available for selection in this SoundSet.
216216
std::vector<SoundSet> m_SubSoundSets; //!< The sub SoundSets available for selection in this SoundSet.

0 commit comments

Comments
 (0)