diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/TerrainChannel.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainChannel.cs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index 6d245cb..d641c87 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs | |||
@@ -100,16 +100,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
100 | } | 100 | } |
101 | 101 | ||
102 | // ITerrainChannel.GetFloatsSerialized() | 102 | // ITerrainChannel.GetFloatsSerialized() |
103 | // NOTICE that the one dimensional form is ordered by Y!! | 103 | // This one dimensional version is ordered so height = map[y*sizeX+x]; |
104 | // DEPRECATED: don't use this function as it does not retain the dimensions of the terrain | ||
105 | // and the caller will probably do the wrong thing if the terrain is not the legacy 256x256. | ||
104 | public float[] GetFloatsSerialised() | 106 | public float[] GetFloatsSerialised() |
105 | { | 107 | { |
106 | int points = Width * Height; | 108 | int points = Width * Height; |
107 | float[] heights = new float[points]; | 109 | float[] heights = new float[points]; |
108 | 110 | ||
109 | int idx = 0; | 111 | int idx = 0; |
110 | for (int ii = 0; ii < Height; ii++) | 112 | for (int jj = 0; jj < Height; jj++) |
111 | for (int jj = 0; jj < Width; jj++) | 113 | for (int ii = 0; ii < Width; ii++) |
112 | heights[idx++] = m_terrainData[jj, ii]; | 114 | { |
115 | heights[idx++] = m_terrainData[ii, jj]; | ||
116 | } | ||
113 | 117 | ||
114 | return heights; | 118 | return heights; |
115 | } | 119 | } |
@@ -117,14 +121,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
117 | // ITerrainChannel.GetDoubles() | 121 | // ITerrainChannel.GetDoubles() |
118 | public double[,] GetDoubles() | 122 | public double[,] GetDoubles() |
119 | { | 123 | { |
120 | int w = Width; | 124 | double[,] heights = new double[Width, Height]; |
121 | int l = Height; | ||
122 | double[,] heights = new double[w, l]; | ||
123 | 125 | ||
124 | int idx = 0; // index into serialized array | 126 | int idx = 0; // index into serialized array |
125 | for (int ii = 0; ii < w; ii++) | 127 | for (int ii = 0; ii < Width; ii++) |
126 | { | 128 | { |
127 | for (int jj = 0; jj < l; jj++) | 129 | for (int jj = 0; jj < Height; jj++) |
128 | { | 130 | { |
129 | heights[ii, jj] = (double)m_terrainData[ii, jj]; | 131 | heights[ii, jj] = (double)m_terrainData[ii, jj]; |
130 | idx++; | 132 | idx++; |