diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index e54774b339..504f09ba5b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -391,36 +391,46 @@ namespace OpenSim.Region.CoreModules.World.Archiver xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString()); xtw.WriteElementString("id", UUID.Random().ToString()); xtw.WriteEndElement(); - - xtw.WriteElementString("assets_included", SaveAssets.ToString()); - + + xtw.WriteStartElement("region_info"); + bool isMegaregion; + Vector2 size; + IRegionCombinerModule rcMod = null; // FIXME: This is only here for regression test purposes since they do not supply a module. Need to fix // this, possibly by doing control file creation somewhere else. - if (m_module != null && m_module.RegionCombinerModule != null) - { - IRegionCombinerModule mod = m_module.RegionCombinerModule; - isMegaregion = mod.IsRootForMegaregion(m_scene.RegionInfo.RegionID); - } + if (m_module != null) + rcMod = m_module.RegionCombinerModule; + + if (rcMod != null) + isMegaregion = rcMod.IsRootForMegaregion(m_scene.RegionInfo.RegionID); else - { isMegaregion = false; - } - + + if (isMegaregion) + size = rcMod.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); + else + size = new Vector2((float)Constants.RegionSize, (float)Constants.RegionSize); + xtw.WriteElementString("is_megaregion", isMegaregion.ToString()); + xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); + + xtw.WriteEndElement(); + xtw.WriteElementString("assets_included", SaveAssets.ToString()); + xtw.WriteEndElement(); xtw.Flush(); - xtw.Close(); } s = sw.ToString(); } -// Console.WriteLine( -// "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s); + if (m_scene != null) + Console.WriteLine( + "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s); return s; } diff --git a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs index ca4ed5cb2e..e03ac5a26f 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs @@ -40,6 +40,20 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Does the given id belong to the root region of a megaregion? /// - bool IsRootForMegaregion(UUID sceneId); + bool IsRootForMegaregion(UUID regionId); + + /// + /// Gets the size of megaregion. + /// + /// + /// Returns size in meters. + /// Do not rely on this method remaining the same - this area is actively under development. + /// + /// + /// The id of the root region for a megaregion. + /// This may change in the future to allow any region id that makes up a megaregion. + /// Currently, will throw an exception if this does not match a root region. + /// + Vector2 GetSizeOfMegaregion(UUID regionId); } } \ No newline at end of file diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 81ed3394e3..98becce8ba 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -113,10 +113,25 @@ namespace OpenSim.Region.RegionCombinerModule } } - public bool IsRootForMegaregion(UUID sceneId) + public bool IsRootForMegaregion(UUID regionId) { lock (m_regions) - return m_regions.ContainsKey(sceneId); + return m_regions.ContainsKey(regionId); + } + + public Vector2 GetSizeOfMegaregion(UUID regionId) + { + lock (m_regions) + { + if (m_regions.ContainsKey(regionId)) + { + RegionConnections rootConn = m_regions[regionId]; + + return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd); + } + } + + throw new Exception(string.Format("Region with id {0} not found", regionId)); } private void NewPresence(ScenePresence presence)