Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2011-01-28 02:36:20 +00:00
commit 3f200da878
6 changed files with 85 additions and 39 deletions

View File

@ -697,6 +697,8 @@ namespace OpenSim.Framework
landData._mediaLoop = _mediaLoop; landData._mediaLoop = _mediaLoop;
landData._obscureMusic = _obscureMusic; landData._obscureMusic = _obscureMusic;
landData._obscureMedia = _obscureMedia; landData._obscureMedia = _obscureMedia;
landData._simwideArea = _simwideArea;
landData._simwidePrims = _simwidePrims;
landData._parcelAccessList.Clear(); landData._parcelAccessList.Clear();
foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)

View File

@ -4398,7 +4398,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.SequenceID = sequence_id; updateMessage.SequenceID = sequence_id;
if (landData.SimwideArea > 0) if (landData.SimwideArea > 0)
{ {
updateMessage.SimWideMaxPrims = parcelObjectCapacity; int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
updateMessage.SimWideMaxPrims = simulatorCapacity;
} }
else else
{ {

View File

@ -217,31 +217,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_scene.DeleteAllSceneObjects(); m_scene.DeleteAllSceneObjects();
} }
// Try to retain the original creator/owner/lastowner if their uuid is present on this grid LoadParcels(serialisedParcels);
// otherwise, use the master avatar uuid instead LoadObjects(serialisedSceneObjects);
// Reload serialized parcels m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count);
List<LandData> landData = new List<LandData>();
foreach (string serialisedParcel in serialisedParcels)
{
LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
if (!ResolveUserUuid(parcel.OwnerID))
parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
// m_log.DebugFormat( m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}",
// parcel.Name, parcel.LocalID, parcel.Area);
landData.Add(parcel);
} }
if (!m_merge) /// <summary>
m_scene.LandChannel.Clear(false); /// Load serialized scene objects.
/// </summary>
m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData); /// <param name="serialisedSceneObjects"></param>
m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count); protected void LoadObjects(List<string> serialisedSceneObjects)
{
// Reload serialized prims // Reload serialized prims
m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
@ -271,6 +260,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// to the same scene (when this is possible). // to the same scene (when this is possible).
sceneObject.ResetIDs(); sceneObject.ResetIDs();
// Try to retain the original creator/owner/lastowner if their uuid is present on this grid
// or creator data is present. Otherwise, use the estate owner instead.
foreach (SceneObjectPart part in sceneObject.Parts) foreach (SceneObjectPart part in sceneObject.Parts)
{ {
if (part.CreatorData == null || part.CreatorData == string.Empty) if (part.CreatorData == null || part.CreatorData == string.Empty)
@ -346,10 +337,35 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (ignoredObjects > 0) if (ignoredObjects > 0)
m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects);
}
m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); /// <summary>
/// Load serialized parcels.
/// </summary>
/// <param name="serialisedParcels"></param>
protected void LoadParcels(List<string> serialisedParcels)
{
// Reload serialized parcels
m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count);
List<LandData> landData = new List<LandData>();
foreach (string serialisedParcel in serialisedParcels)
{
LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
if (!ResolveUserUuid(parcel.OwnerID))
parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); // m_log.DebugFormat(
// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}",
// parcel.Name, parcel.LocalID, parcel.Area);
landData.Add(parcel);
}
if (!m_merge)
m_scene.LandChannel.Clear(false);
m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
} }
/// <summary> /// <summary>

View File

@ -759,10 +759,10 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
try try
{ {
if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
return m_landList[m_landIDList[x / 4, y / 4]]; return m_landList[m_landIDList[x / 4, y / 4]];
else //else
return null; // return null;
} }
catch (IndexOutOfRangeException) catch (IndexOutOfRangeException)
{ {
@ -1995,10 +1995,22 @@ namespace OpenSim.Region.CoreModules.World.Land
protected void ClearCommand(Object[] args) protected void ClearCommand(Object[] args)
{ {
Clear(true); string response = MainConsole.Instance.CmdPrompt(
string.Format(
"Are you sure that you want to clear all land parcels from {0} (y or n)",
m_scene.RegionInfo.RegionName),
"n");
if (response.ToLower() == "y")
{
Clear(true);
MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName);
} }
else
{
MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.RegionInfo.RegionName);
}
}
protected void ShowParcelsCommand(Object[] args) protected void ShowParcelsCommand(Object[] args)
{ {

View File

@ -66,6 +66,13 @@ namespace OpenSim.Region.CoreModules.World.Land
#region ILandObject Members #region ILandObject Members
public int GetPrimsFree()
{
m_scene.EventManager.TriggerParcelPrimCountUpdate();
int free = GetSimulatorMaxPrimCount(this) - m_landData.SimwidePrims;
return free;
}
public LandData LandData public LandData LandData
{ {
get { return m_landData; } get { return m_landData; }
@ -141,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <returns>Returns true if the piece of land contains the specified point</returns> /// <returns>Returns true if the piece of land contains the specified point</returns>
public bool ContainsPoint(int x, int y) public bool ContainsPoint(int x, int y)
{ {
if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize) if (x >= 0 && y >= 0 && x < Constants.RegionSize && y < Constants.RegionSize)
{ {
return (LandBitmap[x / 4, y / 4] == true); return (LandBitmap[x / 4, y / 4] == true);
} }
@ -183,7 +190,11 @@ namespace OpenSim.Region.CoreModules.World.Land
else else
{ {
// Normal Calculations // Normal Calculations
return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); int parcelMax = (int)(((float)LandData.Area / 65536.0f)
* (float)m_scene.RegionInfo.ObjectCapacity
* (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
// TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL!
return parcelMax;
} }
} }
public int GetSimulatorMaxPrimCount(ILandObject thisObject) public int GetSimulatorMaxPrimCount(ILandObject thisObject)
@ -195,7 +206,9 @@ namespace OpenSim.Region.CoreModules.World.Land
else else
{ {
//Normal Calculations //Normal Calculations
return m_scene.RegionInfo.ObjectCapacity; int simMax = (int)(((float)LandData.SimwideArea / 65536.0f)
* (float)m_scene.RegionInfo.ObjectCapacity);
return simMax;
} }
} }
#endregion #endregion
@ -369,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.AuthBuyerID = UUID.Zero; newData.AuthBuyerID = UUID.Zero;
newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
m_scene.EventManager.TriggerParcelPrimCountUpdate();
SendLandUpdateToAvatarsOverMe(true); SendLandUpdateToAvatarsOverMe(true);
} }
@ -384,7 +397,7 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
m_scene.EventManager.TriggerParcelPrimCountUpdate();
SendLandUpdateToAvatarsOverMe(true); SendLandUpdateToAvatarsOverMe(true);
} }
@ -485,6 +498,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client) public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client)
{ {
m_scene.EventManager.TriggerParcelPrimCountUpdate();
SendLandProperties(0, snap_selection, 0, remote_client); SendLandProperties(0, snap_selection, 0, remote_client);
} }

View File

@ -39,6 +39,7 @@ namespace OpenSim.Region.Framework.Interfaces
{ {
int GetParcelMaxPrimCount(ILandObject thisObject); int GetParcelMaxPrimCount(ILandObject thisObject);
int GetSimulatorMaxPrimCount(ILandObject thisObject); int GetSimulatorMaxPrimCount(ILandObject thisObject);
int GetPrimsFree();
LandData LandData { get; set; } LandData LandData { get; set; }
bool[,] LandBitmap { get; set; } bool[,] LandBitmap { get; set; }