aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authormingchen2007-07-16 01:25:16 +0000
committermingchen2007-07-16 01:25:16 +0000
commit7f10179129d4b5ac4ae5c05ff8598f569b8e6412 (patch)
treeb5a6eac77699fd1857085aedcecf8732db7a0ebd /OpenSim/Region/Environment
parentCouple of small changes to NPC test character. (diff)
downloadopensim-SC_OLD-7f10179129d4b5ac4ae5c05ff8598f569b8e6412.zip
opensim-SC_OLD-7f10179129d4b5ac4ae5c05ff8598f569b8e6412.tar.gz
opensim-SC_OLD-7f10179129d4b5ac4ae5c05ff8598f569b8e6412.tar.bz2
opensim-SC_OLD-7f10179129d4b5ac4ae5c05ff8598f569b8e6412.tar.xz
*Fixed bug that incorrectly tabulated 'others' prims on a parcel
*Added support for selected prims (does not yet support prims being sat on) *Added support for listing avatars with prims on parcel with their prim count
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/ParcelManager.cs73
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs23
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs2
4 files changed, 91 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs
index 838a003..e413650 100644
--- a/OpenSim/Region/Environment/ParcelManager.cs
+++ b/OpenSim/Region/Environment/ParcelManager.cs
@@ -33,6 +33,7 @@ using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
35using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; 35using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence;
36using System.IO;
36 37
37namespace OpenSim.Region.Environment 38namespace OpenSim.Region.Environment
38{ 39{
@@ -501,6 +502,11 @@ namespace OpenSim.Region.Environment
501 { 502 {
502 parcelList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); 503 parcelList[local_id].sendForceObjectSelect(local_id, request_type, remote_client);
503 } 504 }
505
506 public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client)
507 {
508 parcelList[local_id].sendParcelObjectOwners(remote_client);
509 }
504 #endregion 510 #endregion
505 511
506 /// <summary> 512 /// <summary>
@@ -591,7 +597,7 @@ namespace OpenSim.Region.Environment
591 foreach (Parcel p in parcelOwnersAndParcels[owner]) 597 foreach (Parcel p in parcelOwnersAndParcels[owner])
592 { 598 {
593 simArea += p.parcelData.area; 599 simArea += p.parcelData.area;
594 simPrims += p.parcelData.ownerPrims + p.parcelData.otherPrims + p.parcelData.groupPrims; 600 simPrims += p.parcelData.ownerPrims + p.parcelData.otherPrims + p.parcelData.groupPrims + p.parcelData.selectedPrims;
595 } 601 }
596 602
597 foreach (Parcel p in parcelOwnersAndParcels[owner]) 603 foreach (Parcel p in parcelOwnersAndParcels[owner])
@@ -713,7 +719,7 @@ namespace OpenSim.Region.Environment
713 updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName); 719 updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName);
714 updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented 720 updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented
715 updatePacket.ParcelData.OtherCount = 0; //unemplemented 721 updatePacket.ParcelData.OtherCount = 0; //unemplemented
716 updatePacket.ParcelData.OtherPrims = parcelData.groupPrims; 722 updatePacket.ParcelData.OtherPrims = parcelData.otherPrims;
717 updatePacket.ParcelData.OwnerID = parcelData.ownerID; 723 updatePacket.ParcelData.OwnerID = parcelData.ownerID;
718 updatePacket.ParcelData.OwnerPrims = parcelData.ownerPrims; 724 updatePacket.ParcelData.OwnerPrims = parcelData.ownerPrims;
719 updatePacket.ParcelData.ParcelFlags = parcelData.parcelFlags; 725 updatePacket.ParcelData.ParcelFlags = parcelData.parcelFlags;
@@ -728,7 +734,7 @@ namespace OpenSim.Region.Environment
728 updatePacket.ParcelData.RentPrice = 0; 734 updatePacket.ParcelData.RentPrice = 0;
729 updatePacket.ParcelData.RequestResult = request_result; 735 updatePacket.ParcelData.RequestResult = request_result;
730 updatePacket.ParcelData.SalePrice = parcelData.salePrice; 736 updatePacket.ParcelData.SalePrice = parcelData.salePrice;
731 updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented 737 updatePacket.ParcelData.SelectedPrims = parcelData.selectedPrims;
732 updatePacket.ParcelData.SelfCount = 0;//unemplemented 738 updatePacket.ParcelData.SelfCount = 0;//unemplemented
733 updatePacket.ParcelData.SequenceID = sequence_id; 739 updatePacket.ParcelData.SequenceID = sequence_id;
734 if (parcelData.simwideArea > 0) 740 if (parcelData.simwideArea > 0)
@@ -743,7 +749,7 @@ namespace OpenSim.Region.Environment
743 updatePacket.ParcelData.SnapSelection = snap_selection; 749 updatePacket.ParcelData.SnapSelection = snap_selection;
744 updatePacket.ParcelData.SnapshotID = parcelData.snapshotID; 750 updatePacket.ParcelData.SnapshotID = parcelData.snapshotID;
745 updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; 751 updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus;
746 updatePacket.ParcelData.TotalPrims = parcelData.ownerPrims + parcelData.groupPrims + parcelData.otherPrims; 752 updatePacket.ParcelData.TotalPrims = parcelData.ownerPrims + parcelData.groupPrims + parcelData.otherPrims + parcelData.selectedPrims;
747 updatePacket.ParcelData.UserLocation = parcelData.userLocation; 753 updatePacket.ParcelData.UserLocation = parcelData.userLocation;
748 updatePacket.ParcelData.UserLookAt = parcelData.userLookAt; 754 updatePacket.ParcelData.UserLookAt = parcelData.userLookAt;
749 remote_client.OutPacket((Packet)updatePacket); 755 remote_client.OutPacket((Packet)updatePacket);
@@ -1042,7 +1048,7 @@ namespace OpenSim.Region.Environment
1042 1048
1043 1049
1044 bool firstCall = true; 1050 bool firstCall = true;
1045 int MAX_OBJECTS_PER_PACKET = 255; 1051 int MAX_OBJECTS_PER_PACKET = 251;
1046 ForceObjectSelectPacket pack = new ForceObjectSelectPacket(); 1052 ForceObjectSelectPacket pack = new ForceObjectSelectPacket();
1047 ForceObjectSelectPacket.DataBlock[] data; 1053 ForceObjectSelectPacket.DataBlock[] data;
1048 while (resultLocalIDs.Count > 0) 1054 while (resultLocalIDs.Count > 0)
@@ -1074,16 +1080,55 @@ namespace OpenSim.Region.Environment
1074 resultLocalIDs.RemoveAt(0); 1080 resultLocalIDs.RemoveAt(0);
1075 } 1081 }
1076 pack.Data = data; 1082 pack.Data = data;
1077
1078 remote_client.OutPacket((Packet)pack); 1083 remote_client.OutPacket((Packet)pack);
1079 } 1084 }
1080 1085
1081 } 1086 }
1087 public void sendParcelObjectOwners(IClientAPI remote_client)
1088 {
1089 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID,int>();
1090 foreach(SceneObject obj in primsOverMe)
1091 {
1092 if(!ownersAndCount.ContainsKey(obj.rootPrimitive.OwnerID))
1093 {
1094 ownersAndCount.Add(obj.rootPrimitive.OwnerID,0);
1095 }
1096 ownersAndCount[obj.rootPrimitive.OwnerID] += obj.primCount;
1097 }
1098 if (ownersAndCount.Count > 0)
1099 {
1100
1101 ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32];
1102
1103 if(ownersAndCount.Count < 32)
1104 {
1105 dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[ownersAndCount.Count];
1106 }
1107
1108
1109 int num = 0;
1110 foreach (LLUUID owner in ownersAndCount.Keys)
1111 {
1112 dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock();
1113 dataBlock[num].Count = ownersAndCount[owner];
1114 dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added
1115 dataBlock[num].OnlineStatus = true; //TODO: fix me later
1116 dataBlock[num].OwnerID = owner;
1117
1118 num++;
1119 }
1120
1121 ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket();
1122 pack.Data = dataBlock;
1123 remote_client.OutPacket(pack);
1124 }
1125 }
1082 public void resetParcelPrimCounts() 1126 public void resetParcelPrimCounts()
1083 { 1127 {
1084 parcelData.groupPrims = 0; 1128 parcelData.groupPrims = 0;
1085 parcelData.ownerPrims = 0; 1129 parcelData.ownerPrims = 0;
1086 parcelData.groupPrims = 0; 1130 parcelData.otherPrims = 0;
1131 parcelData.selectedPrims = 0;
1087 primsOverMe.Clear(); 1132 primsOverMe.Clear();
1088 } 1133 }
1089 1134
@@ -1092,14 +1137,22 @@ namespace OpenSim.Region.Environment
1092 LLUUID prim_owner = obj.rootPrimitive.OwnerID; 1137 LLUUID prim_owner = obj.rootPrimitive.OwnerID;
1093 int prim_count = obj.primCount; 1138 int prim_count = obj.primCount;
1094 1139
1095 if(prim_owner == parcelData.ownerID) 1140 if (obj.isSelected)
1096 { 1141 {
1097 parcelData.ownerPrims += prim_count; 1142 parcelData.selectedPrims += prim_count;
1098 } 1143 }
1099 else 1144 else
1100 { 1145 {
1101 parcelData.otherPrims += prim_count; 1146 if (prim_owner == parcelData.ownerID)
1147 {
1148 parcelData.ownerPrims += prim_count;
1149 }
1150 else
1151 {
1152 parcelData.otherPrims += prim_count;
1153 }
1102 } 1154 }
1155
1103 primsOverMe.Add(obj); 1156 primsOverMe.Add(obj);
1104 1157
1105 } 1158 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 6431bc7..347625a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -341,6 +341,29 @@ namespace OpenSim.Region.Environment.Scenes
341 if (((SceneObject)ent).rootLocalID == primLocalID) 341 if (((SceneObject)ent).rootLocalID == primLocalID)
342 { 342 {
343 ((SceneObject)ent).GetProperites(remoteClient); 343 ((SceneObject)ent).GetProperites(remoteClient);
344 ((SceneObject)ent).isSelected = true;
345 this.ParcelManager.setPrimsTainted();
346 break;
347 }
348 }
349 }
350 }
351
352 /// <summary>
353 ///
354 /// </summary>
355 /// <param name="primLocalID"></param>
356 /// <param name="remoteClient"></param>
357 public void DeselectPrim(uint primLocalID, IClientAPI remoteClient)
358 {
359 foreach (EntityBase ent in Entities.Values)
360 {
361 if (ent is SceneObject)
362 {
363 if (((SceneObject)ent).rootLocalID == primLocalID)
364 {
365 ((SceneObject)ent).isSelected = false;
366 this.ParcelManager.setPrimsTainted();
344 break; 367 break;
345 } 368 }
346 } 369 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 5e2e494..ba57115 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -537,6 +537,7 @@ namespace OpenSim.Region.Environment.Scenes
537 client.OnUpdatePrimTexture += this.UpdatePrimTexture; 537 client.OnUpdatePrimTexture += this.UpdatePrimTexture;
538 client.OnTeleportLocationRequest += this.RequestTeleportLocation; 538 client.OnTeleportLocationRequest += this.RequestTeleportLocation;
539 client.OnObjectSelect += this.SelectPrim; 539 client.OnObjectSelect += this.SelectPrim;
540 client.OnObjectDeselect += this.DeselectPrim;
540 client.OnGrapUpdate += this.MoveObject; 541 client.OnGrapUpdate += this.MoveObject;
541 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; 542 client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
542 client.OnObjectDescription += this.PrimDescription; 543 client.OnObjectDescription += this.PrimDescription;
@@ -549,6 +550,8 @@ namespace OpenSim.Region.Environment.Scenes
549 client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest); 550 client.OnParcelJoinRequest += new ParcelJoinRequest(m_parcelManager.handleParcelJoinRequest);
550 client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_parcelManager.handleParcelPropertiesUpdateRequest); 551 client.OnParcelPropertiesUpdateRequest += new ParcelPropertiesUpdateRequest(m_parcelManager.handleParcelPropertiesUpdateRequest);
551 client.OnParcelSelectObjects += new ParcelSelectObjects(m_parcelManager.handleParcelSelectObjectsRequest); 552 client.OnParcelSelectObjects += new ParcelSelectObjects(m_parcelManager.handleParcelSelectObjectsRequest);
553 client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(m_parcelManager.handleParcelObjectOwnersRequest);
554
552 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); 555 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
553 556
554 } 557 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 8de7cdb..e615599 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -49,6 +49,8 @@ namespace OpenSim.Region.Environment.Scenes
49 49
50 private EventManager m_eventManager; 50 private EventManager m_eventManager;
51 51
52 public bool isSelected = false;
53
52 public LLUUID rootUUID 54 public LLUUID rootUUID
53 { 55 {
54 get 56 get