diff options
author | lbsa71 | 2007-09-19 00:30:55 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-19 00:30:55 +0000 |
commit | 8f0b03597b0bc8ea6873af9a55495407fae1ec56 (patch) | |
tree | f9f4de38379aebf2223ad4cb10a3d9ebcfa52a4f /OpenSim/Region/Environment/LandManagement | |
parent | * Moved SendLogoutPacket back to IClientAPI. (diff) | |
download | opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.zip opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.gz opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.bz2 opensim-SC-8f0b03597b0bc8ea6873af9a55495407fae1ec56.tar.xz |
* Modernized ScriptManager to new interface-based module calls.
* 'remove redundant this qualifier' ftw
Diffstat (limited to 'OpenSim/Region/Environment/LandManagement')
-rw-r--r-- | OpenSim/Region/Environment/LandManagement/Land.cs | 149 | ||||
-rw-r--r-- | OpenSim/Region/Environment/LandManagement/LandManager.cs | 122 |
2 files changed, 151 insertions, 120 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs index a1d8885..4d36650 100644 --- a/OpenSim/Region/Environment/LandManagement/Land.cs +++ b/OpenSim/Region/Environment/LandManagement/Land.cs | |||
@@ -8,37 +8,40 @@ using OpenSim.Region.Environment.Scenes; | |||
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.LandManagement | 9 | namespace OpenSim.Region.Environment.LandManagement |
10 | { | 10 | { |
11 | |||
11 | #region Parcel Class | 12 | #region Parcel Class |
13 | |||
12 | /// <summary> | 14 | /// <summary> |
13 | /// Keeps track of a specific piece of land's information | 15 | /// Keeps track of a specific piece of land's information |
14 | /// </summary> | 16 | /// </summary> |
15 | public class Land | 17 | public class Land |
16 | { | 18 | { |
17 | #region Member Variables | 19 | #region Member Variables |
20 | |||
18 | public LandData landData = new LandData(); | 21 | public LandData landData = new LandData(); |
19 | public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 22 | public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
20 | 23 | ||
21 | public Scene m_scene; | 24 | public Scene m_scene; |
22 | 25 | ||
23 | private bool[,] landBitmap = new bool[64, 64]; | 26 | private bool[,] landBitmap = new bool[64,64]; |
24 | 27 | ||
25 | #endregion | 28 | #endregion |
26 | 29 | ||
27 | |||
28 | #region Constructors | 30 | #region Constructors |
31 | |||
29 | public Land(LLUUID owner_id, bool is_group_owned, Scene scene) | 32 | public Land(LLUUID owner_id, bool is_group_owned, Scene scene) |
30 | { | 33 | { |
31 | m_scene = scene; | 34 | m_scene = scene; |
32 | landData.ownerID = owner_id; | 35 | landData.ownerID = owner_id; |
33 | landData.isGroupOwned = is_group_owned; | 36 | landData.isGroupOwned = is_group_owned; |
34 | |||
35 | } | 37 | } |
36 | #endregion | ||
37 | 38 | ||
39 | #endregion | ||
38 | 40 | ||
39 | #region Member Functions | 41 | #region Member Functions |
40 | 42 | ||
41 | #region General Functions | 43 | #region General Functions |
44 | |||
42 | /// <summary> | 45 | /// <summary> |
43 | /// Checks to see if this land object contains a point | 46 | /// Checks to see if this land object contains a point |
44 | /// </summary> | 47 | /// </summary> |
@@ -49,7 +52,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
49 | { | 52 | { |
50 | if (x >= 0 && y >= 0 && x <= 256 && x <= 256) | 53 | if (x >= 0 && y >= 0 && x <= 256 && x <= 256) |
51 | { | 54 | { |
52 | return (landBitmap[x / 4, y / 4] == true); | 55 | return (landBitmap[x/4, y/4] == true); |
53 | } | 56 | } |
54 | else | 57 | else |
55 | { | 58 | { |
@@ -59,10 +62,10 @@ namespace OpenSim.Region.Environment.LandManagement | |||
59 | 62 | ||
60 | public Land Copy() | 63 | public Land Copy() |
61 | { | 64 | { |
62 | Land newLand = new Land(this.landData.ownerID, this.landData.isGroupOwned, m_scene); | 65 | Land newLand = new Land(landData.ownerID, landData.isGroupOwned, m_scene); |
63 | 66 | ||
64 | //Place all new variables here! | 67 | //Place all new variables here! |
65 | newLand.landBitmap = (bool[,])(this.landBitmap.Clone()); | 68 | newLand.landBitmap = (bool[,]) (landBitmap.Clone()); |
66 | newLand.landData = landData.Copy(); | 69 | newLand.landData = landData.Copy(); |
67 | 70 | ||
68 | return newLand; | 71 | return newLand; |
@@ -70,17 +73,17 @@ namespace OpenSim.Region.Environment.LandManagement | |||
70 | 73 | ||
71 | #endregion | 74 | #endregion |
72 | 75 | ||
73 | |||
74 | #region Packet Request Handling | 76 | #region Packet Request Handling |
77 | |||
75 | /// <summary> | 78 | /// <summary> |
76 | /// Sends land properties as requested | 79 | /// Sends land properties as requested |
77 | /// </summary> | 80 | /// </summary> |
78 | /// <param name="sequence_id">ID sent by client for them to keep track of</param> | 81 | /// <param name="sequence_id">ID sent by client for them to keep track of</param> |
79 | /// <param name="snap_selection">Bool sent by client for them to use</param> | 82 | /// <param name="snap_selection">Bool sent by client for them to use</param> |
80 | /// <param name="remote_client">Object representing the client</param> | 83 | /// <param name="remote_client">Object representing the client</param> |
81 | public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) | 84 | public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, |
85 | IClientAPI remote_client) | ||
82 | { | 86 | { |
83 | |||
84 | ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); | 87 | ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); |
85 | updatePacket.ParcelData.AABBMax = landData.AABBMax; | 88 | updatePacket.ParcelData.AABBMax = landData.AABBMax; |
86 | updatePacket.ParcelData.AABBMin = landData.AABBMin; | 89 | updatePacket.ParcelData.AABBMin = landData.AABBMin; |
@@ -91,17 +94,20 @@ namespace OpenSim.Region.Environment.LandManagement | |||
91 | updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray; | 94 | updatePacket.ParcelData.Bitmap = landData.landBitmapByteArray; |
92 | 95 | ||
93 | updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc); | 96 | updatePacket.ParcelData.Desc = Helpers.StringToField(landData.landDesc); |
94 | updatePacket.ParcelData.Category = (byte)landData.category; | 97 | updatePacket.ParcelData.Category = (byte) landData.category; |
95 | updatePacket.ParcelData.ClaimDate = landData.claimDate; | 98 | updatePacket.ParcelData.ClaimDate = landData.claimDate; |
96 | updatePacket.ParcelData.ClaimPrice = landData.claimPrice; | 99 | updatePacket.ParcelData.ClaimPrice = landData.claimPrice; |
97 | updatePacket.ParcelData.GroupID = landData.groupID; | 100 | updatePacket.ParcelData.GroupID = landData.groupID; |
98 | updatePacket.ParcelData.GroupPrims = landData.groupPrims; | 101 | updatePacket.ParcelData.GroupPrims = landData.groupPrims; |
99 | updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned; | 102 | updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned; |
100 | updatePacket.ParcelData.LandingType = (byte)landData.landingType; | 103 | updatePacket.ParcelData.LandingType = (byte) landData.landingType; |
101 | updatePacket.ParcelData.LocalID = landData.localID; | 104 | updatePacket.ParcelData.LocalID = landData.localID; |
102 | if (landData.area > 0) | 105 | if (landData.area > 0) |
103 | { | 106 | { |
104 | updatePacket.ParcelData.MaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor))); | 107 | updatePacket.ParcelData.MaxPrims = |
108 | Convert.ToInt32( | ||
109 | Math.Round((Convert.ToDecimal(landData.area)/Convert.ToDecimal(65536))*15000* | ||
110 | Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor))); | ||
105 | } | 111 | } |
106 | else | 112 | else |
107 | { | 113 | { |
@@ -122,22 +128,29 @@ namespace OpenSim.Region.Environment.LandManagement | |||
122 | updatePacket.ParcelData.PassHours = landData.passHours; | 128 | updatePacket.ParcelData.PassHours = landData.passHours; |
123 | updatePacket.ParcelData.PassPrice = landData.passPrice; | 129 | updatePacket.ParcelData.PassPrice = landData.passPrice; |
124 | updatePacket.ParcelData.PublicCount = 0; //unemplemented | 130 | updatePacket.ParcelData.PublicCount = 0; //unemplemented |
125 | 131 | ||
126 | uint regionFlags = (uint)m_scene.RegionInfo.estateSettings.regionFlags; | 132 | uint regionFlags = (uint) m_scene.RegionInfo.estateSettings.regionFlags; |
127 | updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint)Simulator.RegionFlags.DenyAnonymous) > 0); | 133 | updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) > |
128 | updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint)Simulator.RegionFlags.DenyIdentified) > 0); | 134 | 0); |
129 | updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint)Simulator.RegionFlags.DenyTransacted) > 0); | 135 | updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) > |
130 | updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint)Simulator.RegionFlags.RestrictPushObject) > 0); | 136 | 0); |
131 | 137 | updatePacket.ParcelData.RegionDenyTransacted = ((regionFlags & (uint) Simulator.RegionFlags.DenyTransacted) > | |
138 | 0); | ||
139 | updatePacket.ParcelData.RegionPushOverride = ((regionFlags & (uint) Simulator.RegionFlags.RestrictPushObject) > | ||
140 | 0); | ||
141 | |||
132 | updatePacket.ParcelData.RentPrice = 0; | 142 | updatePacket.ParcelData.RentPrice = 0; |
133 | updatePacket.ParcelData.RequestResult = request_result; | 143 | updatePacket.ParcelData.RequestResult = request_result; |
134 | updatePacket.ParcelData.SalePrice = landData.salePrice; | 144 | updatePacket.ParcelData.SalePrice = landData.salePrice; |
135 | updatePacket.ParcelData.SelectedPrims = landData.selectedPrims; | 145 | updatePacket.ParcelData.SelectedPrims = landData.selectedPrims; |
136 | updatePacket.ParcelData.SelfCount = 0;//unemplemented | 146 | updatePacket.ParcelData.SelfCount = 0; //unemplemented |
137 | updatePacket.ParcelData.SequenceID = sequence_id; | 147 | updatePacket.ParcelData.SequenceID = sequence_id; |
138 | if (landData.simwideArea > 0) | 148 | if (landData.simwideArea > 0) |
139 | { | 149 | { |
140 | updatePacket.ParcelData.SimWideMaxPrims = Convert.ToInt32(Math.Round((Convert.ToDecimal(landData.simwideArea) / Convert.ToDecimal(65536)) * 15000 * Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor))); | 150 | updatePacket.ParcelData.SimWideMaxPrims = |
151 | Convert.ToInt32( | ||
152 | Math.Round((Convert.ToDecimal(landData.simwideArea)/Convert.ToDecimal(65536))*15000* | ||
153 | Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor))); | ||
141 | } | 154 | } |
142 | else | 155 | else |
143 | { | 156 | { |
@@ -146,11 +159,12 @@ namespace OpenSim.Region.Environment.LandManagement | |||
146 | updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims; | 159 | updatePacket.ParcelData.SimWideTotalPrims = landData.simwidePrims; |
147 | updatePacket.ParcelData.SnapSelection = snap_selection; | 160 | updatePacket.ParcelData.SnapSelection = snap_selection; |
148 | updatePacket.ParcelData.SnapshotID = landData.snapshotID; | 161 | updatePacket.ParcelData.SnapshotID = landData.snapshotID; |
149 | updatePacket.ParcelData.Status = (byte)landData.landStatus; | 162 | updatePacket.ParcelData.Status = (byte) landData.landStatus; |
150 | updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims + landData.selectedPrims; | 163 | updatePacket.ParcelData.TotalPrims = landData.ownerPrims + landData.groupPrims + landData.otherPrims + |
164 | landData.selectedPrims; | ||
151 | updatePacket.ParcelData.UserLocation = landData.userLocation; | 165 | updatePacket.ParcelData.UserLocation = landData.userLocation; |
152 | updatePacket.ParcelData.UserLookAt = landData.userLookAt; | 166 | updatePacket.ParcelData.UserLookAt = landData.userLookAt; |
153 | remote_client.OutPacket((Packet)updatePacket); | 167 | remote_client.OutPacket((Packet) updatePacket); |
154 | } | 168 | } |
155 | 169 | ||
156 | public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) | 170 | public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client) |
@@ -159,7 +173,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
159 | { | 173 | { |
160 | //Needs later group support | 174 | //Needs later group support |
161 | landData.authBuyerID = packet.ParcelData.AuthBuyerID; | 175 | landData.authBuyerID = packet.ParcelData.AuthBuyerID; |
162 | landData.category = (libsecondlife.Parcel.ParcelCategory)packet.ParcelData.Category; | 176 | landData.category = (Parcel.ParcelCategory) packet.ParcelData.Category; |
163 | landData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); | 177 | landData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); |
164 | landData.groupID = packet.ParcelData.GroupID; | 178 | landData.groupID = packet.ParcelData.GroupID; |
165 | landData.landingType = packet.ParcelData.LandingType; | 179 | landData.landingType = packet.ParcelData.LandingType; |
@@ -176,8 +190,6 @@ namespace OpenSim.Region.Environment.LandManagement | |||
176 | landData.userLocation = packet.ParcelData.UserLocation; | 190 | landData.userLocation = packet.ParcelData.UserLocation; |
177 | landData.userLookAt = packet.ParcelData.UserLookAt; | 191 | landData.userLookAt = packet.ParcelData.UserLookAt; |
178 | sendLandUpdateToAvatarsOverMe(); | 192 | sendLandUpdateToAvatarsOverMe(); |
179 | |||
180 | |||
181 | } | 193 | } |
182 | } | 194 | } |
183 | 195 | ||
@@ -186,17 +198,20 @@ namespace OpenSim.Region.Environment.LandManagement | |||
186 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); | 198 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); |
187 | for (int i = 0; i < avatars.Count; i++) | 199 | for (int i = 0; i < avatars.Count; i++) |
188 | { | 200 | { |
189 | Land over = m_scene.LandManager.getLandObject((int)Math.Round(avatars[i].AbsolutePosition.X), (int)Math.Round(avatars[i].AbsolutePosition.Y)); | 201 | Land over = |
190 | if (over.landData.localID == this.landData.localID) | 202 | m_scene.LandManager.getLandObject((int) Math.Round(avatars[i].AbsolutePosition.X), |
203 | (int) Math.Round(avatars[i].AbsolutePosition.Y)); | ||
204 | if (over.landData.localID == landData.localID) | ||
191 | { | 205 | { |
192 | sendLandProperties(0, false, 0, avatars[i].ControllingClient); | 206 | sendLandProperties(0, false, 0, avatars[i].ControllingClient); |
193 | } | 207 | } |
194 | } | 208 | } |
195 | } | 209 | } |
196 | #endregion | ||
197 | 210 | ||
211 | #endregion | ||
198 | 212 | ||
199 | #region Update Functions | 213 | #region Update Functions |
214 | |||
200 | /// <summary> | 215 | /// <summary> |
201 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object | 216 | /// Updates the AABBMin and AABBMax values after area/shape modification of the land object |
202 | /// </summary> | 217 | /// </summary> |
@@ -222,8 +237,12 @@ namespace OpenSim.Region.Environment.LandManagement | |||
222 | } | 237 | } |
223 | } | 238 | } |
224 | } | 239 | } |
225 | landData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_scene.Terrain.GetHeight((min_x * 4), (min_y * 4))); | 240 | landData.AABBMin = |
226 | landData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_scene.Terrain.GetHeight((max_x * 4), (max_y * 4))); | 241 | new LLVector3((float) (min_x*4), (float) (min_y*4), |
242 | (float) m_scene.Terrain.GetHeight((min_x*4), (min_y*4))); | ||
243 | landData.AABBMax = | ||
244 | new LLVector3((float) (max_x*4), (float) (max_y*4), | ||
245 | (float) m_scene.Terrain.GetHeight((max_x*4), (max_y*4))); | ||
227 | landData.area = tempArea; | 246 | landData.area = tempArea; |
228 | } | 247 | } |
229 | 248 | ||
@@ -237,18 +256,19 @@ namespace OpenSim.Region.Environment.LandManagement | |||
237 | /// </summary> | 256 | /// </summary> |
238 | public void forceUpdateLandInfo() | 257 | public void forceUpdateLandInfo() |
239 | { | 258 | { |
240 | this.updateAABBAndAreaValues(); | 259 | updateAABBAndAreaValues(); |
241 | this.updateLandBitmapByteArray(); | 260 | updateLandBitmapByteArray(); |
242 | } | 261 | } |
243 | 262 | ||
244 | public void setLandBitmapFromByteArray() | 263 | public void setLandBitmapFromByteArray() |
245 | { | 264 | { |
246 | landBitmap = convertBytesToLandBitmap(); | 265 | landBitmap = convertBytesToLandBitmap(); |
247 | } | 266 | } |
248 | #endregion | ||
249 | 267 | ||
268 | #endregion | ||
250 | 269 | ||
251 | #region Land Bitmap Functions | 270 | #region Land Bitmap Functions |
271 | |||
252 | /// <summary> | 272 | /// <summary> |
253 | /// Sets the land's bitmap manually | 273 | /// Sets the land's bitmap manually |
254 | /// </summary> | 274 | /// </summary> |
@@ -265,9 +285,9 @@ namespace OpenSim.Region.Environment.LandManagement | |||
265 | //Valid: Lets set it | 285 | //Valid: Lets set it |
266 | landBitmap = bitmap; | 286 | landBitmap = bitmap; |
267 | forceUpdateLandInfo(); | 287 | forceUpdateLandInfo(); |
268 | |||
269 | } | 288 | } |
270 | } | 289 | } |
290 | |||
271 | /// <summary> | 291 | /// <summary> |
272 | /// Gets the land's bitmap manually | 292 | /// Gets the land's bitmap manually |
273 | /// </summary> | 293 | /// </summary> |
@@ -276,6 +296,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
276 | { | 296 | { |
277 | return landBitmap; | 297 | return landBitmap; |
278 | } | 298 | } |
299 | |||
279 | /// <summary> | 300 | /// <summary> |
280 | /// Converts the land bitmap to a packet friendly byte array | 301 | /// Converts the land bitmap to a packet friendly byte array |
281 | /// </summary> | 302 | /// </summary> |
@@ -290,11 +311,11 @@ namespace OpenSim.Region.Environment.LandManagement | |||
290 | { | 311 | { |
291 | for (x = 0; x < 64; x++) | 312 | for (x = 0; x < 64; x++) |
292 | { | 313 | { |
293 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++ % 8)); | 314 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++%8)); |
294 | if (i % 8 == 0) | 315 | if (i%8 == 0) |
295 | { | 316 | { |
296 | tempConvertArr[byteNum] = tempByte; | 317 | tempConvertArr[byteNum] = tempByte; |
297 | tempByte = (byte)0; | 318 | tempByte = (byte) 0; |
298 | i = 0; | 319 | i = 0; |
299 | byteNum++; | 320 | byteNum++; |
300 | } | 321 | } |
@@ -305,7 +326,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
305 | 326 | ||
306 | private bool[,] convertBytesToLandBitmap() | 327 | private bool[,] convertBytesToLandBitmap() |
307 | { | 328 | { |
308 | bool[,] tempConvertMap = new bool[64, 64]; | 329 | bool[,] tempConvertMap = new bool[64,64]; |
309 | tempConvertMap.Initialize(); | 330 | tempConvertMap.Initialize(); |
310 | byte tempByte = 0; | 331 | byte tempByte = 0; |
311 | int x = 0, y = 0, i = 0, bitNum = 0; | 332 | int x = 0, y = 0, i = 0, bitNum = 0; |
@@ -314,7 +335,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
314 | tempByte = landData.landBitmapByteArray[i]; | 335 | tempByte = landData.landBitmapByteArray[i]; |
315 | for (bitNum = 0; bitNum < 8; bitNum++) | 336 | for (bitNum = 0; bitNum < 8; bitNum++) |
316 | { | 337 | { |
317 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); | 338 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); |
318 | tempConvertMap[x, y] = bit; | 339 | tempConvertMap[x, y] = bit; |
319 | x++; | 340 | x++; |
320 | if (x > 63) | 341 | if (x > 63) |
@@ -322,12 +343,11 @@ namespace OpenSim.Region.Environment.LandManagement | |||
322 | x = 0; | 343 | x = 0; |
323 | y++; | 344 | y++; |
324 | } | 345 | } |
325 | |||
326 | } | 346 | } |
327 | |||
328 | } | 347 | } |
329 | return tempConvertMap; | 348 | return tempConvertMap; |
330 | } | 349 | } |
350 | |||
331 | /// <summary> | 351 | /// <summary> |
332 | /// Full sim land object creation | 352 | /// Full sim land object creation |
333 | /// </summary> | 353 | /// </summary> |
@@ -347,8 +367,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
347 | /// <returns></returns> | 367 | /// <returns></returns> |
348 | public static bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) | 368 | public static bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) |
349 | { | 369 | { |
350 | 370 | bool[,] tempBitmap = new bool[64,64]; | |
351 | bool[,] tempBitmap = new bool[64, 64]; | ||
352 | tempBitmap.Initialize(); | 371 | tempBitmap.Initialize(); |
353 | 372 | ||
354 | tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); | 373 | tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); |
@@ -365,7 +384,8 @@ namespace OpenSim.Region.Environment.LandManagement | |||
365 | /// <param name="end_y"></param> | 384 | /// <param name="end_y"></param> |
366 | /// <param name="set_value"></param> | 385 | /// <param name="set_value"></param> |
367 | /// <returns></returns> | 386 | /// <returns></returns> |
368 | public static bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value) | 387 | public static bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, |
388 | bool set_value) | ||
369 | { | 389 | { |
370 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) | 390 | if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) |
371 | { | 391 | { |
@@ -378,8 +398,8 @@ namespace OpenSim.Region.Environment.LandManagement | |||
378 | { | 398 | { |
379 | for (x = 0; x < 64; x++) | 399 | for (x = 0; x < 64; x++) |
380 | { | 400 | { |
381 | if (x >= start_x / 4 && x < end_x / 4 | 401 | if (x >= start_x/4 && x < end_x/4 |
382 | && y >= start_y / 4 && y < end_y / 4) | 402 | && y >= start_y/4 && y < end_y/4) |
383 | { | 403 | { |
384 | land_bitmap[x, y] = set_value; | 404 | land_bitmap[x, y] = set_value; |
385 | } | 405 | } |
@@ -387,6 +407,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
387 | } | 407 | } |
388 | return land_bitmap; | 408 | return land_bitmap; |
389 | } | 409 | } |
410 | |||
390 | /// <summary> | 411 | /// <summary> |
391 | /// Join the true values of 2 bitmaps together | 412 | /// Join the true values of 2 bitmaps together |
392 | /// </summary> | 413 | /// </summary> |
@@ -404,7 +425,6 @@ namespace OpenSim.Region.Environment.LandManagement | |||
404 | { | 425 | { |
405 | //Throw an exception - The bitmap is not 64x64 | 426 | //Throw an exception - The bitmap is not 64x64 |
406 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); | 427 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); |
407 | |||
408 | } | 428 | } |
409 | 429 | ||
410 | int x, y; | 430 | int x, y; |
@@ -420,9 +440,11 @@ namespace OpenSim.Region.Environment.LandManagement | |||
420 | } | 440 | } |
421 | return bitmap_base; | 441 | return bitmap_base; |
422 | } | 442 | } |
443 | |||
423 | #endregion | 444 | #endregion |
424 | 445 | ||
425 | #region Object Select and Object Owner Listing | 446 | #region Object Select and Object Owner Listing |
447 | |||
426 | public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) | 448 | public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client) |
427 | { | 449 | { |
428 | List<uint> resultLocalIDs = new List<uint>(); | 450 | List<uint> resultLocalIDs = new List<uint>(); |
@@ -430,15 +452,16 @@ namespace OpenSim.Region.Environment.LandManagement | |||
430 | { | 452 | { |
431 | if (obj.LocalId > 0) | 453 | if (obj.LocalId > 0) |
432 | { | 454 | { |
433 | if (request_type == LandManager.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == this.landData.ownerID) | 455 | if (request_type == LandManager.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID) |
434 | { | 456 | { |
435 | resultLocalIDs.Add(obj.LocalId); | 457 | resultLocalIDs.Add(obj.LocalId); |
436 | } | 458 | } |
437 | else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && false) //TODO: change false to group support! | 459 | else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && false) |
460 | //TODO: change false to group support! | ||
438 | { | 461 | { |
439 | |||
440 | } | 462 | } |
441 | else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER && obj.OwnerID != remote_client.AgentId) | 463 | else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER && |
464 | obj.OwnerID != remote_client.AgentId) | ||
442 | { | 465 | { |
443 | resultLocalIDs.Add(obj.LocalId); | 466 | resultLocalIDs.Add(obj.LocalId); |
444 | } | 467 | } |
@@ -479,10 +502,10 @@ namespace OpenSim.Region.Environment.LandManagement | |||
479 | resultLocalIDs.RemoveAt(0); | 502 | resultLocalIDs.RemoveAt(0); |
480 | } | 503 | } |
481 | pack.Data = data; | 504 | pack.Data = data; |
482 | remote_client.OutPacket((Packet)pack); | 505 | remote_client.OutPacket((Packet) pack); |
483 | } | 506 | } |
484 | |||
485 | } | 507 | } |
508 | |||
486 | public void sendLandObjectOwners(IClientAPI remote_client) | 509 | public void sendLandObjectOwners(IClientAPI remote_client) |
487 | { | 510 | { |
488 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); | 511 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); |
@@ -496,7 +519,6 @@ namespace OpenSim.Region.Environment.LandManagement | |||
496 | } | 519 | } |
497 | if (ownersAndCount.Count > 0) | 520 | if (ownersAndCount.Count > 0) |
498 | { | 521 | { |
499 | |||
500 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32]; | 522 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock = new ParcelObjectOwnersReplyPacket.DataBlock[32]; |
501 | 523 | ||
502 | if (ownersAndCount.Count < 32) | 524 | if (ownersAndCount.Count < 32) |
@@ -522,19 +544,23 @@ namespace OpenSim.Region.Environment.LandManagement | |||
522 | remote_client.OutPacket(pack); | 544 | remote_client.OutPacket(pack); |
523 | } | 545 | } |
524 | } | 546 | } |
547 | |||
525 | #endregion | 548 | #endregion |
526 | 549 | ||
527 | #region Object Returning | 550 | #region Object Returning |
551 | |||
528 | public void returnObject(SceneObjectGroup obj) | 552 | public void returnObject(SceneObjectGroup obj) |
529 | { | 553 | { |
530 | } | 554 | } |
555 | |||
531 | public void returnLandObjects(int type, LLUUID owner) | 556 | public void returnLandObjects(int type, LLUUID owner) |
532 | { | 557 | { |
533 | |||
534 | } | 558 | } |
559 | |||
535 | #endregion | 560 | #endregion |
536 | 561 | ||
537 | #region Object Adding/Removing from Parcel | 562 | #region Object Adding/Removing from Parcel |
563 | |||
538 | public void resetLandPrimCounts() | 564 | public void resetLandPrimCounts() |
539 | { | 565 | { |
540 | landData.groupPrims = 0; | 566 | landData.groupPrims = 0; |
@@ -566,7 +592,6 @@ namespace OpenSim.Region.Environment.LandManagement | |||
566 | } | 592 | } |
567 | 593 | ||
568 | primsOverMe.Add(obj); | 594 | primsOverMe.Add(obj); |
569 | |||
570 | } | 595 | } |
571 | 596 | ||
572 | public void removePrimFromCount(SceneObjectGroup obj) | 597 | public void removePrimFromCount(SceneObjectGroup obj) |
@@ -592,11 +617,11 @@ namespace OpenSim.Region.Environment.LandManagement | |||
592 | primsOverMe.Remove(obj); | 617 | primsOverMe.Remove(obj); |
593 | } | 618 | } |
594 | } | 619 | } |
595 | #endregion | ||
596 | 620 | ||
597 | #endregion | 621 | #endregion |
598 | 622 | ||
599 | 623 | #endregion | |
600 | } | 624 | } |
625 | |||
601 | #endregion | 626 | #endregion |
602 | } | 627 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index 8e49811..843c0f5 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs | |||
@@ -36,34 +36,34 @@ using OpenSim.Region.Environment.Scenes; | |||
36 | namespace OpenSim.Region.Environment.LandManagement | 36 | namespace OpenSim.Region.Environment.LandManagement |
37 | { | 37 | { |
38 | 38 | ||
39 | |||
40 | #region LandManager Class | 39 | #region LandManager Class |
40 | |||
41 | /// <summary> | 41 | /// <summary> |
42 | /// Handles Land objects and operations requiring information from other Land objects (divide, join, etc) | 42 | /// Handles Land objects and operations requiring information from other Land objects (divide, join, etc) |
43 | /// </summary> | 43 | /// </summary> |
44 | public class LandManager | 44 | public class LandManager |
45 | { | 45 | { |
46 | |||
47 | #region Constants | 46 | #region Constants |
47 | |||
48 | //Land types set with flags in ParcelOverlay. | 48 | //Land types set with flags in ParcelOverlay. |
49 | //Only one of these can be used. | 49 | //Only one of these can be used. |
50 | public const byte LAND_TYPE_PUBLIC = (byte)0; //Equals 00000000 | 50 | public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000 |
51 | public const byte LAND_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 | 51 | public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001 |
52 | public const byte LAND_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 | 52 | public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010 |
53 | public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 | 53 | public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011 |
54 | public const byte LAND_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 | 54 | public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100 |
55 | public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 | 55 | public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101 |
56 | 56 | ||
57 | 57 | ||
58 | //Flags that when set, a border on the given side will be placed | 58 | //Flags that when set, a border on the given side will be placed |
59 | //NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc) | 59 | //NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc) |
60 | //This took forever to figure out -- jeesh. /blame LL for even having to send these | 60 | //This took forever to figure out -- jeesh. /blame LL for even having to send these |
61 | public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 | 61 | public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000 |
62 | public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 | 62 | public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000 |
63 | 63 | ||
64 | //RequestResults (I think these are right, they seem to work): | 64 | //RequestResults (I think these are right, they seem to work): |
65 | public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land | 65 | public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land |
66 | public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land | 66 | public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land |
67 | 67 | ||
68 | //ParcelSelectObjects | 68 | //ParcelSelectObjects |
69 | public const int LAND_SELECT_OBJECTS_OWNER = 2; | 69 | public const int LAND_SELECT_OBJECTS_OWNER = 2; |
@@ -73,12 +73,14 @@ namespace OpenSim.Region.Environment.LandManagement | |||
73 | 73 | ||
74 | //These are other constants. Yay! | 74 | //These are other constants. Yay! |
75 | public const int START_LAND_LOCAL_ID = 1; | 75 | public const int START_LAND_LOCAL_ID = 1; |
76 | |||
76 | #endregion | 77 | #endregion |
77 | 78 | ||
78 | #region Member Variables | 79 | #region Member Variables |
80 | |||
79 | public Dictionary<int, Land> landList = new Dictionary<int, Land>(); | 81 | public Dictionary<int, Land> landList = new Dictionary<int, Land>(); |
80 | private int lastLandLocalID = START_LAND_LOCAL_ID - 1; | 82 | private int lastLandLocalID = START_LAND_LOCAL_ID - 1; |
81 | private int[,] landIDList = new int[64, 64]; | 83 | private int[,] landIDList = new int[64,64]; |
82 | 84 | ||
83 | /// <summary> | 85 | /// <summary> |
84 | /// Set to true when a prim is moved, created, added. Performs a prim count update | 86 | /// Set to true when a prim is moved, created, added. Performs a prim count update |
@@ -91,35 +93,37 @@ namespace OpenSim.Region.Environment.LandManagement | |||
91 | #endregion | 93 | #endregion |
92 | 94 | ||
93 | #region Constructors | 95 | #region Constructors |
96 | |||
94 | public LandManager(Scene scene, RegionInfo reginfo) | 97 | public LandManager(Scene scene, RegionInfo reginfo) |
95 | { | 98 | { |
96 | |||
97 | m_scene = scene; | 99 | m_scene = scene; |
98 | m_regInfo = reginfo; | 100 | m_regInfo = reginfo; |
99 | landIDList.Initialize(); | 101 | landIDList.Initialize(); |
100 | |||
101 | } | 102 | } |
103 | |||
102 | #endregion | 104 | #endregion |
103 | 105 | ||
104 | #region Member Functions | 106 | #region Member Functions |
105 | 107 | ||
106 | #region Parcel From Storage Functions | 108 | #region Parcel From Storage Functions |
109 | |||
107 | public void LandFromStorage(LandData data) | 110 | public void LandFromStorage(LandData data) |
108 | { | 111 | { |
109 | Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene); | 112 | Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene); |
110 | new_land.landData = data.Copy(); | 113 | new_land.landData = data.Copy(); |
111 | new_land.setLandBitmapFromByteArray(); | 114 | new_land.setLandBitmapFromByteArray(); |
112 | addLandObject(new_land); | 115 | addLandObject(new_land); |
113 | |||
114 | } | 116 | } |
115 | 117 | ||
116 | public void NoLandDataFromStorage() | 118 | public void NoLandDataFromStorage() |
117 | { | 119 | { |
118 | resetSimLandObjects(); | 120 | resetSimLandObjects(); |
119 | } | 121 | } |
122 | |||
120 | #endregion | 123 | #endregion |
121 | 124 | ||
122 | #region Parcel Add/Remove/Get/Create | 125 | #region Parcel Add/Remove/Get/Create |
126 | |||
123 | /// <summary> | 127 | /// <summary> |
124 | /// Creates a basic Parcel object without an owner (a zeroed key) | 128 | /// Creates a basic Parcel object without an owner (a zeroed key) |
125 | /// </summary> | 129 | /// </summary> |
@@ -155,8 +159,8 @@ namespace OpenSim.Region.Environment.LandManagement | |||
155 | landList[lastLandLocalID].forceUpdateLandInfo(); | 159 | landList[lastLandLocalID].forceUpdateLandInfo(); |
156 | 160 | ||
157 | return new_land; | 161 | return new_land; |
158 | |||
159 | } | 162 | } |
163 | |||
160 | /// <summary> | 164 | /// <summary> |
161 | /// Removes a land object from the list. Will not remove if local_id is still owning an area in landIDList | 165 | /// Removes a land object from the list. Will not remove if local_id is still owning an area in landIDList |
162 | /// </summary> | 166 | /// </summary> |
@@ -194,6 +198,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
194 | } | 198 | } |
195 | removeLandObject(slave.landData.localID); | 199 | removeLandObject(slave.landData.localID); |
196 | } | 200 | } |
201 | |||
197 | /// <summary> | 202 | /// <summary> |
198 | /// Get the land object at the specified point | 203 | /// Get the land object at the specified point |
199 | /// </summary> | 204 | /// </summary> |
@@ -202,16 +207,16 @@ namespace OpenSim.Region.Environment.LandManagement | |||
202 | /// <returns>Land object at the point supplied</returns> | 207 | /// <returns>Land object at the point supplied</returns> |
203 | public Land getLandObject(float x_float, float y_float) | 208 | public Land getLandObject(float x_float, float y_float) |
204 | { | 209 | { |
205 | int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / Convert.ToDouble(4.0))); | 210 | int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float)/Convert.ToDouble(4.0))); |
206 | int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / Convert.ToDouble(4.0))); | 211 | int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float)/Convert.ToDouble(4.0))); |
207 | 212 | ||
208 | if (x > 63 || y > 63 || x < 0 || y < 0) | 213 | if (x > 63 || y > 63 || x < 0 || y < 0) |
209 | { | 214 | { |
210 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | 215 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); |
211 | } | 216 | } |
212 | else | 217 | else |
213 | { | 218 | { |
214 | // Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")"); | 219 | // Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")"); |
215 | return landList[landIDList[x, y]]; | 220 | return landList[landIDList[x, y]]; |
216 | } | 221 | } |
217 | } | 222 | } |
@@ -224,12 +229,14 @@ namespace OpenSim.Region.Environment.LandManagement | |||
224 | } | 229 | } |
225 | else | 230 | else |
226 | { | 231 | { |
227 | return landList[landIDList[x / 4, y / 4]]; | 232 | return landList[landIDList[x/4, y/4]]; |
228 | } | 233 | } |
229 | } | 234 | } |
235 | |||
230 | #endregion | 236 | #endregion |
231 | 237 | ||
232 | #region Parcel Modification | 238 | #region Parcel Modification |
239 | |||
233 | /// <summary> | 240 | /// <summary> |
234 | /// Subdivides a piece of land | 241 | /// Subdivides a piece of land |
235 | /// </summary> | 242 | /// </summary> |
@@ -241,7 +248,6 @@ namespace OpenSim.Region.Environment.LandManagement | |||
241 | /// <returns>Returns true if successful</returns> | 248 | /// <returns>Returns true if successful</returns> |
242 | private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) | 249 | private bool subdivide(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) |
243 | { | 250 | { |
244 | |||
245 | //First, lets loop through the points and make sure they are all in the same peice of land | 251 | //First, lets loop through the points and make sure they are all in the same peice of land |
246 | //Get the land object at start | 252 | //Get the land object at start |
247 | Land startLandObject = getLandObject(start_x, start_y); | 253 | Land startLandObject = getLandObject(start_x, start_y); |
@@ -284,21 +290,21 @@ namespace OpenSim.Region.Environment.LandManagement | |||
284 | 290 | ||
285 | //Now, lets set the subdivision area of the original to false | 291 | //Now, lets set the subdivision area of the original to false |
286 | int startLandObjectIndex = startLandObject.landData.localID; | 292 | int startLandObjectIndex = startLandObject.landData.localID; |
287 | landList[startLandObjectIndex].setLandBitmap(Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false)); | 293 | landList[startLandObjectIndex].setLandBitmap( |
294 | Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false)); | ||
288 | landList[startLandObjectIndex].forceUpdateLandInfo(); | 295 | landList[startLandObjectIndex].forceUpdateLandInfo(); |
289 | 296 | ||
290 | 297 | ||
291 | this.setPrimsTainted(); | 298 | setPrimsTainted(); |
292 | 299 | ||
293 | //Now add the new land object | 300 | //Now add the new land object |
294 | Land result = addLandObject(newLand); | 301 | Land result = addLandObject(newLand); |
295 | result.sendLandUpdateToAvatarsOverMe(); | 302 | result.sendLandUpdateToAvatarsOverMe(); |
296 | 303 | ||
297 | 304 | ||
298 | |||
299 | |||
300 | return true; | 305 | return true; |
301 | } | 306 | } |
307 | |||
302 | /// <summary> | 308 | /// <summary> |
303 | /// Join 2 land objects together | 309 | /// Join 2 land objects together |
304 | /// </summary> | 310 | /// </summary> |
@@ -320,7 +326,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
320 | { | 326 | { |
321 | for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) | 327 | for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4) |
322 | { | 328 | { |
323 | Land p = getLandObject(stepXSelected,stepYSelected); | 329 | Land p = getLandObject(stepXSelected, stepYSelected); |
324 | if (!selectedLandObjects.Contains(p)) | 330 | if (!selectedLandObjects.Contains(p)) |
325 | { | 331 | { |
326 | selectedLandObjects.Add(p); | 332 | selectedLandObjects.Add(p); |
@@ -330,7 +336,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
330 | Land masterLandObject = selectedLandObjects[0]; | 336 | Land masterLandObject = selectedLandObjects[0]; |
331 | selectedLandObjects.RemoveAt(0); | 337 | selectedLandObjects.RemoveAt(0); |
332 | 338 | ||
333 | 339 | ||
334 | if (selectedLandObjects.Count < 1) | 340 | if (selectedLandObjects.Count < 1) |
335 | { | 341 | { |
336 | return false; //Only one piece of land selected | 342 | return false; //Only one piece of land selected |
@@ -348,23 +354,23 @@ namespace OpenSim.Region.Environment.LandManagement | |||
348 | } | 354 | } |
349 | foreach (Land slaveLandObject in selectedLandObjects) | 355 | foreach (Land slaveLandObject in selectedLandObjects) |
350 | { | 356 | { |
351 | landList[masterLandObject.landData.localID].setLandBitmap(Land.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap())); | 357 | landList[masterLandObject.landData.localID].setLandBitmap( |
358 | Land.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap())); | ||
352 | performFinalLandJoin(masterLandObject, slaveLandObject); | 359 | performFinalLandJoin(masterLandObject, slaveLandObject); |
353 | } | 360 | } |
354 | 361 | ||
355 | 362 | ||
356 | this.setPrimsTainted(); | 363 | setPrimsTainted(); |
357 | 364 | ||
358 | masterLandObject.sendLandUpdateToAvatarsOverMe(); | 365 | masterLandObject.sendLandUpdateToAvatarsOverMe(); |
359 | 366 | ||
360 | return true; | 367 | return true; |
361 | |||
362 | |||
363 | |||
364 | } | 368 | } |
369 | |||
365 | #endregion | 370 | #endregion |
366 | 371 | ||
367 | #region Parcel Updating | 372 | #region Parcel Updating |
373 | |||
368 | /// <summary> | 374 | /// <summary> |
369 | /// Where we send the ParcelOverlay packet to the client | 375 | /// Where we send the ParcelOverlay packet to the client |
370 | /// </summary> | 376 | /// </summary> |
@@ -382,15 +388,17 @@ namespace OpenSim.Region.Environment.LandManagement | |||
382 | { | 388 | { |
383 | for (x = 0; x < 64; x++) | 389 | for (x = 0; x < 64; x++) |
384 | { | 390 | { |
385 | byte tempByte = (byte)0; //This represents the byte for the current 4x4 | 391 | byte tempByte = (byte) 0; //This represents the byte for the current 4x4 |
386 | Land currentParcelBlock = getLandObject(x * 4, y * 4); | 392 | Land currentParcelBlock = getLandObject(x*4, y*4); |
387 | 393 | ||
388 | if (currentParcelBlock.landData.ownerID == remote_client.AgentId) | 394 | if (currentParcelBlock.landData.ownerID == remote_client.AgentId) |
389 | { | 395 | { |
390 | //Owner Flag | 396 | //Owner Flag |
391 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER); | 397 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_OWNED_BY_REQUESTER); |
392 | } | 398 | } |
393 | else if (currentParcelBlock.landData.salePrice > 0 && (currentParcelBlock.landData.authBuyerID == LLUUID.Zero || currentParcelBlock.landData.authBuyerID == remote_client.AgentId)) | 399 | else if (currentParcelBlock.landData.salePrice > 0 && |
400 | (currentParcelBlock.landData.authBuyerID == LLUUID.Zero || | ||
401 | currentParcelBlock.landData.authBuyerID == remote_client.AgentId)) | ||
394 | { | 402 | { |
395 | //Sale Flag | 403 | //Sale Flag |
396 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE); | 404 | tempByte = Convert.ToByte(tempByte | LAND_TYPE_IS_FOR_SALE); |
@@ -412,7 +420,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
412 | { | 420 | { |
413 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); | 421 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); |
414 | } | 422 | } |
415 | else if (getLandObject((x - 1) * 4, y * 4) != currentParcelBlock) | 423 | else if (getLandObject((x - 1)*4, y*4) != currentParcelBlock) |
416 | { | 424 | { |
417 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); | 425 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_WEST); |
418 | } | 426 | } |
@@ -421,7 +429,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
421 | { | 429 | { |
422 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); | 430 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); |
423 | } | 431 | } |
424 | else if (getLandObject(x * 4, (y - 1) * 4) != currentParcelBlock) | 432 | else if (getLandObject(x*4, (y - 1)*4) != currentParcelBlock) |
425 | { | 433 | { |
426 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); | 434 | tempByte = Convert.ToByte(tempByte | LAND_FLAG_PROPERTY_BORDER_SOUTH); |
427 | } | 435 | } |
@@ -434,17 +442,16 @@ namespace OpenSim.Region.Environment.LandManagement | |||
434 | packet = new ParcelOverlayPacket(); | 442 | packet = new ParcelOverlayPacket(); |
435 | packet.ParcelData.Data = byteArray; | 443 | packet.ParcelData.Data = byteArray; |
436 | packet.ParcelData.SequenceID = sequenceID; | 444 | packet.ParcelData.SequenceID = sequenceID; |
437 | remote_client.OutPacket((Packet)packet); | 445 | remote_client.OutPacket((Packet) packet); |
438 | sequenceID++; | 446 | sequenceID++; |
439 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | 447 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; |
440 | } | 448 | } |
441 | } | 449 | } |
442 | } | 450 | } |
443 | |||
444 | |||
445 | } | 451 | } |
446 | 452 | ||
447 | public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client) | 453 | public void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, |
454 | bool snap_selection, IClientAPI remote_client) | ||
448 | { | 455 | { |
449 | //Get the land objects within the bounds | 456 | //Get the land objects within the bounds |
450 | List<Land> temp = new List<Land>(); | 457 | List<Land> temp = new List<Land>(); |
@@ -486,14 +493,15 @@ namespace OpenSim.Region.Environment.LandManagement | |||
486 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); | 493 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); |
487 | } | 494 | } |
488 | } | 495 | } |
496 | |||
489 | public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) | 497 | public void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) |
490 | { | 498 | { |
491 | subdivide(west, south, east, north, remote_client.AgentId); | 499 | subdivide(west, south, east, north, remote_client.AgentId); |
492 | } | 500 | } |
501 | |||
493 | public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) | 502 | public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client) |
494 | { | 503 | { |
495 | join(west, south, east, north, remote_client.AgentId); | 504 | join(west, south, east, north, remote_client.AgentId); |
496 | |||
497 | } | 505 | } |
498 | 506 | ||
499 | public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) | 507 | public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client) |
@@ -505,6 +513,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
505 | { | 513 | { |
506 | landList[local_id].sendLandObjectOwners(remote_client); | 514 | landList[local_id].sendLandObjectOwners(remote_client); |
507 | } | 515 | } |
516 | |||
508 | #endregion | 517 | #endregion |
509 | 518 | ||
510 | /// <summary> | 519 | /// <summary> |
@@ -523,7 +532,6 @@ namespace OpenSim.Region.Environment.LandManagement | |||
523 | fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID; | 532 | fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID; |
524 | 533 | ||
525 | addLandObject(fullSimParcel); | 534 | addLandObject(fullSimParcel); |
526 | |||
527 | } | 535 | } |
528 | 536 | ||
529 | 537 | ||
@@ -532,7 +540,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
532 | ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId); | 540 | ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId); |
533 | if (clientAvatar != null) | 541 | if (clientAvatar != null) |
534 | { | 542 | { |
535 | Land over = getLandObject(clientAvatar.AbsolutePosition.X,clientAvatar.AbsolutePosition.Y); | 543 | Land over = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); |
536 | if (over != null) | 544 | if (over != null) |
537 | { | 545 | { |
538 | over.sendLandProperties(0, false, 0, remote_client); | 546 | over.sendLandProperties(0, false, 0, remote_client); |
@@ -547,9 +555,10 @@ namespace OpenSim.Region.Environment.LandManagement | |||
547 | p.resetLandPrimCounts(); | 555 | p.resetLandPrimCounts(); |
548 | } | 556 | } |
549 | } | 557 | } |
558 | |||
550 | public void setPrimsTainted() | 559 | public void setPrimsTainted() |
551 | { | 560 | { |
552 | this.landPrimCountTainted = true; | 561 | landPrimCountTainted = true; |
553 | } | 562 | } |
554 | 563 | ||
555 | public void addPrimToLandPrimCounts(SceneObjectGroup obj) | 564 | public void addPrimToLandPrimCounts(SceneObjectGroup obj) |
@@ -573,14 +582,14 @@ namespace OpenSim.Region.Environment.LandManagement | |||
573 | public void finalizeLandPrimCountUpdate() | 582 | public void finalizeLandPrimCountUpdate() |
574 | { | 583 | { |
575 | //Get Simwide prim count for owner | 584 | //Get Simwide prim count for owner |
576 | Dictionary<LLUUID, List<Land>> landOwnersAndParcels = new Dictionary<LLUUID,List<Land>>(); | 585 | Dictionary<LLUUID, List<Land>> landOwnersAndParcels = new Dictionary<LLUUID, List<Land>>(); |
577 | foreach (Land p in landList.Values) | 586 | foreach (Land p in landList.Values) |
578 | { | 587 | { |
579 | if(!landOwnersAndParcels.ContainsKey(p.landData.ownerID)) | 588 | if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID)) |
580 | { | 589 | { |
581 | List<Land> tempList = new List<Land>(); | 590 | List<Land> tempList = new List<Land>(); |
582 | tempList.Add(p); | 591 | tempList.Add(p); |
583 | landOwnersAndParcels.Add(p.landData.ownerID,tempList); | 592 | landOwnersAndParcels.Add(p.landData.ownerID, tempList); |
584 | } | 593 | } |
585 | else | 594 | else |
586 | { | 595 | { |
@@ -595,7 +604,8 @@ namespace OpenSim.Region.Environment.LandManagement | |||
595 | foreach (Land p in landOwnersAndParcels[owner]) | 604 | foreach (Land p in landOwnersAndParcels[owner]) |
596 | { | 605 | { |
597 | simArea += p.landData.area; | 606 | simArea += p.landData.area; |
598 | simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims + p.landData.selectedPrims; | 607 | simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims + |
608 | p.landData.selectedPrims; | ||
599 | } | 609 | } |
600 | 610 | ||
601 | foreach (Land p in landOwnersAndParcels[owner]) | 611 | foreach (Land p in landOwnersAndParcels[owner]) |
@@ -604,14 +614,10 @@ namespace OpenSim.Region.Environment.LandManagement | |||
604 | p.landData.simwidePrims = simPrims; | 614 | p.landData.simwidePrims = simPrims; |
605 | } | 615 | } |
606 | } | 616 | } |
607 | |||
608 | } | 617 | } |
618 | |||
609 | #endregion | 619 | #endregion |
610 | } | 620 | } |
611 | #endregion | ||
612 | |||
613 | |||
614 | |||
615 | 621 | ||
616 | 622 | #endregion | |
617 | } | 623 | } \ No newline at end of file |