From 11e1948b57f96e7d22c56e82bfb15b93f62a5cef Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 5 Mar 2009 21:10:39 +0000 Subject: * Replace Scene.GetLandHeight() with a straight query to Scene.Heightmap (which is used in other contexts) --- .../Scenes/Hypergrid/HGSceneCommunicationService.cs | 3 ++- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ----- .../Framework/Scenes/SceneCommunicationService.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 21 +++++++++------------ 5 files changed, 13 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs index 67cc1a1..edd1804 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs @@ -88,7 +88,8 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid } // TODO: Get proper AVG Height float localAVHeight = 1.56f; - float posZLimit = (float)avatar.Scene.GetLandHeight((int)position.X, (int)position.Y); + + float posZLimit = (float)avatar.Scene.Heightmap[(int)position.X, (int)position.Y]; float newPosZ = posZLimit + localAVHeight; if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7776215..aa0218b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3019,11 +3019,6 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnPluginConsole(args); } - public double GetLandHeight(int x, int y) - { - return Heightmap[x, y]; - } - public UUID GetLandOwner(float x, float y) { ILandObject land = LandChannel.GetLandObject(x, y); diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c3b60f8..28ea8b0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -710,7 +710,7 @@ namespace OpenSim.Region.Framework.Scenes // TODO: Get proper AVG Height float localAVHeight = 1.56f; - float posZLimit = (float)avatar.Scene.GetLandHeight((int)position.X, (int)position.Y); + float posZLimit = (float)avatar.Scene.Heightmap[(int)position.X, (int)position.Y]; float newPosZ = posZLimit + localAVHeight; if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6eb6ea4..67f6c29 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes localAVHeight = m_avHeight; } - float posZLimit = (float)m_scene.GetLandHeight((int)pos.X, (int)pos.Y); + float posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; float newPosZ = posZLimit + localAVHeight / 2; if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5be967e..fad456f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1007,17 +1007,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int y = (int)(pos.Y + offset.y); // Clamp to valid position - if (x<0) + if (x < 0) x = 0; - else if (x>=World.Heightmap.Width) - x = World.Heightmap.Width-1; - if (y<0) + else if (x >= World.Heightmap.Width) + x = World.Heightmap.Width - 1; + if (y < 0) y = 0; - else if (y>=World.Heightmap.Height) - y = World.Heightmap.Height-1; - - - return World.GetLandHeight(x, y); + else if (y >= World.Heightmap.Height) + y = World.Heightmap.Height - 1; + + return World.Heightmap[x, y]; } public LSL_Float llCloud(LSL_Vector offset) @@ -2794,15 +2793,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - - public void llSetHoverHeight(double height, int water, double tau) { m_host.AddScriptLPS(1); Vector3 pos = m_host.GetWorldPosition(); int x = (int)(pos.X); int y = (int)(pos.Y); - float landHeight = (float)World.GetLandHeight(x, y); + float landHeight = (float)World.Heightmap[x, y]; float targetHeight = landHeight + (float)height; if (water == 1) { -- cgit v1.1