diff options
author | Robert Adams | 2013-11-28 08:22:41 -0800 |
---|---|---|
committer | Robert Adams | 2013-11-28 08:22:41 -0800 |
commit | 109136c074fd4ce68f4c5615c05665a81fa7c7d9 (patch) | |
tree | b7fbc4f356f831fc826aaeb804012a056485936b /OpenSim/Region/Framework/Scenes/TerrainChannel.cs | |
parent | varregion: many replacements of in-place arithmetic with calls to (diff) | |
download | opensim-SC_OLD-109136c074fd4ce68f4c5615c05665a81fa7c7d9.zip opensim-SC_OLD-109136c074fd4ce68f4c5615c05665a81fa7c7d9.tar.gz opensim-SC_OLD-109136c074fd4ce68f4c5615c05665a81fa7c7d9.tar.bz2 opensim-SC_OLD-109136c074fd4ce68f4c5615c05665a81fa7c7d9.tar.xz |
varregion: add ITerrainChannel.GetHeightAtXYZ() for eventual mesh terrain.
Implementation of same in TerrainChannel.cs.
Check for bounds in TerrainChannel[x,y] to prevent array access exceptions.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainChannel.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index a5b42ff..b4b1823 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs | |||
@@ -156,7 +156,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | // ITerrainChannel.this[x,y] | 156 | // ITerrainChannel.this[x,y] |
157 | public double this[int x, int y] | 157 | public double this[int x, int y] |
158 | { | 158 | { |
159 | get { return (double)m_terrainData[x, y]; } | 159 | get { |
160 | if (x < 0 || x >= Width || y < 0 || y >= Height) | ||
161 | return 0; | ||
162 | return (double)m_terrainData[x, y]; | ||
163 | } | ||
160 | set | 164 | set |
161 | { | 165 | { |
162 | if (Double.IsNaN(value) || Double.IsInfinity(value)) | 166 | if (Double.IsNaN(value) || Double.IsInfinity(value)) |
@@ -166,6 +170,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
166 | } | 170 | } |
167 | } | 171 | } |
168 | 172 | ||
173 | // ITerrainChannel.GetHieghtAtXYZ(x, y, z) | ||
174 | public float GetHeightAtXYZ(float x, float y, float z) | ||
175 | { | ||
176 | if (x < 0 || x >= Width || y < 0 || y >= Height) | ||
177 | return 0; | ||
178 | return m_terrainData[(int)x, (int)y]; | ||
179 | } | ||
180 | |||
169 | // ITerrainChannel.Tainted() | 181 | // ITerrainChannel.Tainted() |
170 | public bool Tainted(int x, int y) | 182 | public bool Tainted(int x, int y) |
171 | { | 183 | { |