diff options
author | Justin Clark-Casey (justincc) | 2013-03-28 00:12:48 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-03-28 00:12:48 +0000 |
commit | dd7d7683c914f5b16d8b87434bccea3fe74d9bab (patch) | |
tree | b4e1a750c7b3a84b5e2dcdf60ed12ffb4ae2bde1 /OpenSim/Region | |
parent | Add admin_get_agents xmlrpc method. (diff) | |
download | opensim-SC_OLD-dd7d7683c914f5b16d8b87434bccea3fe74d9bab.zip opensim-SC_OLD-dd7d7683c914f5b16d8b87434bccea3fe74d9bab.tar.gz opensim-SC_OLD-dd7d7683c914f5b16d8b87434bccea3fe74d9bab.tar.bz2 opensim-SC_OLD-dd7d7683c914f5b16d8b87434bccea3fe74d9bab.tar.xz |
Fix problem with megaregions where teleporting into a different region which already had a child agent would stop the eq working for the agent in the new region.
This was because the calculation as to whether a new agent was needed in the receiving region did not take megaregions into account,
unlike the original calculation when the user first teleported into the region.
This meant that on teleport, entity transfer would create a new CAP but this would be ignored by the viewer and receiving region, meaning that the EQ could no longer be used.
This would prevent subsequent teleport, amongst other things.
Currently, regions up to 512m from a megaregion are considered neighbours.
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 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) |