diff options
Diffstat (limited to 'OpenSim/Region/Environment')
6 files changed, 85 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs b/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs index 0db1294..952ca0a 100644 --- a/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs +++ b/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs | |||
@@ -36,5 +36,7 @@ namespace OpenSim.Region.Environment.Interfaces | |||
36 | double[,] GetDoubles(); | 36 | double[,] GetDoubles(); |
37 | bool Tainted(int x, int y); | 37 | bool Tainted(int x, int y); |
38 | ITerrainChannel MakeCopy(); | 38 | ITerrainChannel MakeCopy(); |
39 | string SaveToXmlString(); | ||
40 | void LoadFromXmlString(string data); | ||
39 | } | 41 | } |
40 | } | 42 | } |
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs index b22ca79..0944406 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -523,7 +523,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
523 | { | 523 | { |
524 | if (upd.AgentOnline) | 524 | if (upd.AgentOnline) |
525 | { | 525 | { |
526 | RegionInfo reginfo = m_scenes[0].CommsManager.GridService.RequestNeighbourInfo(upd.Handle); | 526 | RegionInfo reginfo = m_scenes[0].SceneGridService.RequestNeighbouringRegionInfo(upd.Handle); |
527 | if (reginfo != null) | 527 | if (reginfo != null) |
528 | { | 528 | { |
529 | GridInstantMessage msg = new GridInstantMessage(); | 529 | GridInstantMessage msg = new GridInstantMessage(); |
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index eccaa78..a851cad 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | |||
@@ -950,8 +950,6 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
950 | 950 | ||
951 | return true; | 951 | return true; |
952 | } | 952 | } |
953 | |||
954 | |||
955 | } | 953 | } |
956 | 954 | ||
957 | } | 955 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs index 1399960..53d03fc 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs | |||
@@ -27,6 +27,11 @@ | |||
27 | 27 | ||
28 | using OpenSim.Framework; | 28 | using OpenSim.Framework; |
29 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
30 | using System; | ||
31 | using System.Text; | ||
32 | using System.Xml; | ||
33 | using System.IO; | ||
34 | using System.Xml.Serialization; | ||
30 | 35 | ||
31 | namespace OpenSim.Region.Environment.Modules.World.Terrain | 36 | namespace OpenSim.Region.Environment.Modules.World.Terrain |
32 | { | 37 | { |
@@ -151,5 +156,75 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
151 | 156 | ||
152 | return copy; | 157 | return copy; |
153 | } | 158 | } |
159 | |||
160 | public string SaveToXmlString() | ||
161 | { | ||
162 | XmlWriterSettings settings = new XmlWriterSettings(); | ||
163 | settings.Encoding = Encoding.UTF8; | ||
164 | using (StringWriter sw = new StringWriter()) | ||
165 | { | ||
166 | using (XmlWriter writer = XmlWriter.Create(sw, settings)) | ||
167 | { | ||
168 | WriteXml(writer); | ||
169 | } | ||
170 | string output = sw.ToString(); | ||
171 | return output; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | private void WriteXml(XmlWriter writer) | ||
176 | { | ||
177 | writer.WriteStartElement(String.Empty, "TerrainMap", String.Empty); | ||
178 | ToXml(writer); | ||
179 | writer.WriteEndElement(); | ||
180 | } | ||
181 | |||
182 | public void LoadFromXmlString(string data) | ||
183 | { | ||
184 | StringReader sr = new StringReader(data); | ||
185 | XmlTextReader reader = new XmlTextReader(sr); | ||
186 | reader.Read(); | ||
187 | |||
188 | ReadXml(reader); | ||
189 | reader.Close(); | ||
190 | sr.Close(); | ||
191 | } | ||
192 | |||
193 | private void ReadXml(XmlReader reader) | ||
194 | { | ||
195 | reader.ReadStartElement("TerrainMap"); | ||
196 | FromXml(reader); | ||
197 | } | ||
198 | |||
199 | private void ToXml(XmlWriter xmlWriter) | ||
200 | { | ||
201 | float[] mapData = GetFloatsSerialised(); | ||
202 | byte[] buffer = new byte[mapData.Length * 4]; | ||
203 | for (int i = 0; i < mapData.Length; i++) | ||
204 | { | ||
205 | byte[] value = BitConverter.GetBytes(mapData[i]); | ||
206 | Array.Copy(value, 0, buffer, (i * 4), 4); | ||
207 | } | ||
208 | XmlSerializer serializer = new XmlSerializer(typeof(byte[])); | ||
209 | serializer.Serialize(xmlWriter, buffer); | ||
210 | } | ||
211 | |||
212 | private void FromXml(XmlReader xmlReader) | ||
213 | { | ||
214 | XmlSerializer serializer = new XmlSerializer(typeof(byte[])); | ||
215 | byte[] dataArray = (byte[])serializer.Deserialize(xmlReader); | ||
216 | int index = 0; | ||
217 | |||
218 | for (int y = 0; y < Height; y++) | ||
219 | { | ||
220 | for (int x = 0; x < Width; x++) | ||
221 | { | ||
222 | float value; | ||
223 | value = BitConverter.ToSingle(dataArray, index); | ||
224 | index += 4; | ||
225 | this[x, y] = (double)value; | ||
226 | } | ||
227 | } | ||
228 | } | ||
154 | } | 229 | } |
155 | } \ No newline at end of file | 230 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs index c8d2ef6..5287517 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs | |||
@@ -166,7 +166,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
166 | { | 166 | { |
167 | List<MapBlockData> mapBlocks; | 167 | List<MapBlockData> mapBlocks; |
168 | 168 | ||
169 | mapBlocks = m_scene.CommsManager.GridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8); | 169 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8); |
170 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks); | 170 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks); |
171 | 171 | ||
172 | lock (cachedMapBlocks) | 172 | lock (cachedMapBlocks) |
@@ -244,7 +244,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
244 | public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) | 244 | public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY) |
245 | { | 245 | { |
246 | List<MapBlockData> mapBlocks; | 246 | List<MapBlockData> mapBlocks; |
247 | mapBlocks = m_scene.CommsManager.GridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, minX + 4, minY + 4); | 247 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, minX + 4, minY + 4); |
248 | remoteClient.SendMapBlock(mapBlocks); | 248 | remoteClient.SendMapBlock(mapBlocks); |
249 | } | 249 | } |
250 | public Hashtable OnHTTPGetMapImage(Hashtable keysvals) | 250 | public Hashtable OnHTTPGetMapImage(Hashtable keysvals) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index bbef28f..c7de419 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -101,6 +101,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
101 | 101 | ||
102 | protected SceneCommunicationService m_sceneGridService; | 102 | protected SceneCommunicationService m_sceneGridService; |
103 | 103 | ||
104 | public SceneCommunicationService SceneGridService | ||
105 | { | ||
106 | get { return m_sceneGridService; } | ||
107 | } | ||
108 | |||
104 | /// <summary> | 109 | /// <summary> |
105 | /// Each agent has its own capabilities handler. | 110 | /// Each agent has its own capabilities handler. |
106 | /// </summary> | 111 | /// </summary> |