diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 43c7554..516736a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -4045,18 +4045,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
4045 | 4045 | ||
4046 | } | 4046 | } |
4047 | 4047 | ||
4048 | /* useless. Either use MakeChild or delete the presence | 4048 | /* useless. Either use MakeChild or delete the presence |
4049 | public void Reset() | 4049 | public void Reset() |
4050 | { | 4050 | { |
4051 | // m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName); | 4051 | // m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName); |
4052 | 4052 | ||
4053 | // Put the child agent back at the center | 4053 | // Put the child agent back at the center |
4054 | AbsolutePosition | 4054 | AbsolutePosition |
4055 | = new Vector3(((float)m_scene.RegionInfo.RegionSizeX * 0.5f), ((float)m_scene.RegionInfo.RegionSizeY * 0.5f), 70); | 4055 | = new Vector3(((float)m_scene.RegionInfo.RegionSizeX * 0.5f), ((float)m_scene.RegionInfo.RegionSizeY * 0.5f), 70); |
4056 | 4056 | ||
4057 | Animator.ResetAnimations(); | 4057 | Animator.ResetAnimations(); |
4058 | } | 4058 | } |
4059 | */ | 4059 | */ |
4060 | /// <summary> | 4060 | /// <summary> |
4061 | /// Computes which child agents to close when the scene presence moves to another region. | 4061 | /// Computes which child agents to close when the scene presence moves to another region. |
4062 | /// Removes those regions from m_knownRegions. | 4062 | /// Removes those regions from m_knownRegions. |
@@ -4064,13 +4064,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4064 | /// <param name="newRegionX">The new region's x on the map</param> | 4064 | /// <param name="newRegionX">The new region's x on the map</param> |
4065 | /// <param name="newRegionY">The new region's y on the map</param> | 4065 | /// <param name="newRegionY">The new region's y on the map</param> |
4066 | /// <returns></returns> | 4066 | /// <returns></returns> |
4067 | public void CloseChildAgents(ulong newRegionHandle, int newRegionSizeX, int newRegionSizeY) | 4067 | public void CloseChildAgents(bool logout, ulong newRegionHandle, int newRegionSizeX, int newRegionSizeY) |
4068 | { | 4068 | { |
4069 | uint newRegionX, newRegionY; | 4069 | uint newRegionX, newRegionY; |
4070 | List<ulong> byebyeRegions = new List<ulong>(); | 4070 | List<ulong> byebyeRegions = new List<ulong>(); |
4071 | List<ulong> knownRegions = KnownRegionHandles; | 4071 | List<ulong> knownRegions = KnownRegionHandles; |
4072 | m_log.DebugFormat( | 4072 | m_log.DebugFormat( |
4073 | "[SCENE PRESENCE]: Closing child agents. Checking {0} regions in {1}", | 4073 | "[SCENE PRESENCE]: Closing child agents. Checking {0} regions in {1}", |
4074 | knownRegions.Count, Scene.RegionInfo.RegionName); | 4074 | knownRegions.Count, Scene.RegionInfo.RegionName); |
4075 | //DumpKnownRegions(); | 4075 | //DumpKnownRegions(); |
4076 | 4076 | ||
@@ -4084,29 +4084,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
4084 | // Don't close the agent on this region yet | 4084 | // Don't close the agent on this region yet |
4085 | if (handle != Scene.RegionInfo.RegionHandle) | 4085 | if (handle != Scene.RegionInfo.RegionHandle) |
4086 | { | 4086 | { |
4087 | Util.RegionHandleToRegionLoc(handle, out x, out y); | 4087 | if (logout) |
4088 | if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) | 4088 | byebyeRegions.Add(handle); |
4089 | else | ||
4089 | { | 4090 | { |
4090 | 4091 | Util.RegionHandleToRegionLoc(handle, out x, out y); | |
4091 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | 4092 | if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) |
4092 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
4093 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, | ||
4094 | regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY)) | ||
4095 | { | 4093 | { |
4096 | byebyeRegions.Add(handle); | 4094 | |
4095 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | ||
4096 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
4097 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, | ||
4098 | regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY)) | ||
4099 | { | ||
4100 | byebyeRegions.Add(handle); | ||
4101 | } | ||
4097 | } | 4102 | } |
4098 | } | 4103 | else |
4099 | else | ||
4100 | { | ||
4101 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, | ||
4102 | (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) | ||
4103 | { | 4104 | { |
4104 | byebyeRegions.Add(handle); | 4105 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, |
4106 | (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) | ||
4107 | { | ||
4108 | byebyeRegions.Add(handle); | ||
4109 | } | ||
4105 | } | 4110 | } |
4106 | } | 4111 | } |
4107 | } | 4112 | } |
4108 | } | 4113 | } |
4109 | 4114 | ||
4110 | if (byebyeRegions.Count > 0) | 4115 | if (byebyeRegions.Count > 0) |
4111 | { | 4116 | { |
4112 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); | 4117 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); |
@@ -4115,9 +4120,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4115 | string auth = string.Empty; | 4120 | string auth = string.Empty; |
4116 | if (acd != null) | 4121 | if (acd != null) |
4117 | auth = acd.SessionID.ToString(); | 4122 | auth = acd.SessionID.ToString(); |
4118 | m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, auth, byebyeRegions); | 4123 | m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, auth, byebyeRegions); |
4119 | } | 4124 | } |
4120 | 4125 | ||
4121 | foreach (ulong handle in byebyeRegions) | 4126 | foreach (ulong handle in byebyeRegions) |
4122 | { | 4127 | { |
4123 | RemoveNeighbourRegion(handle); | 4128 | RemoveNeighbourRegion(handle); |