From 597a101b9f65e2f0b67f9f2de99654f2e5979855 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Nov 2012 05:09:44 +0000 Subject: Minor formatting for 0962a35d and a few one-line comments as to why that code is there --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 342de78..6f36c0b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1698,16 +1698,14 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", // Name, pos, m_scene.RegionInfo.RegionName); + // Allow move to another sub-region within a megaregion Vector2 regionSize; IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface(); - if(regionCombinerModule != null) - { + if (regionCombinerModule != null) regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); - } else - { regionSize = new Vector2(Constants.RegionSize); - } + if (pos.X < 0 || pos.X >= regionSize.X || pos.Y < 0 || pos.Y >= regionSize.Y || pos.Z < 0) @@ -1723,14 +1721,15 @@ namespace OpenSim.Region.Framework.Scenes // pos.Z = AbsolutePosition.Z; // } + // Get terrain height for sub-region in a megaregion if necessary int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID; Scene targetScene = m_scene; - if(!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) - { + + if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) targetScene = m_scene; - } + float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)]; pos.Z = Math.Max(terrainHeight, pos.Z); -- cgit v1.1