From 7a2abbb8484c8ceba990b3f5b79a0b5291c71e46 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 27 May 2007 06:36:33 +0000 Subject: * Added ability to set default terrain to a file in region config. If unable to open, terrain will be procedurally generated instead. (also needs testing.). Default file must be in R32 format. Use "terrain save f32 default.r32" on the region console to make a default file you can use. --- OpenSim/OpenSim.RegionServer/world/World.cs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'OpenSim/OpenSim.RegionServer/world/World.cs') diff --git a/OpenSim/OpenSim.RegionServer/world/World.cs b/OpenSim/OpenSim.RegionServer/world/World.cs index 68516d2..ef6833c 100644 --- a/OpenSim/OpenSim.RegionServer/world/World.cs +++ b/OpenSim/OpenSim.RegionServer/world/World.cs @@ -417,10 +417,27 @@ namespace OpenSim.world float[] map = this.localStorage.LoadWorld(); if (map == null) { - Console.WriteLine("creating new terrain"); - this.Terrain.hills(); + if (string.IsNullOrEmpty(this.m_regInfo.TerrainFile)) + { + Console.WriteLine("No default terrain, procedurally generating..."); + this.Terrain.hills(); - this.localStorage.SaveMap(this.Terrain.getHeights1D()); + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } + else + { + try + { + this.Terrain.loadFromFileF32(this.m_regInfo.TerrainFile); + this.Terrain *= this.m_regInfo.TerrainMultiplier; + } + catch (Exception e) + { + Console.WriteLine("Unable to load default terrain (" + e.ToString() + "), procedurally generating instead..."); + Terrain.hills(); + } + this.localStorage.SaveMap(this.Terrain.getHeights1D()); + } } else { -- cgit v1.1