aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs43
1 files changed, 42 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index b85fd93..c26f862 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -2373,7 +2373,10 @@ namespace OpenSim.Region.Environment.Scenes
2373 2373
2374 CrossAttachmentsIntoNewRegion(neighbourHandle, true); 2374 CrossAttachmentsIntoNewRegion(neighbourHandle, true);
2375 2375
2376// m_scene.SendKillObject(m_localId); 2376 // Next, let's close the child agent connections that are too far away.
2377 CloseChildAgents(neighbourx, neighboury);
2378
2379 // m_scene.SendKillObject(m_localId);
2377 2380
2378 m_scene.NotifyMyCoarseLocationChange(); 2381 m_scene.NotifyMyCoarseLocationChange();
2379 // the user may change their profile information in other region, 2382 // the user may change their profile information in other region,
@@ -2391,6 +2394,44 @@ namespace OpenSim.Region.Environment.Scenes
2391 } 2394 }
2392 } 2395 }
2393 2396
2397 /// <summary>
2398 /// Computes which child agents to close when the scene presence moves to another region.
2399 /// Removes those regions from m_knownRegions.
2400 /// </summary>
2401 /// <param name="newRegionX">The new region's x on the map</param>
2402 /// <param name="newRegionY">The new region's y on the map</param>
2403 /// <returns></returns>
2404 public void CloseChildAgents(uint newRegionX, uint newRegionY)
2405 {
2406 List<ulong> byebyeRegions = new List<ulong>();
2407
2408 foreach (ulong handle in m_knownChildRegions)
2409 {
2410 uint x, y;
2411 Utils.LongToUInts(handle, out x, out y);
2412 x = x / Constants.RegionSize;
2413 y = y / Constants.RegionSize;
2414
2415 if (Util.IsOutsideView(x, newRegionX, y, newRegionY))
2416 {
2417 Console.WriteLine("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs(x-newRegionX));
2418 Console.WriteLine("---> y: " + y + "; newy:" + newRegionY);
2419 byebyeRegions.Add(handle);
2420 }
2421 }
2422 foreach (ulong handle in byebyeRegions)
2423 {
2424 RemoveNeighbourRegion(handle);
2425 }
2426
2427 if (byebyeRegions.Count > 0)
2428 {
2429 m_log.Info("[AVATAR]: Closing " + byebyeRegions.Count + " child agents");
2430 m_scene.SceneGridService.SendCloseChildAgentConnections(m_controllingClient.AgentId, byebyeRegions);
2431 }
2432
2433 }
2434
2394 #endregion 2435 #endregion
2395 2436
2396 /// <summary> 2437 /// <summary>