aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authormingchen2007-12-17 03:49:13 +0000
committermingchen2007-12-17 03:49:13 +0000
commitd845da215f8d30ef3f34a3c207fb892c815d1fac (patch)
treea1714f51422e4b5639d28459569d6235c86751d1 /OpenSim/Region/Environment
parentAgain, thanks to Alondria for: (diff)
downloadopensim-SC_OLD-d845da215f8d30ef3f34a3c207fb892c815d1fac.zip
opensim-SC_OLD-d845da215f8d30ef3f34a3c207fb892c815d1fac.tar.gz
opensim-SC_OLD-d845da215f8d30ef3f34a3c207fb892c815d1fac.tar.bz2
opensim-SC_OLD-d845da215f8d30ef3f34a3c207fb892c815d1fac.tar.xz
*Land has now been linked to the StorageManager. Next step is to fill in the functions for the different datastore interfaces for Land Objects.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs6
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs69
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs65
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs26
4 files changed, 123 insertions, 43 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
index 9c2edb9..919cfdc 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
@@ -50,9 +50,9 @@ namespace OpenSim.Region.Environment.Interfaces
50 void StoreTerrain(double[,] terrain, LLUUID regionID); 50 void StoreTerrain(double[,] terrain, LLUUID regionID);
51 double[,] LoadTerrain(LLUUID regionID); 51 double[,] LoadTerrain(LLUUID regionID);
52 52
53 void StoreParcel(Land Parcel); 53 void StoreLandObject(Land Parcel,LLUUID regionUUID);
54 void RemoveLandObject(uint ID); 54 void RemoveLandObject(uint ID, LLUUID regionUUID);
55 List<Land> LoadLandObjects(); 55 List<Framework.LandData> LoadLandObjects(LLUUID regionUUID);
56 56
57 void Shutdown(); 57 void Shutdown();
58 } 58 }
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 45e8aac..3f60b1b 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -32,6 +32,7 @@ using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
35using OpenSim.Region.Environment.Interfaces;
35 36
36namespace OpenSim.Region.Environment.LandManagement 37namespace OpenSim.Region.Environment.LandManagement
37{ 38{
@@ -47,7 +48,6 @@ namespace OpenSim.Region.Environment.LandManagement
47 48
48 public LandData landData = new LandData(); 49 public LandData landData = new LandData();
49 public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 50 public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
50 public List<libsecondlife.ParcelManager.ParcelAccessEntry> parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
51 public Scene m_scene; 51 public Scene m_scene;
52 52
53 private bool[,] landBitmap = new bool[64,64]; 53 private bool[,] landBitmap = new bool[64,64];
@@ -93,21 +93,12 @@ namespace OpenSim.Region.Environment.LandManagement
93 93
94 //Place all new variables here! 94 //Place all new variables here!
95 newLand.landBitmap = (bool[,]) (landBitmap.Clone()); 95 newLand.landBitmap = (bool[,]) (landBitmap.Clone());
96 newLand.parcelAccessList.Clear();
97 foreach (ParcelManager.ParcelAccessEntry entry in parcelAccessList)
98 {
99 ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry();
100 newEntry.AgentID = entry.AgentID;
101 newEntry.Flags = entry.Flags;
102 newEntry.Time = entry.Time;
103
104 newLand.parcelAccessList.Add(newEntry);
105 }
106 newLand.landData = landData.Copy(); 96 newLand.landData = landData.Copy();
107 97
108 return newLand; 98 return newLand;
109 } 99 }
110 100
101
111 #endregion 102 #endregion
112 103
113 #region Packet Request Handling 104 #region Packet Request Handling
@@ -209,24 +200,30 @@ namespace OpenSim.Region.Environment.LandManagement
209 if (remote_client.AgentId == landData.ownerID) 200 if (remote_client.AgentId == landData.ownerID)
210 { 201 {
211 //Needs later group support 202 //Needs later group support
212 landData.authBuyerID = packet.ParcelData.AuthBuyerID; 203 LandData newData = landData.Copy();
213 landData.category = (Parcel.ParcelCategory) packet.ParcelData.Category; 204 newData.authBuyerID = packet.ParcelData.AuthBuyerID;
214 landData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); 205 newData.category = (Parcel.ParcelCategory)packet.ParcelData.Category;
215 landData.groupID = packet.ParcelData.GroupID; 206 newData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc);
216 landData.landingType = packet.ParcelData.LandingType; 207 newData.groupID = packet.ParcelData.GroupID;
217 landData.mediaAutoScale = packet.ParcelData.MediaAutoScale; 208 newData.landingType = packet.ParcelData.LandingType;
218 landData.mediaID = packet.ParcelData.MediaID; 209 newData.mediaAutoScale = packet.ParcelData.MediaAutoScale;
219 landData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); 210 newData.mediaID = packet.ParcelData.MediaID;
220 landData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); 211 newData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL);
221 landData.landName = Helpers.FieldToUTF8String(packet.ParcelData.Name); 212 newData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL);
222 landData.landFlags = packet.ParcelData.ParcelFlags; 213 newData.landName = Helpers.FieldToUTF8String(packet.ParcelData.Name);
223 landData.passHours = packet.ParcelData.PassHours; 214 newData.landFlags = packet.ParcelData.ParcelFlags;
224 landData.passPrice = packet.ParcelData.PassPrice; 215 newData.passHours = packet.ParcelData.PassHours;
225 landData.salePrice = packet.ParcelData.SalePrice; 216 newData.passPrice = packet.ParcelData.PassPrice;
226 landData.snapshotID = packet.ParcelData.SnapshotID; 217 newData.salePrice = packet.ParcelData.SalePrice;
227 landData.userLocation = packet.ParcelData.UserLocation; 218 newData.snapshotID = packet.ParcelData.SnapshotID;
228 landData.userLookAt = packet.ParcelData.UserLookAt; 219 newData.userLocation = packet.ParcelData.UserLocation;
220 newData.userLookAt = packet.ParcelData.UserLookAt;
221
222 m_scene.LandManager.updateLandObject(landData.localID, newData);
223
229 sendLandUpdateToAvatarsOverMe(); 224 sendLandUpdateToAvatarsOverMe();
225
226
230 } 227 }
231 } 228 }
232 229
@@ -257,7 +254,7 @@ namespace OpenSim.Region.Environment.LandManagement
257 public ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag) 254 public ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag)
258 { 255 {
259 List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); 256 List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>();
260 foreach (ParcelManager.ParcelAccessEntry entry in parcelAccessList) 257 foreach (ParcelManager.ParcelAccessEntry entry in landData.parcelAccessList)
261 { 258 {
262 if (entry.Flags == flag) 259 if (entry.Flags == flag)
263 { 260 {
@@ -317,13 +314,15 @@ namespace OpenSim.Region.Environment.LandManagement
317 314
318 public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 315 public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
319 { 316 {
317 LandData newData = landData.Copy();
318
320 if (entries.Count == 1 && entries[0].AgentID == LLUUID.Zero) 319 if (entries.Count == 1 && entries[0].AgentID == LLUUID.Zero)
321 { 320 {
322 entries.Clear(); 321 entries.Clear();
323 } 322 }
324 323
325 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); 324 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>();
326 foreach (ParcelManager.ParcelAccessEntry entry in parcelAccessList) 325 foreach (ParcelManager.ParcelAccessEntry entry in newData.parcelAccessList)
327 { 326 {
328 if (entry.Flags == (ParcelManager.AccessList)flags) 327 if (entry.Flags == (ParcelManager.AccessList)flags)
329 { 328 {
@@ -333,7 +332,7 @@ namespace OpenSim.Region.Environment.LandManagement
333 332
334 foreach (ParcelManager.ParcelAccessEntry entry in toRemove) 333 foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
335 { 334 {
336 parcelAccessList.Remove(entry); 335 newData.parcelAccessList.Remove(entry);
337 } 336 }
338 foreach (ParcelManager.ParcelAccessEntry entry in entries) 337 foreach (ParcelManager.ParcelAccessEntry entry in entries)
339 { 338 {
@@ -342,11 +341,14 @@ namespace OpenSim.Region.Environment.LandManagement
342 temp.Time = new DateTime() ; //Pointless? Yes. 341 temp.Time = new DateTime() ; //Pointless? Yes.
343 temp.Flags = (ParcelManager.AccessList)flags; 342 temp.Flags = (ParcelManager.AccessList)flags;
344 343
345 if (!this.parcelAccessList.Contains(temp)) 344 if (!newData.parcelAccessList.Contains(temp))
346 { 345 {
347 this.parcelAccessList.Add(temp); 346 newData.parcelAccessList.Add(temp);
348 } 347 }
349 } 348 }
349
350 m_scene.LandManager.updateLandObject(landData.localID, newData);
351
350 } 352 }
351 353
352 #endregion 354 #endregion
@@ -385,6 +387,7 @@ namespace OpenSim.Region.Environment.LandManagement
385 new LLVector3((float) (max_x*4), (float) (max_y*4), 387 new LLVector3((float) (max_x*4), (float) (max_y*4),
386 (float) m_scene.Terrain.GetHeight((max_x*4), (max_y*4))); 388 (float) m_scene.Terrain.GetHeight((max_x*4), (max_y*4)));
387 landData.area = tempArea; 389 landData.area = tempArea;
390
388 } 391 }
389 392
390 public void updateLandBitmapByteArray() 393 public void updateLandBitmapByteArray()
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
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 828cb75..8277f39 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -225,9 +225,15 @@ namespace OpenSim.Region.Environment.Scenes
225 m_physicalPrim = physicalPrim; 225 m_physicalPrim = physicalPrim;
226 m_sendTasksToChild = SendTasksToChild; 226 m_sendTasksToChild = SendTasksToChild;
227 227
228 m_eventManager = new EventManager();
229
228 m_LandManager = new LandManager(this, m_regInfo); 230 m_LandManager = new LandManager(this, m_regInfo);
231
232 //Bind Storage Manager functions to some land manager functions for this scene
233 m_LandManager.OnLandObjectAdded += new LandManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
234 m_LandManager.OnLandObjectRemoved += new LandManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
235
229 m_estateManager = new EstateManager(this, m_regInfo); 236 m_estateManager = new EstateManager(this, m_regInfo);
230 m_eventManager = new EventManager();
231 237
232 m_permissionManager = permissionManager; 238 m_permissionManager = permissionManager;
233 m_permissionManager.Initialise(this); 239 m_permissionManager.Initialise(this);
@@ -833,6 +839,24 @@ namespace OpenSim.Region.Environment.Scenes
833 839
834 #endregion 840 #endregion
835 841
842 #region Load Land
843
844 public void loadAllLandObjectsFromStorage()
845 {
846 MainLog.Instance.Verbose("SCENE", "Loading land objects from storage");
847 List<Framework.LandData> landData = m_storageManager.DataStore.LoadLandObjects(RegionInfo.RegionID);
848 if (landData.Count == 0)
849 {
850 m_LandManager.NoLandDataFromStorage();
851 }
852 else
853 {
854 m_LandManager.IncomingLandObjectsFromStorage(landData);
855 }
856 }
857
858 #endregion
859
836 #region Primitives Methods 860 #region Primitives Methods
837 861
838 /// <summary> 862 /// <summary>