Skip to content

Commit 3f22f3a

Browse files
committed
Final touchups
1 parent 594be87 commit 3f22f3a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

source/game_sa/Audio/entities/AECollisionAudioEntity.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,11 +624,12 @@ eSoundID CAECollisionAudioEntity::ChooseCollisionSoundID(eSurfaceType surface) {
624624
if (l->MinSoundID == l->MaxSoundID) {
625625
return l->MinSoundID;
626626
}
627-
while (true) {
627+
for (auto retry = 0; retry < 100; retry++) { // NOTSA: Handle very unlikely infinite loop
628628
const auto soundID = CAEAudioUtility::GetRandomNumberInRange(l->MinSoundID, l->MaxSoundID);
629629
if (soundID != m_CollisionSoundIDHistory[surface]) {
630630
return soundID;
631631
}
632632
}
633-
NOTSA_UNREACHABLE();
633+
NOTSA_LOG_WARN("Failed to generate collision sound ID not in history!"); // NOTSA
634+
return l->MinSoundID; // NOTSA
634635
}

source/game_sa/Audio/entities/AECollisionAudioEntity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class NOTSA_EXPORT_VTABLE CAECollisionAudioEntity : public CAEAudioEntity {
7676
void Service();
7777

7878
// notsa
79-
bool CanAddNewSound() const { return m_CollisionSoundList.size() != m_NumActiveCollisionSounds; }
79+
bool CanAddNewSound() const { return m_NumActiveCollisionSounds <= m_CollisionSoundList.size(); }
8080

8181
protected:
8282
eSoundID ChooseCollisionSoundID(eSurfaceType surface);

0 commit comments

Comments
 (0)