aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/LandManagement/LandManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/LandManagement/LandManager.cs')
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs65
1 files changed, 59 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index 0fa2c23..11845ae 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -31,6 +31,7 @@ using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.Environment.Interfaces;
34 35
35namespace OpenSim.Region.Environment.LandManagement 36namespace OpenSim.Region.Environment.LandManagement
36{ 37{
@@ -75,6 +76,34 @@ namespace OpenSim.Region.Environment.LandManagement
75 76
76 #endregion 77 #endregion
77 78
79 #region Events and Triggers
80 public delegate void LandObjectAdded(Land newParcel, LLUUID regionUUID);
81 public delegate void LandObjectRemoved(uint localParcelID, LLUUID regionUUID);
82
83 public event LandObjectAdded OnLandObjectAdded;
84 public event LandObjectRemoved OnLandObjectRemoved;
85
86 public void triggerLandObjectAdded(Land newParcel)
87 {
88 if (OnLandObjectAdded != null)
89 {
90 OnLandObjectAdded(newParcel, m_scene.RegionInfo.RegionID);
91 }
92 }
93 public void triggerLandObjectRemoved(uint localParcelID)
94 {
95 if (OnLandObjectRemoved != null)
96 {
97 OnLandObjectRemoved(localParcelID, m_scene.RegionInfo.RegionID);
98 }
99 }
100 public void triggerLandObjectUpdated(uint localParcelID, Land newParcel)
101 {
102 triggerLandObjectRemoved(localParcelID);
103 triggerLandObjectAdded(newParcel);
104 }
105
106 #endregion
78 #region Member Variables 107 #region Member Variables
79 108
80 public Dictionary<int, Land> landList = new Dictionary<int, Land>(); 109 public Dictionary<int, Land> landList = new Dictionary<int, Land>();
@@ -100,13 +129,23 @@ namespace OpenSim.Region.Environment.LandManagement
100 landIDList.Initialize(); 129 landIDList.Initialize();
101 } 130 }
102 131
103 #endregion
104 132
133
134 #endregion
135
105 #region Member Functions 136 #region Member Functions
106 137
107 #region Parcel From Storage Functions 138 #region Land Object From Storage Functions
108 139
109 public void LandFromStorage(LandData data) 140 public void IncomingLandObjectsFromStorage(List<LandData> data)
141 {
142 foreach (LandData parcel in data)
143 {
144 IncomingLandObjectFromStorage(parcel);
145 }
146 }
147
148 public void IncomingLandObjectFromStorage(LandData data)
110 { 149 {
111 Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene); 150 Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene);
112 new_land.landData = data.Copy(); 151 new_land.landData = data.Copy();
@@ -116,6 +155,7 @@ namespace OpenSim.Region.Environment.LandManagement
116 155
117 public void NoLandDataFromStorage() 156 public void NoLandDataFromStorage()
118 { 157 {
158 Console.WriteLine("No LandData in storage! Loading a single, flat parcel instead");
119 resetSimLandObjects(); 159 resetSimLandObjects();
120 } 160 }
121 161
@@ -156,7 +196,7 @@ namespace OpenSim.Region.Environment.LandManagement
156 } 196 }
157 } 197 }
158 landList[lastLandLocalID].forceUpdateLandInfo(); 198 landList[lastLandLocalID].forceUpdateLandInfo();
159 199 triggerLandObjectAdded(new_land);
160 return new_land; 200 return new_land;
161 } 201 }
162 202
@@ -177,8 +217,21 @@ namespace OpenSim.Region.Environment.LandManagement
177 } 217 }
178 } 218 }
179 } 219 }
180 // TODO: Put event here for storage manager to bind to.
181 landList.Remove(local_id); 220 landList.Remove(local_id);
221 triggerLandObjectRemoved((uint)local_id);
222 }
223
224 public void updateLandObject(int local_id, LandData newData)
225 {
226 if (landList.ContainsKey(local_id))
227 {
228 landList[local_id].landData = newData.Copy();
229 triggerLandObjectUpdated((uint)local_id, landList[local_id]);
230 }
231 else
232 {
233 throw new Exception("Could not update land object. Local ID '" + local_id + "' does not exist");
234 }
182 } 235 }
183 236
184 private void performFinalLandJoin(Land master, Land slave) 237 private void performFinalLandJoin(Land master, Land slave)
@@ -195,6 +248,7 @@ namespace OpenSim.Region.Environment.LandManagement
195 } 248 }
196 } 249 }
197 } 250 }
251
198 removeLandObject(slave.landData.localID); 252 removeLandObject(slave.landData.localID);
199 } 253 }
200 254
@@ -293,7 +347,6 @@ namespace OpenSim.Region.Environment.LandManagement
293 Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false)); 347 Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false));
294 landList[startLandObjectIndex].forceUpdateLandInfo(); 348 landList[startLandObjectIndex].forceUpdateLandInfo();
295 349
296
297 setPrimsTainted(); 350 setPrimsTainted();
298 351
299 //Now add the new land object 352 //Now add the new land object