diff options
author | UbitUmarov | 2015-08-25 20:00:31 +0100 |
---|---|---|
committer | UbitUmarov | 2015-08-25 20:00:31 +0100 |
commit | 22f573a0bed4c7b0d9aa84ba38e966f0be802f5d (patch) | |
tree | 6798222fd8e2718a1b7a078c62a89fe3fccb005e /OpenSim | |
parent | remove rest of ushort test code (diff) | |
download | opensim-SC_OLD-22f573a0bed4c7b0d9aa84ba38e966f0be802f5d.zip opensim-SC_OLD-22f573a0bed4c7b0d9aa84ba38e966f0be802f5d.tar.gz opensim-SC_OLD-22f573a0bed4c7b0d9aa84ba38e966f0be802f5d.tar.bz2 opensim-SC_OLD-22f573a0bed4c7b0d9aa84ba38e966f0be802f5d.tar.xz |
update raw32 file reader to core one. Warning only suports square regions
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs index 9fb7ef7..1bbef40 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs | |||
@@ -25,7 +25,10 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.IO; | 29 | using System.IO; |
30 | |||
31 | using OpenSim.Framework; | ||
29 | using OpenSim.Region.Framework.Interfaces; | 32 | using OpenSim.Region.Framework.Interfaces; |
30 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
31 | 34 | ||
@@ -116,6 +119,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
116 | 119 | ||
117 | public ITerrainChannel LoadStream(Stream s) | 120 | public ITerrainChannel LoadStream(Stream s) |
118 | { | 121 | { |
122 | // The raw format doesn't contain any dimension information. | ||
123 | // Guess the square dimensions by using the length of the raw file. | ||
124 | double dimension = Math.Sqrt((double)(s.Length / 4)); | ||
125 | // Regions are always multiples of 256. | ||
126 | int trimmedDimension = (int)dimension - ((int)dimension % (int)Constants.RegionSize); | ||
127 | if (trimmedDimension < Constants.RegionSize) | ||
128 | trimmedDimension = (int)Constants.RegionSize; | ||
129 | |||
119 | TerrainChannel retval = new TerrainChannel(); | 130 | TerrainChannel retval = new TerrainChannel(); |
120 | 131 | ||
121 | BinaryReader bs = new BinaryReader(s); | 132 | BinaryReader bs = new BinaryReader(s); |