aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
diff options
context:
space:
mode:
authorMW2007-04-02 10:46:59 +0000
committerMW2007-04-02 10:46:59 +0000
commit1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210 (patch)
tree4022048c8ad28d31a2dd9c87f27bab213a731468 /OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
parentFinished putting user server config into Db4o (diff)
downloadopensim-SC_OLD-1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210.zip
opensim-SC_OLD-1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210.tar.gz
opensim-SC_OLD-1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210.tar.bz2
opensim-SC_OLD-1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210.tar.xz
Moved database storage of the world map to the Db4LocalStorage so its in the same database as in world prims are stored.
Diffstat (limited to 'OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs')
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs47
1 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
index 93ed9cc..cdab9ba 100644
--- a/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
+++ b/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
@@ -31,6 +31,7 @@ using Db4objects.Db4o.Query;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Assets; 33using OpenSim.Framework.Assets;
34using OpenSim.Framework.Terrain;
34 35
35namespace OpenSim.Storage.LocalStorageDb4o 36namespace OpenSim.Storage.LocalStorageDb4o
36{ 37{
@@ -116,7 +117,51 @@ namespace OpenSim.Storage.LocalStorageDb4o
116 receiver.PrimFromStorage(prim); 117 receiver.PrimFromStorage(prim);
117 } 118 }
118 } 119 }
119 120
121 public float[] LoadWorld()
122 {
123 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Loading world....");
124 //World blank = new World();
125 float[] heightmap = null;
126 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Looking for a heightmap in local DB");
127 IObjectSet world_result = db.Get(typeof(MapStorage));
128 if (world_result.Count > 0)
129 {
130 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Found a heightmap in local database, loading");
131 MapStorage map = (MapStorage)world_result.Next();
132 //blank.LandMap = map.Map;
133 heightmap = map.Map;
134 }
135 else
136 {
137 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - No heightmap found, generating new one");
138 HeightmapGenHills hills = new HeightmapGenHills();
139 // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
140 heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
141 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Saving heightmap to local database");
142 MapStorage map = new MapStorage();
143 map.Map = heightmap; //blank.LandMap;
144 db.Set(map);
145 db.Commit();
146 }
147 return heightmap;
148 }
149
150 public void SaveMap(float[] heightmap)
151 {
152 IObjectSet world_result = db.Get(typeof(MapStorage));
153 if (world_result.Count > 0)
154 {
155 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SaveWorld() - updating saved copy of heightmap in local database");
156 MapStorage map = (MapStorage)world_result.Next();
157 db.Delete(map);
158 }
159 MapStorage map1 = new MapStorage();
160 map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
161 db.Set(map1);
162 db.Commit();
163 }
164
120 public void ShutDown() 165 public void ShutDown()
121 { 166 {
122 db.Commit(); 167 db.Commit();