aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.RegionServer/world
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.RegionServer/world')
-rw-r--r--OpenSim/OpenSim.RegionServer/world/ParcelManager.cs66
-rw-r--r--OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs22
-rw-r--r--OpenSim/OpenSim.RegionServer/world/World.cs8
3 files changed, 70 insertions, 26 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 }
diff --git a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs
index 74a64a0..8513e30 100644
--- a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs
+++ b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs
@@ -325,7 +325,7 @@ namespace OpenSim.world
325 { 325 {
326 //Get the parcels within the bounds 326 //Get the parcels within the bounds
327 List<OpenSim.RegionServer.world.Parcel> temp = new List<OpenSim.RegionServer.world.Parcel>(); 327 List<OpenSim.RegionServer.world.Parcel> temp = new List<OpenSim.RegionServer.world.Parcel>();
328 int x, y; 328 int x, y, i;
329 int inc_x = end_x - start_x; 329 int inc_x = end_x - start_x;
330 int inc_y = end_y - start_y; 330 int inc_y = end_y - start_y;
331 for(x = 0; x < inc_x; x++) 331 for(x = 0; x < inc_x; x++)
@@ -335,13 +335,25 @@ namespace OpenSim.world
335 OpenSim.RegionServer.world.Parcel currentParcel = parcelManager.getParcel(start_x + x, start_y + y); 335 OpenSim.RegionServer.world.Parcel currentParcel = parcelManager.getParcel(start_x + x, start_y + y);
336 if(!temp.Contains(currentParcel)) 336 if(!temp.Contains(currentParcel))
337 { 337 {
338 currentParcel.
339 forceUpdateParcelInfo();
338 temp.Add(currentParcel); 340 temp.Add(currentParcel);
339 currentParcel.forceUpdateParcelInfo();
340 currentParcel.sendParcelProperties(sequence_id,snap_selection,remote_client);
341 } 341 }
342 } 342 }
343 } 343 }
344 344
345 int requestResult = OpenSim.RegionServer.world.ParcelManager.PARCEL_RESULT_ONE_PARCEL;
346 if (temp.Count > 1)
347 {
348 requestResult = OpenSim.RegionServer.world.ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS;
349 }
350
351 for (i = 0; i < temp.Count; i++)
352 {
353 temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client);
354 }
355
356
345 parcelManager.sendParcelOverlay(remote_client); 357 parcelManager.sendParcelOverlay(remote_client);
346 } 358 }
347 359
@@ -349,6 +361,10 @@ namespace OpenSim.world
349 { 361 {
350 parcelManager.subdivide(west, south, east, north, remote_client.AgentID); 362 parcelManager.subdivide(west, south, east, north, remote_client.AgentID);
351 } 363 }
364 void ParcelJoinRequest(int west, int south, int east, int north, ClientView remote_client)
365 {
366 parcelManager.join(west, south, east, north, remote_client.AgentID);
367 }
352 #endregion 368 #endregion
353 369
354 /* 370 /*
diff --git a/OpenSim/OpenSim.RegionServer/world/World.cs b/OpenSim/OpenSim.RegionServer/world/World.cs
index 0eea039..8b26ecd 100644
--- a/OpenSim/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim/OpenSim.RegionServer/world/World.cs
@@ -282,10 +282,11 @@ namespace OpenSim.world
282 282
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 = 0;
286 for (i = 0; i < parcelManager.parcelList.Count; i++) 286 foreach(OpenSim.RegionServer.world.Parcel parcel in parcelManager.parcelList.Values)
287 { 287 {
288 parcels[i] = parcelManager.parcelList[OpenSim.RegionServer.world.ParcelManager.START_PARCEL_LOCAL_ID + i].parcelData; 288 parcels[i] = parcel.parcelData;
289 i++;
289 } 290 }
290 localStorage.SaveParcels(parcels); 291 localStorage.SaveParcels(parcels);
291 292
@@ -616,6 +617,7 @@ namespace OpenSim.world
616 617
617 agentClient.OnParcelPropertiesRequest += new OpenSim.RegionServer.world.ParcelPropertiesRequest(ParcelPropertiesRequest); 618 agentClient.OnParcelPropertiesRequest += new OpenSim.RegionServer.world.ParcelPropertiesRequest(ParcelPropertiesRequest);
618 agentClient.OnParcelDivideRequest += new OpenSim.RegionServer.world.ParcelDivideRequest(ParcelDivideRequest); 619 agentClient.OnParcelDivideRequest += new OpenSim.RegionServer.world.ParcelDivideRequest(ParcelDivideRequest);
620 agentClient.OnParcelJoinRequest+=new OpenSim.RegionServer.world.ParcelJoinRequest(ParcelJoinRequest);
619 Avatar newAvatar = null; 621 Avatar newAvatar = null;
620 try 622 try
621 { 623 {