diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/ParcelManager.cs | 73 |
1 files changed, 63 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; | |||
33 | using OpenSim.Framework.Types; | 33 | using OpenSim.Framework.Types; |
34 | using OpenSim.Region.Environment.Scenes; | 34 | using OpenSim.Region.Environment.Scenes; |
35 | using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; | 35 | using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence; |
36 | using System.IO; | ||
36 | 37 | ||
37 | namespace OpenSim.Region.Environment | 38 | namespace 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 | } |