aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIain Oliver2012-11-14 15:02:35 +0000
committerJustin Clark-Casey (justincc)2012-11-20 04:54:13 +0000
commit0962a35d2ff8e2d0a8cf87bfce542276dfb2c0f5 (patch)
tree1875faa3c1ecbd442067a4060f82a62a7115aa91
parentminor: If logging full incoming HTTP data, don't deceptively print ... at the... (diff)
downloadopensim-SC_OLD-0962a35d2ff8e2d0a8cf87bfce542276dfb2c0f5.zip
opensim-SC_OLD-0962a35d2ff8e2d0a8cf87bfce542276dfb2c0f5.tar.gz
opensim-SC_OLD-0962a35d2ff8e2d0a8cf87bfce542276dfb2c0f5.tar.bz2
opensim-SC_OLD-0962a35d2ff8e2d0a8cf87bfce542276dfb2c0f5.tar.xz
Fix movetotarget on mega regions.
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs24
1 files changed, 21 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 96bca3e..342de78 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1698,8 +1698,18 @@ namespace OpenSim.Region.Framework.Scenes
1698// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", 1698// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
1699// Name, pos, m_scene.RegionInfo.RegionName); 1699// Name, pos, m_scene.RegionInfo.RegionName);
1700 1700
1701 if (pos.X < 0 || pos.X >= Constants.RegionSize 1701 Vector2 regionSize;
1702 || pos.Y < 0 || pos.Y >= Constants.RegionSize 1702 IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>();
1703 if(regionCombinerModule != null)
1704 {
1705 regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
1706 }
1707 else
1708 {
1709 regionSize = new Vector2(Constants.RegionSize);
1710 }
1711 if (pos.X < 0 || pos.X >= regionSize.X
1712 || pos.Y < 0 || pos.Y >= regionSize.Y
1703 || pos.Z < 0) 1713 || pos.Z < 0)
1704 return; 1714 return;
1705 1715
@@ -1713,7 +1723,15 @@ namespace OpenSim.Region.Framework.Scenes
1713// pos.Z = AbsolutePosition.Z; 1723// pos.Z = AbsolutePosition.Z;
1714// } 1724// }
1715 1725
1716 float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 1726 int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X);
1727 int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y);
1728 UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID;
1729 Scene targetScene = m_scene;
1730 if(!SceneManager.Instance.TryGetScene(target_regionID, out targetScene))
1731 {
1732 targetScene = m_scene;
1733 }
1734 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)];
1717 pos.Z = Math.Max(terrainHeight, pos.Z); 1735 pos.Z = Math.Max(terrainHeight, pos.Z);
1718 1736
1719 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is 1737 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is