Skip to content

Commit

Permalink
Merge pull request #126 from inguin/elevator-schedules
Browse files Browse the repository at this point in the history
Fix leaking elevator semaphores
  • Loading branch information
Interrupt committed Aug 14, 2018
2 parents 82a9e88 + 74cbf5b commit 0b8006a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/GameSrc/digifx.c
Expand Up @@ -181,7 +181,7 @@ uchar set_sample_pan_gain(snd_digi_parms *sdp) {
for (i = 0; i < NUM_HEIGHT_SEMAPHORS; i++) {
h = h_sems[i];
if ((h.x == (x >> 8)) && (h.y == (y >> 8)) && (h.inuse == 1)) {
h.inuse--;
h_sems[i].inuse--;
return (TRUE);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/MacSrc/SDLSound.c
Expand Up @@ -37,7 +37,8 @@ int snd_sample_play(int snd_ref, int len, uchar *smp, struct snd_digi_parms *dpr
return ERR_NOEFFECT;
}

int channel = Mix_PlayChannel(-1, sample, 0);
int loops = dprm->loops > 0 ? dprm->loops - 1 : -1;
int channel = Mix_PlayChannel(-1, sample, loops);
if (channel < 0) {
DEBUG("%s: Failed to play sample", __FUNCTION__);
Mix_FreeChunk(sample);
Expand Down

0 comments on commit 0b8006a

Please sign in to comment.