From 2c04171990df9e01cd4c5aa600a6eaa1487f9605 Mon Sep 17 00:00:00 2001 From: mingchen Date: Fri, 8 Jun 2007 21:30:51 +0000 Subject: *Added delegates and events for parcel and estate management *Only thing left is to get the master user setup in both sandbox and grid mode --- OpenSim/OpenSim.World/Avatar.cs | 7 ++++ OpenSim/OpenSim.World/ParcelManager.cs | 58 ++++++++++++++++++++++++++++++++-- OpenSim/OpenSim.World/World.cs | 10 ++++++ 3 files changed, 72 insertions(+), 3 deletions(-) (limited to 'OpenSim/OpenSim.World') diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs index d597ca7..6a4c0f8 100644 --- a/OpenSim/OpenSim.World/Avatar.cs +++ b/OpenSim/OpenSim.World/Avatar.cs @@ -83,6 +83,13 @@ namespace OpenSim.world ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); * */ + + ControllingClient.OnParcelPropertiesRequest +=new ParcelPropertiesRequest(this.m_world.parcelManager.handleParcelPropertiesRequest); + ControllingClient.OnParcelDivideRequest += new ParcelDivideRequest(this.m_world.parcelManager.handleParcelDivideRequest); + ControllingClient.OnParcelJoinRequest += new ParcelJoinRequest(this.m_world.parcelManager.handleParcelJoinRequest); + ControllingClient.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(this.m_world.parcelManager.handleParcelPropertiesUpdateRequest); + + ControllingClient.OnEstateOwnerMessage += new EstateOwnerMessageRequest(this.m_world.estateManager.handleEstateOwnerMessage); } /// diff --git a/OpenSim/OpenSim.World/ParcelManager.cs b/OpenSim/OpenSim.World/ParcelManager.cs index 9fbacd6..4a9bfb1 100644 --- a/OpenSim/OpenSim.World/ParcelManager.cs +++ b/OpenSim/OpenSim.World/ParcelManager.cs @@ -166,7 +166,7 @@ namespace OpenSim.world parcelList.Remove(local_id); } - public void performFinalParcelJoin(Parcel master, Parcel slave) + private void performFinalParcelJoin(Parcel master, Parcel slave) { int x, y; bool[,] parcelBitmapSlave = slave.getParcelBitmap(); @@ -212,7 +212,7 @@ namespace OpenSim.world /// North Point /// LLUUID of user who is trying to subdivide /// Returns true if successful - public bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) + private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) { //First, lets loop through the points and make sure they are all in the same parcel //Get the parcel at start @@ -278,7 +278,7 @@ namespace OpenSim.world /// y value in second parcel /// LLUUID of the avatar trying to join the parcels /// Returns true if successful - public bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) + private bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) { end_x -= 4; end_y -= 4; @@ -406,6 +406,58 @@ namespace OpenSim.world packet.ParcelData.SequenceID = sequenceID; //Eh? remote_client.OutPacket((Packet)packet); } + + public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client) + { + //Get the parcels within the bounds + List temp = new List(); + int x, y, i; + int inc_x = end_x - start_x; + int inc_y = end_y - start_y; + for (x = 0; x < inc_x; x++) + { + for (y = 0; y < inc_y; y++) + { + OpenSim.world.Parcel currentParcel = getParcel(start_x + x, start_y + y); + if (!temp.Contains(currentParcel)) + { + currentParcel.forceUpdateParcelInfo(); + temp.Add(currentParcel); + } + } + } + + int requestResult = ParcelManager.PARCEL_RESULT_ONE_PARCEL; + if (temp.Count > 1) + { + requestResult = ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS; + } + + for (i = 0; i < temp.Count; i++) + { + temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client); + } + + + sendParcelOverlay(remote_client); + } + + public void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) + { + if (parcelList.ContainsKey(packet.ParcelData.LocalID)) + { + parcelList[packet.ParcelData.LocalID].updateParcelProperties(packet, remote_client); + } + } + public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) + { + subdivide(west, south, east, north, remote_client.AgentId); + } + public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) + { + join(west, south, east, north, remote_client.AgentId); + + } #endregion /// diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs index e51c983..dc9602e 100644 --- a/OpenSim/OpenSim.World/World.cs +++ b/OpenSim/OpenSim.World/World.cs @@ -217,6 +217,16 @@ namespace OpenSim.world Entities[UUID].BackUp(); } + //Parcel backup routines + ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; + int i = 0; + foreach (OpenSim.world.Parcel parcel in parcelManager.parcelList.Values) + { + parcels[i] = parcel.parcelData; + i++; + } + localStorage.SaveParcels(parcels); + // Backup successful return true; } -- cgit v1.1