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