diff options
author | Dr Scofield | 2008-10-30 15:09:43 +0000 |
---|---|---|
committer | Dr Scofield | 2008-10-30 15:09:43 +0000 |
commit | 537cd4708f31196cb71b63fbb3d5d18d6a4c126b (patch) | |
tree | b3c10f54798cd20b994081be94aa3728460e46a7 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Thank you kindly, NLin for an implementation patch (diff) | |
download | opensim-SC_OLD-537cd4708f31196cb71b63fbb3d5d18d6a4c126b.zip opensim-SC_OLD-537cd4708f31196cb71b63fbb3d5d18d6a4c126b.tar.gz opensim-SC_OLD-537cd4708f31196cb71b63fbb3d5d18d6a4c126b.tar.bz2 opensim-SC_OLD-537cd4708f31196cb71b63fbb3d5d18d6a4c126b.tar.xz |
From: Chris Yeoh (yeohc@au1.ibm.com)
Here's the patch that clamps llGround to using sane values avoiding
runtime errors.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6fd2544..499273c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -937,6 +937,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
937 | Vector3 pos = m_host.GetWorldPosition(); | 937 | Vector3 pos = m_host.GetWorldPosition(); |
938 | int x = (int)(pos.X + offset.x); | 938 | int x = (int)(pos.X + offset.x); |
939 | int y = (int)(pos.Y + offset.y); | 939 | int y = (int)(pos.Y + offset.y); |
940 | |||
941 | // Clamp to valid position | ||
942 | if (x<0) | ||
943 | x = 0; | ||
944 | else if (x>=World.Heightmap.Width) | ||
945 | x = World.Heightmap.Width-1; | ||
946 | if (y<0) | ||
947 | y = 0; | ||
948 | else if (y>=World.Heightmap.Height) | ||
949 | y = World.Heightmap.Height-1; | ||
950 | |||
951 | |||
940 | return World.GetLandHeight(x, y); | 952 | return World.GetLandHeight(x, y); |
941 | } | 953 | } |
942 | 954 | ||