aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/world/ParcelManager.cs')
-rw-r--r--OpenSim/OpenSim.RegionServer/world/ParcelManager.cs66
1 files changed, 46 insertions, 20 deletions
diff --git a/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs b/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs
index 68e22db..c751b0b 100644
--- a/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs
+++ b/OpenSim/OpenSim.RegionServer/world/ParcelManager.cs
@@ -38,6 +38,7 @@ 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 public delegate void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client); 40 public delegate void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client);
41 public delegate void ParcelJoinRequest(int west, int south, int east, int north, ClientView remote_client);
41 42
42 #region ParcelManager Class 43 #region ParcelManager Class
43 /// <summary> 44 /// <summary>
@@ -63,6 +64,9 @@ namespace OpenSim.RegionServer.world
63 public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000 64 public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000
64 public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000 65 public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000
65 66
67 //RequestResults (I think these are right, they seem to work):
68 public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel
69 public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel
66 70
67 //These are other constants. Yay! 71 //These are other constants. Yay!
68 public const int START_PARCEL_LOCAL_ID = 1; 72 public const int START_PARCEL_LOCAL_ID = 1;
@@ -158,8 +162,26 @@ namespace OpenSim.RegionServer.world
158 } 162 }
159 } 163 }
160 } 164 }
165 m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData);
161 parcelList.Remove(local_id); 166 parcelList.Remove(local_id);
162 } 167 }
168
169 public void performFinalParcelJoin(Parcel master, Parcel slave)
170 {
171 int x, y;
172 bool[,] parcelBitmapSlave = slave.getParcelBitmap();
173 for (x = 0; x < 64; x++)
174 {
175 for (y = 0; y < 64; y++)
176 {
177 if (parcelBitmapSlave[x, y])
178 {
179 parcelIDList[x, y] = master.parcelData.localID;
180 }
181 }
182 }
183 removeParcel(slave.parcelData.localID);
184 }
163 /// <summary> 185 /// <summary>
164 /// Get the parcel at the specified point 186 /// Get the parcel at the specified point
165 /// </summary> 187 /// </summary>
@@ -228,6 +250,7 @@ namespace OpenSim.RegionServer.world
228 //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info) 250 //Lets create a new parcel with bitmap activated at that point (keeping the old parcels info)
229 Parcel newParcel = startParcel.Copy(); 251 Parcel newParcel = startParcel.Copy();
230 newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName; 252 newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName;
253 newParcel.parcelData.globalID = LLUUID.Random();
231 254
232 newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y)); 255 newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y));
233 256
@@ -257,6 +280,10 @@ namespace OpenSim.RegionServer.world
257 /// <returns>Returns true if successful</returns> 280 /// <returns>Returns true if successful</returns>
258 public bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id) 281 public bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
259 { 282 {
283 end_x -= 4;
284 end_y -= 4;
285 Console.WriteLine("Joining Parcels between (" + start_x + ", " + start_y + ") and (" + end_x + ", " + end_y + ")");
286
260 //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box! 287 //NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box!
261 //This should be fixed later -- somewhat "incomplete code" --Ming 288 //This should be fixed later -- somewhat "incomplete code" --Ming
262 Parcel startParcel, endParcel; 289 Parcel startParcel, endParcel;
@@ -270,6 +297,11 @@ namespace OpenSim.RegionServer.world
270 { 297 {
271 return false; //Error occured when trying to get the start and end parcels 298 return false; //Error occured when trying to get the start and end parcels
272 } 299 }
300 if (startParcel == endParcel)
301 {
302 return false; //Subdivision of the same parcel is not allowed
303 }
304
273 //Check the parcel owners: 305 //Check the parcel owners:
274 if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID) 306 if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID)
275 { 307 {
@@ -281,12 +313,11 @@ namespace OpenSim.RegionServer.world
281 return false; 313 return false;
282 } 314 }
283 315
316 Console.WriteLine("Performing Join on parcel: " + startParcel.parcelData.parcelName + " - " + startParcel.parcelData.area + "sqm and " + endParcel.parcelData.parcelName + " - " + endParcel.parcelData.area + "sqm");
284 //Same owners! Lets join them 317 //Same owners! Lets join them
285 //Merge them to startParcel 318 //Merge them to startParcel
286 parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap())); 319 parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap()));
287 320 performFinalParcelJoin(startParcel, endParcel);
288 //Remove the old parcel
289 parcelList.Remove(endParcel.parcelData.localID);
290 321
291 return true; 322 return true;
292 323
@@ -386,6 +417,7 @@ namespace OpenSim.RegionServer.world
386 { 417 {
387 //Remove all the parcels in the sim and add a blank, full sim parcel set to public 418 //Remove all the parcels in the sim and add a blank, full sim parcel set to public
388 parcelList.Clear(); 419 parcelList.Clear();
420 lastParcelLocalID = START_PARCEL_LOCAL_ID - 1;
389 parcelIDList.Initialize(); 421 parcelIDList.Initialize();
390 422
391 Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world); 423 Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world);
@@ -475,7 +507,7 @@ namespace OpenSim.RegionServer.world
475 /// <param name="sequence_id">ID sent by client for them to keep track of</param> 507 /// <param name="sequence_id">ID sent by client for them to keep track of</param>
476 /// <param name="snap_selection">Bool sent by client for them to use</param> 508 /// <param name="snap_selection">Bool sent by client for them to use</param>
477 /// <param name="remote_client">Object representing the client</param> 509 /// <param name="remote_client">Object representing the client</param>
478 public void sendParcelProperties(int sequence_id, bool snap_selection, ClientView remote_client) 510 public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, ClientView remote_client)
479 { 511 {
480 512
481 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); 513 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
@@ -495,7 +527,7 @@ namespace OpenSim.RegionServer.world
495 updatePacket.ParcelData.GroupPrims = parcelData.groupPrims; 527 updatePacket.ParcelData.GroupPrims = parcelData.groupPrims;
496 updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned; 528 updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned;
497 updatePacket.ParcelData.LandingType = (byte)0; //unemplemented 529 updatePacket.ParcelData.LandingType = (byte)0; //unemplemented
498 updatePacket.ParcelData.LocalID = (byte)parcelData.localID; 530 updatePacket.ParcelData.LocalID = parcelData.localID;
499 updatePacket.ParcelData.MaxPrims = 1000; //unemplemented 531 updatePacket.ParcelData.MaxPrims = 1000; //unemplemented
500 updatePacket.ParcelData.MediaAutoScale = (byte)0; //unemplemented 532 updatePacket.ParcelData.MediaAutoScale = (byte)0; //unemplemented
501 updatePacket.ParcelData.MediaID = LLUUID.Zero; //unemplemented 533 updatePacket.ParcelData.MediaID = LLUUID.Zero; //unemplemented
@@ -517,7 +549,7 @@ namespace OpenSim.RegionServer.world
517 updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented 549 updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented
518 updatePacket.ParcelData.RegionPushOverride = true; //unemplemented 550 updatePacket.ParcelData.RegionPushOverride = true; //unemplemented
519 updatePacket.ParcelData.RentPrice = 0; //?? 551 updatePacket.ParcelData.RentPrice = 0; //??
520 updatePacket.ParcelData.RequestResult = 0;//?? 552 updatePacket.ParcelData.RequestResult = request_result;
521 updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented 553 updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented
522 updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented 554 updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented
523 updatePacket.ParcelData.SelfCount = 0;//unemplemented 555 updatePacket.ParcelData.SelfCount = 0;//unemplemented
@@ -646,17 +678,9 @@ namespace OpenSim.RegionServer.world
646 private bool[,] convertBytesToParcelBitmap() 678 private bool[,] convertBytesToParcelBitmap()
647 { 679 {
648 bool[,] tempConvertMap = new bool[64, 64]; 680 bool[,] tempConvertMap = new bool[64, 64];
649 //00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 681 tempConvertMap.Initialize();
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 //
658 byte tempByte = 0; 682 byte tempByte = 0;
659 int x = 63, y = 63, i = 0, bitNum = 0; 683 int x = 0, y = 0, i = 0, bitNum = 0;
660 for(i = 0; i < 512; i++) 684 for(i = 0; i < 512; i++)
661 { 685 {
662 tempByte = parcelData.parcelBitmapByteArray[i]; 686 tempByte = parcelData.parcelBitmapByteArray[i];
@@ -664,13 +688,15 @@ namespace OpenSim.RegionServer.world
664 { 688 {
665 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1); 689 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1);
666 tempConvertMap[x, y] = bit; 690 tempConvertMap[x, y] = bit;
667 x--; 691 x++;
668 if (x < 0) 692 if(x > 63)
669 { 693 {
670 y--; 694 x = 0;
671 x = 63; 695 y++;
672 } 696 }
697
673 } 698 }
699
674 } 700 }
675 return tempConvertMap; 701 return tempConvertMap;
676 } 702 }