aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/Config/SimConfig/Db4SimConfig.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Config/SimConfig/Db4SimConfig.cs19
1 files changed, 16 insertions, 3 deletions
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
111 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world...."); 111 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
112 World blank = new World(); 112 World blank = new World();
113 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB"); 113 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
114 IObjectSet world_result = db.Get(new float[65536]); 114 IObjectSet world_result = db.Get(typeof(MapStorage));
115 if(world_result.Count>0) { 115 if(world_result.Count>0) {
116 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading"); 116 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
117 blank.LandMap=(float[])world_result.Next(); 117 MapStorage map=(MapStorage)world_result.Next();
118 blank.LandMap = map.Map;
118 } else { 119 } else {
119 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one"); 120 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
120 HeightmapGenHills hills = new HeightmapGenHills(); 121 HeightmapGenHills hills = new HeightmapGenHills();
121 blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); 122 blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
122 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database"); 123 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
123 db.Set(blank.LandMap); 124 MapStorage map= new MapStorage();
125 map.Map = blank.LandMap;
126 db.Set(map);
124 db.Commit(); 127 db.Commit();
125 } 128 }
126 return blank; 129 return blank;
@@ -143,4 +146,14 @@ namespace Db40SimConfig
143 db.Close(); 146 db.Close();
144 } 147 }
145 } 148 }
149
150 public class MapStorage
151 {
152 public float[] Map;
153
154 public MapStorage()
155 {
156
157 }
158 }
146} 159}