diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Land/LandObject.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Land/LandObject.cs | 1854 |
1 files changed, 927 insertions, 927 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index 368e113..e297b10 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs | |||
@@ -1,928 +1,928 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using log4net; | 33 | using log4net; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
36 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
37 | 37 | ||
38 | namespace OpenSim.Region.Environment.Modules.World.Land | 38 | namespace OpenSim.Region.Environment.Modules.World.Land |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// Keeps track of a specific piece of land's information | 41 | /// Keeps track of a specific piece of land's information |
42 | /// </summary> | 42 | /// </summary> |
43 | public class LandObject : ILandObject | 43 | public class LandObject : ILandObject |
44 | { | 44 | { |
45 | #region Member Variables | 45 | #region Member Variables |
46 | 46 | ||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | private bool[,] m_landBitmap = new bool[64,64]; | 48 | private bool[,] m_landBitmap = new bool[64,64]; |
49 | 49 | ||
50 | protected LandData m_landData = new LandData(); | 50 | protected LandData m_landData = new LandData(); |
51 | protected Scene m_scene; | 51 | protected Scene m_scene; |
52 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 52 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
53 | 53 | ||
54 | public bool[,] landBitmap | 54 | public bool[,] landBitmap |
55 | { | 55 | { |
56 | get { return m_landBitmap; } | 56 | get { return m_landBitmap; } |
57 | set { m_landBitmap = value; } | 57 | set { m_landBitmap = value; } |
58 | } | 58 | } |
59 | 59 | ||
60 | #endregion | 60 | #endregion |
61 | 61 | ||
62 | #region ILandObject Members | 62 | #region ILandObject Members |
63 | 63 | ||
64 | public LandData landData | 64 | public LandData landData |
65 | { | 65 | { |
66 | get { return m_landData; } | 66 | get { return m_landData; } |
67 | 67 | ||
68 | set { m_landData = value; } | 68 | set { m_landData = value; } |
69 | } | 69 | } |
70 | 70 | ||
71 | public LLUUID regionUUID | 71 | public LLUUID regionUUID |
72 | { | 72 | { |
73 | get { return m_scene.RegionInfo.RegionID; } | 73 | get { return m_scene.RegionInfo.RegionID; } |
74 | } | 74 | } |
75 | 75 | ||
76 | #region Constructors | 76 | #region Constructors |
77 | 77 | ||
78 | public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene) | 78 | public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene) |
79 | { | 79 | { |
80 | m_scene = scene; | 80 | m_scene = scene; |
81 | landData.ownerID = owner_id; | 81 | landData.ownerID = owner_id; |
82 | landData.isGroupOwned = is_group_owned; | 82 | landData.isGroupOwned = is_group_owned; |
83 | } | 83 | } |
84 | 84 | ||
85 | #endregion | 85 | #endregion |
86 | 86 | ||
87 | #region Member Functions | 87 | #region Member Functions |
88 | 88 | ||
89 | #region General Functions | 89 | #region General Functions |
90 | 90 | ||
91 | /// <summary> | 91 | /// <summary> |
92 | /// Checks to see if this land object contains a point | 92 | /// Checks to see if this land object contains a point |
93 | /// </summary> | 93 | /// </summary> |
94 | /// <param name="x"></param> | 94 | /// <param name="x"></param> |
95 | /// <param name="y"></param> | 95 | /// <param name="y"></param> |
96 | /// <returns>Returns true if the piece of land contains the specified point</returns> | 96 | /// <returns>Returns true if the piece of land contains the specified point</returns> |
97 | public bool containsPoint(int x, int y) | 97 | public bool containsPoint(int x, int y) |
98 | { | 98 | { |
99 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) | 99 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) |
100 | { | 100 | { |
101 | return (landBitmap[x / 4, y / 4] == true); | 101 | return (landBitmap[x / 4, y / 4] == true); |
102 | } | 102 | } |
103 | else | 103 | else |
104 | { | 104 | { |
105 | return false; | 105 | return false; |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | public ILandObject Copy() | 109 | public ILandObject Copy() |
110 | { | 110 | { |
111 | ILandObject newLand = new LandObject(landData.ownerID, landData.isGroupOwned, m_scene); | 111 | ILandObject newLand = new LandObject(landData.ownerID, landData.isGroupOwned, m_scene); |
112 | 112 | ||
113 | //Place all new variables here! | 113 | //Place all new variables here! |
114 | newLand.landBitmap = (bool[,]) (landBitmap.Clone()); | 114 | newLand.landBitmap = (bool[,]) (landBitmap.Clone()); |
115 | newLand.landData = landData.Copy(); | 115 | newLand.landData = landData.Copy(); |
116 | 116 | ||
117 | return newLand; | 117 | return newLand; |
118 | } | 118 | } |
119 | 119 | ||
120 | #endregion | 120 | #endregion |
121 | 121 | ||
122 | #region Packet Request Handling | 122 | #region Packet Request Handling |
123 | 123 | ||
124 | /// <summary> | 124 | /// <summary> |
125 | /// Sends land properties as requested | 125 | /// Sends land properties as requested |
126 | /// </summary> | 126 | /// </summary> |
127 | /// <param name="sequence_id">ID sent by client for them to keep track of</param> | 127 | /// <param name="sequence_id">ID sent by client for them to keep track of</param> |
128 | /// <param name="snap_selection">Bool sent by client for them to use</param> | 128 | /// <param name="snap_selection">Bool sent by client for them to use</param> |
129 | /// <param name="remote_client">Object representing the client</param> | 129 | /// <param name="remote_client">Object representing the client</param> |
130 | public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, | 130 | public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, |
131 | IClientAPI remote_client) | 131 | IClientAPI remote_client) |
132 | { | 132 | { |
133 | ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); | 133 | ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); |
134 | // TODO: don't create new blocks if recycling an old packet | 134 | // TODO: don't create new blocks if recycling an old packet |
135 | 135 | ||
136 | updatePacket.ParcelData.AABBMax = landData.AABBMax; | 136 | updatePacket.ParcelData.AABBMax = landData.AABBMax; |
137 | updatePacket.ParcelData.AABBMin = landData.AABBMin; | 137 | updatePacket.ParcelData.AABBMin = landData.AABBMin; |
138 | updatePacket.ParcelData.Area = landData.area; | 138 | updatePacket.ParcelData.Area = landData.area; |
139 | updatePacket.ParcelData.AuctionID = landData.auctionID; | 139 | updatePacket.ParcelData.AuctionID = landData.auctionID; |
140 | updatePacket.ParcelData.AuthBuyerID = landData.authBuyerID; //unemplemented | 140 | updatePacket.ParcelData.AuthBuyerID = landData.authBuyerID; //unemplemented |
141 | 141 | ||
142 | updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray; | 142 | updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray; |
143 | 143 | ||
144 | updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc); | 144 | updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc); |
145 | updatePacket.ParcelData.Category = (byte) landData.category; | 145 | updatePacket.ParcelData.Category = (byte) landData.category; |
146 | updatePacket.ParcelData.ClaimDate = landData.claimDate; | 146 | updatePacket.ParcelData.ClaimDate = landData.claimDate; |
147 | updatePacket.ParcelData.ClaimPrice = landData.claimPrice; | 147 | updatePacket.ParcelData.ClaimPrice = landData.claimPrice; |
148 | updatePacket.ParcelData.GroupID = landData.groupID; | 148 | updatePacket.ParcelData.GroupID = landData.groupID; |
149 | updatePacket.ParcelData.GroupPrims = landData.groupPrims; | 149 | updatePacket.ParcelData.GroupPrims = landData.groupPrims; |
150 | updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned; | 150 | updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned; |
151 | updatePacket.ParcelData.LandingType = (byte) landData.landingType; | 151 | updatePacket.ParcelData.LandingType = (byte) landData.landingType; |
152 | updatePacket.ParcelData.LocalID = landData.localID; | 152 | updatePacket.ParcelData.LocalID = landData.localID; |
153 | if (landData.area > 0) | 153 | if (landData.area > 0) |
154 | { | 154 | { |
155 | updatePacket.ParcelData.MaxPrims = | 155 | updatePacket.ParcelData.MaxPrims = |
156 | Convert.ToInt32( | 156 | Convert.ToInt32( |
157 | Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity * | 157 | Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity * |
158 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); | 158 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); |
159 | } | 159 | } |
160 | else | 160 | else |
161 | { | 161 | { |
162 | updatePacket.ParcelData.MaxPrims = 0; | 162 | updatePacket.ParcelData.MaxPrims = 0; |
163 | } | 163 | } |
164 | updatePacket.ParcelData.MediaAutoScale = landData.mediaAutoScale; | 164 | updatePacket.ParcelData.MediaAutoScale = landData.mediaAutoScale; |
165 | updatePacket.ParcelData.MediaID = landData.mediaID; | 165 | updatePacket.ParcelData.MediaID = landData.mediaID; |
166 | updatePacket.ParcelData.MediaURL = Helpers.StringToField(landData.mediaURL); | 166 | updatePacket.ParcelData.MediaURL = Helpers.StringToField(landData.mediaURL); |
167 | updatePacket.ParcelData.MusicURL = Helpers.StringToField(landData.musicURL); | 167 | updatePacket.ParcelData.MusicURL = Helpers.StringToField(landData.musicURL); |
168 | updatePacket.ParcelData.Name = Helpers.StringToField(landData.landName); | 168 | updatePacket.ParcelData.Name = Helpers.StringToField(landData.landName); |
169 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented | 169 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented |
170 | updatePacket.ParcelData.OtherCount = 0; //unemplemented | 170 | updatePacket.ParcelData.OtherCount = 0; //unemplemented |
171 | updatePacket.ParcelData.OtherPrims = landData.otherPrims; | 171 | updatePacket.ParcelData.OtherPrims = landData.otherPrims; |
172 | updatePacket.ParcelData.OwnerID = landData.ownerID; | 172 | updatePacket.ParcelData.OwnerID = landData.ownerID; |
173 | updatePacket.ParcelData.OwnerPrims = landData.ownerPrims; | 173 | updatePacket.ParcelData.OwnerPrims = landData.ownerPrims; |
174 | updatePacket.ParcelData.ParcelFlags = landData.landFlags; | 174 | updatePacket.ParcelData.ParcelFlags = landData.landFlags; |
175 | updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.EstateSettings.objectBonusFactor; | 175 | updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.EstateSettings.objectBonusFactor; |
176 | updatePacket.ParcelData.PassHours = landData.passHours; | 176 | updatePacket.ParcelData.PassHours = landData.passHours; |
177 | updatePacket.ParcelData.PassPrice = landData.passPrice; | 177 | updatePacket.ParcelData.PassPrice = landData.passPrice; |
178 | updatePacket.ParcelData.PublicCount = 0; //unemplemented | 178 | updatePacket.ParcelData.PublicCount = 0; //unemplemented |
179 | 179 | ||
180 | uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags; | 180 | uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags; |
181 | updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) > | 181 | updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) > |
182 | 0); | 182 | 0); |
183 | updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) > | 183 | updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) > |
184 | 0); | 184 | 0); |
185 | updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) > | 185 | updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) > |
186 | 0); | 186 | 0); |
187 | updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) > | 187 | updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) > |
188 | 0); | 188 | 0); |
189 | 189 | ||
190 | updatePacket.ParcelData.RentPrice = 0; | 190 | updatePacket.ParcelData.RentPrice = 0; |
191 | updatePacket.ParcelData.RequestResult = request_result; | 191 | updatePacket.ParcelData.RequestResult = request_result; |
192 | updatePacket.ParcelData.SalePrice = landData.salePrice; | 192 | updatePacket.ParcelData.SalePrice = landData.salePrice; |
193 | updatePacket.ParcelData.SelectedPrims = landData.selectedPrims; | 193 | updatePacket.ParcelData.SelectedPrims = landData.selectedPrims; |
194 | updatePacket.ParcelData.SelfCount = 0; //unemplemented | 194 | updatePacket.ParcelData.SelfCount = 0; //unemplemented |
195 | updatePacket.ParcelData.SequenceID = sequence_id; | 195 | updatePacket.ParcelData.SequenceID = sequence_id; |
196 | if (landData.simwideArea > 0) | 196 | if (landData.simwideArea > 0) |
197 | { | 197 | { |
198 | updatePacket.ParcelData.SimWideMaxPrims = | 198 | updatePacket.ParcelData.SimWideMaxPrims = |
199 | Convert.ToInt32( | 199 | Convert.ToInt32( |
200 | Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * m_scene.objectCapacity * | 200 | Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * m_scene.objectCapacity * |
201 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); | 201 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); |
202 | } | 202 | } |
203 | else | 203 | else |
204 | { | 204 | { |
205 | updatePacket.ParcelData.SimWideMaxPrims = 0; | 205 | updatePacket.ParcelData.SimWideMaxPrims = 0; |
206 | } | 206 | } |
207 | updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims; | 207 | updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims; |
208 | updatePacket.ParcelData.SnapSelection = snap_selection; | 208 | updatePacket.ParcelData.SnapSelection = snap_selection; |
209 | updatePacket.ParcelData.SnapshotID = landData.snapshotID; | 209 | updatePacket.ParcelData.SnapshotID = landData.snapshotID; |
210 | updatePacket.ParcelData.Status = (byte) landData.landStatus; | 210 | updatePacket.ParcelData.Status = (byte) landData.landStatus; |
211 | updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims + | 211 | updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims + |
212 | landData.selectedPrims; | 212 | landData.selectedPrims; |
213 | updatePacket.ParcelData.UserLocation = landData.userLocation; | 213 | updatePacket.ParcelData.UserLocation = landData.userLocation; |
214 | updatePacket.ParcelData.UserLookAt = landData.userLookAt; | 214 | updatePacket.ParcelData.UserLookAt = landData.userLookAt; |
215 | remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task); | 215 | remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task); |
216 | } | 216 | } |
217 | 217 | ||
218 | public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) | 218 | public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) |
219 | { | 219 | { |
220 | if (remote_client.AgentId == landData.ownerID) | 220 | if (remote_client.AgentId == landData.ownerID) |
221 | { | 221 | { |
222 | //Needs later group support | 222 | //Needs later group support |
223 | LandData newData = landData.Copy(); | 223 | LandData newData = landData.Copy(); |
224 | newData.authBuyerID = packet.ParcelData.AuthBuyerID; | 224 | newData.authBuyerID = packet.ParcelData.AuthBuyerID; |
225 | newData.category = (Parcel.ParcelCategory) packet.ParcelData.Category; | 225 | newData.category = (Parcel.ParcelCategory) packet.ParcelData.Category; |
226 | newData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); | 226 | newData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); |
227 | newData.groupID = packet.ParcelData.GroupID; | 227 | newData.groupID = packet.ParcelData.GroupID; |
228 | newData.landingType = packet.ParcelData.LandingType; | 228 | newData.landingType = packet.ParcelData.LandingType; |
229 | newData.mediaAutoScale = packet.ParcelData.MediaAutoScale; | 229 | newData.mediaAutoScale = packet.ParcelData.MediaAutoScale; |
230 | newData.mediaID = packet.ParcelData.MediaID; | 230 | newData.mediaID = packet.ParcelData.MediaID; |
231 | newData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); | 231 | newData.mediaURL = Helpers.FieldToUTF8String(packet.ParcelData.MediaURL); |
232 | newData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); | 232 | newData.musicURL = Helpers.FieldToUTF8String(packet.ParcelData.MusicURL); |
233 | newData.landName = Helpers.FieldToUTF8String(packet.ParcelData.Name); | 233 | newData.landName = Helpers.FieldToUTF8String(packet.ParcelData.Name); |
234 | newData.landFlags = packet.ParcelData.ParcelFlags; | 234 | newData.landFlags = packet.ParcelData.ParcelFlags; |
235 | newData.passHours = packet.ParcelData.PassHours; | 235 | newData.passHours = packet.ParcelData.PassHours; |
236 | newData.passPrice = packet.ParcelData.PassPrice; | 236 | newData.passPrice = packet.ParcelData.PassPrice; |
237 | newData.salePrice = packet.ParcelData.SalePrice; | 237 | newData.salePrice = packet.ParcelData.SalePrice; |
238 | newData.snapshotID = packet.ParcelData.SnapshotID; | 238 | newData.snapshotID = packet.ParcelData.SnapshotID; |
239 | newData.userLocation = packet.ParcelData.UserLocation; | 239 | newData.userLocation = packet.ParcelData.UserLocation; |
240 | newData.userLookAt = packet.ParcelData.UserLookAt; | 240 | newData.userLookAt = packet.ParcelData.UserLookAt; |
241 | 241 | ||
242 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | 242 | m_scene.LandChannel.updateLandObject(landData.localID, newData); |
243 | 243 | ||
244 | sendLandUpdateToAvatarsOverMe(); | 244 | sendLandUpdateToAvatarsOverMe(); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | public void updateLandSold(LLUUID avatarID, LLUUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) | 248 | public void updateLandSold(LLUUID avatarID, LLUUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) |
249 | { | 249 | { |
250 | LandData newData = landData.Copy(); | 250 | LandData newData = landData.Copy(); |
251 | newData.ownerID = avatarID; | 251 | newData.ownerID = avatarID; |
252 | newData.groupID = groupID; | 252 | newData.groupID = groupID; |
253 | newData.isGroupOwned = groupOwned; | 253 | newData.isGroupOwned = groupOwned; |
254 | //newData.auctionID = AuctionID; | 254 | //newData.auctionID = AuctionID; |
255 | newData.claimDate = Util.UnixTimeSinceEpoch(); | 255 | newData.claimDate = Util.UnixTimeSinceEpoch(); |
256 | newData.claimPrice = claimprice; | 256 | newData.claimPrice = claimprice; |
257 | newData.salePrice = 0; | 257 | newData.salePrice = 0; |
258 | newData.authBuyerID = LLUUID.Zero; | 258 | newData.authBuyerID = LLUUID.Zero; |
259 | newData.landFlags &= ~(uint) (Parcel.ParcelFlags.ForSale | Parcel.ParcelFlags.ForSaleObjects | Parcel.ParcelFlags.SellParcelObjects); | 259 | newData.landFlags &= ~(uint) (Parcel.ParcelFlags.ForSale | Parcel.ParcelFlags.ForSaleObjects | Parcel.ParcelFlags.SellParcelObjects); |
260 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | 260 | m_scene.LandChannel.updateLandObject(landData.localID, newData); |
261 | 261 | ||
262 | sendLandUpdateToAvatarsOverMe(); | 262 | sendLandUpdateToAvatarsOverMe(); |
263 | } | 263 | } |
264 | 264 | ||
265 | public bool isEitherBannedOrRestricted(LLUUID avatar) | 265 | public bool isEitherBannedOrRestricted(LLUUID avatar) |
266 | { | 266 | { |
267 | if (isBannedFromLand(avatar)) | 267 | if (isBannedFromLand(avatar)) |
268 | { | 268 | { |
269 | return true; | 269 | return true; |
270 | } | 270 | } |
271 | else if (isRestrictedFromLand(avatar)) | 271 | else if (isRestrictedFromLand(avatar)) |
272 | { | 272 | { |
273 | return true; | 273 | return true; |
274 | } | 274 | } |
275 | return false; | 275 | return false; |
276 | } | 276 | } |
277 | 277 | ||
278 | public bool isBannedFromLand(LLUUID avatar) | 278 | public bool isBannedFromLand(LLUUID avatar) |
279 | { | 279 | { |
280 | if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseBanList) > 0) | 280 | if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseBanList) > 0) |
281 | { | 281 | { |
282 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 282 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
283 | entry.AgentID = avatar; | 283 | entry.AgentID = avatar; |
284 | entry.Flags = ParcelManager.AccessList.Ban; | 284 | entry.Flags = ParcelManager.AccessList.Ban; |
285 | entry.Time = new DateTime(); | 285 | entry.Time = new DateTime(); |
286 | if (landData.parcelAccessList.Contains(entry)) | 286 | if (landData.parcelAccessList.Contains(entry)) |
287 | { | 287 | { |
288 | //They are banned, so lets send them a notice about this parcel | 288 | //They are banned, so lets send them a notice about this parcel |
289 | return true; | 289 | return true; |
290 | } | 290 | } |
291 | } | 291 | } |
292 | return false; | 292 | return false; |
293 | } | 293 | } |
294 | 294 | ||
295 | public bool isRestrictedFromLand(LLUUID avatar) | 295 | public bool isRestrictedFromLand(LLUUID avatar) |
296 | { | 296 | { |
297 | if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseAccessList) > 0) | 297 | if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseAccessList) > 0) |
298 | { | 298 | { |
299 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 299 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
300 | entry.AgentID = avatar; | 300 | entry.AgentID = avatar; |
301 | entry.Flags = ParcelManager.AccessList.Access; | 301 | entry.Flags = ParcelManager.AccessList.Access; |
302 | entry.Time = new DateTime(); | 302 | entry.Time = new DateTime(); |
303 | if (!landData.parcelAccessList.Contains(entry)) | 303 | if (!landData.parcelAccessList.Contains(entry)) |
304 | { | 304 | { |
305 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel | 305 | //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel |
306 | return true; | 306 | return true; |
307 | } | 307 | } |
308 | } | 308 | } |
309 | return false; | 309 | return false; |
310 | } | 310 | } |
311 | 311 | ||
312 | public void sendLandUpdateToClient(IClientAPI remote_client) | 312 | public void sendLandUpdateToClient(IClientAPI remote_client) |
313 | { | 313 | { |
314 | sendLandProperties(0, false, 0, remote_client); | 314 | sendLandProperties(0, false, 0, remote_client); |
315 | } | 315 | } |
316 | 316 | ||
317 | public void sendLandUpdateToAvatarsOverMe() | 317 | public void sendLandUpdateToAvatarsOverMe() |
318 | { | 318 | { |
319 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 319 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
320 | ILandObject over = null; | 320 | ILandObject over = null; |
321 | for (int i = 0; i < avatars.Count; i++) | 321 | for (int i = 0; i < avatars.Count; i++) |
322 | { | 322 | { |
323 | try | 323 | try |
324 | { | 324 | { |
325 | over = | 325 | over = |
326 | m_scene.LandChannel.getLandObject((int) Math.Max(255, Math.Min(0, Math.Round(avatars[i].AbsolutePosition.X))), | 326 | m_scene.LandChannel.getLandObject((int) Math.Max(255, Math.Min(0, Math.Round(avatars[i].AbsolutePosition.X))), |
327 | (int) Math.Max(255, Math.Min(0, Math.Round(avatars[i].AbsolutePosition.Y)))); | 327 | (int) Math.Max(255, Math.Min(0, Math.Round(avatars[i].AbsolutePosition.Y)))); |
328 | } | 328 | } |
329 | catch (Exception) | 329 | catch (Exception) |
330 | { | 330 | { |
331 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + | 331 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + |
332 | Math.Round(avatars[i].AbsolutePosition.Y)); | 332 | Math.Round(avatars[i].AbsolutePosition.Y)); |
333 | } | 333 | } |
334 | 334 | ||
335 | if (over != null) | 335 | if (over != null) |
336 | { | 336 | { |
337 | if (over.landData.localID == landData.localID) | 337 | if (over.landData.localID == landData.localID) |
338 | { | 338 | { |
339 | sendLandUpdateToClient(avatars[i].ControllingClient); | 339 | sendLandUpdateToClient(avatars[i].ControllingClient); |
340 | } | 340 | } |
341 | } | 341 | } |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | #endregion | 345 | #endregion |
346 | 346 | ||
347 | #region AccessList Functions | 347 | #region AccessList Functions |
348 | 348 | ||
349 | public ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag) | 349 | public ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag) |
350 | { | 350 | { |
351 | List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); | 351 | List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); |
352 | foreach (ParcelManager.ParcelAccessEntry entry in landData.parcelAccessList) | 352 | foreach (ParcelManager.ParcelAccessEntry entry in landData.parcelAccessList) |
353 | { | 353 | { |
354 | if (entry.Flags == flag) | 354 | if (entry.Flags == flag) |
355 | { | 355 | { |
356 | ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); | 356 | ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); |
357 | 357 | ||
358 | listBlock.Flags = (uint) 0; | 358 | listBlock.Flags = (uint) 0; |
359 | listBlock.ID = entry.AgentID; | 359 | listBlock.ID = entry.AgentID; |
360 | listBlock.Time = 0; | 360 | listBlock.Time = 0; |
361 | 361 | ||
362 | list.Add(listBlock); | 362 | list.Add(listBlock); |
363 | } | 363 | } |
364 | } | 364 | } |
365 | 365 | ||
366 | if (list.Count == 0) | 366 | if (list.Count == 0) |
367 | { | 367 | { |
368 | ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); | 368 | ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); |
369 | 369 | ||
370 | listBlock.Flags = (uint) 0; | 370 | listBlock.Flags = (uint) 0; |
371 | listBlock.ID = LLUUID.Zero; | 371 | listBlock.ID = LLUUID.Zero; |
372 | listBlock.Time = 0; | 372 | listBlock.Time = 0; |
373 | 373 | ||
374 | list.Add(listBlock); | 374 | list.Add(listBlock); |
375 | } | 375 | } |
376 | return list.ToArray(); | 376 | return list.ToArray(); |
377 | } | 377 | } |
378 | 378 | ||
379 | public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, | 379 | public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, |
380 | IClientAPI remote_client) | 380 | IClientAPI remote_client) |
381 | { | 381 | { |
382 | ParcelAccessListReplyPacket replyPacket; | 382 | ParcelAccessListReplyPacket replyPacket; |
383 | 383 | ||
384 | if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) | 384 | if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) |
385 | { | 385 | { |
386 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); | 386 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); |
387 | replyPacket.Data.AgentID = agentID; | 387 | replyPacket.Data.AgentID = agentID; |
388 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; | 388 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; |
389 | replyPacket.Data.LocalID = landData.localID; | 389 | replyPacket.Data.LocalID = landData.localID; |
390 | replyPacket.Data.SequenceID = 0; | 390 | replyPacket.Data.SequenceID = 0; |
391 | 391 | ||
392 | replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access); | 392 | replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access); |
393 | remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task); | 393 | remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task); |
394 | } | 394 | } |
395 | 395 | ||
396 | if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) | 396 | if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) |
397 | { | 397 | { |
398 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); | 398 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); |
399 | replyPacket.Data.AgentID = agentID; | 399 | replyPacket.Data.AgentID = agentID; |
400 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; | 400 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; |
401 | replyPacket.Data.LocalID = landData.localID; | 401 | replyPacket.Data.LocalID = landData.localID; |
402 | replyPacket.Data.SequenceID = 0; | 402 | replyPacket.Data.SequenceID = 0; |
403 | 403 | ||
404 | replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban); | 404 | replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban); |
405 | remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task); | 405 | remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task); |
406 | } | 406 | } |
407 | } | 407 | } |
408 | 408 | ||
409 | public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) | 409 | public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) |
410 | { | 410 | { |
411 | LandData newData = landData.Copy(); | 411 | LandData newData = landData.Copy(); |
412 | 412 | ||
413 | if (entries.Count == 1 && entries[0].AgentID == LLUUID.Zero) | 413 | if (entries.Count == 1 && entries[0].AgentID == LLUUID.Zero) |
414 | { | 414 | { |
415 | entries.Clear(); | 415 | entries.Clear(); |
416 | } | 416 | } |
417 | 417 | ||
418 | List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); | 418 | List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); |
419 | foreach (ParcelManager.ParcelAccessEntry entry in newData.parcelAccessList) | 419 | foreach (ParcelManager.ParcelAccessEntry entry in newData.parcelAccessList) |
420 | { | 420 | { |
421 | if (entry.Flags == (ParcelManager.AccessList) flags) | 421 | if (entry.Flags == (ParcelManager.AccessList) flags) |
422 | { | 422 | { |
423 | toRemove.Add(entry); | 423 | toRemove.Add(entry); |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) | 427 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) |
428 | { | 428 | { |
429 | newData.parcelAccessList.Remove(entry); | 429 | newData.parcelAccessList.Remove(entry); |
430 | } | 430 | } |
431 | foreach (ParcelManager.ParcelAccessEntry entry in entries) | 431 | foreach (ParcelManager.ParcelAccessEntry entry in entries) |
432 | { | 432 | { |
433 | ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); | 433 | ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); |
434 | temp.AgentID = entry.AgentID; | 434 | temp.AgentID = entry.AgentID; |
435 | temp.Time = new DateTime(); //Pointless? Yes. | 435 | temp.Time = new DateTime(); //Pointless? Yes. |
436 | temp.Flags = (ParcelManager.AccessList) flags; | 436 | temp.Flags = (ParcelManager.AccessList) flags; |
437 | 437 | ||
438 | if (!newData.parcelAccessList.Contains(temp)) | 438 | if (!newData.parcelAccessList.Contains(temp)) |
439 | { | 439 | { |
440 | newData.parcelAccessList.Add(temp); | 440 | newData.parcelAccessList.Add(temp); |
441 | } | 441 | } |
442 | } | 442 | } |
443 | 443 | ||
444 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | 444 | m_scene.LandChannel.updateLandObject(landData.localID, newData); |
445 | } | 445 | } |
446 | 446 | ||
447 | #endregion | 447 | #endregion |
448 | 448 | ||
449 | #region Update Functions | 449 | #region Update Functions |
450 | 450 | ||
451 | public void updateLandBitmapByteArray() | 451 | public void updateLandBitmapByteArray() |
452 | { | 452 | { |
453 | landData.landBitmapByteArray = convertLandBitmapToBytes(); | 453 | landData.landBitmapByteArray = convertLandBitmapToBytes(); |
454 | } | 454 | } |
455 | 455 | ||
456 | /// <summary> | 456 | /// <summary> |
457 | /// Update all settings in land such as area, bitmap byte array, etc | 457 | /// Update all settings in land such as area, bitmap byte array, etc |
458 | /// </summary> | 458 | /// </summary> |
459 | public void forceUpdateLandInfo() | 459 | public void forceUpdateLandInfo() |
460 | { | 460 | { |
461 | updateAABBAndAreaValues(); | 461 | updateAABBAndAreaValues(); |
462 | updateLandBitmapByteArray(); | 462 | updateLandBitmapByteArray(); |
463 | } | 463 | } |
464 | 464 | ||
465 | public void setLandBitmapFromByteArray() | 465 | public void setLandBitmapFromByteArray() |
466 | { | 466 | { |
467 | landBitmap = convertBytesToLandBitmap(); | 467 | landBitmap = convertBytesToLandBitmap(); |
468 | } | 468 | } |
469 | 469 | ||
470 | /// <summary> | 470 | /// <summary> |
471 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object | 471 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object |
472 | /// </summary> | 472 | /// </summary> |
473 | private void updateAABBAndAreaValues() | 473 | private void updateAABBAndAreaValues() |
474 | { | 474 | { |
475 | int min_x = 64; | 475 | int min_x = 64; |
476 | int min_y = 64; | 476 | int min_y = 64; |
477 | int max_x = 0; | 477 | int max_x = 0; |
478 | int max_y = 0; | 478 | int max_y = 0; |
479 | int tempArea = 0; | 479 | int tempArea = 0; |
480 | int x, y; | 480 | int x, y; |
481 | for (x = 0; x < 64; x++) | 481 | for (x = 0; x < 64; x++) |
482 | { | 482 | { |
483 | for (y = 0; y < 64; y++) | 483 | for (y = 0; y < 64; y++) |
484 | { | 484 | { |
485 | if (landBitmap[x, y] == true) | 485 | if (landBitmap[x, y] == true) |
486 | { | 486 | { |
487 | if (min_x > x) min_x = x; | 487 | if (min_x > x) min_x = x; |
488 | if (min_y > y) min_y = y; | 488 | if (min_y > y) min_y = y; |
489 | if (max_x < x) max_x = x; | 489 | if (max_x < x) max_x = x; |
490 | if (max_y < y) max_y = y; | 490 | if (max_y < y) max_y = y; |
491 | tempArea += 16; //16sqm peice of land | 491 | tempArea += 16; //16sqm peice of land |
492 | } | 492 | } |
493 | } | 493 | } |
494 | } | 494 | } |
495 | int tx = min_x * 4; | 495 | int tx = min_x * 4; |
496 | if (tx > 255) | 496 | if (tx > 255) |
497 | tx = 255; | 497 | tx = 255; |
498 | int ty = min_y * 4; | 498 | int ty = min_y * 4; |
499 | if (ty > 255) | 499 | if (ty > 255) |
500 | ty = 255; | 500 | ty = 255; |
501 | landData.AABBMin = | 501 | landData.AABBMin = |
502 | new LLVector3((float) (min_x * 4), (float) (min_y * 4), | 502 | new LLVector3((float) (min_x * 4), (float) (min_y * 4), |
503 | (float) m_scene.Heightmap[tx, ty]); | 503 | (float) m_scene.Heightmap[tx, ty]); |
504 | 504 | ||
505 | tx = max_x * 4; | 505 | tx = max_x * 4; |
506 | if (tx > 255) | 506 | if (tx > 255) |
507 | tx = 255; | 507 | tx = 255; |
508 | ty = max_y * 4; | 508 | ty = max_y * 4; |
509 | if (ty > 255) | 509 | if (ty > 255) |
510 | ty = 255; | 510 | ty = 255; |
511 | landData.AABBMax = | 511 | landData.AABBMax = |
512 | new LLVector3((float) (max_x * 4), (float) (max_y * 4), | 512 | new LLVector3((float) (max_x * 4), (float) (max_y * 4), |
513 | (float) m_scene.Heightmap[tx, ty]); | 513 | (float) m_scene.Heightmap[tx, ty]); |
514 | landData.area = tempArea; | 514 | landData.area = tempArea; |
515 | } | 515 | } |
516 | 516 | ||
517 | #endregion | 517 | #endregion |
518 | 518 | ||
519 | #region Land Bitmap Functions | 519 | #region Land Bitmap Functions |
520 | 520 | ||
521 | /// <summary> | 521 | /// <summary> |
522 | /// Sets the land's bitmap manually | 522 | /// Sets the land's bitmap manually |
523 | /// </summary> | 523 | /// </summary> |
524 | /// <param name="bitmap">64x64 block representing where this land is on a map</param> | 524 | /// <param name="bitmap">64x64 block representing where this land is on a map</param> |
525 | public void setLandBitmap(bool[,] bitmap) | 525 | public void setLandBitmap(bool[,] bitmap) |
526 | { | 526 | { |
527 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) | 527 | if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) |
528 | { | 528 | { |
529 | //Throw an exception - The bitmap is not 64x64 | 529 | //Throw an exception - The bitmap is not 64x64 |
530 | //throw new Exception("Error: Invalid Parcel Bitmap"); | 530 | //throw new Exception("Error: Invalid Parcel Bitmap"); |
531 | } | 531 | } |
532 | else | 532 | else |
533 | { | 533 | { |
534 | //Valid: Lets set it | 534 | //Valid: Lets set it |
535 | landBitmap = bitmap; | 535 | landBitmap = bitmap; |
536 | forceUpdateLandInfo(); | 536 | forceUpdateLandInfo(); |
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||
540 | /// <summary> | 540 | /// <summary> |
541 | /// Gets the land's bitmap manually | 541 | /// Gets the land's bitmap manually |
542 | /// </summary> | 542 | /// </summary> |
543 | /// <returns></returns> | 543 | /// <returns></returns> |
544 | public bool[,] getLandBitmap() | 544 | public bool[,] getLandBitmap() |
545 | { | 545 | { |
546 | return landBitmap; | 546 | return landBitmap; |
547 | } | 547 | } |
548 | 548 | ||
549 | /// <summary> | 549 | /// <summary> |
550 | /// Full sim land object creation | 550 | /// Full sim land object creation |
551 | /// </summary> | 551 | /// </summary> |
552 | /// <returns></returns> | 552 | /// <returns></returns> |
553 | public bool[,] basicFullRegionLandBitmap() | 553 | public bool[,] basicFullRegionLandBitmap() |
554 | { | 554 | { |
555 | return getSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); | 555 | return getSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); |
556 | } | 556 | } |
557 | 557 | ||
558 | /// <summary> | 558 | /// <summary> |
559 | /// Used to modify the bitmap between the x and y points. Points use 64 scale | 559 | /// Used to modify the bitmap between the x and y points. Points use 64 scale |
560 | /// </summary> | 560 | /// </summary> |
561 | /// <param name="start_x"></param> | 561 | /// <param name="start_x"></param> |
562 | /// <param name="start_y"></param> | 562 | /// <param name="start_y"></param> |
563 | /// <param name="end_x"></param> | 563 | /// <param name="end_x"></param> |
564 | /// <param name="end_y"></param> | 564 | /// <param name="end_y"></param> |
565 | /// <returns></returns> | 565 | /// <returns></returns> |
566 | public bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) | 566 | public bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) |
567 | { | 567 | { |
568 | bool[,] tempBitmap = new bool[64,64]; | 568 | bool[,] tempBitmap = new bool[64,64]; |
569 | tempBitmap.Initialize(); | 569 | tempBitmap.Initialize(); |
570 | 570 | ||
571 | tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); | 571 | tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); |
572 | return tempBitmap; | 572 | return tempBitmap; |
573 | } | 573 | } |
574 | 574 | ||
575 | /// <summary> | 575 | /// <summary> |
576 | /// Change a land bitmap at within a square and set those points to a specific value | 576 | /// Change a land bitmap at within a square and set those points to a specific value |
577 | /// </summary> | 577 | /// </summary> |
578 | /// <param name="land_bitmap"></param> | 578 | /// <param name="land_bitmap"></param> |
579 | /// <param name="start_x"></param> | 579 | /// <param name="start_x"></param> |
580 | /// <param name="start_y"></param> | 580 | /// <param name="start_y"></param> |
581 | /// <param name="end_x"></param> | 581 | /// <param name="end_x"></param> |
582 | /// <param name="end_y"></param> | 582 | /// <param name="end_y"></param> |
583 | /// <param name="set_value"></param> | 583 | /// <param name="set_value"></param> |
584 | /// <returns></returns> | 584 | /// <returns></returns> |
585 | public bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, | 585 | public bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, |
586 | bool set_value) | 586 | bool set_value) |
587 | { | 587 | { |
588 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) | 588 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) |
589 | { | 589 | { |
590 | //Throw an exception - The bitmap is not 64x64 | 590 | //Throw an exception - The bitmap is not 64x64 |
591 | //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); | 591 | //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); |
592 | } | 592 | } |
593 | 593 | ||
594 | int x, y; | 594 | int x, y; |
595 | for (y = 0; y < 64; y++) | 595 | for (y = 0; y < 64; y++) |
596 | { | 596 | { |
597 | for (x = 0; x < 64; x++) | 597 | for (x = 0; x < 64; x++) |
598 | { | 598 | { |
599 | if (x >= start_x / 4 && x < end_x / 4 | 599 | if (x >= start_x / 4 && x < end_x / 4 |
600 | && y >= start_y / 4 && y < end_y / 4) | 600 | && y >= start_y / 4 && y < end_y / 4) |
601 | { | 601 | { |
602 | land_bitmap[x, y] = set_value; | 602 | land_bitmap[x, y] = set_value; |
603 | } | 603 | } |
604 | } | 604 | } |
605 | } | 605 | } |
606 | return land_bitmap; | 606 | return land_bitmap; |
607 | } | 607 | } |
608 | 608 | ||
609 | /// <summary> | 609 | /// <summary> |
610 | /// Join the true values of 2 bitmaps together | 610 | /// Join the true values of 2 bitmaps together |
611 | /// </summary> | 611 | /// </summary> |
612 | /// <param name="bitmap_base"></param> | 612 | /// <param name="bitmap_base"></param> |
613 | /// <param name="bitmap_add"></param> | 613 | /// <param name="bitmap_add"></param> |
614 | /// <returns></returns> | 614 | /// <returns></returns> |
615 | public bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) | 615 | public bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) |
616 | { | 616 | { |
617 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) | 617 | if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) |
618 | { | 618 | { |
619 | //Throw an exception - The bitmap is not 64x64 | 619 | //Throw an exception - The bitmap is not 64x64 |
620 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); | 620 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); |
621 | } | 621 | } |
622 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) | 622 | if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) |
623 | { | 623 | { |
624 | //Throw an exception - The bitmap is not 64x64 | 624 | //Throw an exception - The bitmap is not 64x64 |
625 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); | 625 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); |
626 | } | 626 | } |
627 | 627 | ||
628 | int x, y; | 628 | int x, y; |
629 | for (y = 0; y < 64; y++) | 629 | for (y = 0; y < 64; y++) |
630 | { | 630 | { |
631 | for (x = 0; x < 64; x++) | 631 | for (x = 0; x < 64; x++) |
632 | { | 632 | { |
633 | if (bitmap_add[x, y]) | 633 | if (bitmap_add[x, y]) |
634 | { | 634 | { |
635 | bitmap_base[x, y] = true; | 635 | bitmap_base[x, y] = true; |
636 | } | 636 | } |
637 | } | 637 | } |
638 | } | 638 | } |
639 | return bitmap_base; | 639 | return bitmap_base; |
640 | } | 640 | } |
641 | 641 | ||
642 | /// <summary> | 642 | /// <summary> |
643 | /// Converts the land bitmap to a packet friendly byte array | 643 | /// Converts the land bitmap to a packet friendly byte array |
644 | /// </summary> | 644 | /// </summary> |
645 | /// <returns></returns> | 645 | /// <returns></returns> |
646 | private byte[] convertLandBitmapToBytes() | 646 | private byte[] convertLandBitmapToBytes() |
647 | { | 647 | { |
648 | byte[] tempConvertArr = new byte[512]; | 648 | byte[] tempConvertArr = new byte[512]; |
649 | byte tempByte = 0; | 649 | byte tempByte = 0; |
650 | int x, y, i, byteNum = 0; | 650 | int x, y, i, byteNum = 0; |
651 | i = 0; | 651 | i = 0; |
652 | for (y = 0; y < 64; y++) | 652 | for (y = 0; y < 64; y++) |
653 | { | 653 | { |
654 | for (x = 0; x < 64; x++) | 654 | for (x = 0; x < 64; x++) |
655 | { | 655 | { |
656 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++ % 8)); | 656 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++ % 8)); |
657 | if (i % 8 == 0) | 657 | if (i % 8 == 0) |
658 | { | 658 | { |
659 | tempConvertArr[byteNum] = tempByte; | 659 | tempConvertArr[byteNum] = tempByte; |
660 | tempByte = (byte) 0; | 660 | tempByte = (byte) 0; |
661 | i = 0; | 661 | i = 0; |
662 | byteNum++; | 662 | byteNum++; |
663 | } | 663 | } |
664 | } | 664 | } |
665 | } | 665 | } |
666 | return tempConvertArr; | 666 | return tempConvertArr; |
667 | } | 667 | } |
668 | 668 | ||
669 | private bool[,] convertBytesToLandBitmap() | 669 | private bool[,] convertBytesToLandBitmap() |
670 | { | 670 | { |
671 | bool[,] tempConvertMap = new bool[64,64]; | 671 | bool[,] tempConvertMap = new bool[64,64]; |
672 | tempConvertMap.Initialize(); | 672 | tempConvertMap.Initialize(); |
673 | byte tempByte = 0; | 673 | byte tempByte = 0; |
674 | int x = 0, y = 0, i = 0, bitNum = 0; | 674 | int x = 0, y = 0, i = 0, bitNum = 0; |
675 | for (i = 0; i < 512; i++) | 675 | for (i = 0; i < 512; i++) |
676 | { | 676 | { |
677 | tempByte = landData.landBitmapByteArray[i]; | 677 | tempByte = landData.landBitmapByteArray[i]; |
678 | for (bitNum = 0; bitNum < 8; bitNum++) | 678 | for (bitNum = 0; bitNum < 8; bitNum++) |
679 | { | 679 | { |
680 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); | 680 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); |
681 | tempConvertMap[x, y] = bit; | 681 | tempConvertMap[x, y] = bit; |
682 | x++; | 682 | x++; |
683 | if (x > 63) | 683 | if (x > 63) |
684 | { | 684 | { |
685 | x = 0; | 685 | x = 0; |
686 | y++; | 686 | y++; |
687 | } | 687 | } |
688 | } | 688 | } |
689 | } | 689 | } |
690 | return tempConvertMap; | 690 | return tempConvertMap; |
691 | } | 691 | } |
692 | 692 | ||
693 | #endregion | 693 | #endregion |
694 | 694 | ||
695 | #region Object Select and Object Owner Listing | 695 | #region Object Select and Object Owner Listing |
696 | 696 | ||
697 | public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) | 697 | public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) |
698 | { | 698 | { |
699 | List<uint> resultLocalIDs = new List<uint>(); | 699 | List<uint> resultLocalIDs = new List<uint>(); |
700 | foreach (SceneObjectGroup obj in primsOverMe) | 700 | foreach (SceneObjectGroup obj in primsOverMe) |
701 | { | 701 | { |
702 | if (obj.LocalId > 0) | 702 | if (obj.LocalId > 0) |
703 | { | 703 | { |
704 | if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID) | 704 | if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID) |
705 | { | 705 | { |
706 | resultLocalIDs.Add(obj.LocalId); | 706 | resultLocalIDs.Add(obj.LocalId); |
707 | } | 707 | } |
708 | // else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support | 708 | // else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support |
709 | // { | 709 | // { |
710 | // } | 710 | // } |
711 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && | 711 | else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && |
712 | obj.OwnerID != remote_client.AgentId) | 712 | obj.OwnerID != remote_client.AgentId) |
713 | { | 713 | { |
714 | resultLocalIDs.Add(obj.LocalId); | 714 | resultLocalIDs.Add(obj.LocalId); |
715 | } | 715 | } |
716 | } | 716 | } |
717 | } | 717 | } |
718 | 718 | ||
719 | 719 | ||
720 | bool firstCall = true; | 720 | bool firstCall = true; |
721 | int MAX_OBJECTS_PER_PACKET = 251; | 721 | int MAX_OBJECTS_PER_PACKET = 251; |
722 | ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); | 722 | ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); |
723 | // TODO: don't create new blocks if recycling an old packet | 723 | // TODO: don't create new blocks if recycling an old packet |
724 | ForceObjectSelectPacket.DataBlock[] data; | 724 | ForceObjectSelectPacket.DataBlock[] data; |
725 | while (resultLocalIDs.Count > 0) | 725 | while (resultLocalIDs.Count > 0) |
726 | { | 726 | { |
727 | if (firstCall) | 727 | if (firstCall) |
728 | { | 728 | { |
729 | pack._Header.ResetList = true; | 729 | pack._Header.ResetList = true; |
730 | firstCall = false; | 730 | firstCall = false; |
731 | } | 731 | } |
732 | else | 732 | else |
733 | { | 733 | { |
734 | pack._Header.ResetList = false; | 734 | pack._Header.ResetList = false; |
735 | } | 735 | } |
736 | 736 | ||
737 | if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET) | 737 | if (resultLocalIDs.Count > MAX_OBJECTS_PER_PACKET) |
738 | { | 738 | { |
739 | data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET]; | 739 | data = new ForceObjectSelectPacket.DataBlock[MAX_OBJECTS_PER_PACKET]; |
740 | } | 740 | } |
741 | else | 741 | else |
742 | { | 742 | { |
743 | data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count]; | 743 | data = new ForceObjectSelectPacket.DataBlock[resultLocalIDs.Count]; |
744 | } | 744 | } |
745 | 745 | ||
746 | int i; | 746 | int i; |
747 | for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++) | 747 | for (i = 0; i < MAX_OBJECTS_PER_PACKET && resultLocalIDs.Count > 0; i++) |
748 | { | 748 | { |
749 | data[i] = new ForceObjectSelectPacket.DataBlock(); | 749 | data[i] = new ForceObjectSelectPacket.DataBlock(); |
750 | data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]); | 750 | data[i].LocalID = Convert.ToUInt32(resultLocalIDs[0]); |
751 | resultLocalIDs.RemoveAt(0); | 751 | resultLocalIDs.RemoveAt(0); |
752 | } | 752 | } |
753 | pack.Data = data; | 753 | pack.Data = data; |
754 | remote_client.OutPacket((Packet) pack, ThrottleOutPacketType.Task); | 754 | remote_client.OutPacket((Packet) pack, ThrottleOutPacketType.Task); |
755 | } | 755 | } |
756 | } | 756 | } |
757 | 757 | ||
758 | /// <summary> | 758 | /// <summary> |
759 | /// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes | 759 | /// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes |
760 | /// aggreagete details such as the number of prims. | 760 | /// aggreagete details such as the number of prims. |
761 | /// | 761 | /// |
762 | /// </summary> | 762 | /// </summary> |
763 | /// <param name="remote_client"> | 763 | /// <param name="remote_client"> |
764 | /// A <see cref="IClientAPI"/> | 764 | /// A <see cref="IClientAPI"/> |
765 | /// </param> | 765 | /// </param> |
766 | public void sendLandObjectOwners(IClientAPI remote_client) | 766 | public void sendLandObjectOwners(IClientAPI remote_client) |
767 | { | 767 | { |
768 | Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>(); | 768 | Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>(); |
769 | ParcelObjectOwnersReplyPacket pack | 769 | ParcelObjectOwnersReplyPacket pack |
770 | = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); | 770 | = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); |
771 | // TODO: don't create new blocks if recycling an old packet | 771 | // TODO: don't create new blocks if recycling an old packet |
772 | 772 | ||
773 | foreach (SceneObjectGroup obj in primsOverMe) | 773 | foreach (SceneObjectGroup obj in primsOverMe) |
774 | { | 774 | { |
775 | try | 775 | try |
776 | { | 776 | { |
777 | if (!primCount.ContainsKey(obj.OwnerID)) | 777 | if (!primCount.ContainsKey(obj.OwnerID)) |
778 | { | 778 | { |
779 | primCount.Add(obj.OwnerID, 0); | 779 | primCount.Add(obj.OwnerID, 0); |
780 | } | 780 | } |
781 | } | 781 | } |
782 | catch (NullReferenceException) | 782 | catch (NullReferenceException) |
783 | { | 783 | { |
784 | m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); | 784 | m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); |
785 | } | 785 | } |
786 | try | 786 | try |
787 | { | 787 | { |
788 | primCount[obj.OwnerID] += obj.PrimCount; | 788 | primCount[obj.OwnerID] += obj.PrimCount; |
789 | } | 789 | } |
790 | catch (KeyNotFoundException) | 790 | catch (KeyNotFoundException) |
791 | { | 791 | { |
792 | m_log.Error("[LAND]: Unable to match a prim with it's owner."); | 792 | m_log.Error("[LAND]: Unable to match a prim with it's owner."); |
793 | } | 793 | } |
794 | } | 794 | } |
795 | 795 | ||
796 | int notifyCount = primCount.Count; | 796 | int notifyCount = primCount.Count; |
797 | 797 | ||
798 | if (notifyCount > 0) | 798 | if (notifyCount > 0) |
799 | { | 799 | { |
800 | if (notifyCount > 32) | 800 | if (notifyCount > 32) |
801 | { | 801 | { |
802 | m_log.InfoFormat( | 802 | m_log.InfoFormat( |
803 | "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" | 803 | "[LAND]: More than {0} avatars own prims on this parcel. Only sending back details of first {0}" |
804 | + " - a developer might want to investigate whether this is a hard limit", 32); | 804 | + " - a developer might want to investigate whether this is a hard limit", 32); |
805 | 805 | ||
806 | notifyCount = 32; | 806 | notifyCount = 32; |
807 | } | 807 | } |
808 | 808 | ||
809 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock | 809 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock |
810 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; | 810 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; |
811 | 811 | ||
812 | int num = 0; | 812 | int num = 0; |
813 | foreach (LLUUID owner in primCount.Keys) | 813 | foreach (LLUUID owner in primCount.Keys) |
814 | { | 814 | { |
815 | dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock(); | 815 | dataBlock[num] = new ParcelObjectOwnersReplyPacket.DataBlock(); |
816 | dataBlock[num].Count = primCount[owner]; | 816 | dataBlock[num].Count = primCount[owner]; |
817 | dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added | 817 | dataBlock[num].IsGroupOwned = false; //TODO: fix me when group support is added |
818 | dataBlock[num].OnlineStatus = true; //TODO: fix me later | 818 | dataBlock[num].OnlineStatus = true; //TODO: fix me later |
819 | dataBlock[num].OwnerID = owner; | 819 | dataBlock[num].OwnerID = owner; |
820 | 820 | ||
821 | num++; | 821 | num++; |
822 | 822 | ||
823 | if (num >= notifyCount) | 823 | if (num >= notifyCount) |
824 | { | 824 | { |
825 | break; | 825 | break; |
826 | } | 826 | } |
827 | } | 827 | } |
828 | 828 | ||
829 | pack.Data = dataBlock; | 829 | pack.Data = dataBlock; |
830 | } | 830 | } |
831 | 831 | ||
832 | remote_client.OutPacket(pack, ThrottleOutPacketType.Task); | 832 | remote_client.OutPacket(pack, ThrottleOutPacketType.Task); |
833 | } | 833 | } |
834 | 834 | ||
835 | public Dictionary<LLUUID, int> getLandObjectOwners() | 835 | public Dictionary<LLUUID, int> getLandObjectOwners() |
836 | { | 836 | { |
837 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); | 837 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); |
838 | foreach (SceneObjectGroup obj in primsOverMe) | 838 | foreach (SceneObjectGroup obj in primsOverMe) |
839 | { | 839 | { |
840 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) | 840 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) |
841 | { | 841 | { |
842 | ownersAndCount.Add(obj.OwnerID, 0); | 842 | ownersAndCount.Add(obj.OwnerID, 0); |
843 | } | 843 | } |
844 | ownersAndCount[obj.OwnerID] += obj.PrimCount; | 844 | ownersAndCount[obj.OwnerID] += obj.PrimCount; |
845 | } | 845 | } |
846 | return ownersAndCount; | 846 | return ownersAndCount; |
847 | } | 847 | } |
848 | 848 | ||
849 | #endregion | 849 | #endregion |
850 | 850 | ||
851 | #region Object Returning | 851 | #region Object Returning |
852 | 852 | ||
853 | public void returnObject(SceneObjectGroup obj) | 853 | public void returnObject(SceneObjectGroup obj) |
854 | { | 854 | { |
855 | } | 855 | } |
856 | 856 | ||
857 | public void returnLandObjects(int type, LLUUID owner) | 857 | public void returnLandObjects(int type, LLUUID owner) |
858 | { | 858 | { |
859 | } | 859 | } |
860 | 860 | ||
861 | #endregion | 861 | #endregion |
862 | 862 | ||
863 | #region Object Adding/Removing from Parcel | 863 | #region Object Adding/Removing from Parcel |
864 | 864 | ||
865 | public void resetLandPrimCounts() | 865 | public void resetLandPrimCounts() |
866 | { | 866 | { |
867 | landData.groupPrims = 0; | 867 | landData.groupPrims = 0; |
868 | landData.ownerPrims = 0; | 868 | landData.ownerPrims = 0; |
869 | landData.otherPrims = 0; | 869 | landData.otherPrims = 0; |
870 | landData.selectedPrims = 0; | 870 | landData.selectedPrims = 0; |
871 | primsOverMe.Clear(); | 871 | primsOverMe.Clear(); |
872 | } | 872 | } |
873 | 873 | ||
874 | public void addPrimToCount(SceneObjectGroup obj) | 874 | public void addPrimToCount(SceneObjectGroup obj) |
875 | { | 875 | { |
876 | LLUUID prim_owner = obj.OwnerID; | 876 | LLUUID prim_owner = obj.OwnerID; |
877 | int prim_count = obj.PrimCount; | 877 | int prim_count = obj.PrimCount; |
878 | 878 | ||
879 | if (obj.IsSelected) | 879 | if (obj.IsSelected) |
880 | { | 880 | { |
881 | landData.selectedPrims += prim_count; | 881 | landData.selectedPrims += prim_count; |
882 | } | 882 | } |
883 | else | 883 | else |
884 | { | 884 | { |
885 | if (prim_owner == landData.ownerID) | 885 | if (prim_owner == landData.ownerID) |
886 | { | 886 | { |
887 | landData.ownerPrims += prim_count; | 887 | landData.ownerPrims += prim_count; |
888 | } | 888 | } |
889 | else | 889 | else |
890 | { | 890 | { |
891 | landData.otherPrims += prim_count; | 891 | landData.otherPrims += prim_count; |
892 | } | 892 | } |
893 | } | 893 | } |
894 | 894 | ||
895 | primsOverMe.Add(obj); | 895 | primsOverMe.Add(obj); |
896 | } | 896 | } |
897 | 897 | ||
898 | public void removePrimFromCount(SceneObjectGroup obj) | 898 | public void removePrimFromCount(SceneObjectGroup obj) |
899 | { | 899 | { |
900 | if (primsOverMe.Contains(obj)) | 900 | if (primsOverMe.Contains(obj)) |
901 | { | 901 | { |
902 | LLUUID prim_owner = obj.OwnerID; | 902 | LLUUID prim_owner = obj.OwnerID; |
903 | int prim_count = obj.PrimCount; | 903 | int prim_count = obj.PrimCount; |
904 | 904 | ||
905 | if (prim_owner == landData.ownerID) | 905 | if (prim_owner == landData.ownerID) |
906 | { | 906 | { |
907 | landData.ownerPrims -= prim_count; | 907 | landData.ownerPrims -= prim_count; |
908 | } | 908 | } |
909 | else if (prim_owner == landData.groupID) | 909 | else if (prim_owner == landData.groupID) |
910 | { | 910 | { |
911 | landData.groupPrims -= prim_count; | 911 | landData.groupPrims -= prim_count; |
912 | } | 912 | } |
913 | else | 913 | else |
914 | { | 914 | { |
915 | landData.otherPrims -= prim_count; | 915 | landData.otherPrims -= prim_count; |
916 | } | 916 | } |
917 | 917 | ||
918 | primsOverMe.Remove(obj); | 918 | primsOverMe.Remove(obj); |
919 | } | 919 | } |
920 | } | 920 | } |
921 | 921 | ||
922 | #endregion | 922 | #endregion |
923 | 923 | ||
924 | #endregion | 924 | #endregion |
925 | 925 | ||
926 | #endregion | 926 | #endregion |
927 | } | 927 | } |
928 | } \ No newline at end of file | 928 | } \ No newline at end of file |