From 179c4dd2380fe1f569446f945f8d88b315002ba4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Tue, 10 Dec 2019 13:36:05 +0200 Subject: [PATCH] - rewrote test for occupied sound channel without special types https://forum.zdoom.org/viewtopic.php?t=66613 --- src/sound/s_sound.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/sound/s_sound.cpp b/src/sound/s_sound.cpp index f74ecef82..db2bebb19 100644 --- a/src/sound/s_sound.cpp +++ b/src/sound/s_sound.cpp @@ -528,22 +528,9 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source, { if (chan->SourceType == type && chan->EntChannel == channel) { - bool foundit; - - switch (type) - { - case SOURCE_Actor: - case SOURCE_Sector: - case SOURCE_Polyobj: - foundit = chan->Source == source; - break; - case SOURCE_Unattached: - foundit = chan->Point[0] == pt->X && chan->Point[2] == pt->Z && chan->Point[1] == pt->Y; - break; - default: - foundit = false; - break; - } + const bool foundit = (type == SOURCE_Unattached) + ? (chan->Point[0] == pt->X && chan->Point[2] == pt->Z && chan->Point[1] == pt->Y) + : (chan->Source == source); if (foundit) {