aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Common/OpenSim.Framework/Interfaces/ILocalStorage.cs3
-rw-r--r--Common/OpenSim.Framework/Types/ParcelData.cs7
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs5
-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
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs11
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs88
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj42
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDPrimQuery.cs (renamed from OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs)4
-rw-r--r--OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs12
-rw-r--r--OpenSim/OpenSim/OpenSimMain.cs21
12 files changed, 216 insertions, 73 deletions
diff --git a/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs b/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs
index 9fa3a00..dd17b72 100644
--- a/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs
+++ b/Common/OpenSim.Framework/Interfaces/ILocalStorage.cs
@@ -46,6 +46,9 @@ namespace OpenSim.Framework.Interfaces
46 void SaveMap(float[] heightmap); 46 void SaveMap(float[] heightmap);
47 47
48 void SaveParcels(ParcelData[] parcels); 48 void SaveParcels(ParcelData[] parcels);
49 void SaveParcel(ParcelData parcel);
50 void RemoveParcel(ParcelData parcel);
51 void RemoveAllParcels();
49 void LoadParcels(ILocalStorageParcelReceiver recv); 52 void LoadParcels(ILocalStorageParcelReceiver recv);
50 53
51 void ShutDown(); 54 void ShutDown();
diff --git a/Common/OpenSim.Framework/Types/ParcelData.cs b/Common/OpenSim.Framework/Types/ParcelData.cs
index 7b3a24c..b5c3946 100644
--- a/Common/OpenSim.Framework/Types/ParcelData.cs
+++ b/Common/OpenSim.Framework/Types/ParcelData.cs
@@ -28,6 +28,12 @@ namespace OpenSim.Framework.Types
28 public libsecondlife.Parcel.ParcelFlags parcelFlags = libsecondlife.Parcel.ParcelFlags.None; 28 public libsecondlife.Parcel.ParcelFlags parcelFlags = libsecondlife.Parcel.ParcelFlags.None;
29 29
30 public int localID = 0; 30 public int localID = 0;
31 public LLUUID globalID = new LLUUID();
32
33 public ParcelData()
34 {
35 globalID = LLUUID.Random();
36 }
31 37
32 public ParcelData Copy() 38 public ParcelData Copy()
33 { 39 {
@@ -41,6 +47,7 @@ namespace OpenSim.Framework.Types
41 parcelData.category = this.category; 47 parcelData.category = this.category;
42 parcelData.claimDate = this.claimDate; 48 parcelData.claimDate = this.claimDate;
43 parcelData.claimPrice = this.claimPrice; 49 parcelData.claimPrice = this.claimPrice;
50 parcelData.globalID = this.globalID;
44 parcelData.groupID = this.groupID; 51 parcelData.groupID = this.groupID;
45 parcelData.groupPrims = this.groupPrims; 52 parcelData.groupPrims = this.groupPrims;
46 parcelData.isGroupOwned = this.isGroupOwned; 53 parcelData.isGroupOwned = this.isGroupOwned;
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index 2a75205..e329f09 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -85,6 +85,7 @@ namespace OpenSim
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 public event ParcelDivideRequest OnParcelDivideRequest;
88 public event ParcelJoinRequest OnParcelJoinRequest;
88 89
89 protected override void ProcessInPacket(Packet Pack) 90 protected override void ProcessInPacket(Packet Pack)
90 { 91 {
@@ -477,6 +478,10 @@ namespace OpenSim
477 ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack; 478 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 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; 480 break;
481 case PacketType.ParcelJoin:
482 ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack;
483 OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this);
484 break;
480 #endregion 485 #endregion
481 486
482 #region unimplemented handlers 487 #region unimplemented handlers
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 {
diff --git a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
index 6228403..1818e3a 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageBerkeleyDB/BDBLocalStorage.cs
@@ -92,6 +92,17 @@ namespace OpenSim.Storage.LocalStorageBDB
92 { 92 {
93 } 93 }
94 94
95 public void SaveParcel(ParcelData parcel)
96 {
97 }
98
99 public void RemoveParcel(ParcelData parcel)
100 {
101 }
102
103 public void RemoveAllParcels()
104 {
105 }
95 106
96 public void LoadParcels(ILocalStorageParcelReceiver recv) 107 public void LoadParcels(ILocalStorageParcelReceiver recv)
97 { 108 {
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
index 2fb3c90..d7b9f38 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Storage.LocalStorageDb4o
71 71
72 public void StorePrim(PrimData prim) 72 public void StorePrim(PrimData prim)
73 { 73 {
74 IObjectSet result = db.Query(new UUIDQuery(prim.FullID)); 74 IObjectSet result = db.Query(new UUIDPrimQuery(prim.FullID));
75 if(result.Count>0) 75 if(result.Count>0)
76 { 76 {
77 //prim already in storage 77 //prim already in storage
@@ -112,7 +112,7 @@ namespace OpenSim.Storage.LocalStorageDb4o
112 112
113 public void RemovePrim(LLUUID primID) 113 public void RemovePrim(LLUUID primID)
114 { 114 {
115 IObjectSet result = db.Query(new UUIDQuery(primID)); 115 IObjectSet result = db.Query(new UUIDPrimQuery(primID));
116 if(result.Count>0) 116 if(result.Count>0)
117 { 117 {
118 PrimData found = (PrimData) result.Next(); 118 PrimData found = (PrimData) result.Next();
@@ -133,7 +133,6 @@ namespace OpenSim.Storage.LocalStorageDb4o
133 public float[] LoadWorld() 133 public float[] LoadWorld()
134 { 134 {
135 OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world...."); 135 OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world....");
136 //World blank = new World();
137 float[] heightmap = null; 136 float[] heightmap = null;
138 OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB"); 137 OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB");
139 IObjectSet world_result = db.Get(typeof(MapStorage)); 138 IObjectSet world_result = db.Get(typeof(MapStorage));
@@ -144,21 +143,6 @@ namespace OpenSim.Storage.LocalStorageDb4o
144 //blank.LandMap = map.Map; 143 //blank.LandMap = map.Map;
145 heightmap = map.Map; 144 heightmap = map.Map;
146 } 145 }
147 else
148 {
149 /*
150 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - No heightmap found, generating new one");
151 HeightmapGenHills hills = new HeightmapGenHills();
152 // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
153 // heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
154 heightmap = new float[256, 256];
155 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Saving heightmap to local database");
156 MapStorage map = new MapStorage();
157 map.Map = heightmap; //blank.LandMap;
158 db.Set(map);
159 db.Commit();
160 */
161 }
162 return heightmap; 146 return heightmap;
163 } 147 }
164 148
@@ -177,27 +161,77 @@ namespace OpenSim.Storage.LocalStorageDb4o
177 db.Commit(); 161 db.Commit();
178 } 162 }
179 163
180 public void SaveParcels(ParcelData[] parcel_data) 164 public void SaveParcel(ParcelData parcel)
181 { 165 {
182 MainConsole.Instance.Notice("Parcel Backup: Saving Parcels..."); 166 IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
183 IObjectSet result = db.Get(typeof(ParcelData)); 167 if (result.Count > 0)
184 foreach (ParcelData parcel in result) 168 {
169 //Old Parcel
170 ParcelData updateParcel = (ParcelData)result.Next();
171 updateParcel.AABBMax = parcel.AABBMax;
172 updateParcel.AABBMin = parcel.AABBMin;
173 updateParcel.area = parcel.area;
174 updateParcel.auctionID = parcel.auctionID;
175 updateParcel.authBuyerID = parcel.authBuyerID;
176 updateParcel.category = parcel.category;
177 updateParcel.claimDate = parcel.claimDate;
178 updateParcel.claimPrice = parcel.claimPrice;
179 updateParcel.groupID = parcel.groupID;
180 updateParcel.groupPrims = parcel.groupPrims;
181 updateParcel.isGroupOwned = parcel.isGroupOwned;
182 updateParcel.localID = parcel.localID;
183 updateParcel.ownerID = parcel.ownerID;
184 updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone();
185 updateParcel.parcelDesc = parcel.parcelDesc;
186 updateParcel.parcelFlags = parcel.parcelFlags;
187 updateParcel.parcelName = parcel.parcelName;
188 updateParcel.parcelStatus = parcel.parcelStatus;
189 updateParcel.salePrice = parcel.salePrice;
190
191 db.Set(updateParcel);
192 }
193 else
185 { 194 {
186 db.Delete(parcel); 195 db.Set(parcel);
187 } 196 }
188 MainConsole.Instance.Notice("Parcel Backup: Removing old entries complete. Adding new entries."); 197 db.Commit();
198 }
199
200 public void SaveParcels(ParcelData[] parcel_data)
201 {
202 MainConsole.Instance.Notice("Parcel Backup: Saving Parcels...");
189 int i; 203 int i;
190 for (i = 0; i < parcel_data.GetLength(0); i++) 204 for (i = 0; i < parcel_data.GetLength(0); i++)
191 { 205 {
192 206
193 MainConsole.Instance.Notice("Adding : " + i + " - SAMPLE: " + parcel_data[i].parcelBitmapByteArray[0]); 207 SaveParcel(parcel_data[i]);
194 db.Set(parcel_data[i]);
195 208
196 } 209 }
197 db.Commit();
198 MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete"); 210 MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete");
199 } 211 }
200 212
213 public void RemoveParcel(ParcelData parcel)
214 {
215 IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
216 if (result.Count > 0)
217 {
218 db.Delete(result[0]);
219 }
220 db.Commit();
221 }
222 public void RemoveAllParcels()
223 {
224 MainConsole.Instance.Notice("Parcel Backup: Removing all parcels...");
225 IObjectSet result = db.Get(typeof(ParcelData));
226 if (result.Count > 0)
227 {
228 foreach (ParcelData parcelData in result)
229 {
230 RemoveParcel(parcelData);
231 }
232 }
233 }
234
201 public void LoadParcels(ILocalStorageParcelReceiver recv) 235 public void LoadParcels(ILocalStorageParcelReceiver recv)
202 { 236 {
203 MainConsole.Instance.Notice("Parcel Backup: Loading Parcels..."); 237 MainConsole.Instance.Notice("Parcel Backup: Loading Parcels...");
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
index 9b4ff5d..231ba1d 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{E1B79ECF-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{E1B79ECF-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName> 13 <AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace> 21 <RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,22 +61,23 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 73 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 74 <Private>False</Private>
68 </Reference> 75 </Reference>
69 <Reference Include="Db4objects.Db4o.dll" > 76 <Reference Include="Db4objects.Db4o.dll">
70 <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> 77 <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
71 <Private>False</Private> 78 <Private>False</Private>
72 </Reference> 79 </Reference>
73 <Reference Include="libsecondlife.dll" > 80 <Reference Include="libsecondlife.dll">
74 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath> 81 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private> 82 <Private>False</Private>
76 </Reference> 83 </Reference>
@@ -80,26 +87,27 @@
80 <Name>OpenSim.Framework</Name> 87 <Name>OpenSim.Framework</Name>
81 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 88 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
82 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 89 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
83 <Private>False</Private> 90 <Private>False</Private>
84 </ProjectReference> 91 </ProjectReference>
85 <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 92 <ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
86 <Name>OpenSim.Framework.Console</Name> 93 <Name>OpenSim.Framework.Console</Name>
87 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 94 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
88 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 95 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
89 <Private>False</Private> 96 <Private>False</Private>
90 </ProjectReference> 97 </ProjectReference>
91 </ItemGroup> 98 </ItemGroup>
92 <ItemGroup> 99 <ItemGroup>
93 <Compile Include="AssemblyInfo.cs"> 100 <Compile Include="AssemblyInfo.cs">
94 <SubType>Code</SubType> 101 <SubType>Code</SubType>
95 </Compile> 102 </Compile>
96 <Compile Include="Db4LocalStorage.cs"> 103 <Compile Include="UUIDParcelQuery.cs" />
104 <Compile Include="UUIDPrimQuery.cs">
97 <SubType>Code</SubType> 105 <SubType>Code</SubType>
98 </Compile> 106 </Compile>
99 <Compile Include="MapStorage.cs"> 107 <Compile Include="MapStorage.cs">
100 <SubType>Code</SubType> 108 <SubType>Code</SubType>
101 </Compile> 109 </Compile>
102 <Compile Include="UUIDQuery.cs"> 110 <Compile Include="Db4LocalStorage.cs">
103 <SubType>Code</SubType> 111 <SubType>Code</SubType>
104 </Compile> 112 </Compile>
105 </ItemGroup> 113 </ItemGroup>
@@ -110,4 +118,4 @@
110 <PostBuildEvent> 118 <PostBuildEvent>
111 </PostBuildEvent> 119 </PostBuildEvent>
112 </PropertyGroup> 120 </PropertyGroup>
113</Project> 121</Project> \ No newline at end of file
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDPrimQuery.cs
index 4c0be60..b2e8a91 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/UUIDPrimQuery.cs
@@ -36,11 +36,11 @@ using OpenSim.Framework.Types;
36 36
37namespace OpenSim.Storage.LocalStorageDb4o 37namespace OpenSim.Storage.LocalStorageDb4o
38{ 38{
39 public class UUIDQuery : Predicate 39 public class UUIDPrimQuery : Predicate
40 { 40 {
41 private LLUUID _findID; 41 private LLUUID _findID;
42 42
43 public UUIDQuery(LLUUID find) 43 public UUIDPrimQuery(LLUUID find)
44 { 44 {
45 _findID = find; 45 _findID = find;
46 } 46 }
diff --git a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
index 2170898..8106727 100644
--- a/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
+++ b/OpenSim/OpenSim.Storage/LocalStorageSQLite/SQLiteLocalStorage.cs
@@ -173,6 +173,18 @@ namespace OpenSim.Storage.LocalStorageSQLite
173 173
174 } 174 }
175 175
176 public void SaveParcel(ParcelData parcel)
177 {
178 }
179
180 public void RemoveParcel(ParcelData parcel)
181 {
182 }
183
184 public void RemoveAllParcels()
185 {
186 }
187
176 public void LoadParcels(ILocalStorageParcelReceiver recv) 188 public void LoadParcels(ILocalStorageParcelReceiver recv)
177 { 189 {
178 recv.NoParcelDataFromStorage(); 190 recv.NoParcelDataFromStorage();
diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs
index bf0ae56..6db4572 100644
--- a/OpenSim/OpenSim/OpenSimMain.cs
+++ b/OpenSim/OpenSim/OpenSimMain.cs
@@ -205,7 +205,7 @@ namespace OpenSim
205 } 205 }
206 else 206 else
207 { 207 {
208 m_console.Notice("Main.cs:Startup() - Grid Mode; Do not know how to get the user's master key yet!"); 208 m_console.Warn("Main.cs:Startup() - Grid Mode; Do not know how to get the user's master key yet!");
209 } 209 }
210 210
211 m_console.Notice("Creating ParcelManager"); 211 m_console.Notice("Creating ParcelManager");
@@ -528,6 +528,15 @@ namespace OpenSim
528 case "backup": 528 case "backup":
529 LocalWorld.Backup(); 529 LocalWorld.Backup();
530 break; 530 break;
531
532 case "reset":
533 if (cmdparams[0] == "parcels")
534 {
535 LocalWorld.localStorage.RemoveAllParcels();
536 LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager);
537 }
538 break;
539
531 default: 540 default:
532 m_console.Error("Unknown command"); 541 m_console.Error("Unknown command");
533 break; 542 break;
@@ -558,6 +567,16 @@ namespace OpenSim
558 } 567 }
559 } 568 }
560 break; 569 break;
570 case "parcels":
571 foreach (OpenSim.RegionServer.world.Parcel parcel in LocalWorld.parcelManager.parcelList.Values)
572 {
573 m_console.Error("Parcel ID#" + parcel.parcelData.localID + "(Global UUID: " + parcel.parcelData.globalID + "):");
574 m_console.Error("\tParcel Name: " + parcel.parcelData.parcelName);
575 m_console.Error("\tParcel Owner UUID: " + parcel.parcelData.ownerID);
576 m_console.Error("\tParcel Area: " + parcel.parcelData.area + "sqm");
577 m_console.Error(" ");
578 }
579 break;
561 } 580 }
562 } 581 }
563 #endregion 582 #endregion