aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs13
1 files changed, 7 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs b/OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs
index de7af3f..3f6e346 100644
--- a/OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs
+++ b/OpenSim/Region/Environment/Modules/VoiceChat/VoiceChatServer.cs
@@ -306,22 +306,23 @@ namespace OpenSim.Region.Environment.Modules.VoiceChat
306 } 306 }
307 } 307 }
308 308
309 public ScenePresence getScenePresence(LLUUID clientID) 309 public LLVector3 getScenePresencePosition(LLUUID clientID)
310 { 310 {
311 foreach (Scene scene in m_scenes) 311 foreach (Scene scene in m_scenes)
312 { 312 {
313 ScenePresence x; 313 ScenePresence x;
314 if ((x = scene.GetScenePresence(clientID)) != null) 314 if ((x = scene.GetScenePresence(clientID)) != null)
315 { 315 {
316 return x; 316 return x.AbsolutePosition + new LLVector3(Constants.RegionSize * scene.RegionInfo.RegionLocX,
317 Constants.RegionSize * scene.RegionInfo.RegionLocY, 0);
317 } 318 }
318 } 319 }
319 return null; 320 return LLVector3.Zero;
320 } 321 }
321 322
322 public void BroadcastVoice(VoicePacket packet) 323 public void BroadcastVoice(VoicePacket packet)
323 { 324 {
324 libsecondlife.LLVector3 origPos = getScenePresence(packet.m_clientId).AbsolutePosition; 325 libsecondlife.LLVector3 origPos = getScenePresencePosition(packet.m_clientId);
325 326
326 byte[] bytes = packet.GetBytes(); 327 byte[] bytes = packet.GetBytes();
327 foreach (VoiceClient client in m_clients.Values) 328 foreach (VoiceClient client in m_clients.Values)
@@ -329,9 +330,9 @@ namespace OpenSim.Region.Environment.Modules.VoiceChat
329 if (client.IsEnabled() && client.m_clientId != packet.m_clientId && 330 if (client.IsEnabled() && client.m_clientId != packet.m_clientId &&
330 client.m_authenticated && client.IsCodecSupported(packet.m_codec)) 331 client.m_authenticated && client.IsCodecSupported(packet.m_codec))
331 { 332 {
332 ScenePresence presence = getScenePresence(client.m_clientId); 333 LLVector3 presenceLoc = getScenePresencePosition(client.m_clientId);
333 334
334 if (presence != null && Util.GetDistanceTo(presence.AbsolutePosition, origPos) < 20) 335 if (presenceLoc != LLVector3.Zero && Util.GetDistanceTo(presenceLoc, origPos) < 20)
335 { 336 {
336 client.SendTo(bytes); 337 client.SendTo(bytes);
337 } 338 }