]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix SND_PickChannel bug choosing an in use channel
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 14 Apr 2009 07:47:25 +0000 (07:47 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 14 Apr 2009 07:47:25 +0000 (07:47 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8923 d7cf8633-e32d-0410-b094-e92efae38249

snd_main.c

index 943dc5d19fc73ccbebf69711483aaf9106eac4e8..8075c6c1e42a3f1d6d3f6d9378040582dcf800a7 100644 (file)
@@ -1191,7 +1191,7 @@ channel_t *SND_PickChannel(int entnum, int entchannel)
                {
                        // no sound on this channel
                        first_to_die = ch_idx;
-                       break;
+                       goto emptychan_found;
                }
 
                // don't let monster sounds override player sounds
@@ -1212,7 +1212,10 @@ channel_t *SND_PickChannel(int entnum, int entchannel)
 
        if (first_to_die == -1)
                return NULL;
+       
+       S_StopChannel (first_to_die, true);
 
+emptychan_found:
        return &channels[first_to_die];
 }