diff options
author | Oren Hurvitz | 2012-05-03 19:38:35 +0300 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-14 19:59:45 +0100 |
commit | 52a32878a9573681e3b56d0151c4a0903719eadf (patch) | |
tree | a9c5df6d7a47b56e0acac6a9bd3b3bdee1e257c5 /OpenSim/Framework/Serialization | |
parent | set executable bit for Ionic.Zip.dll for running OpenSimulator under cygwin (diff) | |
download | opensim-SC-52a32878a9573681e3b56d0151c4a0903719eadf.zip opensim-SC-52a32878a9573681e3b56d0151c4a0903719eadf.tar.gz opensim-SC-52a32878a9573681e3b56d0151c4a0903719eadf.tar.bz2 opensim-SC-52a32878a9573681e3b56d0151c4a0903719eadf.tar.xz |
Save the Telehub and its Spawn Points in the OAR
Diffstat (limited to 'OpenSim/Framework/Serialization')
-rw-r--r-- | OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs | 37 | ||||
-rw-r--r-- | OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs | 8 |
2 files changed, 43 insertions, 2 deletions
diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index 931898c..f18435d 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs | |||
@@ -30,6 +30,8 @@ using System.Text; | |||
30 | using System.Xml; | 30 | using System.Xml; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using log4net; | ||
34 | using System.Reflection; | ||
33 | 35 | ||
34 | namespace OpenSim.Framework.Serialization.External | 36 | namespace OpenSim.Framework.Serialization.External |
35 | { | 37 | { |
@@ -187,7 +189,29 @@ namespace OpenSim.Framework.Serialization.External | |||
187 | break; | 189 | break; |
188 | } | 190 | } |
189 | } | 191 | } |
190 | 192 | ||
193 | xtr.ReadEndElement(); | ||
194 | |||
195 | if (xtr.IsStartElement("Telehub")) | ||
196 | { | ||
197 | xtr.ReadStartElement("Telehub"); | ||
198 | |||
199 | while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) | ||
200 | { | ||
201 | switch (xtr.Name) | ||
202 | { | ||
203 | case "TelehubObject": | ||
204 | settings.TelehubObject = UUID.Parse(xtr.ReadElementContentAsString()); | ||
205 | break; | ||
206 | case "SpawnPoint": | ||
207 | string str = xtr.ReadElementContentAsString(); | ||
208 | SpawnPoint sp = SpawnPoint.Parse(str); | ||
209 | settings.AddSpawnPoint(sp); | ||
210 | break; | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | |||
191 | xtr.Close(); | 215 | xtr.Close(); |
192 | sr.Close(); | 216 | sr.Close(); |
193 | 217 | ||
@@ -243,7 +267,16 @@ namespace OpenSim.Framework.Serialization.External | |||
243 | xtw.WriteElementString("SunPosition", settings.SunPosition.ToString()); | 267 | xtw.WriteElementString("SunPosition", settings.SunPosition.ToString()); |
244 | // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which | 268 | // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which |
245 | // calculates it automatically according to the date and other factors. | 269 | // calculates it automatically according to the date and other factors. |
246 | xtw.WriteEndElement(); | 270 | xtw.WriteEndElement(); |
271 | |||
272 | xtw.WriteStartElement("Telehub"); | ||
273 | if (settings.TelehubObject != UUID.Zero) | ||
274 | { | ||
275 | xtw.WriteElementString("TelehubObject", settings.TelehubObject.ToString()); | ||
276 | foreach (SpawnPoint sp in settings.SpawnPoints()) | ||
277 | xtw.WriteElementString("SpawnPoint", sp.ToString()); | ||
278 | } | ||
279 | xtw.WriteEndElement(); | ||
247 | 280 | ||
248 | xtw.WriteEndElement(); | 281 | xtw.WriteEndElement(); |
249 | 282 | ||
diff --git a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs index a61e4af..09b6f6d 100644 --- a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs | |||
@@ -78,6 +78,10 @@ namespace OpenSim.Framework.Serialization.Tests | |||
78 | <FixedSun>true</FixedSun> | 78 | <FixedSun>true</FixedSun> |
79 | <SunPosition>12</SunPosition> | 79 | <SunPosition>12</SunPosition> |
80 | </Terrain> | 80 | </Terrain> |
81 | <Telehub> | ||
82 | <TelehubObject>00000000-0000-0000-0000-111111111111</TelehubObject> | ||
83 | <SpawnPoint>1,-2,0.33</SpawnPoint> | ||
84 | </Telehub> | ||
81 | </RegionSettings>"; | 85 | </RegionSettings>"; |
82 | 86 | ||
83 | private RegionSettings m_rs; | 87 | private RegionSettings m_rs; |
@@ -116,6 +120,8 @@ namespace OpenSim.Framework.Serialization.Tests | |||
116 | m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); | 120 | m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); |
117 | m_rs.UseEstateSun = true; | 121 | m_rs.UseEstateSun = true; |
118 | m_rs.WaterHeight = 23; | 122 | m_rs.WaterHeight = 23; |
123 | m_rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111"); | ||
124 | m_rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33")); | ||
119 | } | 125 | } |
120 | 126 | ||
121 | [Test] | 127 | [Test] |
@@ -129,6 +135,8 @@ namespace OpenSim.Framework.Serialization.Tests | |||
129 | Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2)); | 135 | Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2)); |
130 | Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics)); | 136 | Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics)); |
131 | Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit)); | 137 | Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit)); |
138 | Assert.That(deserRs.TelehubObject, Is.EqualTo(m_rs.TelehubObject)); | ||
139 | Assert.That(deserRs.SpawnPoints()[0].ToString(), Is.EqualTo(m_rs.SpawnPoints()[0].ToString())); | ||
132 | } | 140 | } |
133 | } | 141 | } |
134 | } | 142 | } |