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 ++++++++++++++++--- src/Config/SimConfig/SimConfig.csproj | 4 ++++ 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src/Config/SimConfig') 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() + { + + } + } } diff --git a/src/Config/SimConfig/SimConfig.csproj b/src/Config/SimConfig/SimConfig.csproj index 08f0f24..3131405 100644 --- a/src/Config/SimConfig/SimConfig.csproj +++ b/src/Config/SimConfig/SimConfig.csproj @@ -44,6 +44,10 @@ {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E} Second-server + + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} + GridInterfaces + \ No newline at end of file -- cgit v1.1