aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/DataSnapshot/LandSnapshot.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/DataSnapshot/LandSnapshot.cs')
-rw-r--r--OpenSim/Region/DataSnapshot/LandSnapshot.cs71
1 files changed, 63 insertions, 8 deletions
diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
index 183c2a3..4bfa87a 100644
--- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/LandSnapshot.cs
@@ -23,7 +23,7 @@
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29using System; 29using System;
@@ -37,8 +37,9 @@ using OpenSim.Region.DataSnapshot.Interfaces;
37using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
38using OpenSim.Region.Environment.Modules.World.Land; 38using OpenSim.Region.Environment.Modules.World.Land;
39using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
40using libsecondlife.Packets;
40 41
41namespace OpenSim.Region.DataSnapshot 42namespace OpenSim.Region.DataSnapshot.Providers
42{ 43{
43 public class LandSnapshot : IDataSnapshotProvider 44 public class LandSnapshot : IDataSnapshotProvider
44 { 45 {
@@ -46,14 +47,15 @@ namespace OpenSim.Region.DataSnapshot
46 private DataSnapshotManager m_parent = null; 47 private DataSnapshotManager m_parent = null;
47 //private Dictionary<int, Land> m_landIndexed = new Dictionary<int, Land>(); 48 //private Dictionary<int, Land> m_landIndexed = new Dictionary<int, Land>();
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private bool m_stale = true;
49 51
50 #region Dead code 52 #region Dead code
51 53
52 /* 54 /*
53 * David, I don't think we need this at all. When we do the snapshot, we can 55 * David, I don't think we need this at all. When we do the snapshot, we can
54 * simply look into the parcels that are marked for ShowDirectory -- see 56 * simply look into the parcels that are marked for ShowDirectory -- see
55 * conditional in RequestSnapshotData 57 * conditional in RequestSnapshotData
56 * 58 *
57 //Revise this, look for more direct way of checking for change in land 59 //Revise this, look for more direct way of checking for change in land
58 #region Client hooks 60 #region Client hooks
59 61
@@ -106,7 +108,9 @@ namespace OpenSim.Region.DataSnapshot
106 { 108 {
107 m_scene = scene; 109 m_scene = scene;
108 m_parent = parent; 110 m_parent = parent;
109 //m_scene.EventManager.OnNewClient += OnNewClient; 111
112 //Brought back from the dead for staleness checks.
113 m_scene.EventManager.OnNewClient += OnNewClient;
110 } 114 }
111 115
112 public Scene GetParentScene 116 public Scene GetParentScene
@@ -115,7 +119,7 @@ namespace OpenSim.Region.DataSnapshot
115 } 119 }
116 120
117 public XmlNode RequestSnapshotData(XmlDocument nodeFactory) 121 public XmlNode RequestSnapshotData(XmlDocument nodeFactory)
118 { 122 {
119 ILandChannel landChannel = (LandChannel)m_scene.LandChannel; 123 ILandChannel landChannel = (LandChannel)m_scene.LandChannel;
120 Dictionary<int, ILandObject> landList = null; 124 Dictionary<int, ILandObject> landList = null;
121 try 125 try
@@ -129,7 +133,7 @@ namespace OpenSim.Region.DataSnapshot
129 } 133 }
130 catch (Exception e) 134 catch (Exception e)
131 { 135 {
132 Console.WriteLine("[DATASNAPSHOT] couldn't access field reflectively\n" + e.ToString()); 136 m_log.Error("[DATASNAPSHOT] couldn't access field reflectively\n" + e.ToString());
133 } 137 }
134 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", ""); 138 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "parceldata", "");
135 if (landList != null) 139 if (landList != null)
@@ -243,9 +247,32 @@ namespace OpenSim.Region.DataSnapshot
243 //snap.AppendChild(parent); 247 //snap.AppendChild(parent);
244 } 248 }
245 249
250 this.Stale = false;
246 return parent; 251 return parent;
247 } 252 }
248 253
254 public String Name
255 {
256 get { return "LandSnapshot"; }
257 }
258
259 public bool Stale
260 {
261 get
262 {
263 return m_stale;
264 }
265 set
266 {
267 m_stale = value;
268
269 if (m_stale)
270 OnStale(this);
271 }
272 }
273
274 public event ProviderStale OnStale;
275
249 #endregion 276 #endregion
250 277
251 #region Helper functions 278 #region Helper functions
@@ -260,5 +287,33 @@ namespace OpenSim.Region.DataSnapshot
260 } 287 }
261 288
262 #endregion 289 #endregion
290
291 #region Change detection hooks
292
293 public void OnNewClient(IClientAPI client)
294 {
295 //Land hooks
296 client.OnParcelDivideRequest += delegate (int west, int south, int east, int north,
297 IClientAPI remote_client) { this.Stale = true; };
298 client.OnParcelJoinRequest += delegate (int west, int south, int east, int north,
299 IClientAPI remote_client) { this.Stale = true; };
300 client.OnParcelPropertiesUpdateRequest += delegate(LandUpdateArgs args, int local_id,
301 IClientAPI remote_client) { this.Stale = true; };
302 client.OnParcelBuy += delegate (LLUUID agentId, LLUUID groupId, bool final, bool groupOwned,
303 bool removeContribution, int parcelLocalID, int parcelArea, int parcelPrice, bool authenticated)
304 { this.Stale = true; };
305 }
306
307 public void ParcelSplitHook(int west, int south, int east, int north, IClientAPI remote_client)
308 {
309 this.Stale = true;
310 }
311
312 public void ParcelPropsHook(LandUpdateArgs args, int local_id, IClientAPI remote_client)
313 {
314 this.Stale = true;
315 }
316
317 #endregion
263 } 318 }
264} 319} \ No newline at end of file