diff options
author | mingchen | 2007-07-13 21:13:38 +0000 |
---|---|---|
committer | mingchen | 2007-07-13 21:13:38 +0000 |
commit | 862dc9fe975bdaa71116c8449ac27289f860441e (patch) | |
tree | fd90837f60f7bebcca522b4770601795a3c065dc | |
parent | Chat/Shout/etc should be working again (diff) | |
download | opensim-SC-862dc9fe975bdaa71116c8449ac27289f860441e.zip opensim-SC-862dc9fe975bdaa71116c8449ac27289f860441e.tar.gz opensim-SC-862dc9fe975bdaa71116c8449ac27289f860441e.tar.bz2 opensim-SC-862dc9fe975bdaa71116c8449ac27289f860441e.tar.xz |
*Reworked parcel joining to work the same way as LL's method.
**Parcels within selection now join and not the two parcels selected at each corner
*Created OnSignificantClientMovement event that is triggered when an avatar moves more than 2 meters.
-rw-r--r-- | OpenSim/Framework/General/Interfaces/IClientAPI.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.API.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Environment/ParcelManager.cs | 54 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 3 |
5 files changed, 49 insertions, 25 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index 9ac7994..555f46e 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -77,6 +77,8 @@ namespace OpenSim.Framework.Interfaces | |||
77 | 77 | ||
78 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); | 78 | public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); |
79 | 79 | ||
80 | public delegate void SignificantClientMovement(IClientAPI remote_client); | ||
81 | |||
80 | public interface IClientAPI | 82 | public interface IClientAPI |
81 | { | 83 | { |
82 | event ImprovedInstantMessage OnInstantMessage; | 84 | event ImprovedInstantMessage OnInstantMessage; |
@@ -126,6 +128,8 @@ namespace OpenSim.Framework.Interfaces | |||
126 | event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | 128 | event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; |
127 | 129 | ||
128 | event EstateOwnerMessageRequest OnEstateOwnerMessage; | 130 | event EstateOwnerMessageRequest OnEstateOwnerMessage; |
131 | event SignificantClientMovement OnSignificantClientMovement; | ||
132 | |||
129 | LLVector3 StartPos | 133 | LLVector3 StartPos |
130 | { | 134 | { |
131 | get; | 135 | get; |
@@ -182,5 +186,7 @@ namespace OpenSim.Framework.Interfaces | |||
182 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); | 186 | void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); |
183 | void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); | 187 | void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); |
184 | void SendNameReply(LLUUID profileId, string firstname, string lastname); | 188 | void SendNameReply(LLUUID profileId, string firstname, string lastname); |
189 | |||
190 | void TriggerSignificantClientMovement(IClientAPI remote_client); | ||
185 | } | 191 | } |
186 | } | 192 | } |
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index cc4fdbe..df5a853 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs | |||
@@ -87,6 +87,7 @@ namespace OpenSim.Region.ClientStack | |||
87 | 87 | ||
88 | public event EstateOwnerMessageRequest OnEstateOwnerMessage; | 88 | public event EstateOwnerMessageRequest OnEstateOwnerMessage; |
89 | 89 | ||
90 | public event SignificantClientMovement OnSignificantClientMovement; | ||
90 | 91 | ||
91 | /// <summary> | 92 | /// <summary> |
92 | /// | 93 | /// |
@@ -1177,5 +1178,13 @@ namespace OpenSim.Region.ClientStack | |||
1177 | 1178 | ||
1178 | OutPacket( packet ); | 1179 | OutPacket( packet ); |
1179 | } | 1180 | } |
1181 | |||
1182 | public void TriggerSignificantClientMovement(IClientAPI remote_client) | ||
1183 | { | ||
1184 | if (OnSignificantClientMovement != null) | ||
1185 | { | ||
1186 | OnSignificantClientMovement(remote_client); | ||
1187 | } | ||
1188 | } | ||
1180 | } | 1189 | } |
1181 | } | 1190 | } |
diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs index ef6603d..125ba19 100644 --- a/OpenSim/Region/Environment/ParcelManager.cs +++ b/OpenSim/Region/Environment/ParcelManager.cs | |||
@@ -183,7 +183,6 @@ namespace OpenSim.Region.Environment | |||
183 | } | 183 | } |
184 | } | 184 | } |
185 | removeParcel(slave.parcelData.localID); | 185 | removeParcel(slave.parcelData.localID); |
186 | master.sendParcelUpdateToAvatarsOverMe(); | ||
187 | } | 186 | } |
188 | /// <summary> | 187 | /// <summary> |
189 | /// Get the parcel at the specified point | 188 | /// Get the parcel at the specified point |
@@ -217,6 +216,7 @@ namespace OpenSim.Region.Environment | |||
217 | /// <returns>Returns true if successful</returns> | 216 | /// <returns>Returns true if successful</returns> |
218 | private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) | 217 | private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) |
219 | { | 218 | { |
219 | |||
220 | //First, lets loop through the points and make sure they are all in the same parcel | 220 | //First, lets loop through the points and make sure they are all in the same parcel |
221 | //Get the parcel at start | 221 | //Get the parcel at start |
222 | Parcel startParcel = getParcel(start_x, start_y); | 222 | Parcel startParcel = getParcel(start_x, start_y); |
@@ -286,39 +286,47 @@ namespace OpenSim.Region.Environment | |||
286 | end_x -= 4; | 286 | end_x -= 4; |
287 | end_y -= 4; | 287 | end_y -= 4; |
288 | 288 | ||
289 | //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! | 289 | List<Parcel> selectedParcels = new List<Parcel>(); |
290 | //This should be fixed later -- somewhat "incomplete code" --Ming | 290 | int stepXSelected = 0; |
291 | Parcel startParcel, endParcel; | 291 | int stepYSelected = 0; |
292 | 292 | for (stepYSelected = start_y; stepYSelected <= end_y; stepYSelected += 4) | |
293 | try | ||
294 | { | 293 | { |
295 | startParcel = getParcel(start_x, start_y); | 294 | for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) |
296 | endParcel = getParcel(end_x, end_y); | 295 | { |
296 | Parcel p = getParcel(stepXSelected,stepYSelected); | ||
297 | if (!selectedParcels.Contains(p)) | ||
298 | { | ||
299 | selectedParcels.Add(p); | ||
300 | } | ||
301 | } | ||
297 | } | 302 | } |
298 | catch (Exception) | 303 | Parcel masterParcel = selectedParcels[0]; |
304 | selectedParcels.RemoveAt(0); | ||
305 | |||
306 | |||
307 | if (selectedParcels.Count < 1) | ||
299 | { | 308 | { |
300 | return false; //Error occured when trying to get the start and end parcels | 309 | return false; //Only one parcel selected |
301 | } | 310 | } |
302 | if (startParcel == endParcel) | 311 | if (masterParcel.parcelData.ownerID != attempting_user_id) |
303 | { | 312 | { |
304 | return false; //Subdivision of the same parcel is not allowed | 313 | return false; //Not the same owner |
305 | } | 314 | } |
306 | 315 | foreach (Parcel p in selectedParcels) | |
307 | //Check the parcel owners: | ||
308 | if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID) | ||
309 | { | 316 | { |
310 | return false; | 317 | if (p.parcelData.ownerID != masterParcel.parcelData.ownerID) |
318 | { | ||
319 | return false; //Over multiple users. TODO: make this just ignore this parcel? | ||
320 | } | ||
311 | } | 321 | } |
312 | if (startParcel.parcelData.ownerID != attempting_user_id) | 322 | foreach (Parcel slaveParcel in selectedParcels) |
313 | { | 323 | { |
314 | //TODO: Group editing stuff. Avatar owner support for now | 324 | parcelList[masterParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(masterParcel.getParcelBitmap(), slaveParcel.getParcelBitmap())); |
315 | return false; | 325 | performFinalParcelJoin(masterParcel, slaveParcel); |
316 | } | 326 | } |
317 | 327 | ||
318 | //Same owners! Lets join them | 328 | |
319 | //Merge them to startParcel | 329 | masterParcel.sendParcelUpdateToAvatarsOverMe(); |
320 | parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap())); | ||
321 | performFinalParcelJoin(startParcel, endParcel); | ||
322 | 330 | ||
323 | return true; | 331 | return true; |
324 | 332 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a1b060f..7098c38 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -484,6 +484,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
484 | client.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); | 484 | client.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); |
485 | client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); | 485 | client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); |
486 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); | 486 | client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); |
487 | |||
488 | client.OnSignificantClientMovement += new SignificantClientMovement(parcelManager.handleSignificantClientMovement); | ||
487 | } | 489 | } |
488 | 490 | ||
489 | protected void CreateAndAddScenePresence(IClientAPI client) | 491 | protected void CreateAndAddScenePresence(IClientAPI client) |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index a813aed..613ad52 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -479,8 +479,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
479 | if (libsecondlife.Helpers.VecDist(this.Pos, this.posLastSignificantMove) > 2.0) | 479 | if (libsecondlife.Helpers.VecDist(this.Pos, this.posLastSignificantMove) > 2.0) |
480 | { | 480 | { |
481 | this.posLastSignificantMove = this.Pos; | 481 | this.posLastSignificantMove = this.Pos; |
482 | this.m_world.parcelManager.handleSignificantClientMovement(this.ControllingClient); | 482 | this.ControllingClient.TriggerSignificantClientMovement(this.ControllingClient); |
483 | |||
484 | } | 483 | } |
485 | } | 484 | } |
486 | #endregion | 485 | #endregion |