diff options
Diffstat (limited to 'src/Config/SimConfig')
-rw-r--r-- | src/Config/SimConfig/Db4SimConfig.cs | 19 | ||||
-rw-r--r-- | src/Config/SimConfig/SimConfig.csproj | 4 |
2 files changed, 20 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 | } |
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 @@ | |||
44 | <Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project> | 44 | <Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project> |
45 | <Name>Second-server</Name> | 45 | <Name>Second-server</Name> |
46 | </ProjectReference> | 46 | </ProjectReference> |
47 | <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj"> | ||
48 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
49 | <Name>GridInterfaces</Name> | ||
50 | </ProjectReference> | ||
47 | </ItemGroup> | 51 | </ItemGroup> |
48 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | 52 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
49 | </Project> \ No newline at end of file | 53 | </Project> \ No newline at end of file |