This repository was archived by the owner on Jan 5, 2024. It is now read-only.
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 {
220220 }
221221 int selectedVectorSize = m_CurrentSelection.first == false ? m_SoundData.size () : m_SubSoundSets.size ();
222222 int unselectedVectorSize = m_CurrentSelection.first == true ? m_SoundData.size () : m_SubSoundSets.size ();
223- int soundDataAndSetSize = selectedVectorSize + unselectedVectorSize;
224223
225224 // / <summary>
226225 // / Internal lambda function to pick a random sound that's not the previously played sound. Done to avoid scoping issues inside the switch below.
227226 // / </summary>
228227 auto selectSoundRandom = [&selectedVectorSize, &unselectedVectorSize, this ]() {
229- if (selectedVectorSize == 1 || RandomNum (0 , 1 ) == 1 ) {
228+ if (unselectedVectorSize > 0 && ( selectedVectorSize == 1 || RandomNum (0 , 1 ) == 1 ) ) {
230229 std::swap (selectedVectorSize, unselectedVectorSize);
231230 m_CurrentSelection = {!m_CurrentSelection.first , RandomNum (0 , selectedVectorSize - 1 )};
232231 } else {
@@ -253,7 +252,7 @@ namespace RTE {
253252 }
254253 };
255254
256- switch (soundDataAndSetSize ) {
255+ switch (selectedVectorSize + unselectedVectorSize ) {
257256 case 0 :
258257 return false ;
259258 case 1 :
You can’t perform that action at this time.
0 commit comments