diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 4cf7645..8af236e 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -727,6 +727,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
727 | IClientIPEndpoint ipepClient; | 727 | IClientIPEndpoint ipepClient; |
728 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 728 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
729 | { | 729 | { |
730 | m_log.DebugFormat( | ||
731 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}", | ||
732 | finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name); | ||
733 | |||
730 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | 734 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); |
731 | #region IP Translation for NAT | 735 | #region IP Translation for NAT |
732 | // Uses ipepClient above | 736 | // Uses ipepClient above |
@@ -1001,7 +1005,46 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1001 | 1005 | ||
1002 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | 1006 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) |
1003 | { | 1007 | { |
1004 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); | 1008 | Border[] northBorders = Scene.NorthBorders.ToArray(); |
1009 | Border[] southBorders = Scene.SouthBorders.ToArray(); | ||
1010 | Border[] eastBorders = Scene.EastBorders.ToArray(); | ||
1011 | Border[] westBorders = Scene.WestBorders.ToArray(); | ||
1012 | |||
1013 | // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't | ||
1014 | // clear what should be done with a "far view" given that megaregions already extended the | ||
1015 | // view to include everything in the megaregion | ||
1016 | if (northBorders.Length > 1 || southBorders.Length > 1 || eastBorders.Length > 1 || westBorders.Length > 1) | ||
1017 | { | ||
1018 | Vector2 extent = Vector2.Zero; | ||
1019 | for (int i = 0; i < eastBorders.Length; i++) | ||
1020 | { | ||
1021 | extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X; | ||
1022 | } | ||
1023 | for (int i = 0; i < northBorders.Length; i++) | ||
1024 | { | ||
1025 | extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y; | ||
1026 | } | ||
1027 | |||
1028 | // Loss of fraction on purpose | ||
1029 | extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1; | ||
1030 | extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1; | ||
1031 | |||
1032 | uint startX = oldRegionX - 1; | ||
1033 | uint startY = oldRegionY - 1; | ||
1034 | |||
1035 | uint endX = oldRegionX + (uint)extent.X; | ||
1036 | uint endY = oldRegionY + (uint)extent.Y; | ||
1037 | |||
1038 | m_log.DebugFormat( | ||
1039 | "[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1},{2} to {3},{4} with new agent check for {5},{6}", | ||
1040 | Scene.Name, startX, startY, endX, endY, newRegionX, newRegionY); | ||
1041 | |||
1042 | return !(newRegionX >= startX && newRegionX <= endX && newRegionY >= startY && newRegionY <= endY); | ||
1043 | } | ||
1044 | else | ||
1045 | { | ||
1046 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); | ||
1047 | } | ||
1005 | } | 1048 | } |
1006 | 1049 | ||
1007 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 1050 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |