From d0cb4fc3262df2afe2ef34396c7960f7afee6b89 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 25 Feb 2013 23:04:38 +0000 Subject: Move map related settings from [Startup] to a new [Map] section in OpenSim.ini Existing map settings in [Startup] will continue to work, and if present will override anything in [Map] However, the proper place for such settings would now be [Map] This is to reduce the use of [Startup] as a bag for non-generic settings which should really go in sections, in common with other settings. This commit also extends Diva's previous work to allow a default setting to be given when looking at multiple sections for settings. --- .../CoreModules/Hypergrid/HGWorldMapModule.cs | 4 ++-- .../CoreModules/World/LegacyMap/MapImageModule.cs | 24 +++++++++------------- .../World/Warp3DMap/Warp3DImageModule.cs | 20 ++++++++---------- .../CoreModules/World/WorldMap/WorldMapModule.cs | 9 +++++--- OpenSim/Region/Framework/Scenes/Scene.cs | 11 ++++++++-- 5 files changed, 35 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index e0921ad..c4255b9 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs @@ -52,8 +52,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid public override void Initialise(IConfigSource config) { - IConfig startupConfig = config.Configs["Startup"]; - if (startupConfig.GetString("WorldMapModule", "WorldMap") == "HGWorldMap") + if (Util.GetConfigVarFromSections( + config, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap") m_Enabled = true; } diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index e7065dc..40638f8 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs @@ -80,17 +80,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap bool generateMaptiles = true; Bitmap mapbmp; - try - { - IConfig startupConfig = m_config.Configs["Startup"]; - drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume); - textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain); - generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", generateMaptiles); - } - catch - { - m_log.Warn("[MAPTILE]: Failed to load StartupConfig"); - } + string[] configSections = new string[] { "Map", "Startup" }; + + drawPrimVolume + = Util.GetConfigVarFromSections(m_config, "DrawPrimOnMapTile", configSections, drawPrimVolume); + textureTerrain + = Util.GetConfigVarFromSections(m_config, "TextureOnMapTile", configSections, textureTerrain); + generateMaptiles + = Util.GetConfigVarFromSections(m_config, "GenerateMaptiles", configSections, generateMaptiles); if (generateMaptiles) { @@ -148,9 +145,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap { m_config = source; - IConfig startupConfig = m_config.Configs["Startup"]; - if (startupConfig.GetString("MapImageModule", "MapImageModule") != - "MapImageModule") + if (Util.GetConfigVarFromSections( + m_config, "MapImageModule", new string[] { "Startup", "Map" }, "MapImageModule") != "MapImageModule") return; m_Enabled = true; diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 5e0dfa7..ed2b06a 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -71,8 +71,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap { m_config = source; - IConfig startupConfig = m_config.Configs["Startup"]; - if (startupConfig.GetString("MapImageModule", "MapImageModule") != "Warp3DImageModule") + if (Util.GetConfigVarFromSections( + m_config, "MapImageModule", new string[] { "Startup", "Map" }, "MapImageModule") != "Warp3DImageModule") return; m_Enabled = true; @@ -143,16 +143,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap bool drawPrimVolume = true; bool textureTerrain = true; - try - { - IConfig startupConfig = m_config.Configs["Startup"]; - drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume); - textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain); - } - catch - { - m_log.Warn("[WARP 3D IMAGE MODULE]: Failed to load StartupConfig"); - } + string[] configSections = new string[] { "Map", "Startup" }; + + drawPrimVolume + = Util.GetConfigVarFromSections(m_config, "DrawPrimOnMapTile", configSections, drawPrimVolume); + textureTerrain + = Util.GetConfigVarFromSections(m_config, "TextureOnMapTile", configSections, textureTerrain); m_colors.Clear(); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index e2f525c..912d50a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -86,11 +86,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap #region INonSharedRegionModule Members public virtual void Initialise (IConfigSource config) { - IConfig startupConfig = config.Configs["Startup"]; - if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap") + string[] configSections = new string[] { "Map", "Startup" }; + + if (Util.GetConfigVarFromSections( + config, "WorldMapModule", configSections, "WorldMap") == "WorldMap") m_Enabled = true; - blacklistTimeout = startupConfig.GetInt("BlacklistTimeout", 10*60) * 1000; + blacklistTimeout + = Util.GetConfigVarFromSections(config, "BlacklistTimeout", configSections, 10 * 60) * 1000; } public virtual void AddRegion (Scene scene) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9b17b7f..5b61538 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -897,7 +897,11 @@ namespace OpenSim.Region.Framework.Scenes m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); - m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); + string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; + + m_generateMaptiles + = Util.GetConfigVarFromSections(config, "GenerateMaptiles", possibleMapConfigSections, true); + if (m_generateMaptiles) { int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); @@ -911,7 +915,10 @@ namespace OpenSim.Region.Framework.Scenes } else { - string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); + string tile + = Util.GetConfigVarFromSections( + config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); + UUID tileID; if (tile != UUID.Zero.ToString() && UUID.TryParse(tile, out tileID)) -- cgit v1.1