diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs index 5c3eb7d..1534c4b 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs | |||
@@ -108,12 +108,20 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
108 | 108 | ||
109 | public float[] GetFloatsSerialised() | 109 | public float[] GetFloatsSerialised() |
110 | { | 110 | { |
111 | float[] heights = new float[Width * Height]; | 111 | // Move the member variables into local variables, calling |
112 | int i; | 112 | // member variables 256*256 times gets expensive |
113 | 113 | int w = Width; | |
114 | for (i = 0; i < Width * Height; i++) | 114 | int h = Height; |
115 | float[] heights = new float[w * h]; | ||
116 | |||
117 | int i, j; // map coordinates | ||
118 | int idx = 0; // index into serialized array | ||
119 | for (i = 0; i < h; i++) | ||
115 | { | 120 | { |
116 | heights[i] = (float) map[i % Width, i / Width]; | 121 | for (j = 0; j < w; j++) |
122 | { | ||
123 | heights[idx++] = (float)map[j, i]; | ||
124 | } | ||
117 | } | 125 | } |
118 | 126 | ||
119 | return heights; | 127 | return heights; |