diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs index 62d232e..ce93a180 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs | |||
@@ -147,7 +147,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
147 | 147 | ||
148 | public ITerrainChannel LoadStream(Stream s) | 148 | public ITerrainChannel LoadStream(Stream s) |
149 | { | 149 | { |
150 | TerrainChannel retval = new TerrainChannel(); | 150 | // The raw format doesn't contain any dimension information. |
151 | // Guess the square dimensions by using the length of the raw file. | ||
152 | double dimension = Math.Sqrt((double)(s.Length / 13)); | ||
153 | // Regions are always multiples of 256. | ||
154 | int trimmedDimension = (int)dimension - ((int)dimension % (int)Constants.RegionSize); | ||
155 | if (trimmedDimension < Constants.RegionSize) | ||
156 | trimmedDimension = (int)Constants.RegionSize; | ||
157 | |||
158 | TerrainChannel retval = new TerrainChannel(trimmedDimension, trimmedDimension); | ||
151 | 159 | ||
152 | BinaryReader bs = new BinaryReader(s); | 160 | BinaryReader bs = new BinaryReader(s); |
153 | int y; | 161 | int y; |