refactoring StopSound into a private static method to skip repeating m_scene.TryGetSceneObjectPart

integration
SignpostMarv 2012-10-06 22:40:26 +01:00 committed by Justin Clark-Casey (justincc)
parent e5df8cafb8
commit 3d8f59aac3
1 changed files with 6 additions and 1 deletions

View File

@ -185,6 +185,11 @@ namespace OpenSim.Region.CoreModules.World.Sound
if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) if (!m_scene.TryGetSceneObjectPart(objectID, out m_host))
return; return;
StopSound(m_host);
}
private static void StopSound(SceneObjectPart m_host)
{
m_host.AdjustSoundGain(0); m_host.AdjustSoundGain(0);
// Xantor 20080528: Clear prim data of sound instead // Xantor 20080528: Clear prim data of sound instead
if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host))
@ -253,7 +258,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
m_host.ParentGroup.LoopSoundMasterPrim = m_host; m_host.ParentGroup.LoopSoundMasterPrim = m_host;
if (m_host.Sound != UUID.Zero) if (m_host.Sound != UUID.Zero)
StopSound(objectID); StopSound(m_host);
m_host.Sound = soundID; m_host.Sound = soundID;
m_host.SoundGain = volume; m_host.SoundGain = volume;