diff options
author | mingchen | 2007-06-06 03:00:59 +0000 |
---|---|---|
committer | mingchen | 2007-06-06 03:00:59 +0000 |
commit | ea798195758a6692b583930e5846c643157143be (patch) | |
tree | 50ac10b862332a622dc50c991591cc65c084d9b5 /OpenSim/OpenSim.RegionServer | |
parent | Unhippos! (diff) | |
download | opensim-SC-ea798195758a6692b583930e5846c643157143be.zip opensim-SC-ea798195758a6692b583930e5846c643157143be.tar.gz opensim-SC-ea798195758a6692b583930e5846c643157143be.tar.bz2 opensim-SC-ea798195758a6692b583930e5846c643157143be.tar.xz |
Changes:
*Added support for Subdivision (use master avatar to login to try out)
*Added Parcel Border support
*Enabled user account storage, but only when a new account is created
Bug Fixes:
*Fixed crash on startup while in sandbox when "Setting up master avatar"
*Fixed most core functions in ParcelManager and Parcel that where broken
*Fixed Parcel saving to database
Known Issues:
*Dividing parcel fails in viewer (gives an error about needing 2 parcels)
Diffstat (limited to 'OpenSim/OpenSim.RegionServer')
4 files changed, 132 insertions, 78 deletions
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs index 35de1e6..2a75205 100644 --- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs +++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs | |||
@@ -84,6 +84,7 @@ namespace OpenSim | |||
84 | public event UpdatePrimVector OnUpdatePrimScale; | 84 | public event UpdatePrimVector OnUpdatePrimScale; |
85 | public event StatusChange OnChildAgentStatus; | 85 | public event StatusChange OnChildAgentStatus; |
86 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | 86 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; |
87 | public event ParcelDivideRequest OnParcelDivideRequest; | ||
87 | 88 | ||
88 | protected override void ProcessInPacket(Packet Pack) | 89 | protected override void ProcessInPacket(Packet Pack) |
89 | { | 90 | { |
@@ -472,6 +473,10 @@ namespace OpenSim | |||
472 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; | 473 | ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack; |
473 | OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North),propertiesRequest.ParcelData.SequenceID,propertiesRequest.ParcelData.SnapSelection, this); | 474 | OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North),propertiesRequest.ParcelData.SequenceID,propertiesRequest.ParcelData.SnapSelection, this); |
474 | break; | 475 | break; |
476 | case PacketType.ParcelDivide: | ||
477 | ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack; | ||
478 | OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this); | ||
479 | break; | ||
475 | #endregion | 480 | #endregion |
476 | 481 | ||
477 | #region unimplemented handlers | 482 | #region unimplemented handlers |
@@ -481,19 +486,7 @@ namespace OpenSim | |||
481 | case PacketType.ObjectScale: | 486 | case PacketType.ObjectScale: |
482 | break; | 487 | break; |
483 | case PacketType.MoneyBalanceRequest: | 488 | case PacketType.MoneyBalanceRequest: |
484 | //This need to be actually done and not thrown back with fake info | 489 | //This need to be actually done and not thrown back with fake infos |
485 | MoneyBalanceRequestPacket incoming = (MoneyBalanceRequestPacket)Pack; | ||
486 | MoneyBalanceReplyPacket outgoing = new MoneyBalanceReplyPacket(); | ||
487 | outgoing.MoneyData.AgentID = incoming.AgentData.AgentID; | ||
488 | outgoing.MoneyData.MoneyBalance = 31337; | ||
489 | outgoing.MoneyData.SquareMetersCommitted = 0; | ||
490 | outgoing.MoneyData.SquareMetersCredit = 100000000; | ||
491 | outgoing.MoneyData.TransactionID = incoming.MoneyData.TransactionID; | ||
492 | outgoing.MoneyData.TransactionSuccess = true; | ||
493 | outgoing.MoneyData.Description = libsecondlife.Helpers.StringToField(""); | ||
494 | this.OutPacket((Packet)outgoing); | ||
495 | MainConsole.Instance.Notice("Sent Temporary Money packet (they have leet monies)"); | ||
496 | |||
497 | break; | 490 | break; |
498 | 491 | ||
499 | case PacketType.EstateCovenantRequest: | 492 | case PacketType.EstateCovenantRequest: |
diff --git a/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs b/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs index 8078bbb..68e22db 100644 --- a/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs +++ b/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Framework.Types; | |||
37 | namespace OpenSim.RegionServer.world | 37 | namespace OpenSim.RegionServer.world |
38 | { | 38 | { |
39 | public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, ClientView remote_client); | 39 | public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, ClientView remote_client); |
40 | 40 | public delegate void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client); | |
41 | 41 | ||
42 | #region ParcelManager Class | 42 | #region ParcelManager Class |
43 | /// <summary> | 43 | /// <summary> |
@@ -49,25 +49,28 @@ namespace OpenSim.RegionServer.world | |||
49 | #region Constants | 49 | #region Constants |
50 | //Parcel types set with flags in ParcelOverlay. | 50 | //Parcel types set with flags in ParcelOverlay. |
51 | //Only one of these can be used. | 51 | //Only one of these can be used. |
52 | public static byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000 | 52 | public const byte PARCEL_TYPE_PUBLIC = (byte)0; //Equals 00000000 |
53 | public static byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 | 53 | public const byte PARCEL_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001 |
54 | public static byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 | 54 | public const byte PARCEL_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010 |
55 | public static byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 | 55 | public const byte PARCEL_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011 |
56 | public static byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 | 56 | public const byte PARCEL_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100 |
57 | public static byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 | 57 | public const byte PARCEL_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101 |
58 | 58 | ||
59 | 59 | ||
60 | //Flags that when set, a border on the given side will be placed | 60 | //Flags that when set, a border on the given side will be placed |
61 | //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc) | 61 | //NOTE: North and East is assumable by the west and south sides (if parcel to east has a west border, then I have an east border; etc) |
62 | //This took forever to figure out -- jeesh. /blame LL for even having to send these | 62 | //This took forever to figure out -- jeesh. /blame LL for even having to send these |
63 | public static byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 | 63 | public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 |
64 | public static byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 | 64 | public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 |
65 | |||
65 | 66 | ||
67 | //These are other constants. Yay! | ||
68 | public const int START_PARCEL_LOCAL_ID = 1; | ||
66 | #endregion | 69 | #endregion |
67 | 70 | ||
68 | #region Member Variables | 71 | #region Member Variables |
69 | public Dictionary<int, Parcel> parcelList = new Dictionary<int, Parcel>(); | 72 | public Dictionary<int, Parcel> parcelList = new Dictionary<int, Parcel>(); |
70 | private int lastParcelLocalID = -1; | 73 | private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1; |
71 | private int[,] parcelIDList = new int[64, 64]; | 74 | private int[,] parcelIDList = new int[64, 64]; |
72 | 75 | ||
73 | private static World m_world; | 76 | private static World m_world; |
@@ -78,8 +81,7 @@ namespace OpenSim.RegionServer.world | |||
78 | { | 81 | { |
79 | 82 | ||
80 | m_world = world; | 83 | m_world = world; |
81 | Console.WriteLine("Created ParcelManager Object"); | 84 | parcelIDList.Initialize(); |
82 | |||
83 | 85 | ||
84 | } | 86 | } |
85 | #endregion | 87 | #endregion |
@@ -90,15 +92,15 @@ namespace OpenSim.RegionServer.world | |||
90 | public void ParcelFromStorage(ParcelData data) | 92 | public void ParcelFromStorage(ParcelData data) |
91 | { | 93 | { |
92 | Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world); | 94 | Parcel new_parcel = new Parcel(data.ownerID, data.isGroupOwned, m_world); |
93 | new_parcel.parcelData = data; | 95 | new_parcel.parcelData = data.Copy(); |
94 | new_parcel.setParcelBitmapFromByteArray(); | 96 | new_parcel.setParcelBitmapFromByteArray(); |
97 | addParcel(new_parcel); | ||
95 | 98 | ||
96 | this.addParcel(new_parcel); | ||
97 | } | 99 | } |
98 | 100 | ||
99 | public void NoParcelDataFromStorage() | 101 | public void NoParcelDataFromStorage() |
100 | { | 102 | { |
101 | this.resetSimParcels(); | 103 | resetSimParcels(); |
102 | } | 104 | } |
103 | #endregion | 105 | #endregion |
104 | 106 | ||
@@ -120,7 +122,7 @@ namespace OpenSim.RegionServer.world | |||
120 | { | 122 | { |
121 | lastParcelLocalID++; | 123 | lastParcelLocalID++; |
122 | new_parcel.parcelData.localID = lastParcelLocalID; | 124 | new_parcel.parcelData.localID = lastParcelLocalID; |
123 | parcelList.Add(lastParcelLocalID, new_parcel); | 125 | parcelList.Add(lastParcelLocalID, new_parcel.Copy()); |
124 | 126 | ||
125 | 127 | ||
126 | bool[,] parcelBitmap = new_parcel.getParcelBitmap(); | 128 | bool[,] parcelBitmap = new_parcel.getParcelBitmap(); |
@@ -135,6 +137,9 @@ namespace OpenSim.RegionServer.world | |||
135 | } | 137 | } |
136 | } | 138 | } |
137 | } | 139 | } |
140 | parcelList[lastParcelLocalID].forceUpdateParcelInfo(); | ||
141 | |||
142 | |||
138 | } | 143 | } |
139 | /// <summary> | 144 | /// <summary> |
140 | /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList | 145 | /// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList |
@@ -198,9 +203,9 @@ namespace OpenSim.RegionServer.world | |||
198 | int totalX = end_x - start_x; | 203 | int totalX = end_x - start_x; |
199 | int totalY = end_y - start_y; | 204 | int totalY = end_y - start_y; |
200 | int x, y; | 205 | int x, y; |
201 | for (x = 0; x < totalX; x++) | 206 | for (y = 0; y < totalY; y++) |
202 | { | 207 | { |
203 | for (y = 0; y < totalY; y++) | 208 | for (x = 0; x < totalX; x++) |
204 | { | 209 | { |
205 | Parcel tempParcel = getParcel(start_x + x, start_y + y); | 210 | Parcel tempParcel = getParcel(start_x + x, start_y + y); |
206 | if (tempParcel == null) return false; //No such parcel at that point | 211 | if (tempParcel == null) return false; //No such parcel at that point |
@@ -221,16 +226,24 @@ namespace OpenSim.RegionServer.world | |||
221 | } | 226 | } |
222 | 227 | ||
223 | //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info) | 228 | //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info) |
224 | Parcel newParcel = startParcel; | 229 | Parcel newParcel = startParcel.Copy(); |
230 | newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName; | ||
231 | |||
225 | newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y)); | 232 | newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y)); |
226 | 233 | ||
227 | //Now, lets set the subdivision area of the original to false | 234 | //Now, lets set the subdivision area of the original to false |
228 | int startParcelIndex = startParcel.parcelData.localID; | 235 | int startParcelIndex = startParcel.parcelData.localID; |
229 | parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(parcelList[startParcelIndex].getParcelBitmap(), start_x, start_y, end_x, end_y, false)); | 236 | parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false)); |
237 | parcelList[startParcelIndex].forceUpdateParcelInfo(); | ||
238 | |||
230 | 239 | ||
231 | //Now add the new parcel | 240 | //Now add the new parcel |
232 | addParcel(newParcel); | 241 | addParcel(newParcel); |
233 | 242 | ||
243 | |||
244 | |||
245 | |||
246 | |||
234 | return true; | 247 | return true; |
235 | } | 248 | } |
236 | /// <summary> | 249 | /// <summary> |
@@ -247,6 +260,7 @@ namespace OpenSim.RegionServer.world | |||
247 | //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! | 260 | //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! |
248 | //This should be fixed later -- somewhat "incomplete code" --Ming | 261 | //This should be fixed later -- somewhat "incomplete code" --Ming |
249 | Parcel startParcel, endParcel; | 262 | Parcel startParcel, endParcel; |
263 | |||
250 | try | 264 | try |
251 | { | 265 | { |
252 | startParcel = getParcel(start_x, start_y); | 266 | startParcel = getParcel(start_x, start_y); |
@@ -295,9 +309,9 @@ namespace OpenSim.RegionServer.world | |||
295 | int sequenceID = 0; | 309 | int sequenceID = 0; |
296 | ParcelOverlayPacket packet; | 310 | ParcelOverlayPacket packet; |
297 | 311 | ||
298 | for (x = 0; x < 64; x++) | 312 | for (y = 0; y < 64; y++) |
299 | { | 313 | { |
300 | for (y = 0; y < 64; y++) | 314 | for (x = 0; x < 64; x++) |
301 | { | 315 | { |
302 | byte tempByte = (byte)0; //This represents the byte for the current 4x4 | 316 | byte tempByte = (byte)0; //This represents the byte for the current 4x4 |
303 | Parcel currentParcelBlock = getParcel(x * 4, y * 4); | 317 | Parcel currentParcelBlock = getParcel(x * 4, y * 4); |
@@ -329,7 +343,7 @@ namespace OpenSim.RegionServer.world | |||
329 | { | 343 | { |
330 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); | 344 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); |
331 | } | 345 | } |
332 | else if (getParcel(x - 1, y) != currentParcelBlock) | 346 | else if (getParcel((x - 1) * 4, y * 4) != currentParcelBlock) |
333 | { | 347 | { |
334 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); | 348 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_WEST); |
335 | } | 349 | } |
@@ -338,7 +352,7 @@ namespace OpenSim.RegionServer.world | |||
338 | { | 352 | { |
339 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); | 353 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); |
340 | } | 354 | } |
341 | else if (getParcel(x, y - 1) != currentParcelBlock) | 355 | else if (getParcel(x * 4, (y - 1) * 4) != currentParcelBlock) |
342 | { | 356 | { |
343 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); | 357 | tempByte = Convert.ToByte(tempByte | PARCEL_FLAG_PROPERTY_BORDER_SOUTH); |
344 | } | 358 | } |
@@ -373,8 +387,10 @@ namespace OpenSim.RegionServer.world | |||
373 | //Remove all the parcels in the sim and add a blank, full sim parcel set to public | 387 | //Remove all the parcels in the sim and add a blank, full sim parcel set to public |
374 | parcelList.Clear(); | 388 | parcelList.Clear(); |
375 | parcelIDList.Initialize(); | 389 | parcelIDList.Initialize(); |
390 | |||
376 | Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world); | 391 | Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world); |
377 | fullSimParcel.setParcelBitmap(Parcel.basicFullRegionParcelBitmap()); | 392 | |
393 | fullSimParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(0, 0, 256, 256)); | ||
378 | fullSimParcel.parcelData.parcelName = "Your Sim Parcel"; | 394 | fullSimParcel.parcelData.parcelName = "Your Sim Parcel"; |
379 | fullSimParcel.parcelData.parcelDesc = ""; | 395 | fullSimParcel.parcelData.parcelDesc = ""; |
380 | 396 | ||
@@ -382,8 +398,8 @@ namespace OpenSim.RegionServer.world | |||
382 | fullSimParcel.parcelData.salePrice = 1; | 398 | fullSimParcel.parcelData.salePrice = 1; |
383 | fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale; | 399 | fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale; |
384 | fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased; | 400 | fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased; |
385 | addParcel(fullSimParcel); | ||
386 | 401 | ||
402 | addParcel(fullSimParcel); | ||
387 | 403 | ||
388 | } | 404 | } |
389 | #endregion | 405 | #endregion |
@@ -430,13 +446,25 @@ namespace OpenSim.RegionServer.world | |||
430 | { | 446 | { |
431 | if (x >= 0 && y >= 0 && x <= 256 && x <= 256) | 447 | if (x >= 0 && y >= 0 && x <= 256 && x <= 256) |
432 | { | 448 | { |
433 | return (this.parcelBitmap[x / 4, y / 4] == true); | 449 | return (parcelBitmap[x / 4, y / 4] == true); |
434 | } | 450 | } |
435 | else | 451 | else |
436 | { | 452 | { |
437 | return false; | 453 | return false; |
438 | } | 454 | } |
439 | } | 455 | } |
456 | |||
457 | public Parcel Copy() | ||
458 | { | ||
459 | Parcel newParcel = new Parcel(this.parcelData.ownerID, this.parcelData.isGroupOwned, m_world); | ||
460 | |||
461 | //Place all new variables here! | ||
462 | newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone()); | ||
463 | newParcel.parcelData = parcelData.Copy(); | ||
464 | |||
465 | return newParcel; | ||
466 | } | ||
467 | |||
440 | #endregion | 468 | #endregion |
441 | 469 | ||
442 | 470 | ||
@@ -453,33 +481,33 @@ namespace OpenSim.RegionServer.world | |||
453 | ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); | 481 | ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); |
454 | updatePacket.ParcelData.AABBMax = parcelData.AABBMax; | 482 | updatePacket.ParcelData.AABBMax = parcelData.AABBMax; |
455 | updatePacket.ParcelData.AABBMin = parcelData.AABBMin; | 483 | updatePacket.ParcelData.AABBMin = parcelData.AABBMin; |
456 | updatePacket.ParcelData.Area = this.parcelData.area; | 484 | updatePacket.ParcelData.Area = parcelData.area; |
457 | updatePacket.ParcelData.AuctionID = this.parcelData.auctionID; | 485 | updatePacket.ParcelData.AuctionID = parcelData.auctionID; |
458 | updatePacket.ParcelData.AuthBuyerID = this.parcelData.authBuyerID; //unemplemented | 486 | updatePacket.ParcelData.AuthBuyerID =parcelData.authBuyerID; //unemplemented |
459 | 487 | ||
460 | updatePacket.ParcelData.Bitmap = this.convertParcelBitmapToBytes(); | 488 | updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray; |
461 | 489 | ||
462 | updatePacket.ParcelData.Desc = libsecondlife.Helpers.StringToField(this.parcelData.parcelDesc); | 490 | updatePacket.ParcelData.Desc = libsecondlife.Helpers.StringToField(parcelData.parcelDesc); |
463 | updatePacket.ParcelData.Category = (byte)this.parcelData.category; | 491 | updatePacket.ParcelData.Category = (byte)parcelData.category; |
464 | updatePacket.ParcelData.ClaimDate = this.parcelData.claimDate; | 492 | updatePacket.ParcelData.ClaimDate = parcelData.claimDate; |
465 | updatePacket.ParcelData.ClaimPrice = this.parcelData.claimPrice; | 493 | updatePacket.ParcelData.ClaimPrice = parcelData.claimPrice; |
466 | updatePacket.ParcelData.GroupID = this.parcelData.groupID; | 494 | updatePacket.ParcelData.GroupID = parcelData.groupID; |
467 | updatePacket.ParcelData.GroupPrims = this.parcelData.groupPrims; | 495 | updatePacket.ParcelData.GroupPrims = parcelData.groupPrims; |
468 | updatePacket.ParcelData.IsGroupOwned = this.parcelData.isGroupOwned; | 496 | updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; |
469 | updatePacket.ParcelData.LandingType = (byte)0; //unemplemented | 497 | updatePacket.ParcelData.LandingType = (byte)0; //unemplemented |
470 | updatePacket.ParcelData.LocalID = (byte)this.parcelData.localID; | 498 | updatePacket.ParcelData.LocalID = (byte)parcelData.localID; |
471 | updatePacket.ParcelData.MaxPrims = 1000; //unemplemented | 499 | updatePacket.ParcelData.MaxPrims = 1000; //unemplemented |
472 | updatePacket.ParcelData.MediaAutoScale = (byte)0; //unemplemented | 500 | updatePacket.ParcelData.MediaAutoScale = (byte)0; //unemplemented |
473 | updatePacket.ParcelData.MediaID = LLUUID.Zero; //unemplemented | 501 | updatePacket.ParcelData.MediaID = LLUUID.Zero; //unemplemented |
474 | updatePacket.ParcelData.MediaURL = Helpers.StringToField(""); //unemplemented | 502 | updatePacket.ParcelData.MediaURL = Helpers.StringToField(""); //unemplemented |
475 | updatePacket.ParcelData.MusicURL = Helpers.StringToField(""); //unemplemented | 503 | updatePacket.ParcelData.MusicURL = Helpers.StringToField(""); //unemplemented |
476 | updatePacket.ParcelData.Name = Helpers.StringToField(this.parcelData.parcelName); | 504 | updatePacket.ParcelData.Name = Helpers.StringToField(parcelData.parcelName); |
477 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented | 505 | updatePacket.ParcelData.OtherCleanTime = 0; //unemplemented |
478 | updatePacket.ParcelData.OtherCount = 0; //unemplemented | 506 | updatePacket.ParcelData.OtherCount = 0; //unemplemented |
479 | updatePacket.ParcelData.OtherPrims = 0; //unemplented | 507 | updatePacket.ParcelData.OtherPrims = 0; //unemplented |
480 | updatePacket.ParcelData.OwnerID = this.parcelData.ownerID; | 508 | updatePacket.ParcelData.OwnerID = parcelData.ownerID; |
481 | updatePacket.ParcelData.OwnerPrims = 0; //unemplemented | 509 | updatePacket.ParcelData.OwnerPrims = 0; //unemplemented |
482 | updatePacket.ParcelData.ParcelFlags = (uint)this.parcelData.parcelFlags; //unemplemented | 510 | updatePacket.ParcelData.ParcelFlags = (uint)parcelData.parcelFlags; //unemplemented |
483 | updatePacket.ParcelData.ParcelPrimBonus = (float)1.0; //unemplemented | 511 | updatePacket.ParcelData.ParcelPrimBonus = (float)1.0; //unemplemented |
484 | updatePacket.ParcelData.PassHours = (float)0.0; //unemplemented | 512 | updatePacket.ParcelData.PassHours = (float)0.0; //unemplemented |
485 | updatePacket.ParcelData.PassPrice = 0; //unemeplemented | 513 | updatePacket.ParcelData.PassPrice = 0; //unemeplemented |
@@ -490,7 +518,7 @@ namespace OpenSim.RegionServer.world | |||
490 | updatePacket.ParcelData.RegionPushOverride = true; //unemplemented | 518 | updatePacket.ParcelData.RegionPushOverride = true; //unemplemented |
491 | updatePacket.ParcelData.RentPrice = 0; //?? | 519 | updatePacket.ParcelData.RentPrice = 0; //?? |
492 | updatePacket.ParcelData.RequestResult = 0;//?? | 520 | updatePacket.ParcelData.RequestResult = 0;//?? |
493 | updatePacket.ParcelData.SalePrice = this.parcelData.salePrice; //unemplemented | 521 | updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented |
494 | updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented | 522 | updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented |
495 | updatePacket.ParcelData.SelfCount = 0;//unemplemented | 523 | updatePacket.ParcelData.SelfCount = 0;//unemplemented |
496 | updatePacket.ParcelData.SequenceID = sequence_id; | 524 | updatePacket.ParcelData.SequenceID = sequence_id; |
@@ -498,7 +526,7 @@ namespace OpenSim.RegionServer.world | |||
498 | updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented | 526 | updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented |
499 | updatePacket.ParcelData.SnapSelection = snap_selection; //Bleh - not important yet | 527 | updatePacket.ParcelData.SnapSelection = snap_selection; //Bleh - not important yet |
500 | updatePacket.ParcelData.SnapshotID = LLUUID.Zero; //Unemplemented | 528 | updatePacket.ParcelData.SnapshotID = LLUUID.Zero; //Unemplemented |
501 | updatePacket.ParcelData.Status = (byte)this.parcelData.parcelStatus; //?? | 529 | updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus; //?? |
502 | updatePacket.ParcelData.TotalPrims = 0; //unemplemented | 530 | updatePacket.ParcelData.TotalPrims = 0; //unemplemented |
503 | updatePacket.ParcelData.UserLocation = LLVector3.Zero; //unemplemented | 531 | updatePacket.ParcelData.UserLocation = LLVector3.Zero; //unemplemented |
504 | updatePacket.ParcelData.UserLookAt = LLVector3.Zero; //unemeplemented | 532 | updatePacket.ParcelData.UserLookAt = LLVector3.Zero; //unemeplemented |
@@ -534,15 +562,25 @@ namespace OpenSim.RegionServer.world | |||
534 | } | 562 | } |
535 | } | 563 | } |
536 | } | 564 | } |
537 | this.parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), m_world.Terrain[(min_x * 4), (min_y * 4)]); | 565 | parcelData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), m_world.Terrain[(min_x * 4), (min_y * 4)]); |
538 | this.parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), m_world.Terrain[(max_x * 4), (max_y * 4)]); | 566 | parcelData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), m_world.Terrain[(max_x * 4), (max_y * 4)]); |
539 | this.parcelData.area = tempArea; | 567 | parcelData.area = tempArea; |
540 | } | 568 | } |
541 | 569 | ||
542 | public void updateParcelBitmapByteArray() | 570 | public void updateParcelBitmapByteArray() |
543 | { | 571 | { |
544 | parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes(); | 572 | parcelData.parcelBitmapByteArray = convertParcelBitmapToBytes(); |
545 | } | 573 | } |
574 | |||
575 | /// <summary> | ||
576 | /// Update all settings in parcel such as area, bitmap byte array, etc | ||
577 | /// </summary> | ||
578 | public void forceUpdateParcelInfo() | ||
579 | { | ||
580 | this.updateAABBAndAreaValues(); | ||
581 | this.updateParcelBitmapByteArray(); | ||
582 | } | ||
583 | |||
546 | public void setParcelBitmapFromByteArray() | 584 | public void setParcelBitmapFromByteArray() |
547 | { | 585 | { |
548 | parcelBitmap = convertBytesToParcelBitmap(); | 586 | parcelBitmap = convertBytesToParcelBitmap(); |
@@ -565,9 +603,9 @@ namespace OpenSim.RegionServer.world | |||
565 | else | 603 | else |
566 | { | 604 | { |
567 | //Valid: Lets set it | 605 | //Valid: Lets set it |
568 | this.parcelBitmap = bitmap; | 606 | parcelBitmap = bitmap; |
569 | updateAABBAndAreaValues(); | 607 | forceUpdateParcelInfo(); |
570 | updateParcelBitmapByteArray(); | 608 | |
571 | } | 609 | } |
572 | } | 610 | } |
573 | /// <summary> | 611 | /// <summary> |
@@ -608,9 +646,17 @@ namespace OpenSim.RegionServer.world | |||
608 | private bool[,] convertBytesToParcelBitmap() | 646 | private bool[,] convertBytesToParcelBitmap() |
609 | { | 647 | { |
610 | bool[,] tempConvertMap = new bool[64, 64]; | 648 | bool[,] tempConvertMap = new bool[64, 64]; |
611 | 649 | //00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | |
650 | //00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | ||
651 | //00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | ||
652 | //00000000 00000000 00000000 00000001 10000000 00000000 00000000 00000000 | ||
653 | //00000000 00000000 00000000 00000001 10000000 00000000 00000000 00000000 | ||
654 | //00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | ||
655 | //00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | ||
656 | //00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | ||
657 | // | ||
612 | byte tempByte = 0; | 658 | byte tempByte = 0; |
613 | int x = 0, y = 0, i = 0, bitNum = 0; | 659 | int x = 63, y = 63, i = 0, bitNum = 0; |
614 | for(i = 0; i < 512; i++) | 660 | for(i = 0; i < 512; i++) |
615 | { | 661 | { |
616 | tempByte = parcelData.parcelBitmapByteArray[i]; | 662 | tempByte = parcelData.parcelBitmapByteArray[i]; |
@@ -618,7 +664,12 @@ namespace OpenSim.RegionServer.world | |||
618 | { | 664 | { |
619 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); | 665 | bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); |
620 | tempConvertMap[x, y] = bit; | 666 | tempConvertMap[x, y] = bit; |
621 | if (x >= 64) y++; | 667 | x--; |
668 | if (x < 0) | ||
669 | { | ||
670 | y--; | ||
671 | x = 63; | ||
672 | } | ||
622 | } | 673 | } |
623 | } | 674 | } |
624 | return tempConvertMap; | 675 | return tempConvertMap; |
@@ -646,7 +697,7 @@ namespace OpenSim.RegionServer.world | |||
646 | bool[,] tempBitmap = new bool[64, 64]; | 697 | bool[,] tempBitmap = new bool[64, 64]; |
647 | tempBitmap.Initialize(); | 698 | tempBitmap.Initialize(); |
648 | 699 | ||
649 | tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_x, true); | 700 | tempBitmap = modifyParcelBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); |
650 | return tempBitmap; | 701 | return tempBitmap; |
651 | } | 702 | } |
652 | 703 | ||
@@ -669,14 +720,14 @@ namespace OpenSim.RegionServer.world | |||
669 | } | 720 | } |
670 | 721 | ||
671 | int x, y; | 722 | int x, y; |
672 | for (x = 0; x < 64; x++) | 723 | for (y = 0; y < 64; y++) |
673 | { | 724 | { |
674 | for (y = 0; y < 64; y++) | 725 | for (x = 0; x < 64; x++) |
675 | { | 726 | { |
676 | if (x >= start_x / 4 && x <= end_x / 4 | 727 | if (x >= start_x / 4 && x < end_x / 4 |
677 | && y >= start_y / 4 && y <= end_y / 4) | 728 | && y >= start_y / 4 && y < end_y / 4) |
678 | { | 729 | { |
679 | parcel_bitmap[x, y] = true; | 730 | parcel_bitmap[x, y] = set_value; |
680 | } | 731 | } |
681 | } | 732 | } |
682 | } | 733 | } |
@@ -699,12 +750,13 @@ namespace OpenSim.RegionServer.world | |||
699 | { | 750 | { |
700 | //Throw an exception - The bitmap is not 64x64 | 751 | //Throw an exception - The bitmap is not 64x64 |
701 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps"); | 752 | throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps"); |
753 | |||
702 | } | 754 | } |
703 | 755 | ||
704 | int x, y; | 756 | int x, y; |
705 | for (x = 0; x < 64; x++) | 757 | for (y = 0; y < 64; y++) |
706 | { | 758 | { |
707 | for (y = 0; y < 64; y++) | 759 | for (x = 0; x < 64; x++) |
708 | { | 760 | { |
709 | if (bitmap_add[x, y]) | 761 | if (bitmap_add[x, y]) |
710 | { | 762 | { |
diff --git a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs index 805251f..74a64a0 100644 --- a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs +++ b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs | |||
@@ -336,6 +336,7 @@ namespace OpenSim.world | |||
336 | if(!temp.Contains(currentParcel)) | 336 | if(!temp.Contains(currentParcel)) |
337 | { | 337 | { |
338 | temp.Add(currentParcel); | 338 | temp.Add(currentParcel); |
339 | currentParcel.forceUpdateParcelInfo(); | ||
339 | currentParcel.sendParcelProperties(sequence_id,snap_selection,remote_client); | 340 | currentParcel.sendParcelProperties(sequence_id,snap_selection,remote_client); |
340 | } | 341 | } |
341 | } | 342 | } |
@@ -343,6 +344,11 @@ namespace OpenSim.world | |||
343 | 344 | ||
344 | parcelManager.sendParcelOverlay(remote_client); | 345 | parcelManager.sendParcelOverlay(remote_client); |
345 | } | 346 | } |
347 | |||
348 | void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client) | ||
349 | { | ||
350 | parcelManager.subdivide(west, south, east, north, remote_client.AgentID); | ||
351 | } | ||
346 | #endregion | 352 | #endregion |
347 | 353 | ||
348 | /* | 354 | /* |
diff --git a/OpenSim/OpenSim.RegionServer/world/World.cs b/OpenSim/OpenSim.RegionServer/world/World.cs index 559ed6f..0eea039 100644 --- a/OpenSim/OpenSim.RegionServer/world/World.cs +++ b/OpenSim/OpenSim.RegionServer/world/World.cs | |||
@@ -283,9 +283,9 @@ namespace OpenSim.world | |||
283 | //Parcel backup routines. Yay! | 283 | //Parcel backup routines. Yay! |
284 | ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; | 284 | ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count]; |
285 | int i; | 285 | int i; |
286 | for(i = 0; i < parcelManager.parcelList.Count; i++) | 286 | for (i = 0; i < parcelManager.parcelList.Count; i++) |
287 | { | 287 | { |
288 | parcels[i] = parcelManager.parcelList[i].parcelData; | 288 | parcels[i] = parcelManager.parcelList[OpenSim.RegionServer.world.ParcelManager.START_PARCEL_LOCAL_ID + i].parcelData; |
289 | } | 289 | } |
290 | localStorage.SaveParcels(parcels); | 290 | localStorage.SaveParcels(parcels); |
291 | 291 | ||
@@ -615,6 +615,7 @@ namespace OpenSim.world | |||
615 | agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); | 615 | agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); |
616 | 616 | ||
617 | agentClient.OnParcelPropertiesRequest += new OpenSim.RegionServer.world.ParcelPropertiesRequest(ParcelPropertiesRequest); | 617 | agentClient.OnParcelPropertiesRequest += new OpenSim.RegionServer.world.ParcelPropertiesRequest(ParcelPropertiesRequest); |
618 | agentClient.OnParcelDivideRequest += new OpenSim.RegionServer.world.ParcelDivideRequest(ParcelDivideRequest); | ||
618 | Avatar newAvatar = null; | 619 | Avatar newAvatar = null; |
619 | try | 620 | try |
620 | { | 621 | { |
@@ -662,6 +663,8 @@ namespace OpenSim.world | |||
662 | return newAvatar; | 663 | return newAvatar; |
663 | } | 664 | } |
664 | 665 | ||
666 | |||
667 | |||
665 | 668 | ||
666 | 669 | ||
667 | public override void RemoveViewerAgent(ClientView agentClient) | 670 | public override void RemoveViewerAgent(ClientView agentClient) |