*Renamed everything Parcels and ParcelData to Land and LandData
*Added missing files (I hope)afrisby
parent
7fabf9612a
commit
2873b82b78
|
@ -71,7 +71,7 @@ namespace OpenSim.Framework.Interfaces
|
|||
public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client);
|
||||
public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
|
||||
public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
|
||||
public delegate void ParcelSelectObjects(int parcel_local_id, int request_type, IClientAPI remote_client);
|
||||
public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client);
|
||||
public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client);
|
||||
public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
|
||||
|
||||
|
|
|
@ -48,11 +48,11 @@ namespace OpenSim.Framework.Interfaces
|
|||
[System.Obsolete("Use DataStorage instead")]
|
||||
void SaveMap(float[] heightmap);
|
||||
|
||||
void SaveParcels(ParcelData[] parcels);
|
||||
void SaveParcel(ParcelData parcel);
|
||||
void RemoveParcel(ParcelData parcel);
|
||||
void RemoveAllParcels();
|
||||
void LoadParcels(ILocalStorageParcelReceiver recv);
|
||||
void SaveLandObjects(LandData[] lands);
|
||||
void SaveLandObject(LandData land);
|
||||
void RemoveLandObject(LandData land);
|
||||
void RemoveAllLandObjects();
|
||||
void LoadLandObjects(ILocalStorageLandObjectReceiver recv);
|
||||
|
||||
void ShutDown();
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ namespace OpenSim.Framework.Interfaces
|
|||
void PrimFromStorage(PrimData prim);
|
||||
}
|
||||
|
||||
public interface ILocalStorageParcelReceiver
|
||||
public interface ILocalStorageLandObjectReceiver
|
||||
{
|
||||
void ParcelFromStorage(ParcelData data);
|
||||
void NoParcelDataFromStorage();
|
||||
void LandFromStorage(LandData data);
|
||||
void NoLandDataFromStorage();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,120 +1,120 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Types
|
||||
{
|
||||
|
||||
public class ParcelData
|
||||
{
|
||||
public byte[] parcelBitmapByteArray = new byte[512];
|
||||
public string parcelName = "Your Parcel";
|
||||
public string parcelDesc = "";
|
||||
public LLUUID ownerID = new LLUUID();
|
||||
public bool isGroupOwned = false;
|
||||
public LLVector3 AABBMin = new LLVector3();
|
||||
public LLVector3 AABBMax = new LLVector3();
|
||||
public int area = 0;
|
||||
public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned
|
||||
public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID
|
||||
public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category
|
||||
public int claimDate = 0; //Unemplemented
|
||||
public int claimPrice = 0; //Unemplemented
|
||||
public LLUUID groupID = new LLUUID(); //Unemplemented
|
||||
public int groupPrims = 0;
|
||||
public int otherPrims = 0;
|
||||
public int ownerPrims = 0;
|
||||
public int selectedPrims = 0;
|
||||
public int simwidePrims = 0;
|
||||
public int simwideArea = 0;
|
||||
public int salePrice = 0; //Unemeplemented. Parcels price.
|
||||
public Parcel.ParcelStatus parcelStatus = Parcel.ParcelStatus.Leased;
|
||||
public uint parcelFlags = (uint)Parcel.ParcelFlags.AllowFly | (uint)Parcel.ParcelFlags.AllowLandmark | (uint)Parcel.ParcelFlags.AllowAllObjectEntry | (uint)Parcel.ParcelFlags.AllowDeedToGroup | (uint)Parcel.ParcelFlags.AllowTerraform | (uint)Parcel.ParcelFlags.CreateObjects | (uint)Parcel.ParcelFlags.AllowOtherScripts;
|
||||
public byte landingType = 0;
|
||||
public byte mediaAutoScale = 0;
|
||||
public LLUUID mediaID = LLUUID.Zero;
|
||||
public int localID = 0;
|
||||
public LLUUID globalID = new LLUUID();
|
||||
|
||||
public string mediaURL = "";
|
||||
public string musicURL = "";
|
||||
public float passHours = 0;
|
||||
public int passPrice = 0;
|
||||
public LLUUID snapshotID = LLUUID.Zero;
|
||||
public LLVector3 userLocation = new LLVector3();
|
||||
public LLVector3 userLookAt = new LLVector3();
|
||||
|
||||
public ParcelData()
|
||||
{
|
||||
globalID = LLUUID.Random();
|
||||
}
|
||||
|
||||
public ParcelData Copy()
|
||||
{
|
||||
ParcelData parcelData = new ParcelData();
|
||||
|
||||
parcelData.AABBMax = this.AABBMax;
|
||||
parcelData.AABBMin = this.AABBMin;
|
||||
parcelData.area = this.area;
|
||||
parcelData.auctionID = this.auctionID;
|
||||
parcelData.authBuyerID = this.authBuyerID;
|
||||
parcelData.category = this.category;
|
||||
parcelData.claimDate = this.claimDate;
|
||||
parcelData.claimPrice = this.claimPrice;
|
||||
parcelData.globalID = this.globalID;
|
||||
parcelData.groupID = this.groupID;
|
||||
parcelData.groupPrims = this.groupPrims;
|
||||
parcelData.otherPrims = this.otherPrims;
|
||||
parcelData.ownerPrims = this.ownerPrims;
|
||||
parcelData.selectedPrims = this.selectedPrims;
|
||||
parcelData.isGroupOwned = this.isGroupOwned;
|
||||
parcelData.localID = this.localID;
|
||||
parcelData.landingType = this.landingType;
|
||||
parcelData.mediaAutoScale = this.mediaAutoScale;
|
||||
parcelData.mediaID = this.mediaID;
|
||||
parcelData.mediaURL = this.mediaURL;
|
||||
parcelData.musicURL = this.musicURL;
|
||||
parcelData.ownerID = this.ownerID;
|
||||
parcelData.parcelBitmapByteArray = (byte[])this.parcelBitmapByteArray.Clone();
|
||||
parcelData.parcelDesc = this.parcelDesc;
|
||||
parcelData.parcelFlags = this.parcelFlags;
|
||||
parcelData.parcelName = this.parcelName;
|
||||
parcelData.parcelStatus = this.parcelStatus;
|
||||
parcelData.passHours = this.passHours;
|
||||
parcelData.passPrice = this.passPrice;
|
||||
parcelData.salePrice = this.salePrice;
|
||||
parcelData.snapshotID = this.snapshotID;
|
||||
parcelData.userLocation = this.userLocation;
|
||||
parcelData.userLookAt = this.userLookAt;
|
||||
|
||||
return parcelData;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Types
|
||||
{
|
||||
|
||||
public class LandData
|
||||
{
|
||||
public byte[] landBitmapByteArray = new byte[512];
|
||||
public string landName = "Your Parcel";
|
||||
public string landDesc = "";
|
||||
public LLUUID ownerID = new LLUUID();
|
||||
public bool isGroupOwned = false;
|
||||
public LLVector3 AABBMin = new LLVector3();
|
||||
public LLVector3 AABBMax = new LLVector3();
|
||||
public int area = 0;
|
||||
public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned
|
||||
public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID
|
||||
public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category
|
||||
public int claimDate = 0; //Unemplemented
|
||||
public int claimPrice = 0; //Unemplemented
|
||||
public LLUUID groupID = new LLUUID(); //Unemplemented
|
||||
public int groupPrims = 0;
|
||||
public int otherPrims = 0;
|
||||
public int ownerPrims = 0;
|
||||
public int selectedPrims = 0;
|
||||
public int simwidePrims = 0;
|
||||
public int simwideArea = 0;
|
||||
public int salePrice = 0; //Unemeplemented. Parcels price.
|
||||
public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased;
|
||||
public uint landFlags = (uint)Parcel.ParcelFlags.AllowFly | (uint)Parcel.ParcelFlags.AllowLandmark | (uint)Parcel.ParcelFlags.AllowAllObjectEntry | (uint)Parcel.ParcelFlags.AllowDeedToGroup | (uint)Parcel.ParcelFlags.AllowTerraform | (uint)Parcel.ParcelFlags.CreateObjects | (uint)Parcel.ParcelFlags.AllowOtherScripts;
|
||||
public byte landingType = 0;
|
||||
public byte mediaAutoScale = 0;
|
||||
public LLUUID mediaID = LLUUID.Zero;
|
||||
public int localID = 0;
|
||||
public LLUUID globalID = new LLUUID();
|
||||
|
||||
public string mediaURL = "";
|
||||
public string musicURL = "";
|
||||
public float passHours = 0;
|
||||
public int passPrice = 0;
|
||||
public LLUUID snapshotID = LLUUID.Zero;
|
||||
public LLVector3 userLocation = new LLVector3();
|
||||
public LLVector3 userLookAt = new LLVector3();
|
||||
|
||||
public LandData()
|
||||
{
|
||||
globalID = LLUUID.Random();
|
||||
}
|
||||
|
||||
public LandData Copy()
|
||||
{
|
||||
LandData landData = new LandData();
|
||||
|
||||
landData.AABBMax = this.AABBMax;
|
||||
landData.AABBMin = this.AABBMin;
|
||||
landData.area = this.area;
|
||||
landData.auctionID = this.auctionID;
|
||||
landData.authBuyerID = this.authBuyerID;
|
||||
landData.category = this.category;
|
||||
landData.claimDate = this.claimDate;
|
||||
landData.claimPrice = this.claimPrice;
|
||||
landData.globalID = this.globalID;
|
||||
landData.groupID = this.groupID;
|
||||
landData.groupPrims = this.groupPrims;
|
||||
landData.otherPrims = this.otherPrims;
|
||||
landData.ownerPrims = this.ownerPrims;
|
||||
landData.selectedPrims = this.selectedPrims;
|
||||
landData.isGroupOwned = this.isGroupOwned;
|
||||
landData.localID = this.localID;
|
||||
landData.landingType = this.landingType;
|
||||
landData.mediaAutoScale = this.mediaAutoScale;
|
||||
landData.mediaID = this.mediaID;
|
||||
landData.mediaURL = this.mediaURL;
|
||||
landData.musicURL = this.musicURL;
|
||||
landData.ownerID = this.ownerID;
|
||||
landData.landBitmapByteArray = (byte[])this.landBitmapByteArray.Clone();
|
||||
landData.landDesc = this.landDesc;
|
||||
landData.landFlags = this.landFlags;
|
||||
landData.landName = this.landName;
|
||||
landData.landStatus = this.landStatus;
|
||||
landData.passHours = this.passHours;
|
||||
landData.passPrice = this.passPrice;
|
||||
landData.salePrice = this.salePrice;
|
||||
landData.snapshotID = this.snapshotID;
|
||||
landData.userLocation = this.userLocation;
|
||||
landData.userLookAt = this.userLookAt;
|
||||
|
||||
return landData;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -240,13 +240,13 @@ namespace OpenSim
|
|||
{
|
||||
m_log.Notice("Parcels - Found master avatar [" + masterAvatar.UUID.ToStringHyphenated() + "]");
|
||||
scene.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID;
|
||||
scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.LandManager);
|
||||
scene.localStorage.LoadLandObjects((ILocalStorageLandObjectReceiver)scene.LandManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Notice("Parcels - No master avatar found, using null.");
|
||||
scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero;
|
||||
scene.localStorage.LoadParcels((ILocalStorageParcelReceiver)scene.LandManager);
|
||||
scene.localStorage.LoadLandObjects((ILocalStorageLandObjectReceiver)scene.LandManager);
|
||||
}
|
||||
scene.performParcelPrimCountUpdate();
|
||||
scene.StartTimer();
|
||||
|
|
|
@ -583,17 +583,17 @@ namespace OpenSim.Region.ClientStack
|
|||
}
|
||||
break;
|
||||
case PacketType.ParcelDivide:
|
||||
ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack;
|
||||
ParcelDividePacket landDivide = (ParcelDividePacket)Pack;
|
||||
if (OnParcelDivideRequest != null)
|
||||
{
|
||||
OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this);
|
||||
OnParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West), (int)Math.Round(landDivide.ParcelData.South), (int)Math.Round(landDivide.ParcelData.East), (int)Math.Round(landDivide.ParcelData.North), this);
|
||||
}
|
||||
break;
|
||||
case PacketType.ParcelJoin:
|
||||
ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack;
|
||||
ParcelJoinPacket landJoin = (ParcelJoinPacket)Pack;
|
||||
if (OnParcelJoinRequest != null)
|
||||
{
|
||||
OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this);
|
||||
OnParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West), (int)Math.Round(landJoin.ParcelData.South), (int)Math.Round(landJoin.ParcelData.East), (int)Math.Round(landJoin.ParcelData.North), this);
|
||||
}
|
||||
break;
|
||||
case PacketType.ParcelPropertiesUpdate:
|
||||
|
|
|
@ -32,7 +32,7 @@ using OpenSim.Framework.Types;
|
|||
using OpenSim.Region;
|
||||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Environment.Parcels;
|
||||
using OpenSim.Region.Environment.LandManagement;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -55,9 +55,9 @@ namespace OpenSim.Region.Interfaces
|
|||
void StoreTerrain(double[,] terrain);
|
||||
double[,] LoadTerrain();
|
||||
|
||||
void StoreParcel(Environment.Parcels.Parcel Parcel);
|
||||
void RemoveParcel(uint ID);
|
||||
List<Environment.Parcels.Parcel> LoadParcels();
|
||||
void StoreParcel(Land Parcel);
|
||||
void RemoveLandObject(uint ID);
|
||||
List<Land> LoadLandObjects();
|
||||
|
||||
void Shutdown();
|
||||
}
|
||||
|
|
|
@ -1,599 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Environment.Parcels
|
||||
{
|
||||
#region Parcel Class
|
||||
/// <summary>
|
||||
/// Keeps track of a specific parcel's information
|
||||
/// </summary>
|
||||
public class Parcel
|
||||
{
|
||||
#region Member Variables
|
||||
public ParcelData parcelData = new ParcelData();
|
||||
public List<SceneObject> primsOverMe = new List<SceneObject>();
|
||||
|
||||
public Scene m_world;
|
||||
|
||||
private bool[,] parcelBitmap = new bool[64, 64];
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Constructors
|
||||
public Parcel(LLUUID owner_id, bool is_group_owned, Scene world)
|
||||
{
|
||||
m_world = world;
|
||||
parcelData.ownerID = owner_id;
|
||||
parcelData.isGroupOwned = is_group_owned;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Member Functions
|
||||
|
||||
#region General Functions
|
||||
/// <summary>
|
||||
/// Checks to see if this parcel contains a point
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns>Returns true if the parcel contains the specified point</returns>
|
||||
public bool containsPoint(int x, int y)
|
||||
{
|
||||
if (x >= 0 && y >= 0 && x <= 256 && x <= 256)
|
||||
{
|
||||
return (parcelBitmap[x / 4, y / 4] == true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Parcel Copy()
|
||||
{
|
||||
Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world);
|
||||
|
||||
//Place all new variables here!
|
||||
newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone());
|
||||
newParcel.parcelData = parcelData.Copy();
|
||||
|
||||
return newParcel;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Packet Request Handling
|
||||
/// <summary>
|
||||
/// Sends parcel properties as requested
|
||||
/// </summary>
|
||||
/// <param name="sequence_id">ID sent by client for them to keep track of</param>
|
||||
/// <param name="snap_selection">Bool sent by client for them to use</param>
|
||||
/// <param name="remote_client">Object representing the client</param>
|
||||
public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
|
||||
{
|
||||
|
||||
ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
|
||||
updatePacket.ParcelData.AABBMax = parcelData.AABBMax;
|
||||
updatePacket.ParcelData.AABBMin = parcelData.AABBMin;
|
||||
updatePacket.ParcelData.Area = parcelData.area;
|
||||
updatePacket.ParcelData.AuctionID = parcelData.auctionID;
|
||||
updatePacket.ParcelData.AuthBuyerID = parcelData.authBuyerID; //unemplemented
|
||||
|
||||
updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray;
|
||||
|
||||
updatePacket.ParcelData.Desc = Helpers.StringToField(parcelData.parcelDesc);
|
||||
updatePacket.ParcelData.Category = (byte)parcelData.category;
|
||||
updatePacket.ParcelData.ClaimDate = parcelData.claimDate;
|
||||
updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice;
|
||||
updatePacket.ParcelData.GroupID = parcelData.groupID;
|
||||
updatePacket.ParcelData.GroupPrims = parcelData.groupPrims;
|
||||
updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned;
|
||||
updatePacket.ParcelData.LandingType = (byte)parcelData.landingType;
|
||||
updatePacket.ParcelData.LocalID = parcelData.localID;
|
||||
if (parcelData.area > 0)
|
||||
{
|
||||
updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor)));
|
||||
}
|
||||
else
|
||||
{
|
||||
updatePacket.ParcelData.MaxPrims = 0;
|
||||
}
|
||||
updatePacket.ParcelData.MediaAutoScale = parcelData.mediaAutoScale;
|
||||
updatePacket.ParcelData.MediaID = parcelData.mediaID;
|
||||
updatePacket.ParcelData.MediaURL = Helpers.StringToField(parcelData.mediaURL);
|
||||
updatePacket.ParcelData.MusicURL = Helpers.StringToField(parcelData.musicURL);
|
||||
updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName);
|
||||
updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
|
||||
updatePacket.ParcelData.OtherCount = 0; //unemplemented
|
||||
updatePacket.ParcelData.OtherPrims = parcelData.otherPrims;
|
||||
updatePacket.ParcelData.OwnerID = parcelData.ownerID;
|
||||
updatePacket.ParcelData.OwnerPrims = parcelData.ownerPrims;
|
||||
updatePacket.ParcelData.ParcelFlags = parcelData.parcelFlags;
|
||||
updatePacket.ParcelData.ParcelPrimBonus = m_world.RegionInfo.estateSettings.objectBonusFactor;
|
||||
updatePacket.ParcelData.PassHours = parcelData.passHours;
|
||||
updatePacket.ParcelData.PassPrice = parcelData.passPrice;
|
||||
updatePacket.ParcelData.PublicCount = 0; //unemplemented
|
||||
updatePacket.ParcelData.RegionDenyAnonymous = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > 0);
|
||||
updatePacket.ParcelData.RegionDenyIdentified = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > 0);
|
||||
updatePacket.ParcelData.RegionDenyTransacted = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > 0);
|
||||
updatePacket.ParcelData.RegionPushOverride = (((uint)m_world.RegionInfo.estateSettings.regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > 0);
|
||||
updatePacket.ParcelData.RentPrice = 0;
|
||||
updatePacket.ParcelData.RequestResult = request_result;
|
||||
updatePacket.ParcelData.SalePrice = parcelData.salePrice;
|
||||
updatePacket.ParcelData.SelectedPrims = parcelData.selectedPrims;
|
||||
updatePacket.ParcelData.SelfCount = 0;//unemplemented
|
||||
updatePacket.ParcelData.SequenceID = sequence_id;
|
||||
if (parcelData.simwideArea > 0)
|
||||
{
|
||||
updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(parcelData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_world.RegionInfo.estateSettings.objectBonusFactor)));
|
||||
}
|
||||
else
|
||||
{
|
||||
updatePacket.ParcelData.SimWideMaxPrims = 0;
|
||||
}
|
||||
updatePacket.ParcelData.SimWideTotalPrims = parcelData.simwidePrims;
|
||||
updatePacket.ParcelData.SnapSelection = snap_selection;
|
||||
updatePacket.ParcelData.SnapshotID = parcelData.snapshotID;
|
||||
updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus;
|
||||
updatePacket.ParcelData.TotalPrims = parcelData.ownerPrims + parcelData.groupPrims + parcelData.otherPrims + parcelData.selectedPrims;
|
||||
updatePacket.ParcelData.UserLocation = parcelData.userLocation;
|
||||
updatePacket.ParcelData.UserLookAt = parcelData.userLookAt;
|
||||
remote_client.OutPacket((Packet)updatePacket);
|
||||
}
|
||||
|
||||
public void updateParcelProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
|
||||
{
|
||||
if (remote_client.AgentId == parcelData.ownerID)
|
||||
{
|
||||
//Needs later group support
|
||||
parcelData.authBuyerID = packet.ParcelData.AuthBuyerID;
|
||||
parcelData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category;
|
||||
parcelData.parcelDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc);
|
||||
parcelData.groupID = packet.ParcelData.GroupID;
|
||||
parcelData.landingType = packet.ParcelData.LandingType;
|
||||
parcelData.mediaAutoScale = packet.ParcelData.MediaAutoScale;
|
||||
parcelData.mediaID = packet.ParcelData.MediaID;
|
||||
parcelData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL);
|
||||
parcelData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL);
|
||||
parcelData.parcelName = Helpers.FieldToUTF8String(packet.ParcelData.Name);
|
||||
parcelData.parcelFlags = packet.ParcelData.ParcelFlags;
|
||||
parcelData.passHours = packet.ParcelData.PassHours;
|
||||
parcelData.passPrice = packet.ParcelData.PassPrice;
|
||||
parcelData.salePrice = packet.ParcelData.SalePrice;
|
||||
parcelData.snapshotID = packet.ParcelData.SnapshotID;
|
||||
parcelData.userLocation = packet.ParcelData.UserLocation;
|
||||
parcelData.userLookAt = packet.ParcelData.UserLookAt;
|
||||
sendParcelUpdateToAvatarsOverMe();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void sendParcelUpdateToAvatarsOverMe()
|
||||
{
|
||||
List<ScenePresence> avatars = m_world.RequestAvatarList();
|
||||
for (int i = 0; i < avatars.Count; i++)
|
||||
{
|
||||
Parcel over = m_world.LandManager.getParcel((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y));
|
||||
if (over.parcelData.localID == this.parcelData.localID)
|
||||
{
|
||||
sendParcelProperties(0, false, 0, avatars[i].ControllingClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Update Functions
|
||||
/// <summary>
|
||||
/// Updates the AABBMin and AABBMax values after area/shape modification of parcel
|
||||
/// </summary>
|
||||
private void updateAABBAndAreaValues()
|
||||
{
|
||||
int min_x = 64;
|
||||
int min_y = 64;
|
||||
int max_x = 0;
|
||||
int max_y = 0;
|
||||
int tempArea = 0;
|
||||
int x, y;
|
||||
for (x = 0; x < 64; x++)
|
||||
{
|
||||
for (y = 0; y < 64; y++)
|
||||
{
|
||||
if (parcelBitmap[x, y] == true)
|
||||
{
|
||||
if (min_x > x) min_x = x;
|
||||
if (min_y > y) min_y = y;
|
||||
if (max_x < x) max_x = x;
|
||||
if (max_y < y) max_y = y;
|
||||
tempArea += 16; //16sqm parcel
|
||||
}
|
||||
}
|
||||
}
|
||||
parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_world.Terrain.get((min_x * 4), (min_y * 4)));
|
||||
parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_world.Terrain.get((max_x * 4), (max_y * 4)));
|
||||
parcelData.area = tempArea;
|
||||
}
|
||||
|
||||
public void updateParcelBitmapByteArray()
|
||||
{
|
||||
parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update all settings in parcel such as area, bitmap byte array, etc
|
||||
/// </summary>
|
||||
public void forceUpdateParcelInfo()
|
||||
{
|
||||
this.updateAABBAndAreaValues();
|
||||
this.updateParcelBitmapByteArray();
|
||||
}
|
||||
|
||||
public void setParcelBitmapFromByteArray()
|
||||
{
|
||||
parcelBitmap = convertBytesToParcelBitmap();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Parcel Bitmap Functions
|
||||
/// <summary>
|
||||
/// Sets the parcel's bitmap manually
|
||||
/// </summary>
|
||||
/// <param name="bitmap">64x64 block representing where this parcel is on a map</param>
|
||||
public void setParcelBitmap(bool[,] bitmap)
|
||||
{
|
||||
if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2)
|
||||
{
|
||||
//Throw an exception - The bitmap is not 64x64
|
||||
throw new Exception("Error: Invalid Parcel Bitmap");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Valid: Lets set it
|
||||
parcelBitmap = bitmap;
|
||||
forceUpdateParcelInfo();
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the parcels bitmap manually
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool[,] getParcelBitmap()
|
||||
{
|
||||
return parcelBitmap;
|
||||
}
|
||||
/// <summary>
|
||||
/// Converts the parcel bitmap to a packet friendly byte array
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private byte[] convertParcelBitmapToBytes()
|
||||
{
|
||||
byte[] tempConvertArr = new byte[512];
|
||||
byte tempByte = 0;
|
||||
int x, y, i, byteNum = 0;
|
||||
i = 0;
|
||||
for (y = 0; y < 64; y++)
|
||||
{
|
||||
for (x = 0; x < 64; x++)
|
||||
{
|
||||
tempByte = Convert.ToByte(tempByte | Convert.ToByte(parcelBitmap[x, y]) << (i++ % 8));
|
||||
if (i % 8 == 0)
|
||||
{
|
||||
tempConvertArr[byteNum] = tempByte;
|
||||
tempByte = (byte)0;
|
||||
i = 0;
|
||||
byteNum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tempConvertArr;
|
||||
}
|
||||
|
||||
private bool[,] convertBytesToParcelBitmap()
|
||||
{
|
||||
bool[,] tempConvertMap = new bool[64, 64];
|
||||
tempConvertMap.Initialize();
|
||||
byte tempByte = 0;
|
||||
int x = 0, y = 0, i = 0, bitNum = 0;
|
||||
for (i = 0; i < 512; i++)
|
||||
{
|
||||
tempByte = parcelData.parcelBitmapByteArray[i];
|
||||
for (bitNum = 0; bitNum < 8; bitNum++)
|
||||
{
|
||||
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1);
|
||||
tempConvertMap[x, y] = bit;
|
||||
x++;
|
||||
if (x > 63)
|
||||
{
|
||||
x = 0;
|
||||
y++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return tempConvertMap;
|
||||
}
|
||||
/// <summary>
|
||||
/// Full sim parcel creation
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool[,] basicFullRegionParcelBitmap()
|
||||
{
|
||||
return getSquareParcelBitmap(0, 0, 256, 256);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to modify the bitmap between the x and y points. Points use 64 scale
|
||||
/// </summary>
|
||||
/// <param name="start_x"></param>
|
||||
/// <param name="start_y"></param>
|
||||
/// <param name="end_x"></param>
|
||||
/// <param name="end_y"></param>
|
||||
/// <returns></returns>
|
||||
public static bool[,] getSquareParcelBitmap(int start_x, int start_y, int end_x, int end_y)
|
||||
{
|
||||
|
||||
bool[,] tempBitmap = new bool[64, 64];
|
||||
tempBitmap.Initialize();
|
||||
|
||||
tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
|
||||
return tempBitmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change a parcel's bitmap at within a square and set those points to a specific value
|
||||
/// </summary>
|
||||
/// <param name="parcel_bitmap"></param>
|
||||
/// <param name="start_x"></param>
|
||||
/// <param name="start_y"></param>
|
||||
/// <param name="end_x"></param>
|
||||
/// <param name="end_y"></param>
|
||||
/// <param name="set_value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool[,] modifyParcelBitmapSquare(bool[,] parcel_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value)
|
||||
{
|
||||
if (parcel_bitmap.GetLength(0) != 64 || parcel_bitmap.GetLength(1) != 64 || parcel_bitmap.Rank != 2)
|
||||
{
|
||||
//Throw an exception - The bitmap is not 64x64
|
||||
throw new Exception("Error: Invalid Parcel Bitmap in modifyParcelBitmapSquare()");
|
||||
}
|
||||
|
||||
int x, y;
|
||||
for (y = 0; y < 64; y++)
|
||||
{
|
||||
for (x = 0; x < 64; x++)
|
||||
{
|
||||
if (x >= start_x / 4 && x < end_x / 4
|
||||
&& y >= start_y / 4 && y < end_y / 4)
|
||||
{
|
||||
parcel_bitmap[x, y] = set_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return parcel_bitmap;
|
||||
}
|
||||
/// <summary>
|
||||
/// Join the true values of 2 bitmaps together
|
||||
/// </summary>
|
||||
/// <param name="bitmap_base"></param>
|
||||
/// <param name="bitmap_add"></param>
|
||||
/// <returns></returns>
|
||||
public static bool[,] mergeParcelBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
|
||||
{
|
||||
if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2)
|
||||
{
|
||||
//Throw an exception - The bitmap is not 64x64
|
||||
throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeParcelBitmaps");
|
||||
}
|
||||
if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2)
|
||||
{
|
||||
//Throw an exception - The bitmap is not 64x64
|
||||
throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps");
|
||||
|
||||
}
|
||||
|
||||
int x, y;
|
||||
for (y = 0; y < 64; y++)
|
||||
{
|
||||
for (x = 0; x < 64; x++)
|
||||
{
|
||||
if (bitmap_add[x, y])
|
||||
{
|
||||
bitmap_base[x, y] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bitmap_base;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Object Select and Object Owner Listing
|
||||
public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client)
|
||||
{
|
||||
List<uint> resultLocalIDs = new List<uint>();
|
||||
foreach (SceneObject obj in primsOverMe)
|
||||
{
|
||||
if (obj.rootLocalID > 0)
|
||||
{
|
||||
if (request_type == LandManager.PARCEL_SELECT_OBJECTS_OWNER && obj.rootPrimitive.OwnerID == this.parcelData.ownerID)
|
||||
{
|
||||
resultLocalIDs.Add(obj.rootLocalID);
|
||||
}
|
||||
else if (request_type == LandManager.PARCEL_SELECT_OBJECTS_GROUP && false) //TODO: change false to group support!
|
||||
{
|
||||
|
||||
}
|
||||
else if (request_type == LandManager.PARCEL_SELECT_OBJECTS_OTHER && obj.rootPrimitive.OwnerID != remote_client.AgentId)
|
||||
{
|
||||
resultLocalIDs.Add(obj.rootLocalID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool firstCall = true;
|
||||
int MAX_OBJECTS_PER_PACKET = 251;
|
||||
ForceObjectSelectPacket pack = new ForceObjectSelectPacket();
|
||||
ForceObjectSelectPacket.DataBlock[] data;
|
||||
while (resultLocalIDs.Count > 0)
|
||||
{
|
||||
if (firstCall)
|
||||
{
|
||||
pack._Header.ResetList = true;
|
||||
firstCall = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
pack._Header.ResetList = false;
|
||||
}
|
||||
|
||||
if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET)
|
||||
{
|
||||
data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET];
|
||||
}
|
||||
else
|
||||
{
|
||||
data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count];
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++)
|
||||
{
|
||||
data[i] = new ForceObjectSelectPacket.DataBlock();
|
||||
data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]);
|
||||
resultLocalIDs.RemoveAt(0);
|
||||
}
|
||||
pack.Data = data;
|
||||
remote_client.OutPacket((Packet)pack);
|
||||
}
|
||||
|
||||
}
|
||||
public void sendParcelObjectOwners(IClientAPI remote_client)
|
||||
{
|
||||
Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>();
|
||||
foreach (SceneObject obj in primsOverMe)
|
||||
{
|
||||
if (!ownersAndCount.ContainsKey(obj.rootPrimitive.OwnerID))
|
||||
{
|
||||
ownersAndCount.Add(obj.rootPrimitive.OwnerID, 0);
|
||||
}
|
||||
ownersAndCount[obj.rootPrimitive.OwnerID] += obj.primCount;
|
||||
}
|
||||
if (ownersAndCount.Count > 0)
|
||||
{
|
||||
|
||||
ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32];
|
||||
|
||||
if (ownersAndCount.Count < 32)
|
||||
{
|
||||
dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[ownersAndCount.Count];
|
||||
}
|
||||
|
||||
|
||||
int num = 0;
|
||||
foreach (LLUUID owner in ownersAndCount.Keys)
|
||||
{
|
||||
dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock();
|
||||
dataBlock[num].Count = ownersAndCount[owner];
|
||||
dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added
|
||||
dataBlock[num].OnlineStatus = true; //TODO: fix me later
|
||||
dataBlock[num].OwnerID = owner;
|
||||
|
||||
num++;
|
||||
}
|
||||
|
||||
ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket();
|
||||
pack.Data = dataBlock;
|
||||
remote_client.OutPacket(pack);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Object Returning
|
||||
public void returnObject(SceneObject obj)
|
||||
{
|
||||
}
|
||||
public void returnParcelObjects(int type, LLUUID owner)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Object Adding/Removing from Parcel
|
||||
public void resetParcelPrimCounts()
|
||||
{
|
||||
parcelData.groupPrims = 0;
|
||||
parcelData.ownerPrims = 0;
|
||||
parcelData.otherPrims = 0;
|
||||
parcelData.selectedPrims = 0;
|
||||
primsOverMe.Clear();
|
||||
}
|
||||
|
||||
public void addPrimToCount(SceneObject obj)
|
||||
{
|
||||
LLUUID prim_owner = obj.rootPrimitive.OwnerID;
|
||||
int prim_count = obj.primCount;
|
||||
|
||||
if (obj.isSelected)
|
||||
{
|
||||
parcelData.selectedPrims += prim_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prim_owner == parcelData.ownerID)
|
||||
{
|
||||
parcelData.ownerPrims += prim_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
parcelData.otherPrims += prim_count;
|
||||
}
|
||||
}
|
||||
|
||||
primsOverMe.Add(obj);
|
||||
|
||||
}
|
||||
|
||||
public void removePrimFromCount(SceneObject obj)
|
||||
{
|
||||
if (primsOverMe.Contains(obj))
|
||||
{
|
||||
LLUUID prim_owner = obj.rootPrimitive.OwnerID;
|
||||
int prim_count = obj.primCount;
|
||||
|
||||
if (prim_owner == parcelData.ownerID)
|
||||
{
|
||||
parcelData.ownerPrims -= prim_count;
|
||||
}
|
||||
else if (prim_owner == parcelData.groupID)
|
||||
{
|
||||
parcelData.groupPrims -= prim_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
parcelData.otherPrims -= prim_count;
|
||||
}
|
||||
|
||||
primsOverMe.Remove(obj);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
|
@ -4,7 +4,7 @@ using OpenSim.Framework.Communications;
|
|||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Region.Capabilities;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Environment.Parcels;
|
||||
using OpenSim.Region.Environment.LandManagement;
|
||||
|
||||
namespace OpenSim.Region.Environment
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ using OpenSim.Region.Terrain;
|
|||
using Caps = OpenSim.Region.Capabilities.Caps;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
using OpenSim.Region.Environment.Parcels;
|
||||
using OpenSim.Region.Environment.LandManagement;
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
private uint _primCount = 702000;
|
||||
private System.Threading.Mutex _primAllocateMutex = new Mutex(false);
|
||||
private int storageCount;
|
||||
private int parcelPrimCheckCount;
|
||||
private int landPrimCheckCount;
|
||||
private Mutex updateLock;
|
||||
|
||||
protected AuthenticateSessionsBase authenticateHandler;
|
||||
|
@ -146,7 +146,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_scriptManager = new ScriptManager(this);
|
||||
m_eventManager = new EventManager();
|
||||
|
||||
m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_LandManager.addPrimToParcelCounts);
|
||||
m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_LandManager.addPrimToLandPrimCounts);
|
||||
|
||||
MainLog.Instance.Verbose("World.cs - creating new entitities instance");
|
||||
Entities = new Dictionary<LLUUID, EntityBase>();
|
||||
|
@ -244,14 +244,14 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
storageCount = 0;
|
||||
}
|
||||
|
||||
this.parcelPrimCheckCount++;
|
||||
if (this.parcelPrimCheckCount > 50) //check every 5 seconds for tainted prims
|
||||
this.landPrimCheckCount++;
|
||||
if (this.landPrimCheckCount > 50) //check every 5 seconds for tainted prims
|
||||
{
|
||||
if (m_LandManager.parcelPrimCountTainted)
|
||||
if (m_LandManager.landPrimCountTainted)
|
||||
{
|
||||
//Perform parcel update of prim count
|
||||
//Perform land update of prim count
|
||||
performParcelPrimCountUpdate();
|
||||
this.parcelPrimCheckCount = 0;
|
||||
this.landPrimCheckCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -513,7 +513,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
if (this.Entities.ContainsKey(sceneObject.rootUUID))
|
||||
{
|
||||
m_LandManager.removePrimFromParcelCounts(sceneObject);
|
||||
m_LandManager.removePrimFromLandPrimCounts(sceneObject);
|
||||
this.Entities.Remove(sceneObject.rootUUID);
|
||||
m_LandManager.setPrimsTainted();
|
||||
}
|
||||
|
@ -910,10 +910,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public void performParcelPrimCountUpdate()
|
||||
{
|
||||
m_LandManager.resetAllParcelPrimCounts();
|
||||
m_LandManager.resetAllLandPrimCounts();
|
||||
m_eventManager.TriggerParcelPrimCountUpdate();
|
||||
m_LandManager.finalizeParcelPrimCountUpdate();
|
||||
m_LandManager.parcelPrimCountTainted = false;
|
||||
m_LandManager.finalizeLandPrimCountUpdate();
|
||||
m_LandManager.landPrimCountTainted = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends my primitive info to the parcel manager for it to keep tally of all of the prims!
|
||||
/// Sends my primitive info to the land manager for it to keep tally of all of the prims!
|
||||
/// </summary>
|
||||
private void ProcessParcelPrimCountUpdate()
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace SimpleApp
|
|||
if (masterAvatar != null)
|
||||
{
|
||||
world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID;
|
||||
world.LandManager.NoParcelDataFromStorage();
|
||||
world.LandManager.NoLandDataFromStorage();
|
||||
}
|
||||
|
||||
world.StartTimer();
|
||||
|
|
|
@ -82,25 +82,25 @@ namespace OpenSim.Region.Storage.LocalStorageBDB
|
|||
|
||||
}
|
||||
|
||||
public void SaveParcels(ParcelData[] parcel_data)
|
||||
public void SaveLandObjects(LandData[] land_data)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveParcel(ParcelData parcel)
|
||||
public void SaveLandObject(LandData land)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveParcel(ParcelData parcel)
|
||||
public void RemoveLandObject(LandData land)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveAllParcels()
|
||||
public void RemoveAllLandObjects()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
||||
public void LoadLandObjects(ILocalStorageLandObjectReceiver recv)
|
||||
{
|
||||
recv.NoParcelDataFromStorage();
|
||||
recv.NoLandDataFromStorage();
|
||||
}
|
||||
|
||||
public void ShutDown()
|
||||
|
|
|
@ -157,106 +157,106 @@ namespace OpenSim.Region.Storage.LocalStorageDb4o
|
|||
db.Commit();
|
||||
}
|
||||
|
||||
public void SaveParcel(ParcelData parcel)
|
||||
public void SaveLandObject(LandData landObject)
|
||||
{
|
||||
IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
|
||||
IObjectSet result = db.Query(new UUIDLandQuery(landObject.globalID));
|
||||
if (result.Count > 0)
|
||||
{
|
||||
//Old Parcel
|
||||
ParcelData updateParcel = (ParcelData)result.Next();
|
||||
updateParcel.AABBMax = parcel.AABBMax;
|
||||
updateParcel.AABBMin = parcel.AABBMin;
|
||||
updateParcel.area = parcel.area;
|
||||
updateParcel.auctionID = parcel.auctionID;
|
||||
updateParcel.authBuyerID = parcel.authBuyerID;
|
||||
updateParcel.category = parcel.category;
|
||||
updateParcel.claimDate = parcel.claimDate;
|
||||
updateParcel.claimPrice = parcel.claimPrice;
|
||||
updateParcel.groupID = parcel.groupID;
|
||||
updateParcel.groupPrims = parcel.groupPrims;
|
||||
updateParcel.isGroupOwned = parcel.isGroupOwned;
|
||||
updateParcel.landingType = parcel.landingType;
|
||||
updateParcel.mediaAutoScale = parcel.mediaAutoScale;
|
||||
updateParcel.mediaID = parcel.mediaID;
|
||||
updateParcel.mediaURL = parcel.mediaURL;
|
||||
updateParcel.musicURL = parcel.musicURL;
|
||||
updateParcel.localID = parcel.localID;
|
||||
updateParcel.ownerID = parcel.ownerID;
|
||||
updateParcel.passHours = parcel.passHours;
|
||||
updateParcel.passPrice = parcel.passPrice;
|
||||
updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone();
|
||||
updateParcel.parcelDesc = parcel.parcelDesc;
|
||||
updateParcel.parcelFlags = parcel.parcelFlags;
|
||||
updateParcel.parcelName = parcel.parcelName;
|
||||
updateParcel.parcelStatus = parcel.parcelStatus;
|
||||
updateParcel.salePrice = parcel.salePrice;
|
||||
updateParcel.snapshotID = parcel.snapshotID;
|
||||
updateParcel.userLocation = parcel.userLocation;
|
||||
updateParcel.userLookAt = parcel.userLookAt;
|
||||
//Old Land
|
||||
LandData updateLand = (LandData)result.Next();
|
||||
updateLand.AABBMax = landObject.AABBMax;
|
||||
updateLand.AABBMin = landObject.AABBMin;
|
||||
updateLand.area = landObject.area;
|
||||
updateLand.auctionID = landObject.auctionID;
|
||||
updateLand.authBuyerID = landObject.authBuyerID;
|
||||
updateLand.category = landObject.category;
|
||||
updateLand.claimDate = landObject.claimDate;
|
||||
updateLand.claimPrice = landObject.claimPrice;
|
||||
updateLand.groupID = landObject.groupID;
|
||||
updateLand.groupPrims = landObject.groupPrims;
|
||||
updateLand.isGroupOwned = landObject.isGroupOwned;
|
||||
updateLand.landingType = landObject.landingType;
|
||||
updateLand.mediaAutoScale = landObject.mediaAutoScale;
|
||||
updateLand.mediaID = landObject.mediaID;
|
||||
updateLand.mediaURL = landObject.mediaURL;
|
||||
updateLand.musicURL = landObject.musicURL;
|
||||
updateLand.localID = landObject.localID;
|
||||
updateLand.ownerID = landObject.ownerID;
|
||||
updateLand.passHours = landObject.passHours;
|
||||
updateLand.passPrice = landObject.passPrice;
|
||||
updateLand.landBitmapByteArray = (byte[])landObject.landBitmapByteArray.Clone();
|
||||
updateLand.landDesc = landObject.landDesc;
|
||||
updateLand.landFlags = landObject.landFlags;
|
||||
updateLand.landName = landObject.landName;
|
||||
updateLand.landStatus = landObject.landStatus;
|
||||
updateLand.salePrice = landObject.salePrice;
|
||||
updateLand.snapshotID = landObject.snapshotID;
|
||||
updateLand.userLocation = landObject.userLocation;
|
||||
updateLand.userLookAt = landObject.userLookAt;
|
||||
|
||||
db.Set(updateParcel);
|
||||
db.Set(updateLand);
|
||||
}
|
||||
else
|
||||
{
|
||||
db.Set(parcel);
|
||||
db.Set(landObject);
|
||||
}
|
||||
db.Commit();
|
||||
}
|
||||
|
||||
public void SaveParcels(ParcelData[] parcel_data)
|
||||
public void SaveLandObjects(LandData[] landObject_data)
|
||||
{
|
||||
MainLog.Instance.Notice("Parcel Backup: Saving Parcels...");
|
||||
MainLog.Instance.Notice("Land Backup: Saving Lands...");
|
||||
int i;
|
||||
for (i = 0; i < parcel_data.GetLength(0); i++)
|
||||
for (i = 0; i < landObject_data.GetLength(0); i++)
|
||||
{
|
||||
|
||||
SaveParcel(parcel_data[i]);
|
||||
SaveLandObject(landObject_data[i]);
|
||||
|
||||
}
|
||||
MainLog.Instance.Notice("Parcel Backup: Parcel Save Complete");
|
||||
MainLog.Instance.Notice("Land Backup: Land Save Complete");
|
||||
}
|
||||
|
||||
public void RemoveParcel(ParcelData parcel)
|
||||
public void RemoveLandObject(LandData landObject)
|
||||
{
|
||||
IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
|
||||
IObjectSet result = db.Query(new UUIDLandQuery(landObject.globalID));
|
||||
if (result.Count > 0)
|
||||
{
|
||||
db.Delete(result[0]);
|
||||
}
|
||||
db.Commit();
|
||||
}
|
||||
public void RemoveAllParcels()
|
||||
public void RemoveAllLandObjects()
|
||||
{
|
||||
MainLog.Instance.Notice("Parcel Backup: Removing all parcels...");
|
||||
IObjectSet result = db.Get(typeof(ParcelData));
|
||||
MainLog.Instance.Notice("Land Backup: Removing all land objects...");
|
||||
IObjectSet result = db.Get(typeof(LandData));
|
||||
if (result.Count > 0)
|
||||
{
|
||||
foreach (ParcelData parcelData in result)
|
||||
foreach (LandData landData in result)
|
||||
{
|
||||
RemoveParcel(parcelData);
|
||||
RemoveLandObject(landData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
||||
public void LoadLandObjects(ILocalStorageLandObjectReceiver recv)
|
||||
{
|
||||
MainLog.Instance.Notice("Parcel Backup: Loading Parcels...");
|
||||
IObjectSet result = db.Get(typeof(ParcelData));
|
||||
MainLog.Instance.Notice("Land Backup: Loading Lands...");
|
||||
IObjectSet result = db.Get(typeof(LandData));
|
||||
if (result.Count > 0)
|
||||
{
|
||||
MainLog.Instance.Notice("Parcel Backup: Parcels exist in database.");
|
||||
foreach (ParcelData parcelData in result)
|
||||
MainLog.Instance.Notice("Land Backup: Lands exist in database.");
|
||||
foreach (LandData landData in result)
|
||||
{
|
||||
|
||||
recv.ParcelFromStorage(parcelData);
|
||||
recv.LandFromStorage(landData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Notice("Parcel Backup: No parcels exist. Creating basic parcel.");
|
||||
recv.NoParcelDataFromStorage();
|
||||
MainLog.Instance.Notice("Land Backup: No landObjects exist. Creating basic landObject.");
|
||||
recv.NoLandDataFromStorage();
|
||||
}
|
||||
MainLog.Instance.Notice("Parcel Backup: Parcels Restored");
|
||||
MainLog.Instance.Notice("Land Backup: Lands Restored");
|
||||
}
|
||||
public void ShutDown()
|
||||
{
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using Db4objects.Db4o.Query;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Types;
|
||||
|
||||
namespace OpenSim.Region.Storage.LocalStorageDb4o
|
||||
{
|
||||
public class UUIDParcelQuery : Predicate
|
||||
{
|
||||
private LLUUID globalIDSearch;
|
||||
|
||||
public UUIDParcelQuery(LLUUID find)
|
||||
{
|
||||
globalIDSearch = find;
|
||||
}
|
||||
public bool Match(ParcelData parcel)
|
||||
{
|
||||
return (parcel.globalID == globalIDSearch);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
using Db4objects.Db4o.Query;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Types;
|
||||
|
||||
namespace OpenSim.Region.Storage.LocalStorageDb4o
|
||||
{
|
||||
public class UUIDLandQuery : Predicate
|
||||
{
|
||||
private LLUUID globalIDSearch;
|
||||
|
||||
public UUIDLandQuery(LLUUID find)
|
||||
{
|
||||
globalIDSearch = find;
|
||||
}
|
||||
public bool Match(LandData land)
|
||||
{
|
||||
return (land.globalID == globalIDSearch);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -167,26 +167,26 @@ namespace OpenSim.Region.Storage.LocalStorageSQLite
|
|||
|
||||
}
|
||||
|
||||
public void SaveParcels(ParcelData[] parcel_manager)
|
||||
public void SaveLandObjects(LandData[] land_manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SaveParcel(ParcelData parcel)
|
||||
public void SaveLandObject(LandData land)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveParcel(ParcelData parcel)
|
||||
public void RemoveLandObject(LandData land)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveAllParcels()
|
||||
public void RemoveAllLandObjects()
|
||||
{
|
||||
}
|
||||
|
||||
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
||||
public void LoadLandObjects(ILocalStorageLandObjectReceiver recv)
|
||||
{
|
||||
recv.NoParcelDataFromStorage();
|
||||
recv.NoLandDataFromStorage();
|
||||
}
|
||||
|
||||
public void ShutDown()
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.LandManagement;
|
||||
using OpenSim.Region.Interfaces;
|
||||
using OpenSim.Framework.Console;
|
||||
using libsecondlife;
|
||||
|
@ -43,19 +43,19 @@ namespace OpenSim.DataStore.NullStorage
|
|||
return null;
|
||||
}
|
||||
|
||||
public void RemoveParcel(uint id)
|
||||
public void RemoveLandObject(uint id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void StoreParcel(OpenSim.Region.Environment.Parcels.Parcel parcel)
|
||||
public void StoreParcel(Land land)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public List<OpenSim.Region.Environment.Parcels.Parcel> LoadParcels()
|
||||
public List<Land> LoadLandObjects()
|
||||
{
|
||||
return new List<OpenSim.Region.Environment.Parcels.Parcel>();
|
||||
return new List<Land>();
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
|
|
Loading…
Reference in New Issue