From da17e4329ba842eef88878fb0b9b62ba59fd059b Mon Sep 17 00:00:00 2001 From: stwf Date: Fri, 14 Jun 2013 00:24:51 +0000 Subject: [PATCH] cleanup SOundManaer component This was SVN commit r13475. --- .../components/CCmpSoundManager.cpp | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/source/simulation2/components/CCmpSoundManager.cpp b/source/simulation2/components/CCmpSoundManager.cpp index f63244f7c5..c77b7466ce 100644 --- a/source/simulation2/components/CCmpSoundManager.cpp +++ b/source/simulation2/components/CCmpSoundManager.cpp @@ -28,9 +28,8 @@ class CCmpSoundManager : public ICmpSoundManager { public: - static void ClassInit(CComponentManager& componentManager) + static void ClassInit(CComponentManager& UNUSED(componentManager) ) { - componentManager.SubscribeToMessageType(MT_Update); } DEFAULT_COMPONENT_ALLOCATOR(SoundManager) @@ -59,36 +58,27 @@ public: Init(paramNode); } - virtual void HandleMessage(const CMessage& msg, bool UNUSED(global)) - { - switch (msg.GetType()) - { - case MT_Update: - { - } - } - } - virtual void PlaySoundGroup(std::wstring name, entity_id_t source) { - if ( g_SoundManager ) - { - CmpPtr cmpRangeManager(GetSimContext(), SYSTEM_ENTITY); - ICmpRangeManager::ELosVisibility vis = cmpRangeManager->GetLosVisibility(source, GetSimContext().GetCurrentDisplayedPlayer()); + if ( ! g_SoundManager ) + return; - if (vis == ICmpRangeManager::VIS_VISIBLE) + CmpPtr cmpRangeManager(GetSimContext(), SYSTEM_ENTITY); + ICmpRangeManager::ELosVisibility vis = cmpRangeManager->GetLosVisibility(source, GetSimContext().GetCurrentDisplayedPlayer()); + + if (vis == ICmpRangeManager::VIS_VISIBLE) + { + if (source != INVALID_ENTITY) { - if (source != INVALID_ENTITY) + CmpPtr cmpPosition(GetSimContext(), source); + if (cmpPosition && cmpPosition->IsInWorld()) { - CmpPtr cmpPosition(GetSimContext(), source); - if (cmpPosition && cmpPosition->IsInWorld()) - { - CVector3D sourcePos = CVector3D(cmpPosition->GetPosition()); - g_SoundManager->PlayAsGroup(name, sourcePos, source); - } + CVector3D sourcePos = CVector3D(cmpPosition->GetPosition()); + g_SoundManager->PlayAsGroup(name, sourcePos, source); } } } + } };