From f60bc970eb925cd245cc77b1ae700b28d4589163 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 8 Mar 2007 13:21:24 +0000 Subject: Another attemp to fix the Session Logout bug World map data is now saved in database and recovered on startup. Primitives are now backed up to a local database and reloaded on startup. --- src/Config/SimConfig/Db4SimConfig.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/Config/SimConfig/Db4SimConfig.cs') diff --git a/src/Config/SimConfig/Db4SimConfig.cs b/src/Config/SimConfig/Db4SimConfig.cs index cc31328..4a06187 100644 --- a/src/Config/SimConfig/Db4SimConfig.cs +++ b/src/Config/SimConfig/Db4SimConfig.cs @@ -111,16 +111,19 @@ namespace Db40SimConfig ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world...."); World blank = new World(); ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB"); - IObjectSet world_result = db.Get(new float[65536]); + IObjectSet world_result = db.Get(typeof(MapStorage)); if(world_result.Count>0) { ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading"); - blank.LandMap=(float[])world_result.Next(); + MapStorage map=(MapStorage)world_result.Next(); + blank.LandMap = map.Map; } else { ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one"); HeightmapGenHills hills = new HeightmapGenHills(); blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database"); - db.Set(blank.LandMap); + MapStorage map= new MapStorage(); + map.Map = blank.LandMap; + db.Set(map); db.Commit(); } return blank; @@ -143,4 +146,14 @@ namespace Db40SimConfig db.Close(); } } + + public class MapStorage + { + public float[] Map; + + public MapStorage() + { + + } + } } -- cgit v1.1