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.RegionServer/ClientView.API.cs | 8 +++ .../ClientView.ProcessPackets.cs | 25 ++++++++++ OpenSim/OpenSim.World/Avatar.cs | 7 +++ OpenSim/OpenSim.World/ParcelManager.cs | 58 ++++++++++++++++++++-- OpenSim/OpenSim.World/World.cs | 10 ++++ OpenSim/OpenSim/OpenSimMain.cs | 9 +++- 6 files changed, 112 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs index dd9adac..a6e5317 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs @@ -4,6 +4,7 @@ using System.Text; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Inventory; using OpenSim.Framework.Types; + using libsecondlife; using libsecondlife.Packets; @@ -36,6 +37,13 @@ namespace OpenSim public event NewAvatar OnNewAvatar; public event GenericCall6 OnRemoveAvatar; + public event ParcelPropertiesRequest OnParcelPropertiesRequest; + public event ParcelDivideRequest OnParcelDivideRequest; + public event ParcelJoinRequest OnParcelJoinRequest; + public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; + + public event EstateOwnerMessageRequest OnEstateOwnerMessage; + /// /// /// diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs index d215a23..8b94a82 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs @@ -454,6 +454,31 @@ namespace OpenSim break; #endregion + #region Parcel related packets + case PacketType.ParcelPropertiesRequest: + ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; + OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this); + break; + case PacketType.ParcelDivide: + ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack; + 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); + break; + case PacketType.ParcelJoin: + ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack; + 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); + break; + case PacketType.ParcelPropertiesUpdate: + ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack; + OnParcelPropertiesUpdateRequest(updatePacket, this); + break; + #endregion + + #region Estate Packets + case PacketType.EstateOwnerMessage: + EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; + OnEstateOwnerMessage(messagePacket, this); + break; + #endregion #region unimplemented handlers case PacketType.AgentIsNowWearing: // AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; 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; } diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index cbcf3db..1864e06 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -253,6 +253,8 @@ namespace OpenSim LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); LocalWorld.LoadPrimsFromStorage(); + LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager); + LocalWorld.StartTimer(); } @@ -417,11 +419,14 @@ namespace OpenSim break; case "show": - Show(cmdparams[0]); + if (cmdparams.Length > 0) + { + Show(cmdparams[0]); + } break; case "terrain": - string result = ""; + //string result = ""; /* if (!((World)m_localWorld).Terrain.RunTerrainCmd(cmdparams, ref result)) { m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result); -- cgit v1.1