diff options
author | Adam Frisby | 2008-04-30 21:43:47 +0000 |
---|---|---|
committer | Adam Frisby | 2008-04-30 21:43:47 +0000 |
commit | be20f41637b6c06ce3ab16bc25851b6e43468e12 (patch) | |
tree | c41081329891f4c24de704fc760fb9012954ac9d /OpenSim/Region/Environment/Modules/World/Land | |
parent | * Sometimes you know, you do something really stupid. (diff) | |
download | opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.zip opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.gz opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.bz2 opensim-SC_OLD-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.xz |
* Cruft removal step #1. Cleaning Modules directory.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Land')
3 files changed, 286 insertions, 316 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs index cbea07a..efc5234 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs | |||
@@ -43,61 +43,45 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
43 | 43 | ||
44 | //Land types set with flags in ParcelOverlay. | 44 | //Land types set with flags in ParcelOverlay. |
45 | //Only one of these can be used. | 45 | //Only one of these can be used. |
46 | public const byte LAND_TYPE_PUBLIC = (byte)0; //Equals 00000000 | 46 | public const float BAN_LINE_SAFETY_HIEGHT = 100; |
47 | public const byte LAND_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 | 47 | public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000 |
48 | public const byte LAND_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 | 48 | public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000 |
49 | public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 | ||
50 | public const byte LAND_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 | ||
51 | public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 | ||
52 | |||
53 | //Flags that when set, a border on the given side will be placed | ||
54 | //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) | ||
55 | //This took forever to figure out -- jeesh. /blame LL for even having to send these | ||
56 | public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 | ||
57 | public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 | ||
58 | 49 | ||
59 | //RequestResults (I think these are right, they seem to work): | 50 | //RequestResults (I think these are right, they seem to work): |
60 | public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land | ||
61 | public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land | 51 | public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land |
52 | public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land | ||
62 | 53 | ||
63 | //ParcelSelectObjects | 54 | //ParcelSelectObjects |
64 | public const int LAND_SELECT_OBJECTS_OWNER = 2; | ||
65 | public const int LAND_SELECT_OBJECTS_GROUP = 4; | 55 | public const int LAND_SELECT_OBJECTS_GROUP = 4; |
66 | public const int LAND_SELECT_OBJECTS_OTHER = 8; | 56 | public const int LAND_SELECT_OBJECTS_OTHER = 8; |
57 | public const int LAND_SELECT_OBJECTS_OWNER = 2; | ||
58 | public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101 | ||
59 | public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100 | ||
60 | public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010 | ||
61 | public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001 | ||
62 | public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011 | ||
63 | public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000 | ||
67 | 64 | ||
68 | //These are other constants. Yay! | 65 | //These are other constants. Yay! |
69 | public const int START_LAND_LOCAL_ID = 1; | 66 | public const int START_LAND_LOCAL_ID = 1; |
70 | 67 | ||
71 | public const float BAN_LINE_SAFETY_HIEGHT = 100; | ||
72 | |||
73 | #endregion | 68 | #endregion |
74 | 69 | ||
75 | private Scene m_scene; | 70 | private int[,] landIDList = new int[64,64]; |
76 | |||
77 | private Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>(); | 71 | private Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>(); |
78 | private int lastLandLocalID = START_LAND_LOCAL_ID - 1; | ||
79 | private int[,] landIDList = new int[64, 64]; | ||
80 | 72 | ||
81 | private bool landPrimCountTainted = false; | 73 | private bool landPrimCountTainted = false; |
74 | private int lastLandLocalID = START_LAND_LOCAL_ID - 1; | ||
82 | 75 | ||
83 | private bool m_allowedForcefulBans = true; | 76 | private bool m_allowedForcefulBans = true; |
84 | public bool allowedForcefulBans | 77 | private Scene m_scene; |
85 | { | ||
86 | get | ||
87 | { | ||
88 | return m_allowedForcefulBans; | ||
89 | } | ||
90 | set | ||
91 | { | ||
92 | m_allowedForcefulBans = value; | ||
93 | } | ||
94 | } | ||
95 | 78 | ||
96 | public LandChannel(Scene scene) | 79 | public LandChannel(Scene scene) |
97 | { | 80 | { |
98 | m_scene = scene; | 81 | m_scene = scene; |
99 | landIDList.Initialize(); | 82 | landIDList.Initialize(); |
100 | } | 83 | } |
84 | |||
101 | #region Land Object From Storage Functions | 85 | #region Land Object From Storage Functions |
102 | 86 | ||
103 | public void IncomingLandObjectsFromStorage(List<LandData> data) | 87 | public void IncomingLandObjectsFromStorage(List<LandData> data) |
@@ -133,10 +117,64 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
133 | resetSimLandObjects(); | 117 | resetSimLandObjects(); |
134 | } | 118 | } |
135 | 119 | ||
136 | #endregion | 120 | #endregion |
137 | 121 | ||
138 | #region Parcel Add/Remove/Get/Create | 122 | #region Parcel Add/Remove/Get/Create |
139 | 123 | ||
124 | public void updateLandObject(int local_id, LandData newData) | ||
125 | { | ||
126 | if (landList.ContainsKey(local_id)) | ||
127 | { | ||
128 | landList[local_id].landData = newData.Copy(); | ||
129 | m_scene.EventManager.TriggerLandObjectUpdated((uint) local_id, landList[local_id]); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | /// <summary> | ||
134 | /// Get the land object at the specified point | ||
135 | /// </summary> | ||
136 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> | ||
137 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> | ||
138 | /// <returns>Land object at the point supplied</returns> | ||
139 | public ILandObject getLandObject(float x_float, float y_float) | ||
140 | { | ||
141 | int x; | ||
142 | int y; | ||
143 | |||
144 | try | ||
145 | { | ||
146 | x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / Convert.ToDouble(4.0))); | ||
147 | y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / Convert.ToDouble(4.0))); | ||
148 | } | ||
149 | catch (OverflowException) | ||
150 | { | ||
151 | return null; | ||
152 | } | ||
153 | |||
154 | if (x >= 64 || y >= 64 || x < 0 || y < 0) | ||
155 | { | ||
156 | return null; | ||
157 | } | ||
158 | else | ||
159 | { | ||
160 | return landList[landIDList[x, y]]; | ||
161 | } | ||
162 | } | ||
163 | |||
164 | public ILandObject getLandObject(int x, int y) | ||
165 | { | ||
166 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) | ||
167 | { | ||
168 | // These exceptions here will cause a lot of complaints from the users specifically because | ||
169 | // they happen every time at border crossings | ||
170 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | return landList[landIDList[x / 4, y / 4]]; | ||
175 | } | ||
176 | } | ||
177 | |||
140 | /// <summary> | 178 | /// <summary> |
141 | /// Creates a basic Parcel object without an owner (a zeroed key) | 179 | /// Creates a basic Parcel object without an owner (a zeroed key) |
142 | /// </summary> | 180 | /// </summary> |
@@ -154,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
154 | { | 192 | { |
155 | lastLandLocalID++; | 193 | lastLandLocalID++; |
156 | new_land.landData.localID = lastLandLocalID; | 194 | new_land.landData.localID = lastLandLocalID; |
157 | landList.Add(lastLandLocalID, (LandObject)new_land.Copy()); | 195 | landList.Add(lastLandLocalID, (LandObject) new_land.Copy()); |
158 | 196 | ||
159 | 197 | ||
160 | bool[,] landBitmap = new_land.getLandBitmap(); | 198 | bool[,] landBitmap = new_land.getLandBitmap(); |
@@ -197,15 +235,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
197 | landList.Remove(local_id); | 235 | landList.Remove(local_id); |
198 | } | 236 | } |
199 | 237 | ||
200 | public void updateLandObject(int local_id, LandData newData) | ||
201 | { | ||
202 | if (landList.ContainsKey(local_id)) | ||
203 | { | ||
204 | landList[local_id].landData = newData.Copy(); | ||
205 | m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landList[local_id]); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | private void performFinalLandJoin(ILandObject master, ILandObject slave) | 238 | private void performFinalLandJoin(ILandObject master, ILandObject slave) |
210 | { | 239 | { |
211 | int x, y; | 240 | int x, y; |
@@ -225,66 +254,113 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
225 | updateLandObject(master.landData.localID, master.landData); | 254 | updateLandObject(master.landData.localID, master.landData); |
226 | } | 255 | } |
227 | 256 | ||
228 | /// <summary> | 257 | public ILandObject getLandObject(int parcelLocalID) |
229 | /// Get the land object at the specified point | ||
230 | /// </summary> | ||
231 | /// <param name="x">Value between 0 - 256 on the x axis of the point</param> | ||
232 | /// <param name="y">Value between 0 - 256 on the y axis of the point</param> | ||
233 | /// <returns>Land object at the point supplied</returns> | ||
234 | public ILandObject getLandObject(float x_float, float y_float) | ||
235 | { | 258 | { |
236 | int x; | 259 | lock (landList) |
237 | int y; | ||
238 | |||
239 | try | ||
240 | { | 260 | { |
241 | x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / Convert.ToDouble(4.0))); | 261 | if (landList.ContainsKey(parcelLocalID)) |
242 | y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / Convert.ToDouble(4.0))); | 262 | { |
263 | return landList[parcelLocalID]; | ||
264 | } | ||
243 | } | 265 | } |
244 | catch (OverflowException) | 266 | return null; |
267 | } | ||
268 | |||
269 | #endregion | ||
270 | |||
271 | #region Parcel Modification | ||
272 | |||
273 | public void resetAllLandPrimCounts() | ||
274 | { | ||
275 | foreach (LandObject p in landList.Values) | ||
245 | { | 276 | { |
246 | return null; | 277 | p.resetLandPrimCounts(); |
247 | } | 278 | } |
279 | } | ||
248 | 280 | ||
249 | if (x >= 64 || y >= 64 || x < 0 || y < 0) | 281 | public void setPrimsTainted() |
282 | { | ||
283 | landPrimCountTainted = true; | ||
284 | } | ||
285 | |||
286 | public bool isLandPrimCountTainted() | ||
287 | { | ||
288 | return landPrimCountTainted; | ||
289 | } | ||
290 | |||
291 | public void addPrimToLandPrimCounts(SceneObjectGroup obj) | ||
292 | { | ||
293 | LLVector3 position = obj.AbsolutePosition; | ||
294 | ILandObject landUnderPrim = getLandObject(position.X, position.Y); | ||
295 | if (landUnderPrim != null) | ||
250 | { | 296 | { |
251 | return null; | 297 | landUnderPrim.addPrimToCount(obj); |
252 | } | 298 | } |
253 | else | 299 | } |
300 | |||
301 | public void removePrimFromLandPrimCounts(SceneObjectGroup obj) | ||
302 | { | ||
303 | foreach (LandObject p in landList.Values) | ||
254 | { | 304 | { |
255 | return landList[landIDList[x, y]]; | 305 | p.removePrimFromCount(obj); |
256 | } | 306 | } |
257 | } | 307 | } |
258 | 308 | ||
259 | public ILandObject getLandObject(int parcelLocalID) | 309 | public void finalizeLandPrimCountUpdate() |
260 | { | 310 | { |
261 | lock (landList) | 311 | //Get Simwide prim count for owner |
312 | Dictionary<LLUUID, List<LandObject>> landOwnersAndParcels = new Dictionary<LLUUID, List<LandObject>>(); | ||
313 | foreach (LandObject p in landList.Values) | ||
262 | { | 314 | { |
263 | if (landList.ContainsKey(parcelLocalID)) | 315 | if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID)) |
264 | { | 316 | { |
265 | return landList[parcelLocalID]; | 317 | List<LandObject> tempList = new List<LandObject>(); |
318 | tempList.Add(p); | ||
319 | landOwnersAndParcels.Add(p.landData.ownerID, tempList); | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | landOwnersAndParcels[p.landData.ownerID].Add(p); | ||
266 | } | 324 | } |
267 | } | 325 | } |
268 | return null; | ||
269 | } | ||
270 | 326 | ||
271 | public ILandObject getLandObject(int x, int y) | 327 | foreach (LLUUID owner in landOwnersAndParcels.Keys) |
272 | { | ||
273 | if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) | ||
274 | { | 328 | { |
275 | // These exceptions here will cause a lot of complaints from the users specifically because | 329 | int simArea = 0; |
276 | // they happen every time at border crossings | 330 | int simPrims = 0; |
277 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | 331 | foreach (LandObject p in landOwnersAndParcels[owner]) |
332 | { | ||
333 | simArea += p.landData.area; | ||
334 | simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims + | ||
335 | p.landData.selectedPrims; | ||
336 | } | ||
337 | |||
338 | foreach (LandObject p in landOwnersAndParcels[owner]) | ||
339 | { | ||
340 | p.landData.simwideArea = simArea; | ||
341 | p.landData.simwidePrims = simPrims; | ||
342 | } | ||
278 | } | 343 | } |
279 | else | 344 | } |
345 | |||
346 | public void updateLandPrimCounts() | ||
347 | { | ||
348 | foreach (EntityBase obj in m_scene.Entities.Values) | ||
280 | { | 349 | { |
281 | return landList[landIDList[x / 4, y / 4]]; | 350 | if (obj is SceneObjectGroup) |
351 | { | ||
352 | m_scene.EventManager.TriggerParcelPrimCountAdd((SceneObjectGroup) obj); | ||
353 | } | ||
282 | } | 354 | } |
283 | } | 355 | } |
284 | 356 | ||
285 | #endregion | 357 | public void performParcelPrimCountUpdate() |
286 | 358 | { | |
287 | #region Parcel Modification | 359 | resetAllLandPrimCounts(); |
360 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | ||
361 | finalizeLandPrimCountUpdate(); | ||
362 | landPrimCountTainted = false; | ||
363 | } | ||
288 | 364 | ||
289 | /// <summary> | 365 | /// <summary> |
290 | /// Subdivides a piece of land | 366 | /// Subdivides a piece of land |
@@ -435,97 +511,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
435 | return true; | 511 | return true; |
436 | } | 512 | } |
437 | 513 | ||
438 | public void resetAllLandPrimCounts() | ||
439 | { | ||
440 | foreach (LandObject p in landList.Values) | ||
441 | { | ||
442 | p.resetLandPrimCounts(); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | public void setPrimsTainted() | ||
447 | { | ||
448 | landPrimCountTainted = true; | ||
449 | } | ||
450 | |||
451 | public bool isLandPrimCountTainted() | ||
452 | { | ||
453 | return landPrimCountTainted; | ||
454 | } | ||
455 | |||
456 | public void addPrimToLandPrimCounts(SceneObjectGroup obj) | ||
457 | { | ||
458 | LLVector3 position = obj.AbsolutePosition; | ||
459 | ILandObject landUnderPrim = getLandObject(position.X, position.Y); | ||
460 | if (landUnderPrim != null) | ||
461 | { | ||
462 | landUnderPrim.addPrimToCount(obj); | ||
463 | } | ||
464 | } | ||
465 | |||
466 | public void removePrimFromLandPrimCounts(SceneObjectGroup obj) | ||
467 | { | ||
468 | foreach (LandObject p in landList.Values) | ||
469 | { | ||
470 | p.removePrimFromCount(obj); | ||
471 | } | ||
472 | } | ||
473 | |||
474 | public void finalizeLandPrimCountUpdate() | ||
475 | { | ||
476 | //Get Simwide prim count for owner | ||
477 | Dictionary<LLUUID, List<LandObject>> landOwnersAndParcels = new Dictionary<LLUUID, List<LandObject>>(); | ||
478 | foreach (LandObject p in landList.Values) | ||
479 | { | ||
480 | if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID)) | ||
481 | { | ||
482 | List<LandObject> tempList = new List<LandObject>(); | ||
483 | tempList.Add(p); | ||
484 | landOwnersAndParcels.Add(p.landData.ownerID, tempList); | ||
485 | } | ||
486 | else | ||
487 | { | ||
488 | landOwnersAndParcels[p.landData.ownerID].Add(p); | ||
489 | } | ||
490 | } | ||
491 | |||
492 | foreach (LLUUID owner in landOwnersAndParcels.Keys) | ||
493 | { | ||
494 | int simArea = 0; | ||
495 | int simPrims = 0; | ||
496 | foreach (LandObject p in landOwnersAndParcels[owner]) | ||
497 | { | ||
498 | simArea += p.landData.area; | ||
499 | simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims + | ||
500 | p.landData.selectedPrims; | ||
501 | } | ||
502 | |||
503 | foreach (LandObject p in landOwnersAndParcels[owner]) | ||
504 | { | ||
505 | p.landData.simwideArea = simArea; | ||
506 | p.landData.simwidePrims = simPrims; | ||
507 | } | ||
508 | } | ||
509 | } | ||
510 | |||
511 | public void updateLandPrimCounts() | ||
512 | { | ||
513 | foreach (EntityBase obj in m_scene.Entities.Values) | ||
514 | { | ||
515 | if (obj is SceneObjectGroup) | ||
516 | { | ||
517 | m_scene.EventManager.TriggerParcelPrimCountAdd((SceneObjectGroup)obj); | ||
518 | } | ||
519 | } | ||
520 | } | ||
521 | |||
522 | public void performParcelPrimCountUpdate() | ||
523 | { | ||
524 | resetAllLandPrimCounts(); | ||
525 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | ||
526 | finalizeLandPrimCountUpdate(); | ||
527 | landPrimCountTainted = false; | ||
528 | } | ||
529 | #endregion | 514 | #endregion |
530 | 515 | ||
531 | #region Parcel Updating | 516 | #region Parcel Updating |
@@ -547,7 +532,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
547 | { | 532 | { |
548 | for (x = 0; x < 64; x++) | 533 | for (x = 0; x < 64; x++) |
549 | { | 534 | { |
550 | byte tempByte = (byte)0; //This represents the byte for the current 4x4 | 535 | byte tempByte = (byte) 0; //This represents the byte for the current 4x4 |
551 | ILandObject currentParcelBlock = null; | 536 | ILandObject currentParcelBlock = null; |
552 | 537 | ||
553 | try | 538 | try |
@@ -623,10 +608,10 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
623 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | 608 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) |
624 | { | 609 | { |
625 | byteArrayCount = 0; | 610 | byteArrayCount = 0; |
626 | packet = (ParcelOverlayPacket)PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); | 611 | packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); |
627 | packet.ParcelData.Data = byteArray; | 612 | packet.ParcelData.Data = byteArray; |
628 | packet.ParcelData.SequenceID = sequenceID; | 613 | packet.ParcelData.SequenceID = sequenceID; |
629 | remote_client.OutPacket((Packet)packet, ThrottleOutPacketType.Task); | 614 | remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task); |
630 | sequenceID++; | 615 | sequenceID++; |
631 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | 616 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; |
632 | } | 617 | } |
@@ -652,7 +637,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
652 | { | 637 | { |
653 | for (y = 0; y < inc_y; y++) | 638 | for (y = 0; y < inc_y; y++) |
654 | { | 639 | { |
655 | |||
656 | ILandObject currentParcel = null; | 640 | ILandObject currentParcel = null; |
657 | try | 641 | try |
658 | { | 642 | { |
@@ -693,7 +677,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
693 | if (landList.ContainsKey(packet.ParcelData.LocalID)) | 677 | if (landList.ContainsKey(packet.ParcelData.LocalID)) |
694 | { | 678 | { |
695 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); | 679 | landList[packet.ParcelData.LocalID].updateLandProperties(packet, remote_client); |
696 | |||
697 | } | 680 | } |
698 | } | 681 | } |
699 | 682 | ||
@@ -719,6 +702,14 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
719 | 702 | ||
720 | #endregion | 703 | #endregion |
721 | 704 | ||
705 | #region ILandChannel Members | ||
706 | |||
707 | public bool allowedForcefulBans | ||
708 | { | ||
709 | get { return m_allowedForcefulBans; } | ||
710 | set { m_allowedForcefulBans = value; } | ||
711 | } | ||
712 | |||
722 | /// <summary> | 713 | /// <summary> |
723 | /// Resets the sim to the default land object (full sim piece of land owned by the default user) | 714 | /// Resets the sim to the default land object (full sim piece of land owned by the default user) |
724 | /// </summary> | 715 | /// </summary> |
@@ -731,7 +722,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
731 | 722 | ||
732 | ILandObject fullSimParcel = new LandObject(LLUUID.Zero, false, m_scene); | 723 | ILandObject fullSimParcel = new LandObject(LLUUID.Zero, false, m_scene); |
733 | 724 | ||
734 | fullSimParcel.setLandBitmap(fullSimParcel.getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | 725 | fullSimParcel.setLandBitmap(fullSimParcel.getSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize)); |
735 | fullSimParcel.landData.ownerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; | 726 | fullSimParcel.landData.ownerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; |
736 | 727 | ||
737 | addLandObject(fullSimParcel); | 728 | addLandObject(fullSimParcel); |
@@ -816,18 +807,17 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
816 | { | 807 | { |
817 | if (presence.UUID == avatar.AgentId) | 808 | if (presence.UUID == avatar.AgentId) |
818 | { | 809 | { |
819 | |||
820 | List<ILandObject> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition); | 810 | List<ILandObject> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition); |
821 | foreach (ILandObject checkBan in checkLandParcels) | 811 | foreach (ILandObject checkBan in checkLandParcels) |
822 | { | 812 | { |
823 | if (checkBan.isBannedFromLand(avatar.AgentId)) | 813 | if (checkBan.isBannedFromLand(avatar.AgentId)) |
824 | { | 814 | { |
825 | checkBan.sendLandProperties(-30000, false, (int)ParcelManager.ParcelResult.Single, avatar); | 815 | checkBan.sendLandProperties(-30000, false, (int) ParcelManager.ParcelResult.Single, avatar); |
826 | return; //Only send one | 816 | return; //Only send one |
827 | } | 817 | } |
828 | else if (checkBan.isRestrictedFromLand(avatar.AgentId)) | 818 | else if (checkBan.isRestrictedFromLand(avatar.AgentId)) |
829 | { | 819 | { |
830 | checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar); | 820 | checkBan.sendLandProperties(-40000, false, (int) ParcelManager.ParcelResult.Single, avatar); |
831 | return; //Only send one | 821 | return; //Only send one |
832 | } | 822 | } |
833 | } | 823 | } |
@@ -841,8 +831,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
841 | ILandObject over = null; | 831 | ILandObject over = null; |
842 | try | 832 | try |
843 | { | 833 | { |
844 | over = getLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), | 834 | over = getLandObject((int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), |
845 | (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); | 835 | (int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); |
846 | } | 836 | } |
847 | catch (Exception) | 837 | catch (Exception) |
848 | { | 838 | { |
@@ -873,11 +863,12 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
873 | } | 863 | } |
874 | } | 864 | } |
875 | } | 865 | } |
866 | |||
876 | public void sendLandUpdate(ScenePresence avatar) | 867 | public void sendLandUpdate(ScenePresence avatar) |
877 | { | 868 | { |
878 | sendLandUpdate(avatar, false); | 869 | sendLandUpdate(avatar, false); |
879 | |||
880 | } | 870 | } |
871 | |||
881 | public void handleSignificantClientMovement(IClientAPI remote_client) | 872 | public void handleSignificantClientMovement(IClientAPI remote_client) |
882 | { | 873 | { |
883 | ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId); | 874 | ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId); |
@@ -949,6 +940,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
949 | } | 940 | } |
950 | } | 941 | } |
951 | 942 | ||
943 | #endregion | ||
944 | |||
952 | // If the economy has been validated by the economy module, | 945 | // If the economy has been validated by the economy module, |
953 | // and land has been validated as well, this method transfers | 946 | // and land has been validated as well, this method transfers |
954 | // the land ownership | 947 | // the land ownership |
@@ -961,7 +954,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
961 | { | 954 | { |
962 | if (landList.ContainsKey(e.parcelLocalID)) | 955 | if (landList.ContainsKey(e.parcelLocalID)) |
963 | { | 956 | { |
964 | landList[e.parcelLocalID].updateLandSold(e.agentId, e.groupId, e.groupOwned, (uint)e.transactionID, e.parcelPrice, e.parcelArea); | 957 | landList[e.parcelLocalID].updateLandSold(e.agentId, e.groupId, e.groupOwned, (uint) e.transactionID, e.parcelPrice, e.parcelArea); |
965 | return; | 958 | return; |
966 | } | 959 | } |
967 | } | 960 | } |
@@ -989,17 +982,16 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
989 | LLUUID AuthorizedID = lob.landData.authBuyerID; | 982 | LLUUID AuthorizedID = lob.landData.authBuyerID; |
990 | int saleprice = lob.landData.salePrice; | 983 | int saleprice = lob.landData.salePrice; |
991 | LLUUID pOwnerID = lob.landData.ownerID; | 984 | LLUUID pOwnerID = lob.landData.ownerID; |
992 | 985 | ||
993 | bool landforsale = ((lob.landData.landFlags & (uint)(Parcel.ParcelFlags.ForSale | Parcel.ParcelFlags.ForSaleObjects | Parcel.ParcelFlags.SellParcelObjects)) != 0); | 986 | bool landforsale = ((lob.landData.landFlags & |
987 | (uint) (Parcel.ParcelFlags.ForSale | Parcel.ParcelFlags.ForSaleObjects | Parcel.ParcelFlags.SellParcelObjects)) != 0); | ||
994 | if ((AuthorizedID == LLUUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale) | 988 | if ((AuthorizedID == LLUUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale) |
995 | { | 989 | { |
996 | lock (e) | 990 | lock (e) |
997 | { | 991 | { |
998 | e.parcelOwnerID = pOwnerID; | 992 | e.parcelOwnerID = pOwnerID; |
999 | e.landValidated = true; | 993 | e.landValidated = true; |
1000 | |||
1001 | } | 994 | } |
1002 | |||
1003 | } | 995 | } |
1004 | } | 996 | } |
1005 | } | 997 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index c5ffdca..3f09bd5 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | using Nini.Config; | 28 | using Nini.Config; |
29 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
30 | using OpenSim.Region.Environment.Modules.World.Land; | ||
31 | using OpenSim.Region.Environment.Scenes; | 30 | using OpenSim.Region.Environment.Scenes; |
32 | 31 | ||
33 | namespace OpenSim.Region.Environment.Modules.World.Land | 32 | namespace OpenSim.Region.Environment.Modules.World.Land |
@@ -43,7 +42,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
43 | { | 42 | { |
44 | m_scene = scene; | 43 | m_scene = scene; |
45 | landChannel = new LandChannel(scene); | 44 | landChannel = new LandChannel(scene); |
46 | 45 | ||
47 | m_scene.EventManager.OnParcelPrimCountAdd += landChannel.addPrimToLandPrimCounts; | 46 | m_scene.EventManager.OnParcelPrimCountAdd += landChannel.addPrimToLandPrimCounts; |
48 | m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; | 47 | m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts; |
49 | m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); | 48 | m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel); |
@@ -53,18 +52,16 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
53 | 52 | ||
54 | lock (m_scene) | 53 | lock (m_scene) |
55 | { | 54 | { |
56 | m_scene.LandChannel = (ILandChannel)landChannel; | 55 | m_scene.LandChannel = (ILandChannel) landChannel; |
57 | } | 56 | } |
58 | } | 57 | } |
59 | 58 | ||
60 | public void PostInitialise() | 59 | public void PostInitialise() |
61 | { | 60 | { |
62 | |||
63 | } | 61 | } |
64 | 62 | ||
65 | public void Close() | 63 | public void Close() |
66 | { | 64 | { |
67 | |||
68 | } | 65 | } |
69 | 66 | ||
70 | public string Name | 67 | public string Name |
@@ -77,10 +74,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
77 | get { return false; } | 74 | get { return false; } |
78 | } | 75 | } |
79 | 76 | ||
80 | |||
81 | |||
82 | |||
83 | |||
84 | #endregion | 77 | #endregion |
85 | } | 78 | } |
86 | } \ No newline at end of file | 79 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index 693c55d..368e113 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs | |||
@@ -33,7 +33,6 @@ 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.Modules.World.Land; | ||
37 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
38 | 37 | ||
39 | namespace OpenSim.Region.Environment.Modules.World.Land | 38 | namespace OpenSim.Region.Environment.Modules.World.Land |
@@ -46,23 +45,16 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
46 | #region Member Variables | 45 | #region Member Variables |
47 | 46 | ||
48 | 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]; | ||
49 | 49 | ||
50 | protected LandData m_landData = new LandData(); | 50 | protected LandData m_landData = new LandData(); |
51 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | ||
52 | protected Scene m_scene; | 51 | protected Scene m_scene; |
53 | 52 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | |
54 | private bool[,] m_landBitmap = new bool[64,64]; | ||
55 | 53 | ||
56 | public bool[,] landBitmap | 54 | public bool[,] landBitmap |
57 | { | 55 | { |
58 | get | 56 | get { return m_landBitmap; } |
59 | { | 57 | set { m_landBitmap = value; } |
60 | return m_landBitmap; | ||
61 | } | ||
62 | set | ||
63 | { | ||
64 | m_landBitmap = value; | ||
65 | } | ||
66 | } | 58 | } |
67 | 59 | ||
68 | #endregion | 60 | #endregion |
@@ -71,25 +63,16 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
71 | 63 | ||
72 | public LandData landData | 64 | public LandData landData |
73 | { | 65 | { |
74 | get | 66 | get { return m_landData; } |
75 | { | ||
76 | return m_landData; | ||
77 | } | ||
78 | 67 | ||
79 | set | 68 | set { m_landData = value; } |
80 | { | ||
81 | m_landData = value; | ||
82 | } | ||
83 | } | 69 | } |
84 | 70 | ||
85 | public LLUUID regionUUID | 71 | public LLUUID regionUUID |
86 | { | 72 | { |
87 | get { return m_scene.RegionInfo.RegionID; } | 73 | get { return m_scene.RegionInfo.RegionID; } |
88 | } | 74 | } |
89 | 75 | ||
90 | #endregion | ||
91 | |||
92 | |||
93 | #region Constructors | 76 | #region Constructors |
94 | 77 | ||
95 | public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene) | 78 | public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene) |
@@ -115,7 +98,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
115 | { | 98 | { |
116 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) | 99 | if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) |
117 | { | 100 | { |
118 | return (landBitmap[x/4, y/4] == true); | 101 | return (landBitmap[x / 4, y / 4] == true); |
119 | } | 102 | } |
120 | else | 103 | else |
121 | { | 104 | { |
@@ -149,7 +132,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
149 | { | 132 | { |
150 | ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); | 133 | ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); |
151 | // TODO: don't create new blocks if recycling an old packet | 134 | // TODO: don't create new blocks if recycling an old packet |
152 | 135 | ||
153 | updatePacket.ParcelData.AABBMax = landData.AABBMax; | 136 | updatePacket.ParcelData.AABBMax = landData.AABBMax; |
154 | updatePacket.ParcelData.AABBMin = landData.AABBMin; | 137 | updatePacket.ParcelData.AABBMin = landData.AABBMin; |
155 | updatePacket.ParcelData.Area = landData.area; | 138 | updatePacket.ParcelData.Area = landData.area; |
@@ -171,7 +154,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
171 | { | 154 | { |
172 | updatePacket.ParcelData.MaxPrims = | 155 | updatePacket.ParcelData.MaxPrims = |
173 | Convert.ToInt32( | 156 | Convert.ToInt32( |
174 | 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 * |
175 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); | 158 | Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); |
176 | } | 159 | } |
177 | else | 160 | else |
@@ -193,7 +176,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
193 | updatePacket.ParcelData.PassHours = landData.passHours; | 176 | updatePacket.ParcelData.PassHours = landData.passHours; |
194 | updatePacket.ParcelData.PassPrice = landData.passPrice; | 177 | updatePacket.ParcelData.PassPrice = landData.passPrice; |
195 | updatePacket.ParcelData.PublicCount = 0; //unemplemented | 178 | updatePacket.ParcelData.PublicCount = 0; //unemplemented |
196 | 179 | ||
197 | uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags; | 180 | uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags; |
198 | updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) > | 181 | updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) > |
199 | 0); | 182 | 0); |
@@ -255,12 +238,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
255 | newData.snapshotID = packet.ParcelData.SnapshotID; | 238 | newData.snapshotID = packet.ParcelData.SnapshotID; |
256 | newData.userLocation = packet.ParcelData.UserLocation; | 239 | newData.userLocation = packet.ParcelData.UserLocation; |
257 | newData.userLookAt = packet.ParcelData.UserLookAt; | 240 | newData.userLookAt = packet.ParcelData.UserLookAt; |
258 | 241 | ||
259 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | 242 | m_scene.LandChannel.updateLandObject(landData.localID, newData); |
260 | 243 | ||
261 | sendLandUpdateToAvatarsOverMe(); | 244 | sendLandUpdateToAvatarsOverMe(); |
262 | } | 245 | } |
263 | } | 246 | } |
247 | |||
264 | 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) |
265 | { | 249 | { |
266 | LandData newData = landData.Copy(); | 250 | LandData newData = landData.Copy(); |
@@ -272,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
272 | newData.claimPrice = claimprice; | 256 | newData.claimPrice = claimprice; |
273 | newData.salePrice = 0; | 257 | newData.salePrice = 0; |
274 | newData.authBuyerID = LLUUID.Zero; | 258 | newData.authBuyerID = LLUUID.Zero; |
275 | 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); |
276 | m_scene.LandChannel.updateLandObject(landData.localID, newData); | 260 | m_scene.LandChannel.updateLandObject(landData.localID, newData); |
277 | 261 | ||
278 | sendLandUpdateToAvatarsOverMe(); | 262 | sendLandUpdateToAvatarsOverMe(); |
@@ -339,12 +323,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
339 | try | 323 | try |
340 | { | 324 | { |
341 | over = | 325 | over = |
342 | 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))), |
343 | (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)))); |
344 | } | 328 | } |
345 | catch (Exception) | 329 | catch (Exception) |
346 | { | 330 | { |
347 | m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatars[i].AbsolutePosition.X) + " y: " + Math.Round(avatars[i].AbsolutePosition.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)); | ||
348 | } | 333 | } |
349 | 334 | ||
350 | if (over != null) | 335 | if (over != null) |
@@ -463,6 +448,25 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
463 | 448 | ||
464 | #region Update Functions | 449 | #region Update Functions |
465 | 450 | ||
451 | public void updateLandBitmapByteArray() | ||
452 | { | ||
453 | landData.landBitmapByteArray = convertLandBitmapToBytes(); | ||
454 | } | ||
455 | |||
456 | /// <summary> | ||
457 | /// Update all settings in land such as area, bitmap byte array, etc | ||
458 | /// </summary> | ||
459 | public void forceUpdateLandInfo() | ||
460 | { | ||
461 | updateAABBAndAreaValues(); | ||
462 | updateLandBitmapByteArray(); | ||
463 | } | ||
464 | |||
465 | public void setLandBitmapFromByteArray() | ||
466 | { | ||
467 | landBitmap = convertBytesToLandBitmap(); | ||
468 | } | ||
469 | |||
466 | /// <summary> | 470 | /// <summary> |
467 | /// 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 |
468 | /// </summary> | 472 | /// </summary> |
@@ -495,8 +499,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
495 | if (ty > 255) | 499 | if (ty > 255) |
496 | ty = 255; | 500 | ty = 255; |
497 | landData.AABBMin = | 501 | landData.AABBMin = |
498 | new LLVector3((float)(min_x * 4), (float)(min_y * 4), | 502 | new LLVector3((float) (min_x * 4), (float) (min_y * 4), |
499 | (float)m_scene.Heightmap[tx, ty]); | 503 | (float) m_scene.Heightmap[tx, ty]); |
500 | 504 | ||
501 | tx = max_x * 4; | 505 | tx = max_x * 4; |
502 | if (tx > 255) | 506 | if (tx > 255) |
@@ -505,30 +509,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
505 | if (ty > 255) | 509 | if (ty > 255) |
506 | ty = 255; | 510 | ty = 255; |
507 | landData.AABBMax = | 511 | landData.AABBMax = |
508 | new LLVector3((float)(max_x * 4), (float)(max_y * 4), | 512 | new LLVector3((float) (max_x * 4), (float) (max_y * 4), |
509 | (float)m_scene.Heightmap[tx, ty]); | 513 | (float) m_scene.Heightmap[tx, ty]); |
510 | landData.area = tempArea; | 514 | landData.area = tempArea; |
511 | } | 515 | } |
512 | 516 | ||
513 | public void updateLandBitmapByteArray() | ||
514 | { | ||
515 | landData.landBitmapByteArray = convertLandBitmapToBytes(); | ||
516 | } | ||
517 | |||
518 | /// <summary> | ||
519 | /// Update all settings in land such as area, bitmap byte array, etc | ||
520 | /// </summary> | ||
521 | public void forceUpdateLandInfo() | ||
522 | { | ||
523 | updateAABBAndAreaValues(); | ||
524 | updateLandBitmapByteArray(); | ||
525 | } | ||
526 | |||
527 | public void setLandBitmapFromByteArray() | ||
528 | { | ||
529 | landBitmap = convertBytesToLandBitmap(); | ||
530 | } | ||
531 | |||
532 | #endregion | 517 | #endregion |
533 | 518 | ||
534 | #region Land Bitmap Functions | 519 | #region Land Bitmap Functions |
@@ -562,63 +547,12 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
562 | } | 547 | } |
563 | 548 | ||
564 | /// <summary> | 549 | /// <summary> |
565 | /// Converts the land bitmap to a packet friendly byte array | ||
566 | /// </summary> | ||
567 | /// <returns></returns> | ||
568 | private byte[] convertLandBitmapToBytes() | ||
569 | { | ||
570 | byte[] tempConvertArr = new byte[512]; | ||
571 | byte tempByte = 0; | ||
572 | int x, y, i, byteNum = 0; | ||
573 | i = 0; | ||
574 | for (y = 0; y < 64; y++) | ||
575 | { | ||
576 | for (x = 0; x < 64; x++) | ||
577 | { | ||
578 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++%8)); | ||
579 | if (i%8 == 0) | ||
580 | { | ||
581 | tempConvertArr[byteNum] = tempByte; | ||
582 | tempByte = (byte) 0; | ||
583 | i = 0; | ||
584 | byteNum++; | ||
585 | } | ||
586 | } | ||
587 | } | ||
588 | return tempConvertArr; | ||
589 | } | ||
590 | |||
591 | private bool[,] convertBytesToLandBitmap() | ||
592 | { | ||
593 | bool[,] tempConvertMap = new bool[64,64]; | ||
594 | tempConvertMap.Initialize(); | ||
595 | byte tempByte = 0; | ||
596 | int x = 0, y = 0, i = 0, bitNum = 0; | ||
597 | for (i = 0; i < 512; i++) | ||
598 | { | ||
599 | tempByte = landData.landBitmapByteArray[i]; | ||
600 | for (bitNum = 0; bitNum < 8; bitNum++) | ||
601 | { | ||
602 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); | ||
603 | tempConvertMap[x, y] = bit; | ||
604 | x++; | ||
605 | if (x > 63) | ||
606 | { | ||
607 | x = 0; | ||
608 | y++; | ||
609 | } | ||
610 | } | ||
611 | } | ||
612 | return tempConvertMap; | ||
613 | } | ||
614 | |||
615 | /// <summary> | ||
616 | /// Full sim land object creation | 550 | /// Full sim land object creation |
617 | /// </summary> | 551 | /// </summary> |
618 | /// <returns></returns> | 552 | /// <returns></returns> |
619 | public bool[,] basicFullRegionLandBitmap() | 553 | public bool[,] basicFullRegionLandBitmap() |
620 | { | 554 | { |
621 | return getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize); | 555 | return getSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); |
622 | } | 556 | } |
623 | 557 | ||
624 | /// <summary> | 558 | /// <summary> |
@@ -662,8 +596,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
662 | { | 596 | { |
663 | for (x = 0; x < 64; x++) | 597 | for (x = 0; x < 64; x++) |
664 | { | 598 | { |
665 | if (x >= start_x/4 && x < end_x/4 | 599 | if (x >= start_x / 4 && x < end_x / 4 |
666 | && y >= start_y/4 && y < end_y/4) | 600 | && y >= start_y / 4 && y < end_y / 4) |
667 | { | 601 | { |
668 | land_bitmap[x, y] = set_value; | 602 | land_bitmap[x, y] = set_value; |
669 | } | 603 | } |
@@ -705,6 +639,57 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
705 | return bitmap_base; | 639 | return bitmap_base; |
706 | } | 640 | } |
707 | 641 | ||
642 | /// <summary> | ||
643 | /// Converts the land bitmap to a packet friendly byte array | ||
644 | /// </summary> | ||
645 | /// <returns></returns> | ||
646 | private byte[] convertLandBitmapToBytes() | ||
647 | { | ||
648 | byte[] tempConvertArr = new byte[512]; | ||
649 | byte tempByte = 0; | ||
650 | int x, y, i, byteNum = 0; | ||
651 | i = 0; | ||
652 | for (y = 0; y < 64; y++) | ||
653 | { | ||
654 | for (x = 0; x < 64; x++) | ||
655 | { | ||
656 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++ % 8)); | ||
657 | if (i % 8 == 0) | ||
658 | { | ||
659 | tempConvertArr[byteNum] = tempByte; | ||
660 | tempByte = (byte) 0; | ||
661 | i = 0; | ||
662 | byteNum++; | ||
663 | } | ||
664 | } | ||
665 | } | ||
666 | return tempConvertArr; | ||
667 | } | ||
668 | |||
669 | private bool[,] convertBytesToLandBitmap() | ||
670 | { | ||
671 | bool[,] tempConvertMap = new bool[64,64]; | ||
672 | tempConvertMap.Initialize(); | ||
673 | byte tempByte = 0; | ||
674 | int x = 0, y = 0, i = 0, bitNum = 0; | ||
675 | for (i = 0; i < 512; i++) | ||
676 | { | ||
677 | tempByte = landData.landBitmapByteArray[i]; | ||
678 | for (bitNum = 0; bitNum < 8; bitNum++) | ||
679 | { | ||
680 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); | ||
681 | tempConvertMap[x, y] = bit; | ||
682 | x++; | ||
683 | if (x > 63) | ||
684 | { | ||
685 | x = 0; | ||
686 | y++; | ||
687 | } | ||
688 | } | ||
689 | } | ||
690 | return tempConvertMap; | ||
691 | } | ||
692 | |||
708 | #endregion | 693 | #endregion |
709 | 694 | ||
710 | #region Object Select and Object Owner Listing | 695 | #region Object Select and Object Owner Listing |
@@ -781,7 +766,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
781 | public void sendLandObjectOwners(IClientAPI remote_client) | 766 | public void sendLandObjectOwners(IClientAPI remote_client) |
782 | { | 767 | { |
783 | Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>(); | 768 | Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>(); |
784 | ParcelObjectOwnersReplyPacket pack | 769 | ParcelObjectOwnersReplyPacket pack |
785 | = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); | 770 | = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); |
786 | // TODO: don't create new blocks if recycling an old packet | 771 | // TODO: don't create new blocks if recycling an old packet |
787 | 772 | ||
@@ -807,21 +792,21 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
807 | 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."); |
808 | } | 793 | } |
809 | } | 794 | } |
810 | 795 | ||
811 | int notifyCount = primCount.Count; | 796 | int notifyCount = primCount.Count; |
812 | 797 | ||
813 | if (notifyCount > 0) | 798 | if (notifyCount > 0) |
814 | { | 799 | { |
815 | if (notifyCount > 32) | 800 | if (notifyCount > 32) |
816 | { | 801 | { |
817 | m_log.InfoFormat( | 802 | m_log.InfoFormat( |
818 | "[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}" |
819 | + " - 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); |
820 | 805 | ||
821 | notifyCount = 32; | 806 | notifyCount = 32; |
822 | } | 807 | } |
823 | 808 | ||
824 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock | 809 | ParcelObjectOwnersReplyPacket.DataBlock[] dataBlock |
825 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; | 810 | = new ParcelObjectOwnersReplyPacket.DataBlock[notifyCount]; |
826 | 811 | ||
827 | int num = 0; | 812 | int num = 0; |
@@ -834,16 +819,16 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
834 | dataBlock[num].OwnerID = owner; | 819 | dataBlock[num].OwnerID = owner; |
835 | 820 | ||
836 | num++; | 821 | num++; |
837 | 822 | ||
838 | if (num >= notifyCount) | 823 | if (num >= notifyCount) |
839 | { | 824 | { |
840 | break; | 825 | break; |
841 | } | 826 | } |
842 | } | 827 | } |
843 | 828 | ||
844 | pack.Data = dataBlock; | 829 | pack.Data = dataBlock; |
845 | } | 830 | } |
846 | 831 | ||
847 | remote_client.OutPacket(pack, ThrottleOutPacketType.Task); | 832 | remote_client.OutPacket(pack, ThrottleOutPacketType.Task); |
848 | } | 833 | } |
849 | 834 | ||
@@ -937,7 +922,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
937 | #endregion | 922 | #endregion |
938 | 923 | ||
939 | #endregion | 924 | #endregion |
940 | |||
941 | 925 | ||
926 | #endregion | ||
942 | } | 927 | } |
943 | } \ No newline at end of file | 928 | } \ No newline at end of file |