mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
update raw32 file reader to core one. Warning only suports square regions
This commit is contained in:
@@ -25,7 +25,10 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
@@ -116,6 +119,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
|
||||
|
||||
public ITerrainChannel LoadStream(Stream s)
|
||||
{
|
||||
// The raw format doesn't contain any dimension information.
|
||||
// Guess the square dimensions by using the length of the raw file.
|
||||
double dimension = Math.Sqrt((double)(s.Length / 4));
|
||||
// Regions are always multiples of 256.
|
||||
int trimmedDimension = (int)dimension - ((int)dimension % (int)Constants.RegionSize);
|
||||
if (trimmedDimension < Constants.RegionSize)
|
||||
trimmedDimension = (int)Constants.RegionSize;
|
||||
|
||||
TerrainChannel retval = new TerrainChannel();
|
||||
|
||||
BinaryReader bs = new BinaryReader(s);
|
||||
|
||||
Reference in New Issue
Block a user