*Added new commands ('backup','show parcels','reset parcels')
*Added parcel join support *Made parcel saving and loading much more efficient *Fixed bug that would not allow joining of parcel locally in the viewer (gives an error before sending to server) *Known Issue: Restoring parcels from storage is not working correctly. For now, do a 'reset parcels' to regenerate a standard parcelzircon^2
parent
ea79819575
commit
73a36680bd
|
@ -46,6 +46,9 @@ namespace OpenSim.Framework.Interfaces
|
||||||
void SaveMap(float[] heightmap);
|
void SaveMap(float[] heightmap);
|
||||||
|
|
||||||
void SaveParcels(ParcelData[] parcels);
|
void SaveParcels(ParcelData[] parcels);
|
||||||
|
void SaveParcel(ParcelData parcel);
|
||||||
|
void RemoveParcel(ParcelData parcel);
|
||||||
|
void RemoveAllParcels();
|
||||||
void LoadParcels(ILocalStorageParcelReceiver recv);
|
void LoadParcels(ILocalStorageParcelReceiver recv);
|
||||||
|
|
||||||
void ShutDown();
|
void ShutDown();
|
||||||
|
|
|
@ -28,6 +28,12 @@ namespace OpenSim.Framework.Types
|
||||||
public libsecondlife.Parcel.ParcelFlags parcelFlags = libsecondlife.Parcel.ParcelFlags.None;
|
public libsecondlife.Parcel.ParcelFlags parcelFlags = libsecondlife.Parcel.ParcelFlags.None;
|
||||||
|
|
||||||
public int localID = 0;
|
public int localID = 0;
|
||||||
|
public LLUUID globalID = new LLUUID();
|
||||||
|
|
||||||
|
public ParcelData()
|
||||||
|
{
|
||||||
|
globalID = LLUUID.Random();
|
||||||
|
}
|
||||||
|
|
||||||
public ParcelData Copy()
|
public ParcelData Copy()
|
||||||
{
|
{
|
||||||
|
@ -41,6 +47,7 @@ namespace OpenSim.Framework.Types
|
||||||
parcelData.category = this.category;
|
parcelData.category = this.category;
|
||||||
parcelData.claimDate = this.claimDate;
|
parcelData.claimDate = this.claimDate;
|
||||||
parcelData.claimPrice = this.claimPrice;
|
parcelData.claimPrice = this.claimPrice;
|
||||||
|
parcelData.globalID = this.globalID;
|
||||||
parcelData.groupID = this.groupID;
|
parcelData.groupID = this.groupID;
|
||||||
parcelData.groupPrims = this.groupPrims;
|
parcelData.groupPrims = this.groupPrims;
|
||||||
parcelData.isGroupOwned = this.isGroupOwned;
|
parcelData.isGroupOwned = this.isGroupOwned;
|
||||||
|
|
|
@ -85,6 +85,7 @@ namespace OpenSim
|
||||||
public event StatusChange OnChildAgentStatus;
|
public event StatusChange OnChildAgentStatus;
|
||||||
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
|
||||||
public event ParcelDivideRequest OnParcelDivideRequest;
|
public event ParcelDivideRequest OnParcelDivideRequest;
|
||||||
|
public event ParcelJoinRequest OnParcelJoinRequest;
|
||||||
|
|
||||||
protected override void ProcessInPacket(Packet Pack)
|
protected override void ProcessInPacket(Packet Pack)
|
||||||
{
|
{
|
||||||
|
@ -477,6 +478,10 @@ namespace OpenSim
|
||||||
ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack;
|
ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack;
|
||||||
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);
|
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);
|
||||||
break;
|
break;
|
||||||
|
case PacketType.ParcelJoin:
|
||||||
|
ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack;
|
||||||
|
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);
|
||||||
|
break;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region unimplemented handlers
|
#region unimplemented handlers
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace OpenSim.RegionServer.world
|
||||||
{
|
{
|
||||||
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);
|
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);
|
||||||
public delegate void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client);
|
public delegate void ParcelDivideRequest(int west, int south, int east, int north, ClientView remote_client);
|
||||||
|
public delegate void ParcelJoinRequest(int west, int south, int east, int north, ClientView remote_client);
|
||||||
|
|
||||||
#region ParcelManager Class
|
#region ParcelManager Class
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -63,6 +64,9 @@ namespace OpenSim.RegionServer.world
|
||||||
public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000
|
public const byte PARCEL_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000
|
||||||
public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000
|
public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000
|
||||||
|
|
||||||
|
//RequestResults (I think these are right, they seem to work):
|
||||||
|
public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel
|
||||||
|
public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel
|
||||||
|
|
||||||
//These are other constants. Yay!
|
//These are other constants. Yay!
|
||||||
public const int START_PARCEL_LOCAL_ID = 1;
|
public const int START_PARCEL_LOCAL_ID = 1;
|
||||||
|
@ -158,8 +162,26 @@ namespace OpenSim.RegionServer.world
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_world.localStorage.RemoveParcel(parcelList[local_id].parcelData);
|
||||||
parcelList.Remove(local_id);
|
parcelList.Remove(local_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void performFinalParcelJoin(Parcel master, Parcel slave)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
bool[,] parcelBitmapSlave = slave.getParcelBitmap();
|
||||||
|
for (x = 0; x < 64; x++)
|
||||||
|
{
|
||||||
|
for (y = 0; y < 64; y++)
|
||||||
|
{
|
||||||
|
if (parcelBitmapSlave[x, y])
|
||||||
|
{
|
||||||
|
parcelIDList[x, y] = master.parcelData.localID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
removeParcel(slave.parcelData.localID);
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the parcel at the specified point
|
/// Get the parcel at the specified point
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -228,6 +250,7 @@ namespace OpenSim.RegionServer.world
|
||||||
//Lets create a new parcel with bitmap activated at that point (keeping the old parcels info)
|
//Lets create a new parcel with bitmap activated at that point (keeping the old parcels info)
|
||||||
Parcel newParcel = startParcel.Copy();
|
Parcel newParcel = startParcel.Copy();
|
||||||
newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName;
|
newParcel.parcelData.parcelName = "Subdivision of " + newParcel.parcelData.parcelName;
|
||||||
|
newParcel.parcelData.globalID = LLUUID.Random();
|
||||||
|
|
||||||
newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y));
|
newParcel.setParcelBitmap(Parcel.getSquareParcelBitmap(start_x, start_y, end_x, end_y));
|
||||||
|
|
||||||
|
@ -257,6 +280,10 @@ namespace OpenSim.RegionServer.world
|
||||||
/// <returns>Returns true if successful</returns>
|
/// <returns>Returns true if successful</returns>
|
||||||
public bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
|
public bool join(int start_x, int start_y, int end_x, int end_y, LLUUID attempting_user_id)
|
||||||
{
|
{
|
||||||
|
end_x -= 4;
|
||||||
|
end_y -= 4;
|
||||||
|
Console.WriteLine("Joining Parcels between (" + start_x + ", " + start_y + ") and (" + end_x + ", " + end_y + ")");
|
||||||
|
|
||||||
//NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box!
|
//NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box!
|
||||||
//This should be fixed later -- somewhat "incomplete code" --Ming
|
//This should be fixed later -- somewhat "incomplete code" --Ming
|
||||||
Parcel startParcel, endParcel;
|
Parcel startParcel, endParcel;
|
||||||
|
@ -270,6 +297,11 @@ namespace OpenSim.RegionServer.world
|
||||||
{
|
{
|
||||||
return false; //Error occured when trying to get the start and end parcels
|
return false; //Error occured when trying to get the start and end parcels
|
||||||
}
|
}
|
||||||
|
if (startParcel == endParcel)
|
||||||
|
{
|
||||||
|
return false; //Subdivision of the same parcel is not allowed
|
||||||
|
}
|
||||||
|
|
||||||
//Check the parcel owners:
|
//Check the parcel owners:
|
||||||
if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID)
|
if (startParcel.parcelData.ownerID != endParcel.parcelData.ownerID)
|
||||||
{
|
{
|
||||||
|
@ -281,12 +313,11 @@ namespace OpenSim.RegionServer.world
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Performing Join on parcel: " + startParcel.parcelData.parcelName + " - " + startParcel.parcelData.area + "sqm and " + endParcel.parcelData.parcelName + " - " + endParcel.parcelData.area + "sqm");
|
||||||
//Same owners! Lets join them
|
//Same owners! Lets join them
|
||||||
//Merge them to startParcel
|
//Merge them to startParcel
|
||||||
parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap()));
|
parcelList[startParcel.parcelData.localID].setParcelBitmap(Parcel.mergeParcelBitmaps(startParcel.getParcelBitmap(), endParcel.getParcelBitmap()));
|
||||||
|
performFinalParcelJoin(startParcel, endParcel);
|
||||||
//Remove the old parcel
|
|
||||||
parcelList.Remove(endParcel.parcelData.localID);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -386,6 +417,7 @@ namespace OpenSim.RegionServer.world
|
||||||
{
|
{
|
||||||
//Remove all the parcels in the sim and add a blank, full sim parcel set to public
|
//Remove all the parcels in the sim and add a blank, full sim parcel set to public
|
||||||
parcelList.Clear();
|
parcelList.Clear();
|
||||||
|
lastParcelLocalID = START_PARCEL_LOCAL_ID - 1;
|
||||||
parcelIDList.Initialize();
|
parcelIDList.Initialize();
|
||||||
|
|
||||||
Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world);
|
Parcel fullSimParcel = new Parcel(LLUUID.Zero, false, m_world);
|
||||||
|
@ -475,7 +507,7 @@ namespace OpenSim.RegionServer.world
|
||||||
/// <param name="sequence_id">ID sent by client for them to keep track of</param>
|
/// <param name="sequence_id">ID sent by client for them to keep track of</param>
|
||||||
/// <param name="snap_selection">Bool sent by client for them to use</param>
|
/// <param name="snap_selection">Bool sent by client for them to use</param>
|
||||||
/// <param name="remote_client">Object representing the client</param>
|
/// <param name="remote_client">Object representing the client</param>
|
||||||
public void sendParcelProperties(int sequence_id, bool snap_selection, ClientView remote_client)
|
public void sendParcelProperties(int sequence_id, bool snap_selection, int request_result, ClientView remote_client)
|
||||||
{
|
{
|
||||||
|
|
||||||
ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
|
ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket();
|
||||||
|
@ -495,7 +527,7 @@ namespace OpenSim.RegionServer.world
|
||||||
updatePacket.ParcelData.GroupPrims = parcelData.groupPrims;
|
updatePacket.ParcelData.GroupPrims = parcelData.groupPrims;
|
||||||
updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned;
|
updatePacket.ParcelData.IsGroupOwned = parcelData.isGroupOwned;
|
||||||
updatePacket.ParcelData.LandingType = (byte)0; //unemplemented
|
updatePacket.ParcelData.LandingType = (byte)0; //unemplemented
|
||||||
updatePacket.ParcelData.LocalID = (byte)parcelData.localID;
|
updatePacket.ParcelData.LocalID = parcelData.localID;
|
||||||
updatePacket.ParcelData.MaxPrims = 1000; //unemplemented
|
updatePacket.ParcelData.MaxPrims = 1000; //unemplemented
|
||||||
updatePacket.ParcelData.MediaAutoScale = (byte)0; //unemplemented
|
updatePacket.ParcelData.MediaAutoScale = (byte)0; //unemplemented
|
||||||
updatePacket.ParcelData.MediaID = LLUUID.Zero; //unemplemented
|
updatePacket.ParcelData.MediaID = LLUUID.Zero; //unemplemented
|
||||||
|
@ -517,7 +549,7 @@ namespace OpenSim.RegionServer.world
|
||||||
updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented
|
updatePacket.ParcelData.RegionDenyTransacted = false; //unemplemented
|
||||||
updatePacket.ParcelData.RegionPushOverride = true; //unemplemented
|
updatePacket.ParcelData.RegionPushOverride = true; //unemplemented
|
||||||
updatePacket.ParcelData.RentPrice = 0; //??
|
updatePacket.ParcelData.RentPrice = 0; //??
|
||||||
updatePacket.ParcelData.RequestResult = 0;//??
|
updatePacket.ParcelData.RequestResult = request_result;
|
||||||
updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented
|
updatePacket.ParcelData.SalePrice = parcelData.salePrice; //unemplemented
|
||||||
updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented
|
updatePacket.ParcelData.SelectedPrims = 0; //unemeplemented
|
||||||
updatePacket.ParcelData.SelfCount = 0;//unemplemented
|
updatePacket.ParcelData.SelfCount = 0;//unemplemented
|
||||||
|
@ -646,17 +678,9 @@ namespace OpenSim.RegionServer.world
|
||||||
private bool[,] convertBytesToParcelBitmap()
|
private bool[,] convertBytesToParcelBitmap()
|
||||||
{
|
{
|
||||||
bool[,] tempConvertMap = new bool[64, 64];
|
bool[,] tempConvertMap = new bool[64, 64];
|
||||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
|
tempConvertMap.Initialize();
|
||||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
|
|
||||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
|
|
||||||
//00000000 00000000 00000000 00000001 10000000 00000000 00000000 00000000
|
|
||||||
//00000000 00000000 00000000 00000001 10000000 00000000 00000000 00000000
|
|
||||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
|
|
||||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
|
|
||||||
//00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
|
|
||||||
//
|
|
||||||
byte tempByte = 0;
|
byte tempByte = 0;
|
||||||
int x = 63, y = 63, i = 0, bitNum = 0;
|
int x = 0, y = 0, i = 0, bitNum = 0;
|
||||||
for(i = 0; i < 512; i++)
|
for(i = 0; i < 512; i++)
|
||||||
{
|
{
|
||||||
tempByte = parcelData.parcelBitmapByteArray[i];
|
tempByte = parcelData.parcelBitmapByteArray[i];
|
||||||
|
@ -664,13 +688,15 @@ namespace OpenSim.RegionServer.world
|
||||||
{
|
{
|
||||||
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1);
|
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1);
|
||||||
tempConvertMap[x, y] = bit;
|
tempConvertMap[x, y] = bit;
|
||||||
x--;
|
x++;
|
||||||
if (x < 0)
|
if(x > 63)
|
||||||
{
|
{
|
||||||
y--;
|
x = 0;
|
||||||
x = 63;
|
y++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return tempConvertMap;
|
return tempConvertMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,7 +325,7 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
//Get the parcels within the bounds
|
//Get the parcels within the bounds
|
||||||
List<OpenSim.RegionServer.world.Parcel> temp = new List<OpenSim.RegionServer.world.Parcel>();
|
List<OpenSim.RegionServer.world.Parcel> temp = new List<OpenSim.RegionServer.world.Parcel>();
|
||||||
int x, y;
|
int x, y, i;
|
||||||
int inc_x = end_x - start_x;
|
int inc_x = end_x - start_x;
|
||||||
int inc_y = end_y - start_y;
|
int inc_y = end_y - start_y;
|
||||||
for(x = 0; x < inc_x; x++)
|
for(x = 0; x < inc_x; x++)
|
||||||
|
@ -335,13 +335,25 @@ namespace OpenSim.world
|
||||||
OpenSim.RegionServer.world.Parcel currentParcel = parcelManager.getParcel(start_x + x, start_y + y);
|
OpenSim.RegionServer.world.Parcel currentParcel = parcelManager.getParcel(start_x + x, start_y + y);
|
||||||
if(!temp.Contains(currentParcel))
|
if(!temp.Contains(currentParcel))
|
||||||
{
|
{
|
||||||
|
currentParcel.
|
||||||
|
forceUpdateParcelInfo();
|
||||||
temp.Add(currentParcel);
|
temp.Add(currentParcel);
|
||||||
currentParcel.forceUpdateParcelInfo();
|
|
||||||
currentParcel.sendParcelProperties(sequence_id,snap_selection,remote_client);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int requestResult = OpenSim.RegionServer.world.ParcelManager.PARCEL_RESULT_ONE_PARCEL;
|
||||||
|
if (temp.Count > 1)
|
||||||
|
{
|
||||||
|
requestResult = OpenSim.RegionServer.world.ParcelManager.PARCEL_RESULT_MULTIPLE_PARCELS;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < temp.Count; i++)
|
||||||
|
{
|
||||||
|
temp[i].sendParcelProperties(sequence_id, snap_selection, requestResult, remote_client);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
parcelManager.sendParcelOverlay(remote_client);
|
parcelManager.sendParcelOverlay(remote_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,6 +361,10 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
parcelManager.subdivide(west, south, east, north, remote_client.AgentID);
|
parcelManager.subdivide(west, south, east, north, remote_client.AgentID);
|
||||||
}
|
}
|
||||||
|
void ParcelJoinRequest(int west, int south, int east, int north, ClientView remote_client)
|
||||||
|
{
|
||||||
|
parcelManager.join(west, south, east, north, remote_client.AgentID);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -282,10 +282,11 @@ namespace OpenSim.world
|
||||||
|
|
||||||
//Parcel backup routines. Yay!
|
//Parcel backup routines. Yay!
|
||||||
ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count];
|
ParcelData[] parcels = new ParcelData[parcelManager.parcelList.Count];
|
||||||
int i;
|
int i = 0;
|
||||||
for (i = 0; i < parcelManager.parcelList.Count; i++)
|
foreach(OpenSim.RegionServer.world.Parcel parcel in parcelManager.parcelList.Values)
|
||||||
{
|
{
|
||||||
parcels[i] = parcelManager.parcelList[OpenSim.RegionServer.world.ParcelManager.START_PARCEL_LOCAL_ID + i].parcelData;
|
parcels[i] = parcel.parcelData;
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
localStorage.SaveParcels(parcels);
|
localStorage.SaveParcels(parcels);
|
||||||
|
|
||||||
|
@ -616,6 +617,7 @@ namespace OpenSim.world
|
||||||
|
|
||||||
agentClient.OnParcelPropertiesRequest += new OpenSim.RegionServer.world.ParcelPropertiesRequest(ParcelPropertiesRequest);
|
agentClient.OnParcelPropertiesRequest += new OpenSim.RegionServer.world.ParcelPropertiesRequest(ParcelPropertiesRequest);
|
||||||
agentClient.OnParcelDivideRequest += new OpenSim.RegionServer.world.ParcelDivideRequest(ParcelDivideRequest);
|
agentClient.OnParcelDivideRequest += new OpenSim.RegionServer.world.ParcelDivideRequest(ParcelDivideRequest);
|
||||||
|
agentClient.OnParcelJoinRequest+=new OpenSim.RegionServer.world.ParcelJoinRequest(ParcelJoinRequest);
|
||||||
Avatar newAvatar = null;
|
Avatar newAvatar = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,6 +92,17 @@ namespace OpenSim.Storage.LocalStorageBDB
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveParcel(ParcelData parcel)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveParcel(ParcelData parcel)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveAllParcels()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||||
|
|
||||||
public void StorePrim(PrimData prim)
|
public void StorePrim(PrimData prim)
|
||||||
{
|
{
|
||||||
IObjectSet result = db.Query(new UUIDQuery(prim.FullID));
|
IObjectSet result = db.Query(new UUIDPrimQuery(prim.FullID));
|
||||||
if(result.Count>0)
|
if(result.Count>0)
|
||||||
{
|
{
|
||||||
//prim already in storage
|
//prim already in storage
|
||||||
|
@ -112,7 +112,7 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||||
|
|
||||||
public void RemovePrim(LLUUID primID)
|
public void RemovePrim(LLUUID primID)
|
||||||
{
|
{
|
||||||
IObjectSet result = db.Query(new UUIDQuery(primID));
|
IObjectSet result = db.Query(new UUIDPrimQuery(primID));
|
||||||
if(result.Count>0)
|
if(result.Count>0)
|
||||||
{
|
{
|
||||||
PrimData found = (PrimData) result.Next();
|
PrimData found = (PrimData) result.Next();
|
||||||
|
@ -133,7 +133,6 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||||
public float[] LoadWorld()
|
public float[] LoadWorld()
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world....");
|
OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world....");
|
||||||
//World blank = new World();
|
|
||||||
float[] heightmap = null;
|
float[] heightmap = null;
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB");
|
OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB");
|
||||||
IObjectSet world_result = db.Get(typeof(MapStorage));
|
IObjectSet world_result = db.Get(typeof(MapStorage));
|
||||||
|
@ -144,21 +143,6 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||||
//blank.LandMap = map.Map;
|
//blank.LandMap = map.Map;
|
||||||
heightmap = map.Map;
|
heightmap = map.Map;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - No heightmap found, generating new one");
|
|
||||||
HeightmapGenHills hills = new HeightmapGenHills();
|
|
||||||
// blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
|
||||||
// heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
|
||||||
heightmap = new float[256, 256];
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Saving heightmap to local database");
|
|
||||||
MapStorage map = new MapStorage();
|
|
||||||
map.Map = heightmap; //blank.LandMap;
|
|
||||||
db.Set(map);
|
|
||||||
db.Commit();
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
return heightmap;
|
return heightmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,27 +161,77 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||||
db.Commit();
|
db.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveParcel(ParcelData parcel)
|
||||||
|
{
|
||||||
|
IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
|
||||||
|
if (result.Count > 0)
|
||||||
|
{
|
||||||
|
//Old Parcel
|
||||||
|
ParcelData updateParcel = (ParcelData)result.Next();
|
||||||
|
updateParcel.AABBMax = parcel.AABBMax;
|
||||||
|
updateParcel.AABBMin = parcel.AABBMin;
|
||||||
|
updateParcel.area = parcel.area;
|
||||||
|
updateParcel.auctionID = parcel.auctionID;
|
||||||
|
updateParcel.authBuyerID = parcel.authBuyerID;
|
||||||
|
updateParcel.category = parcel.category;
|
||||||
|
updateParcel.claimDate = parcel.claimDate;
|
||||||
|
updateParcel.claimPrice = parcel.claimPrice;
|
||||||
|
updateParcel.groupID = parcel.groupID;
|
||||||
|
updateParcel.groupPrims = parcel.groupPrims;
|
||||||
|
updateParcel.isGroupOwned = parcel.isGroupOwned;
|
||||||
|
updateParcel.localID = parcel.localID;
|
||||||
|
updateParcel.ownerID = parcel.ownerID;
|
||||||
|
updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone();
|
||||||
|
updateParcel.parcelDesc = parcel.parcelDesc;
|
||||||
|
updateParcel.parcelFlags = parcel.parcelFlags;
|
||||||
|
updateParcel.parcelName = parcel.parcelName;
|
||||||
|
updateParcel.parcelStatus = parcel.parcelStatus;
|
||||||
|
updateParcel.salePrice = parcel.salePrice;
|
||||||
|
|
||||||
|
db.Set(updateParcel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
db.Set(parcel);
|
||||||
|
}
|
||||||
|
db.Commit();
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveParcels(ParcelData[] parcel_data)
|
public void SaveParcels(ParcelData[] parcel_data)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Notice("Parcel Backup: Saving Parcels...");
|
MainConsole.Instance.Notice("Parcel Backup: Saving Parcels...");
|
||||||
IObjectSet result = db.Get(typeof(ParcelData));
|
|
||||||
foreach (ParcelData parcel in result)
|
|
||||||
{
|
|
||||||
db.Delete(parcel);
|
|
||||||
}
|
|
||||||
MainConsole.Instance.Notice("Parcel Backup: Removing old entries complete. Adding new entries.");
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < parcel_data.GetLength(0); i++)
|
for (i = 0; i < parcel_data.GetLength(0); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
MainConsole.Instance.Notice("Adding : " + i + " - SAMPLE: " + parcel_data[i].parcelBitmapByteArray[0]);
|
SaveParcel(parcel_data[i]);
|
||||||
db.Set(parcel_data[i]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
db.Commit();
|
|
||||||
MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete");
|
MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveParcel(ParcelData parcel)
|
||||||
|
{
|
||||||
|
IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
|
||||||
|
if (result.Count > 0)
|
||||||
|
{
|
||||||
|
db.Delete(result[0]);
|
||||||
|
}
|
||||||
|
db.Commit();
|
||||||
|
}
|
||||||
|
public void RemoveAllParcels()
|
||||||
|
{
|
||||||
|
MainConsole.Instance.Notice("Parcel Backup: Removing all parcels...");
|
||||||
|
IObjectSet result = db.Get(typeof(ParcelData));
|
||||||
|
if (result.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (ParcelData parcelData in result)
|
||||||
|
{
|
||||||
|
RemoveParcel(parcelData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Notice("Parcel Backup: Loading Parcels...");
|
MainConsole.Instance.Notice("Parcel Backup: Loading Parcels...");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectType>Local</ProjectType>
|
<ProjectType>Local</ProjectType>
|
||||||
<ProductVersion>8.0.50727</ProductVersion>
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
@ -6,7 +6,8 @@
|
||||||
<ProjectGuid>{E1B79ECF-0000-0000-0000-000000000000}</ProjectGuid>
|
<ProjectGuid>{E1B79ECF-0000-0000-0000-000000000000}</ProjectGuid>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ApplicationIcon></ApplicationIcon>
|
<ApplicationIcon>
|
||||||
|
</ApplicationIcon>
|
||||||
<AssemblyKeyContainerName>
|
<AssemblyKeyContainerName>
|
||||||
</AssemblyKeyContainerName>
|
</AssemblyKeyContainerName>
|
||||||
<AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName>
|
<AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName>
|
||||||
|
@ -15,9 +16,11 @@
|
||||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
<DelaySign>false</DelaySign>
|
<DelaySign>false</DelaySign>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder></AppDesignerFolder>
|
<AppDesignerFolder>
|
||||||
|
</AppDesignerFolder>
|
||||||
<RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace>
|
<RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace>
|
||||||
<StartupObject></StartupObject>
|
<StartupObject>
|
||||||
|
</StartupObject>
|
||||||
<FileUpgradeFlags>
|
<FileUpgradeFlags>
|
||||||
</FileUpgradeFlags>
|
</FileUpgradeFlags>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -28,7 +31,8 @@
|
||||||
<ConfigurationOverrideFile>
|
<ConfigurationOverrideFile>
|
||||||
</ConfigurationOverrideFile>
|
</ConfigurationOverrideFile>
|
||||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
<DocumentationFile></DocumentationFile>
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
<DebugSymbols>True</DebugSymbols>
|
<DebugSymbols>True</DebugSymbols>
|
||||||
<FileAlignment>4096</FileAlignment>
|
<FileAlignment>4096</FileAlignment>
|
||||||
<Optimize>False</Optimize>
|
<Optimize>False</Optimize>
|
||||||
|
@ -37,7 +41,8 @@
|
||||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn></NoWarn>
|
<NoWarn>
|
||||||
|
</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
@ -46,7 +51,8 @@
|
||||||
<ConfigurationOverrideFile>
|
<ConfigurationOverrideFile>
|
||||||
</ConfigurationOverrideFile>
|
</ConfigurationOverrideFile>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<DocumentationFile></DocumentationFile>
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
<DebugSymbols>False</DebugSymbols>
|
<DebugSymbols>False</DebugSymbols>
|
||||||
<FileAlignment>4096</FileAlignment>
|
<FileAlignment>4096</FileAlignment>
|
||||||
<Optimize>True</Optimize>
|
<Optimize>True</Optimize>
|
||||||
|
@ -55,22 +61,23 @@
|
||||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn></NoWarn>
|
<NoWarn>
|
||||||
|
</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" >
|
<Reference Include="System">
|
||||||
<HintPath>System.dll</HintPath>
|
<HintPath>System.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml" >
|
<Reference Include="System.Xml">
|
||||||
<HintPath>System.Xml.dll</HintPath>
|
<HintPath>System.Xml.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Db4objects.Db4o.dll" >
|
<Reference Include="Db4objects.Db4o.dll">
|
||||||
<HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
|
<HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="libsecondlife.dll" >
|
<Reference Include="libsecondlife.dll">
|
||||||
<HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
|
<HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -80,26 +87,27 @@
|
||||||
<Name>OpenSim.Framework</Name>
|
<Name>OpenSim.Framework</Name>
|
||||||
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
|
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
|
||||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
<ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
||||||
<Name>OpenSim.Framework.Console</Name>
|
<Name>OpenSim.Framework.Console</Name>
|
||||||
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
|
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
|
||||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AssemblyInfo.cs">
|
<Compile Include="AssemblyInfo.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Db4LocalStorage.cs">
|
<Compile Include="UUIDParcelQuery.cs" />
|
||||||
|
<Compile Include="UUIDPrimQuery.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="MapStorage.cs">
|
<Compile Include="MapStorage.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="UUIDQuery.cs">
|
<Compile Include="Db4LocalStorage.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -110,4 +118,4 @@
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -36,11 +36,11 @@ using OpenSim.Framework.Types;
|
||||||
|
|
||||||
namespace OpenSim.Storage.LocalStorageDb4o
|
namespace OpenSim.Storage.LocalStorageDb4o
|
||||||
{
|
{
|
||||||
public class UUIDQuery : Predicate
|
public class UUIDPrimQuery : Predicate
|
||||||
{
|
{
|
||||||
private LLUUID _findID;
|
private LLUUID _findID;
|
||||||
|
|
||||||
public UUIDQuery(LLUUID find)
|
public UUIDPrimQuery(LLUUID find)
|
||||||
{
|
{
|
||||||
_findID = find;
|
_findID = find;
|
||||||
}
|
}
|
|
@ -173,6 +173,18 @@ namespace OpenSim.Storage.LocalStorageSQLite
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveParcel(ParcelData parcel)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveParcel(ParcelData parcel)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveAllParcels()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
||||||
{
|
{
|
||||||
recv.NoParcelDataFromStorage();
|
recv.NoParcelDataFromStorage();
|
||||||
|
|
|
@ -205,7 +205,7 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_console.Notice("Main.cs:Startup() - Grid Mode; Do not know how to get the user's master key yet!");
|
m_console.Warn("Main.cs:Startup() - Grid Mode; Do not know how to get the user's master key yet!");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_console.Notice("Creating ParcelManager");
|
m_console.Notice("Creating ParcelManager");
|
||||||
|
@ -528,6 +528,15 @@ namespace OpenSim
|
||||||
case "backup":
|
case "backup":
|
||||||
LocalWorld.Backup();
|
LocalWorld.Backup();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "reset":
|
||||||
|
if (cmdparams[0] == "parcels")
|
||||||
|
{
|
||||||
|
LocalWorld.localStorage.RemoveAllParcels();
|
||||||
|
LocalWorld.localStorage.LoadParcels((ILocalStorageParcelReceiver)LocalWorld.parcelManager);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
m_console.Error("Unknown command");
|
m_console.Error("Unknown command");
|
||||||
break;
|
break;
|
||||||
|
@ -558,6 +567,16 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "parcels":
|
||||||
|
foreach (OpenSim.RegionServer.world.Parcel parcel in LocalWorld.parcelManager.parcelList.Values)
|
||||||
|
{
|
||||||
|
m_console.Error("Parcel ID#" + parcel.parcelData.localID + "(Global UUID: " + parcel.parcelData.globalID + "):");
|
||||||
|
m_console.Error("\tParcel Name: " + parcel.parcelData.parcelName);
|
||||||
|
m_console.Error("\tParcel Owner UUID: " + parcel.parcelData.ownerID);
|
||||||
|
m_console.Error("\tParcel Area: " + parcel.parcelData.area + "sqm");
|
||||||
|
m_console.Error(" ");
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in New Issue