From a23f99366fda4f3c85d3cde8d1a5dd805f936bae Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 6 Jun 2017 03:22:11 +0100 Subject: bug fix: handle current region on GetChildAgentsToClose --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f86814d..daa9e50 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1819,6 +1819,7 @@ namespace OpenSim.Region.Framework.Scenes lock (m_knownChildRegions) { m_knownChildRegionsSizeInfo.Clear(); + foreach (GridRegion region in regionsList) { spRegionSizeInfo sizeInfo = new spRegionSizeInfo(); @@ -4440,15 +4441,19 @@ namespace OpenSim.Region.Framework.Scenes /// public List GetChildAgentsToClose(ulong newRegionHandle, int newRegionSizeX, int newRegionSizeY) { - uint newRegionX, newRegionY; + ulong curRegionHandle = m_scene.RegionInfo.RegionHandle; List byebyeRegions = new List(); + + if(newRegionHandle == curRegionHandle) //?? + return byebyeRegions; + + uint newRegionX, newRegionY; List knownRegions = KnownRegionHandles; m_log.DebugFormat( "[SCENE PRESENCE]: Closing child agents. Checking {0} regions in {1}", knownRegions.Count, Scene.RegionInfo.RegionName); Util.RegionHandleToRegionLoc(newRegionHandle, out newRegionX, out newRegionY); - uint x, y; spRegionSizeInfo regInfo; @@ -4456,7 +4461,16 @@ namespace OpenSim.Region.Framework.Scenes { if(newRegionY == 0) // HG byebyeRegions.Add(handle); - else + else if(handle == curRegionHandle) + { + RegionInfo curreg = m_scene.RegionInfo; + if (Util.IsOutsideView(255, curreg.RegionLocX, newRegionX, curreg.RegionLocY, newRegionY, + (int)curreg.RegionSizeX, (int)curreg.RegionSizeX, newRegionSizeX, newRegionSizeY)) + { + byebyeRegions.Add(handle); + } + } + else { Util.RegionHandleToRegionLoc(handle, out x, out y); if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) @@ -4471,7 +4485,8 @@ namespace OpenSim.Region.Framework.Scenes } else { - if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY, +// if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY, + if (Util.IsOutsideView(255, x, newRegionX, y, newRegionY, (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) { byebyeRegions.Add(handle); -- cgit v1.1