diff options
Diffstat (limited to 'OpenSim/Region/Environment/ParcelManager.cs')
-rw-r--r-- | OpenSim/Region/Environment/ParcelManager.cs | 89 |
1 files changed, 77 insertions, 12 deletions
diff --git a/OpenSim/Region/Environment/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs index 4f836ef..838a003 100644 --- a/OpenSim/Region/Environment/ParcelManager.cs +++ b/OpenSim/Region/Environment/ParcelManager.cs | |||
@@ -66,6 +66,12 @@ namespace OpenSim.Region.Environment | |||
66 | public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel | 66 | public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel |
67 | public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel | 67 | public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel |
68 | 68 | ||
69 | //ParcelSelectObjects | ||
70 | public const int PARCEL_SELECT_OBJECTS_OWNER = 2; | ||
71 | public const int PARCEL_SELECT_OBJECTS_GROUP = 4; | ||
72 | public const int PARCEL_SELECT_OBJECTS_OTHER = 8; | ||
73 | |||
74 | |||
69 | //These are other constants. Yay! | 75 | //These are other constants. Yay! |
70 | public const int START_PARCEL_LOCAL_ID = 1; | 76 | public const int START_PARCEL_LOCAL_ID = 1; |
71 | #endregion | 77 | #endregion |
@@ -490,6 +496,11 @@ namespace OpenSim.Region.Environment | |||
490 | join(west, south, east, north, remote_client.AgentId); | 496 | join(west, south, east, north, remote_client.AgentId); |
491 | 497 | ||
492 | } | 498 | } |
499 | |||
500 | public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) | ||
501 | { | ||
502 | parcelList[local_id].sendForceObjectSelect(local_id, request_type, remote_client); | ||
503 | } | ||
493 | #endregion | 504 | #endregion |
494 | 505 | ||
495 | /// <summary> | 506 | /// <summary> |
@@ -532,10 +543,14 @@ namespace OpenSim.Region.Environment | |||
532 | p.resetParcelPrimCounts(); | 543 | p.resetParcelPrimCounts(); |
533 | } | 544 | } |
534 | } | 545 | } |
546 | public void setPrimsTainted() | ||
547 | { | ||
548 | this.parcelPrimCountTainted = true; | ||
549 | } | ||
535 | 550 | ||
536 | public void addPrimToParcelCounts(SceneObject obj) | 551 | public void addPrimToParcelCounts(SceneObject obj) |
537 | { | 552 | { |
538 | LLVector3 position = obj.rootPrimitive.Pos; | 553 | LLVector3 position = obj.Pos; |
539 | Parcel parcelUnderPrim = getParcel(position.X, position.Y); | 554 | Parcel parcelUnderPrim = getParcel(position.X, position.Y); |
540 | if (parcelUnderPrim != null) | 555 | if (parcelUnderPrim != null) |
541 | { | 556 | { |
@@ -551,13 +566,6 @@ namespace OpenSim.Region.Environment | |||
551 | } | 566 | } |
552 | } | 567 | } |
553 | 568 | ||
554 | public void setPrimsTainted() | ||
555 | { | ||
556 | this.parcelPrimCountTainted = true; | ||
557 | } | ||
558 | |||
559 | |||
560 | |||
561 | public void finalizeParcelPrimCountUpdate() | 569 | public void finalizeParcelPrimCountUpdate() |
562 | { | 570 | { |
563 | //Get Simwide prim count for owner | 571 | //Get Simwide prim count for owner |
@@ -1010,6 +1018,67 @@ namespace OpenSim.Region.Environment | |||
1010 | } | 1018 | } |
1011 | #endregion | 1019 | #endregion |
1012 | 1020 | ||
1021 | public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) | ||
1022 | { | ||
1023 | List<uint> resultLocalIDs = new List<uint>(); | ||
1024 | foreach (SceneObject obj in primsOverMe) | ||
1025 | { | ||
1026 | if (obj.rootLocalID > 0) | ||
1027 | { | ||
1028 | if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OWNER && obj.rootPrimitive.OwnerID == this.parcelData.ownerID) | ||
1029 | { | ||
1030 | resultLocalIDs.Add(obj.rootLocalID); | ||
1031 | } | ||
1032 | else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_GROUP && false) //TODO: change false to group support! | ||
1033 | { | ||
1034 | |||
1035 | } | ||
1036 | else if (request_type == ParcelManager.PARCEL_SELECT_OBJECTS_OTHER && obj.rootPrimitive.OwnerID != remote_client.AgentId) | ||
1037 | { | ||
1038 | resultLocalIDs.Add(obj.rootLocalID); | ||
1039 | } | ||
1040 | } | ||
1041 | } | ||
1042 | |||
1043 | |||
1044 | bool firstCall = true; | ||
1045 | int MAX_OBJECTS_PER_PACKET = 255; | ||
1046 | ForceObjectSelectPacket pack = new ForceObjectSelectPacket(); | ||
1047 | ForceObjectSelectPacket.DataBlock[] data; | ||
1048 | while (resultLocalIDs.Count > 0) | ||
1049 | { | ||
1050 | if (firstCall) | ||
1051 | { | ||
1052 | pack._Header.ResetList = true; | ||
1053 | firstCall = false; | ||
1054 | } | ||
1055 | else | ||
1056 | { | ||
1057 | pack._Header.ResetList = false; | ||
1058 | } | ||
1059 | |||
1060 | if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET) | ||
1061 | { | ||
1062 | data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET]; | ||
1063 | } | ||
1064 | else | ||
1065 | { | ||
1066 | data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count]; | ||
1067 | } | ||
1068 | |||
1069 | int i; | ||
1070 | for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++) | ||
1071 | { | ||
1072 | data[i] = new ForceObjectSelectPacket.DataBlock(); | ||
1073 | data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]); | ||
1074 | resultLocalIDs.RemoveAt(0); | ||
1075 | } | ||
1076 | pack.Data = data; | ||
1077 | |||
1078 | remote_client.OutPacket((Packet)pack); | ||
1079 | } | ||
1080 | |||
1081 | } | ||
1013 | public void resetParcelPrimCounts() | 1082 | public void resetParcelPrimCounts() |
1014 | { | 1083 | { |
1015 | parcelData.groupPrims = 0; | 1084 | parcelData.groupPrims = 0; |
@@ -1027,10 +1096,6 @@ namespace OpenSim.Region.Environment | |||
1027 | { | 1096 | { |
1028 | parcelData.ownerPrims += prim_count; | 1097 | parcelData.ownerPrims += prim_count; |
1029 | } | 1098 | } |
1030 | else if (prim_owner == parcelData.groupID) | ||
1031 | { | ||
1032 | parcelData.groupPrims += prim_count; | ||
1033 | } | ||
1034 | else | 1099 | else |
1035 | { | 1100 | { |
1036 | parcelData.otherPrims += prim_count; | 1101 | parcelData.otherPrims += prim_count; |