From 2873b82b788244852fd1dad3a747f3ba33a73be5 Mon Sep 17 00:00:00 2001 From: mingchen Date: Mon, 16 Jul 2007 19:40:25 +0000 Subject: *Renamed everything Parcels and ParcelData to Land and LandData *Added missing files (I hope) --- OpenSim/Region/Application/OpenSimMain.cs | 4 +- .../ClientStack/ClientView.ProcessPackets.cs | 8 +- .../Environment/Interfaces/IRegionDataStore.cs | 8 +- OpenSim/Region/Environment/Parcels/Parcel.cs | 599 --------------------- OpenSim/Region/Environment/RegionManager.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 24 +- OpenSim/Region/Environment/Scenes/SceneObject.cs | 2 +- OpenSim/Region/Examples/SimpleApp/Program.cs | 2 +- .../LocalStorageBerkeleyDB/BDBLocalStorage.cs | 12 +- .../Storage/LocalStorageDb4o/Db4LocalStorage.cs | 112 ++-- .../Storage/LocalStorageDb4o/UUIDLandQuery.cs | 47 ++ .../Storage/LocalStorageDb4o/UUIDParcelQuery.cs | 47 -- .../LocalStorageSQLite/SQLiteLocalStorage.cs | 12 +- .../OpenSim.DataStore.NullStorage/NullDataStore.cs | 10 +- 14 files changed, 145 insertions(+), 744 deletions(-) delete mode 100644 OpenSim/Region/Environment/Parcels/Parcel.cs create mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/UUIDLandQuery.cs delete mode 100644 OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 4e10955..368af12 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -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(); diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 1f9110c..dd0a6c8 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -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: diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs index 05e936e..4148d08 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs @@ -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 LoadParcels(); + void StoreParcel(Land Parcel); + void RemoveLandObject(uint ID); + List LoadLandObjects(); void Shutdown(); } diff --git a/OpenSim/Region/Environment/Parcels/Parcel.cs b/OpenSim/Region/Environment/Parcels/Parcel.cs deleted file mode 100644 index 99e9591..0000000 --- a/OpenSim/Region/Environment/Parcels/Parcel.cs +++ /dev/null @@ -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 - /// - /// Keeps track of a specific parcel's information - /// - public class Parcel - { - #region Member Variables - public ParcelData parcelData = new ParcelData(); - public List primsOverMe = new List(); - - 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 - /// - /// Checks to see if this parcel contains a point - /// - /// - /// - /// Returns true if the parcel contains the specified point - 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 - /// - /// Sends parcel properties as requested - /// - /// ID sent by client for them to keep track of - /// Bool sent by client for them to use - /// Object representing the client - 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 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 - /// - /// Updates the AABBMin and AABBMax values after area/shape modification of parcel - /// - 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(); - } - - /// - /// Update all settings in parcel such as area, bitmap byte array, etc - /// - public void forceUpdateParcelInfo() - { - this.updateAABBAndAreaValues(); - this.updateParcelBitmapByteArray(); - } - - public void setParcelBitmapFromByteArray() - { - parcelBitmap = convertBytesToParcelBitmap(); - } - #endregion - - - #region Parcel Bitmap Functions - /// - /// Sets the parcel's bitmap manually - /// - /// 64x64 block representing where this parcel is on a map - 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(); - - } - } - /// - /// Gets the parcels bitmap manually - /// - /// - public bool[,] getParcelBitmap() - { - return parcelBitmap; - } - /// - /// Converts the parcel bitmap to a packet friendly byte array - /// - /// - 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; - } - /// - /// Full sim parcel creation - /// - /// - public static bool[,] basicFullRegionParcelBitmap() - { - return getSquareParcelBitmap(0, 0, 256, 256); - } - - /// - /// Used to modify the bitmap between the x and y points. Points use 64 scale - /// - /// - /// - /// - /// - /// - 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; - } - - /// - /// Change a parcel's bitmap at within a square and set those points to a specific value - /// - /// - /// - /// - /// - /// - /// - /// - 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; - } - /// - /// Join the true values of 2 bitmaps together - /// - /// - /// - /// - 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 resultLocalIDs = new List(); - 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 ownersAndCount = new Dictionary(); - 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 -} diff --git a/OpenSim/Region/Environment/RegionManager.cs b/OpenSim/Region/Environment/RegionManager.cs index eb30389..92e2766 100644 --- a/OpenSim/Region/Environment/RegionManager.cs +++ b/OpenSim/Region/Environment/RegionManager.cs @@ -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 { diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 5689308..917f6c4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -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(); @@ -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 diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 43d41e6..f0b25ce 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Scenes } /// - /// 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! /// private void ProcessParcelPrimCountUpdate() { diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 631e076..a2fdd81 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -82,7 +82,7 @@ namespace SimpleApp if (masterAvatar != null) { world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID; - world.LandManager.NoParcelDataFromStorage(); + world.LandManager.NoLandDataFromStorage(); } world.StartTimer(); diff --git a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs index 0a88594..1c0a4a3 100644 --- a/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs @@ -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() diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs index 8d9f473..5dc5a3b 100644 --- a/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageDb4o/Db4LocalStorage.cs @@ -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() { diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDLandQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDLandQuery.cs new file mode 100644 index 0000000..6c5b2fb --- /dev/null +++ b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDLandQuery.cs @@ -0,0 +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 UUIDLandQuery : Predicate + { + private LLUUID globalIDSearch; + + public UUIDLandQuery(LLUUID find) + { + globalIDSearch = find; + } + public bool Match(LandData land) + { + return (land.globalID == globalIDSearch); + } + } +} diff --git a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs b/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs deleted file mode 100644 index debaa88..0000000 --- a/OpenSim/Region/Storage/LocalStorageDb4o/UUIDParcelQuery.cs +++ /dev/null @@ -1,47 +0,0 @@ -/* -* 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); - } - } -} diff --git a/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs index 599ff6c..88c5bde 100644 --- a/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs +++ b/OpenSim/Region/Storage/LocalStorageSQLite/SQLiteLocalStorage.cs @@ -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() diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index 9dc20c3..fc003e8 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs @@ -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 LoadParcels() + public List LoadLandObjects() { - return new List(); + return new List(); } public void Shutdown() -- cgit v1.1