*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.
afrisby
mingchen 2007-07-13 21:13:38 +00:00
parent 9b61def98d
commit 862dc9fe97
5 changed files with 51 additions and 27 deletions

View File

@ -77,6 +77,8 @@ namespace OpenSim.Framework.Interfaces
public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape);
public delegate void SignificantClientMovement(IClientAPI remote_client);
public interface IClientAPI public interface IClientAPI
{ {
event ImprovedInstantMessage OnInstantMessage; event ImprovedInstantMessage OnInstantMessage;
@ -126,6 +128,8 @@ namespace OpenSim.Framework.Interfaces
event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
event EstateOwnerMessageRequest OnEstateOwnerMessage; event EstateOwnerMessageRequest OnEstateOwnerMessage;
event SignificantClientMovement OnSignificantClientMovement;
LLVector3 StartPos LLVector3 StartPos
{ {
get; get;
@ -182,5 +186,7 @@ namespace OpenSim.Framework.Interfaces
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item);
void SendNameReply(LLUUID profileId, string firstname, string lastname); void SendNameReply(LLUUID profileId, string firstname, string lastname);
void TriggerSignificantClientMovement(IClientAPI remote_client);
} }
} }

View File

@ -87,6 +87,7 @@ namespace OpenSim.Region.ClientStack
public event EstateOwnerMessageRequest OnEstateOwnerMessage; public event EstateOwnerMessageRequest OnEstateOwnerMessage;
public event SignificantClientMovement OnSignificantClientMovement;
/// <summary> /// <summary>
/// ///
@ -1177,5 +1178,13 @@ namespace OpenSim.Region.ClientStack
OutPacket( packet ); OutPacket( packet );
} }
public void TriggerSignificantClientMovement(IClientAPI remote_client)
{
if (OnSignificantClientMovement != null)
{
OnSignificantClientMovement(remote_client);
}
}
} }
} }

View File

@ -183,7 +183,6 @@ namespace OpenSim.Region.Environment
} }
} }
removeParcel(slave.parcelData.localID); removeParcel(slave.parcelData.localID);
master.sendParcelUpdateToAvatarsOverMe();
} }
/// <summary> /// <summary>
/// Get the parcel at the specified point /// Get the parcel at the specified point
@ -217,6 +216,7 @@ namespace OpenSim.Region.Environment
/// <returns>Returns true if successful</returns> /// <returns>Returns true if successful</returns>
private 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 //First, lets loop through the points and make sure they are all in the same parcel
//Get the parcel at start //Get the parcel at start
Parcel startParcel = getParcel(start_x, start_y); Parcel startParcel = getParcel(start_x, start_y);
@ -286,39 +286,47 @@ namespace OpenSim.Region.Environment
end_x -= 4; end_x -= 4;
end_y -= 4; end_y -= 4;
//NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! List<Parcel> selectedParcels = new List<Parcel>();
//This should be fixed later -- somewhat "incomplete code" --Ming int stepXSelected = 0;
Parcel startParcel, endParcel; int stepYSelected = 0;
for (stepYSelected = start_y; stepYSelected <= end_y; stepYSelected += 4)
{
for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
{
Parcel p = getParcel(stepXSelected,stepYSelected);
if (!selectedParcels.Contains(p))
{
selectedParcels.Add(p);
}
}
}
Parcel masterParcel = selectedParcels[0];
selectedParcels.RemoveAt(0);
try
if (selectedParcels.Count < 1)
{ {
startParcel = getParcel(start_x, start_y); return false; //Only one parcel selected
endParcel = getParcel(end_x, end_y);
} }
catch (Exception) if (masterParcel.parcelData.ownerID != attempting_user_id)
{ {
return false; //Error occured when trying to get the start and end parcels return false; //Not the same owner
} }
if (startParcel == endParcel) foreach (Parcel p in selectedParcels)
{ {
return false; //Subdivision of the same parcel is not allowed if (p.parcelData.ownerID != masterParcel.parcelData.ownerID)
{
return false; //Over multiple users. TODO: make this just ignore this parcel?
}
}
foreach (Parcel slaveParcel in selectedParcels)
{
parcelList[masterParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(masterParcel.getParcelBitmap(), slaveParcel.getParcelBitmap()));
performFinalParcelJoin(masterParcel, slaveParcel);
} }
//Check the parcel owners:
if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID)
{
return false;
}
if (startParcel.parcelData.ownerID != attempting_user_id)
{
//TODO: Group editing stuff. Avatar owner support for now
return false;
}
//Same owners! Lets join them masterParcel.sendParcelUpdateToAvatarsOverMe();
//Merge them to startParcel
parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap()));
performFinalParcelJoin(startParcel, endParcel);
return true; return true;

View File

@ -484,6 +484,8 @@ namespace OpenSim.Region.Environment.Scenes
client.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest); client.OnParcelJoinRequest += new ParcelJoinRequest(parcelManager.handleParcelJoinRequest);
client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest); client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(parcelManager.handleParcelPropertiesUpdateRequest);
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage); client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(estateManager.handleEstateOwnerMessage);
client.OnSignificantClientMovement += new SignificantClientMovement(parcelManager.handleSignificantClientMovement);
} }
protected void CreateAndAddScenePresence(IClientAPI client) protected void CreateAndAddScenePresence(IClientAPI client)

View File

@ -479,8 +479,7 @@ namespace OpenSim.Region.Environment.Scenes
if (libsecondlife.Helpers.VecDist(this.Pos, this.posLastSignificantMove) > 2.0) if (libsecondlife.Helpers.VecDist(this.Pos, this.posLastSignificantMove) > 2.0)
{ {
this.posLastSignificantMove = this.Pos; this.posLastSignificantMove = this.Pos;
this.m_world.parcelManager.handleSignificantClientMovement(this.ControllingClient); this.ControllingClient.TriggerSignificantClientMovement(this.ControllingClient);
} }
} }
#endregion #endregion