aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2011-01-28 02:36:20 +0000
committerMelanie2011-01-28 02:36:20 +0000
commit3f200da8781a91ced8733bd4bac3ee17ae2de518 (patch)
tree5a28bcf8726927dbaafd659a36f70e490aaea99b /OpenSim/Region/CoreModules
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-3f200da8781a91ced8733bd4bac3ee17ae2de518.zip
opensim-SC-3f200da8781a91ced8733bd4bac3ee17ae2de518.tar.gz
opensim-SC-3f200da8781a91ced8733bd4bac3ee17ae2de518.tar.bz2
opensim-SC-3f200da8781a91ced8733bd4bac3ee17ae2de518.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs72
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs24
3 files changed, 80 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 29d0713..b1dec4c 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -217,31 +217,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
217 m_scene.DeleteAllSceneObjects(); 217 m_scene.DeleteAllSceneObjects();
218 } 218 }
219 219
220 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid 220 LoadParcels(serialisedParcels);
221 // otherwise, use the master avatar uuid instead 221 LoadObjects(serialisedSceneObjects);
222 222
223 // Reload serialized parcels 223 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
224 m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count);
225 List<LandData> landData = new List<LandData>();
226 foreach (string serialisedParcel in serialisedParcels)
227 {
228 LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
229 if (!ResolveUserUuid(parcel.OwnerID))
230 parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
231
232// m_log.DebugFormat(
233// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}",
234// parcel.Name, parcel.LocalID, parcel.Area);
235
236 landData.Add(parcel);
237 }
238
239 if (!m_merge)
240 m_scene.LandChannel.Clear(false);
241
242 m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
243 m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
244 224
225 m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
226 }
227
228 /// <summary>
229 /// Load serialized scene objects.
230 /// </summary>
231 /// <param name="serialisedSceneObjects"></param>
232 protected void LoadObjects(List<string> serialisedSceneObjects)
233 {
245 // Reload serialized prims 234 // Reload serialized prims
246 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); 235 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
247 236
@@ -271,6 +260,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
271 // to the same scene (when this is possible). 260 // to the same scene (when this is possible).
272 sceneObject.ResetIDs(); 261 sceneObject.ResetIDs();
273 262
263 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
264 // or creator data is present. Otherwise, use the estate owner instead.
274 foreach (SceneObjectPart part in sceneObject.Parts) 265 foreach (SceneObjectPart part in sceneObject.Parts)
275 { 266 {
276 if (part.CreatorData == null || part.CreatorData == string.Empty) 267 if (part.CreatorData == null || part.CreatorData == string.Empty)
@@ -345,11 +336,36 @@ namespace OpenSim.Region.CoreModules.World.Archiver
345 int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount; 336 int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount;
346 337
347 if (ignoredObjects > 0) 338 if (ignoredObjects > 0)
348 m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); 339 m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects);
349 340 }
350 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); 341
351 342 /// <summary>
352 m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); 343 /// Load serialized parcels.
344 /// </summary>
345 /// <param name="serialisedParcels"></param>
346 protected void LoadParcels(List<string> serialisedParcels)
347 {
348 // Reload serialized parcels
349 m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count);
350 List<LandData> landData = new List<LandData>();
351 foreach (string serialisedParcel in serialisedParcels)
352 {
353 LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
354 if (!ResolveUserUuid(parcel.OwnerID))
355 parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
356
357// m_log.DebugFormat(
358// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}",
359// parcel.Name, parcel.LocalID, parcel.Area);
360
361 landData.Add(parcel);
362 }
363
364 if (!m_merge)
365 m_scene.LandChannel.Clear(false);
366
367 m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
368 m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
353 } 369 }
354 370
355 /// <summary> 371 /// <summary>
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index a4e85d6..9bcaf32 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -759,10 +759,10 @@ namespace OpenSim.Region.CoreModules.World.Land
759 { 759 {
760 try 760 try
761 { 761 {
762 if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) 762 //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
763 return m_landList[m_landIDList[x / 4, y / 4]]; 763 return m_landList[m_landIDList[x / 4, y / 4]];
764 else 764 //else
765 return null; 765 // return null;
766 } 766 }
767 catch (IndexOutOfRangeException) 767 catch (IndexOutOfRangeException)
768 { 768 {
@@ -1995,9 +1995,21 @@ namespace OpenSim.Region.CoreModules.World.Land
1995 1995
1996 protected void ClearCommand(Object[] args) 1996 protected void ClearCommand(Object[] args)
1997 { 1997 {
1998 Clear(true); 1998 string response = MainConsole.Instance.CmdPrompt(
1999 string.Format(
2000 "Are you sure that you want to clear all land parcels from {0} (y or n)",
2001 m_scene.RegionInfo.RegionName),
2002 "n");
1999 2003
2000 MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); 2004 if (response.ToLower() == "y")
2005 {
2006 Clear(true);
2007 MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName);
2008 }
2009 else
2010 {
2011 MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.RegionInfo.RegionName);
2012 }
2001 } 2013 }
2002 2014
2003 protected void ShowParcelsCommand(Object[] args) 2015 protected void ShowParcelsCommand(Object[] args)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 7723eb4..b114db1 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -66,6 +66,13 @@ namespace OpenSim.Region.CoreModules.World.Land
66 66
67 #region ILandObject Members 67 #region ILandObject Members
68 68
69 public int GetPrimsFree()
70 {
71 m_scene.EventManager.TriggerParcelPrimCountUpdate();
72 int free = GetSimulatorMaxPrimCount(this) - m_landData.SimwidePrims;
73 return free;
74 }
75
69 public LandData LandData 76 public LandData LandData
70 { 77 {
71 get { return m_landData; } 78 get { return m_landData; }
@@ -141,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land
141 /// <returns>Returns true if the piece of land contains the specified point</returns> 148 /// <returns>Returns true if the piece of land contains the specified point</returns>
142 public bool ContainsPoint(int x, int y) 149 public bool ContainsPoint(int x, int y)
143 { 150 {
144 if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize) 151 if (x >= 0 && y >= 0 && x < Constants.RegionSize && y < Constants.RegionSize)
145 { 152 {
146 return (LandBitmap[x / 4, y / 4] == true); 153 return (LandBitmap[x / 4, y / 4] == true);
147 } 154 }
@@ -183,7 +190,11 @@ namespace OpenSim.Region.CoreModules.World.Land
183 else 190 else
184 { 191 {
185 // Normal Calculations 192 // Normal Calculations
186 return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 193 int parcelMax = (int)(((float)LandData.Area / 65536.0f)
194 * (float)m_scene.RegionInfo.ObjectCapacity
195 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
196 // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL!
197 return parcelMax;
187 } 198 }
188 } 199 }
189 public int GetSimulatorMaxPrimCount(ILandObject thisObject) 200 public int GetSimulatorMaxPrimCount(ILandObject thisObject)
@@ -195,7 +206,9 @@ namespace OpenSim.Region.CoreModules.World.Land
195 else 206 else
196 { 207 {
197 //Normal Calculations 208 //Normal Calculations
198 return m_scene.RegionInfo.ObjectCapacity; 209 int simMax = (int)(((float)LandData.SimwideArea / 65536.0f)
210 * (float)m_scene.RegionInfo.ObjectCapacity);
211 return simMax;
199 } 212 }
200 } 213 }
201 #endregion 214 #endregion
@@ -369,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.Land
369 newData.AuthBuyerID = UUID.Zero; 382 newData.AuthBuyerID = UUID.Zero;
370 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 383 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
371 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 384 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
372 385 m_scene.EventManager.TriggerParcelPrimCountUpdate();
373 SendLandUpdateToAvatarsOverMe(true); 386 SendLandUpdateToAvatarsOverMe(true);
374 } 387 }
375 388
@@ -384,7 +397,7 @@ namespace OpenSim.Region.CoreModules.World.Land
384 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 397 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
385 398
386 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 399 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
387 400 m_scene.EventManager.TriggerParcelPrimCountUpdate();
388 SendLandUpdateToAvatarsOverMe(true); 401 SendLandUpdateToAvatarsOverMe(true);
389 } 402 }
390 403
@@ -485,6 +498,7 @@ namespace OpenSim.Region.CoreModules.World.Land
485 498
486 public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client) 499 public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client)
487 { 500 {
501 m_scene.EventManager.TriggerParcelPrimCountUpdate();
488 SendLandProperties(0, snap_selection, 0, remote_client); 502 SendLandProperties(0, snap_selection, 0, remote_client);
489 } 503 }
490 504