File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -220,13 +220,12 @@ namespace RTE {
220
220
}
221
221
int selectedVectorSize = m_CurrentSelection.first == false ? m_SoundData.size () : m_SubSoundSets.size ();
222
222
int unselectedVectorSize = m_CurrentSelection.first == true ? m_SoundData.size () : m_SubSoundSets.size ();
223
- int soundDataAndSetSize = selectedVectorSize + unselectedVectorSize;
224
223
225
224
// / <summary>
226
225
// / Internal lambda function to pick a random sound that's not the previously played sound. Done to avoid scoping issues inside the switch below.
227
226
// / </summary>
228
227
auto selectSoundRandom = [&selectedVectorSize, &unselectedVectorSize, this ]() {
229
- if (selectedVectorSize == 1 || RandomNum (0 , 1 ) == 1 ) {
228
+ if (unselectedVectorSize > 0 && ( selectedVectorSize == 1 || RandomNum (0 , 1 ) == 1 ) ) {
230
229
std::swap (selectedVectorSize, unselectedVectorSize);
231
230
m_CurrentSelection = {!m_CurrentSelection.first , RandomNum (0 , selectedVectorSize - 1 )};
232
231
} else {
@@ -253,7 +252,7 @@ namespace RTE {
253
252
}
254
253
};
255
254
256
- switch (soundDataAndSetSize ) {
255
+ switch (selectedVectorSize + unselectedVectorSize ) {
257
256
case 0 :
258
257
return false ;
259
258
case 1 :
You can’t perform that action at this time.
0 commit comments