Esempio n. 1
0
        public float[] LoadWorld()
        {
            OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Loading world....");
            //World blank = new World();
            float[] heightmap = null;
            OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Looking for a heightmap in local DB");
            IObjectSet world_result = db.Get(typeof(MapStorage));

            if (world_result.Count > 0)
            {
                OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Found a heightmap in local database, loading");
                MapStorage map = (MapStorage)world_result.Next();
                //blank.LandMap = map.Map;
                heightmap = map.Map;
            }
            else
            {
                /*
                 * OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - No heightmap found, generating new one");
                 * HeightmapGenHills hills = new HeightmapGenHills();
                 * // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
                 * // heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
                 * heightmap = new float[256, 256];
                 * OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Saving heightmap to local database");
                 * MapStorage map = new MapStorage();
                 * map.Map = heightmap; //blank.LandMap;
                 * db.Set(map);
                 * db.Commit();
                 */
            }
            return(heightmap);
        }
Esempio n. 2
0
        public void SaveMap(float[] heightmap)
        {
            IObjectSet world_result = db.Get(typeof(MapStorage));

            if (world_result.Count > 0)
            {
                OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SaveWorld() - updating saved copy of heightmap in local database");
                MapStorage map = (MapStorage)world_result.Next();
                db.Delete(map);
            }
            MapStorage map1 = new MapStorage();

            map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
            db.Set(map1);
            db.Commit();
        }
 public void SaveMap(float[] heightmap)
 {
     IObjectSet world_result = db.Get(typeof(MapStorage));
     if (world_result.Count > 0)
     {
         OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SaveWorld() - updating saved copy of heightmap in local database");
         MapStorage map = (MapStorage)world_result.Next();
         db.Delete(map);
     }
     MapStorage map1 = new MapStorage();
     map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
     db.Set(map1);
     db.Commit();
 }