From eb5a02298140d5ea23d7e47bcadc084d43a82075 Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 16 Jan 2009 12:52:05 +0000 Subject: Added some basic relocation mapping support for when loading hypergrid links from a xml file. Console Command: link-mapping . This results in only the last two digits of any of the locations defined in the xml file being used, and those 0-99 values being added to the StartXloc and StartYloc figures. For more infomation, see the email on the mailing list and the soon to be added instructions on the wiki's hypergrid page. Also made the Secion Names in xml file case insensitive. --- OpenSim/Region/Application/HGOpenSimNode.cs | 36 +++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Application') diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index f46c9e3..6a525be 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs @@ -57,6 +57,10 @@ namespace OpenSim private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IHyperlink HGServices = null; + private uint m_autoMappingX = 0; + private uint m_autoMappingY = 0; + private bool m_enableAutoMapping = false; + public HGOpenSimNode(IConfigSource configSource) : base(configSource) { } @@ -140,7 +144,25 @@ namespace OpenSim public override void RunCmd(string command, string[] cmdparams) { - if (command.Equals("link-region")) + if (command.Equals("link-mapping")) + { + if (cmdparams.Length == 2) + { + try + { + m_autoMappingX = Convert.ToUInt32(cmdparams[0]); + m_autoMappingY = Convert.ToUInt32(cmdparams[1]); + m_enableAutoMapping = true; + } + catch (Exception) + { + m_autoMappingX = 0; + m_autoMappingY = 0; + m_enableAutoMapping = false; + } + } + } + else if (command.Equals("link-region")) { // link-region if (cmdparams.Length < 4) @@ -203,9 +225,9 @@ namespace OpenSim if (cmdparams.Length == 2) { - if (cmdparams[1].StartsWith("excludeList:")) + if (cmdparams[1].ToLower().StartsWith("excludelist:")) { - string excludeString = cmdparams[1]; + string excludeString = cmdparams[1].ToLower(); excludeString = excludeString.Remove(0, 12); char[] splitter = { ';' }; @@ -220,7 +242,7 @@ namespace OpenSim { for (int n = 0; n < excludeSections.Length; n++) { - if (excludeSections[n] == cs.Configs[i].Name) + if (excludeSections[n] == cs.Configs[i].Name.ToLower()) { skip = true; break; @@ -251,6 +273,12 @@ namespace OpenSim externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); externalHostName = config.GetString("externalHostName", ""); + if (m_enableAutoMapping) + { + xloc = (uint)((xloc % 100) + m_autoMappingX); + yloc = (uint)((yloc % 100) + m_autoMappingY); + } + if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo)) { regInfo.RegionName = config.GetString("localName", ""); -- cgit v1.1