From 0c9933fd0f68187a0150f9dfefe4748256e52849 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 23 Oct 2007 12:44:12 +0000 Subject: [PATCH] * Added "create-region" console command. Syntax: create-region * Spring cleaning. --- OpenSim/Framework/General/Types/RegionInfo.cs | 21 +++++++ OpenSim/Region/Application/OpenSimMain.cs | 62 +++++++++++-------- .../MonoSqliteDataStore.cs | 5 -- 3 files changed, 57 insertions(+), 31 deletions(-) diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs index cab6cd7b9f..49360f8832 100644 --- a/OpenSim/Framework/General/Types/RegionInfo.cs +++ b/OpenSim/Framework/General/Types/RegionInfo.cs @@ -131,6 +131,10 @@ namespace OpenSim.Framework.Types { return m_externalHostName; } + set + { + m_externalHostName = value; + } } protected IPEndPoint m_internalEndPoint; @@ -140,6 +144,10 @@ namespace OpenSim.Framework.Types { return m_internalEndPoint; } + set + { + m_internalEndPoint = value; + } } protected uint? m_regionLocX; @@ -149,6 +157,10 @@ namespace OpenSim.Framework.Types { return m_regionLocX.Value; } + set + { + m_regionLocX = value; + } } protected uint? m_regionLocY; @@ -158,6 +170,10 @@ namespace OpenSim.Framework.Types { return m_regionLocY.Value; } + set + { + m_regionLocY = value; + } } public ulong RegionHandle @@ -209,6 +225,11 @@ namespace OpenSim.Framework.Types { + } + + public RegionInfo() + { + } //not in use, should swap to nini though. diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 9de3831609..67713d3900 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -218,32 +218,7 @@ namespace OpenSim //Console.WriteLine("Loading region config file"); RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]); - - UDPServer udpServer; - Scene scene = SetupScene(regionInfo, out udpServer); - - m_moduleLoader.InitialiseSharedModules(scene); - MainLog.Instance.Verbose("Loading Region's Modules"); - - m_moduleLoader.PickupModules(scene, "."); - m_moduleLoader.PickupModules(scene, "ScriptEngines"); - - scene.SetModuleInterfaces(); - - // Check if we have a script engine to load - //if (m_scriptEngine != null && m_scriptEngine != "") - //{ - // OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine(m_scriptEngine); - // scene.AddScriptEngine(ScriptEngine, m_log); - //} - - //Server side object editing permissions checking - scene.PermissionsMngr.BypassPermissions = !m_permissions; - - m_sceneManager.Add(scene); - - m_udpServers.Add(udpServer); - m_regionData.Add(regionInfo); + CreateRegion(regionInfo); } m_moduleLoader.PostInitialise(); @@ -268,6 +243,37 @@ namespace OpenSim MainLog.Instance.Status("STARTUP","Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); } + public UDPServer CreateRegion(RegionInfo regionInfo) + { + UDPServer udpServer; + Scene scene = SetupScene(regionInfo, out udpServer); + + m_moduleLoader.InitialiseSharedModules(scene); + MainLog.Instance.Verbose("MODULES", "Loading Region's Modules"); + + m_moduleLoader.PickupModules(scene, "."); + m_moduleLoader.PickupModules(scene, "ScriptEngines"); + + scene.SetModuleInterfaces(); + + // Check if we have a script engine to load + //if (m_scriptEngine != null && m_scriptEngine != "") + //{ + // OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine(m_scriptEngine); + // scene.AddScriptEngine(ScriptEngine, m_log); + //} + + //Server side object editing permissions checking + scene.PermissionsMngr.BypassPermissions = !m_permissions; + + m_sceneManager.Add(scene); + + m_udpServers.Add(udpServer); + m_regionData.Add(regionInfo); + + return udpServer; + } + private static void CreateDefaultRegionInfoXml(string fileName) { new RegionInfo("DEFAULT REGION CONFIG", fileName); @@ -549,6 +555,10 @@ namespace OpenSim } break; + case "create-region": + CreateRegion(new RegionInfo(cmdparams[0], "Regions/" + cmdparams[1])).ServerListener(); + break; + case "quit": case "shutdown": Shutdown(); diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 95772dfb0d..c69200a579 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs @@ -331,11 +331,6 @@ namespace OpenSim.DataStore.MonoSqlite createCol(terrain, "Revision", typeof(System.Int32)); createCol(terrain, "Heightfield", typeof(System.Byte[])); - /* // Attempting to work out requirements to get SQLite to actually *save* the data. - createCol(terrain, "PrIndex", typeof(System.String)); - terrain.PrimaryKey = new DataColumn[] { terrain.Columns["PrIndex"] }; - */ - return terrain; }