*Moved LandManagement into its own region module (spiffy!)

0.6.0-stable
mingchen 2008-03-22 23:10:22 +00:00
parent 5ebef6410e
commit 71ca162821
21 changed files with 2031 additions and 1890 deletions

View File

@ -35,7 +35,6 @@ using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Data;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Framework.Data.MSSQL;
@ -429,7 +428,7 @@ namespace OpenSim.Framework.Data.MSSQL
}
}
public void StoreLandObject(Land parcel, LLUUID regionUUID)
public void StoreLandObject(ILandObject parcel)
{
// Instance.StoreLandObject(parcel, regionUUID);
@ -446,12 +445,12 @@ namespace OpenSim.Framework.Data.MSSQL
if (landRow == null)
{
landRow = land.NewRow();
fillLandRow(landRow, parcel.landData, regionUUID);
fillLandRow(landRow, parcel.landData, parcel.regionUUID);
land.Rows.Add(landRow);
}
else
{
fillLandRow(landRow, parcel.landData, regionUUID);
fillLandRow(landRow, parcel.landData, parcel.regionUUID);
}
using (

View File

@ -34,7 +34,6 @@ using libsecondlife;
using MySql.Data.MySqlClient;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Framework.Data.MySQL
@ -416,7 +415,7 @@ namespace OpenSim.Framework.Data.MySQL
}
}
public void StoreLandObject(Land parcel, LLUUID regionUUID)
public void StoreLandObject(ILandObject parcel)
{
lock (m_dataSet)
{
@ -427,12 +426,12 @@ namespace OpenSim.Framework.Data.MySQL
if (landRow == null)
{
landRow = land.NewRow();
fillLandRow(landRow, parcel.landData, regionUUID);
fillLandRow(landRow, parcel.landData, parcel.regionUUID);
land.Rows.Add(landRow);
}
else
{
fillLandRow(landRow, parcel.landData, regionUUID);
fillLandRow(landRow, parcel.landData, parcel.regionUUID);
}
using (

View File

@ -34,7 +34,6 @@ using Mono.Data.SqliteClient;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Framework.Data.SQLite
@ -477,7 +476,7 @@ namespace OpenSim.Framework.Data.SQLite
}
}
public void StoreLandObject(Land parcel, LLUUID regionUUID)
public void StoreLandObject(ILandObject parcel)
{
lock (ds)
{
@ -488,12 +487,12 @@ namespace OpenSim.Framework.Data.SQLite
if (landRow == null)
{
landRow = land.NewRow();
fillLandRow(landRow, parcel.landData, regionUUID);
fillLandRow(landRow, parcel.landData, parcel.regionUUID);
land.Rows.Add(landRow);
}
else
{
fillLandRow(landRow, parcel.landData, regionUUID);
fillLandRow(landRow, parcel.landData, parcel.regionUUID);
}
// I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around

View File

@ -504,6 +504,9 @@ namespace OpenSim
// We need to do this after we've initialized the scripting engines.
scene.StartScripts();
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
scene.LandChannel.performParcelPrimCountUpdate();
m_sceneManager.Add(scene);
m_udpServers.Add(udpServer);

View File

@ -155,8 +155,6 @@ namespace OpenSim.Region.ClientStack
}
scene.LoadPrimsFromStorage(m_permissions, regionInfo.originRegionID);
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
scene.performParcelPrimCountUpdate();
scene.StartTimer();
return scene;
}

View File

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Framework;
namespace OpenSim.Region.Environment.Interfaces
{
public interface ILandChannel
{
bool allowedForcefulBans { get; set; }
void IncomingLandObjectsFromStorage(List<LandData> data);
void IncomingLandObjectFromStorage(LandData data);
void NoLandDataFromStorage();
ILandObject getLandObject(int x, int y);
ILandObject getLandObject(float x, float y);
void setPrimsTainted();
bool isLandPrimCountTainted();
void sendLandUpdate(ScenePresence avatar, bool force);
void sendLandUpdate(ScenePresence avatar);
void resetAllLandPrimCounts();
void addPrimToLandPrimCounts(SceneObjectGroup obj);
void removePrimFromLandPrimCounts(SceneObjectGroup obj);
void finalizeLandPrimCountUpdate();
void updateLandPrimCounts();
void performParcelPrimCountUpdate();
void updateLandObject(int local_id, LandData newData);
void sendParcelOverlay(IClientAPI remote_client);
void handleParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
void handleParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
void handleParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client);
void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client);
void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client);
void resetSimLandObjects();
List<ILandObject> parcelsNearPoint(LLVector3 position);
void sendYouAreBannedNotice(ScenePresence avatar);
void handleAvatarChangingParcel(ScenePresence avatar, int localLandID, LLUUID regionID);
void sendOutNearestBanLine(IClientAPI avatar);
void handleSignificantClientMovement(IClientAPI remote_client);
void handleAnyClientMovement(ScenePresence avatar);
void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client);
void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
}
}

View File

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Framework;
namespace OpenSim.Region.Environment.Interfaces
{
public interface ILandObject
{
LandData landData { get; set; }
bool[,] landBitmap { get; set; }
LLUUID regionUUID { get; }
bool containsPoint(int x, int y);
ILandObject Copy();
void sendLandUpdateToAvatarsOverMe();
void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client);
void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
bool isEitherBannedOrRestricted(LLUUID avatar);
bool isBannedFromLand(LLUUID avatar);
bool isRestrictedFromLand(LLUUID avatar);
void sendLandUpdateToClient(IClientAPI remote_client);
ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag);
void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
void updateLandBitmapByteArray();
void setLandBitmapFromByteArray();
bool[,] getLandBitmap();
void forceUpdateLandInfo();
void setLandBitmap(bool[,] bitmap);
bool[,] basicFullRegionLandBitmap();
bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y);
bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value);
bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add);
void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client);
void sendLandObjectOwners(IClientAPI remote_client);
void returnObject(SceneObjectGroup obj);
void returnLandObjects(int type, LLUUID owner);
void resetLandPrimCounts();
void addPrimToCount(SceneObjectGroup obj);
void removePrimFromCount(SceneObjectGroup obj);
}
}

View File

@ -28,7 +28,6 @@
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Interfaces
@ -69,7 +68,7 @@ namespace OpenSim.Region.Environment.Interfaces
void StoreTerrain(double[,] terrain, LLUUID regionID);
double[,] LoadTerrain(LLUUID regionID);
void StoreLandObject(Land Parcel, LLUUID regionUUID);
void StoreLandObject(ILandObject Parcel);
void RemoveLandObject(LLUUID globalID);
List<LandData> LoadLandObjects(LLUUID regionUUID);

View File

@ -1,32 +1,7 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System;
using System.Collections.Generic;
using System.Text;
using Axiom.Math;
using libsecondlife;
using libsecondlife.Packets;
@ -36,33 +11,26 @@ using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.LandManagement
namespace OpenSim.Region.Environment.Modules.LandManagement
{
#region LandManager Class
/// <summary>
/// Handles Land objects and operations requiring information from other Land objects (divide, join, etc)
/// </summary>
public class LandManager
public class LandChannel : ILandChannel
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Constants
//Land types set with flags in ParcelOverlay.
//Only one of these can be used.
public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000
public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001
public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010
public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011
public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100
public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101
public const byte LAND_TYPE_PUBLIC = (byte)0; //Equals 00000000
public const byte LAND_TYPE_OWNED_BY_OTHER = (byte)1; //Equals 00000001
public const byte LAND_TYPE_OWNED_BY_GROUP = (byte)2; //Equals 00000010
public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte)3; //Equals 00000011
public const byte LAND_TYPE_IS_FOR_SALE = (byte)4; //Equals 00000100
public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte)5; //Equals 00000101
//Flags that when set, a border on the given side will be placed
//NOTE: North and East is assumable by the west and south sides (if land to east has a west border, then I have an east border; etc)
//This took forever to figure out -- jeesh. /blame LL for even having to send these
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte)64; //Equals 01000000
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000
//RequestResults (I think these are right, they seem to work):
public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land
@ -80,40 +48,32 @@ namespace OpenSim.Region.Environment.LandManagement
#endregion
#region Member Variables
private Scene m_scene;
public Dictionary<int, Land> landList = new Dictionary<int, Land>();
private Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>();
private int lastLandLocalID = START_LAND_LOCAL_ID - 1;
private int[,] landIDList = new int[64,64];
private int[,] landIDList = new int[64, 64];
/// <summary>
/// Set to true when a prim is moved, created, added. Performs a prim count update
/// </summary>
public bool landPrimCountTainted = false;
private bool landPrimCountTainted = false;
private readonly Scene m_scene;
private readonly RegionInfo m_regInfo;
public bool allowedForcefulBans = true;
#endregion
#region Constructors
public LandManager(Scene scene, RegionInfo reginfo)
private bool m_allowedForcefulBans = true;
public bool allowedForcefulBans
{
m_scene = scene;
m_regInfo = reginfo;
landIDList.Initialize();
scene.EventManager.OnAvatarEnteringNewParcel +=
new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel);
scene.EventManager.OnClientMovement += new EventManager.ClientMovement(handleAnyClientMovement);
get
{
return m_allowedForcefulBans;
}
set
{
m_allowedForcefulBans = value;
}
}
#endregion
#region Member Functions
public LandChannel(Scene scene)
{
m_scene = scene;
landIDList.Initialize();
}
#region Land Object From Storage Functions
public void IncomingLandObjectsFromStorage(List<LandData> data)
@ -122,12 +82,12 @@ namespace OpenSim.Region.Environment.LandManagement
{
//try
//{
IncomingLandObjectFromStorage(data[i]);
IncomingLandObjectFromStorage(data[i]);
//}
//catch (Exception ex)
//{
//m_log.Error("[LandManager]: IncomingLandObjectsFromStorage: Exception: " + ex.ToString());
//throw ex;
//m_log.Error("[LandManager]: IncomingLandObjectsFromStorage: Exception: " + ex.ToString());
//throw ex;
//}
}
//foreach (LandData parcel in data)
@ -138,7 +98,7 @@ namespace OpenSim.Region.Environment.LandManagement
public void IncomingLandObjectFromStorage(LandData data)
{
Land new_land = new Land(data.ownerID, data.isGroupOwned, m_scene);
ILandObject new_land = new LandObject(data.ownerID, data.isGroupOwned, m_scene);
new_land.landData = data.Copy();
new_land.setLandBitmapFromByteArray();
addLandObject(new_land);
@ -146,7 +106,6 @@ namespace OpenSim.Region.Environment.LandManagement
public void NoLandDataFromStorage()
{
Console.WriteLine("No LandData in storage! Loading a single, flat parcel instead");
resetSimLandObjects();
}
@ -158,20 +117,20 @@ namespace OpenSim.Region.Environment.LandManagement
/// Creates a basic Parcel object without an owner (a zeroed key)
/// </summary>
/// <returns></returns>
public Land createBaseLand()
public ILandObject createBaseLand()
{
return new Land(LLUUID.Zero, false, m_scene);
return new LandObject(LLUUID.Zero, false, m_scene);
}
/// <summary>
/// Adds a land object to the stored list and adds them to the landIDList to what they own
/// </summary>
/// <param name="new_land">The land object being added</param>
public Land addLandObject(Land new_land)
public ILandObject addLandObject(ILandObject new_land)
{
lastLandLocalID++;
new_land.landData.localID = lastLandLocalID;
landList.Add(lastLandLocalID, new_land.Copy());
landList.Add(lastLandLocalID, (LandObject)new_land.Copy());
bool[,] landBitmap = new_land.getLandBitmap();
@ -187,7 +146,7 @@ namespace OpenSim.Region.Environment.LandManagement
}
}
landList[lastLandLocalID].forceUpdateLandInfo();
m_scene.EventManager.TriggerLandObjectAdded(new_land, m_scene.RegionInfo.RegionID);
m_scene.EventManager.TriggerLandObjectAdded(new_land);
return new_land;
}
@ -219,15 +178,11 @@ namespace OpenSim.Region.Environment.LandManagement
if (landList.ContainsKey(local_id))
{
landList[local_id].landData = newData.Copy();
m_scene.EventManager.TriggerLandObjectUpdated((uint) local_id, landList[local_id]);
}
else
{
//throw new Exception("Could not update land object. Local ID '" + local_id + "' does not exist");
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landList[local_id]);
}
}
private void performFinalLandJoin(Land master, Land slave)
private void performFinalLandJoin(ILandObject master, ILandObject slave)
{
int x, y;
bool[,] landBitmapSlave = slave.getLandBitmap();
@ -252,7 +207,7 @@ namespace OpenSim.Region.Environment.LandManagement
/// <param name="x">Value between 0 - 256 on the x axis of the point</param>
/// <param name="y">Value between 0 - 256 on the y axis of the point</param>
/// <returns>Land object at the point supplied</returns>
public Land getLandObject(float x_float, float y_float)
public ILandObject getLandObject(float x_float, float y_float)
{
int x;
int y;
@ -273,12 +228,11 @@ namespace OpenSim.Region.Environment.LandManagement
}
else
{
// Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")");
return landList[landIDList[x, y]];
}
}
public Land getLandObject(int x, int y)
public ILandObject getLandObject(int x, int y)
{
if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0)
{
@ -288,7 +242,7 @@ namespace OpenSim.Region.Environment.LandManagement
}
else
{
return landList[landIDList[x/4, y/4]];
return landList[landIDList[x / 4, y / 4]];
}
}
@ -309,14 +263,14 @@ namespace OpenSim.Region.Environment.LandManagement
{
//First, lets loop through the points and make sure they are all in the same peice of land
//Get the land object at start
Land startLandObject = null;
ILandObject startLandObject = null;
try
{
startLandObject = getLandObject(start_x, start_y);
}
catch (Exception)
{
m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + start_x + " y:" + start_y);
//m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + start_x + " y:" + start_y);
}
if (startLandObject == null) return false; //No such land object at the beginning
@ -330,7 +284,7 @@ namespace OpenSim.Region.Environment.LandManagement
{
for (x = 0; x < totalX; x++)
{
Land tempLandObject = getLandObject(start_x + x, start_y + y);
ILandObject tempLandObject = getLandObject(start_x + x, start_y + y);
if (tempLandObject == null) return false; //No such land object at that point
if (tempLandObject != startLandObject) return false; //Subdividing over 2 land objects; no-no
}
@ -349,22 +303,22 @@ namespace OpenSim.Region.Environment.LandManagement
}
//Lets create a new land object with bitmap activated at that point (keeping the old land objects info)
Land newLand = startLandObject.Copy();
ILandObject newLand = startLandObject.Copy();
newLand.landData.landName = "Subdivision of " + newLand.landData.landName;
newLand.landData.globalID = LLUUID.Random();
newLand.setLandBitmap(Land.getSquareLandBitmap(start_x, start_y, end_x, end_y));
newLand.setLandBitmap(newLand.getSquareLandBitmap(start_x, start_y, end_x, end_y));
//Now, lets set the subdivision area of the original to false
int startLandObjectIndex = startLandObject.landData.localID;
landList[startLandObjectIndex].setLandBitmap(
Land.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false));
newLand.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false));
landList[startLandObjectIndex].forceUpdateLandInfo();
setPrimsTainted();
//Now add the new land object
Land result = addLandObject(newLand);
ILandObject result = addLandObject(newLand);
updateLandObject(startLandObject.landData.localID, startLandObject.landData);
result.sendLandUpdateToAvatarsOverMe();
@ -386,21 +340,21 @@ namespace OpenSim.Region.Environment.LandManagement
end_x -= 4;
end_y -= 4;
List<Land> selectedLandObjects = new List<Land>();
List<ILandObject> selectedLandObjects = new List<ILandObject>();
int stepXSelected = 0;
int stepYSelected = 0;
for (stepYSelected = start_y; stepYSelected <= end_y; stepYSelected += 4)
{
for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
{
Land p = null;
ILandObject p = null;
try
{
p = getLandObject(stepXSelected, stepYSelected);
}
catch (Exception)
{
m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + stepXSelected + " y:" + stepYSelected);
//m_log.Error("[LAND]: " + "Unable to get land object for subdivision at x: " + stepXSelected + " y:" + stepYSelected);
}
if (p != null)
{
@ -411,7 +365,7 @@ namespace OpenSim.Region.Environment.LandManagement
}
}
}
Land masterLandObject = selectedLandObjects[0];
ILandObject masterLandObject = selectedLandObjects[0];
selectedLandObjects.RemoveAt(0);
@ -423,17 +377,17 @@ namespace OpenSim.Region.Environment.LandManagement
{
return false; //Not the same owner
}
foreach (Land p in selectedLandObjects)
foreach (ILandObject p in selectedLandObjects)
{
if (p.landData.ownerID != masterLandObject.landData.ownerID)
{
return false; //Over multiple users. TODO: make this just ignore this piece of land?
}
}
foreach (Land slaveLandObject in selectedLandObjects)
foreach (ILandObject slaveLandObject in selectedLandObjects)
{
landList[masterLandObject.landData.localID].setLandBitmap(
Land.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap()));
slaveLandObject.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap()));
performFinalLandJoin(masterLandObject, slaveLandObject);
}
@ -445,6 +399,97 @@ namespace OpenSim.Region.Environment.LandManagement
return true;
}
public void resetAllLandPrimCounts()
{
foreach (LandObject p in landList.Values)
{
p.resetLandPrimCounts();
}
}
public void setPrimsTainted()
{
landPrimCountTainted = true;
}
public bool isLandPrimCountTainted()
{
return landPrimCountTainted;
}
public void addPrimToLandPrimCounts(SceneObjectGroup obj)
{
LLVector3 position = obj.AbsolutePosition;
ILandObject landUnderPrim = getLandObject(position.X, position.Y);
if (landUnderPrim != null)
{
landUnderPrim.addPrimToCount(obj);
}
}
public void removePrimFromLandPrimCounts(SceneObjectGroup obj)
{
foreach (LandObject p in landList.Values)
{
p.removePrimFromCount(obj);
}
}
public void finalizeLandPrimCountUpdate()
{
//Get Simwide prim count for owner
Dictionary<LLUUID, List<LandObject>> landOwnersAndParcels = new Dictionary<LLUUID, List<LandObject>>();
foreach (LandObject p in landList.Values)
{
if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID))
{
List<LandObject> tempList = new List<LandObject>();
tempList.Add(p);
landOwnersAndParcels.Add(p.landData.ownerID, tempList);
}
else
{
landOwnersAndParcels[p.landData.ownerID].Add(p);
}
}
foreach (LLUUID owner in landOwnersAndParcels.Keys)
{
int simArea = 0;
int simPrims = 0;
foreach (LandObject p in landOwnersAndParcels[owner])
{
simArea += p.landData.area;
simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims +
p.landData.selectedPrims;
}
foreach (LandObject p in landOwnersAndParcels[owner])
{
p.landData.simwideArea = simArea;
p.landData.simwidePrims = simPrims;
}
}
}
public void updateLandPrimCounts()
{
foreach (EntityBase obj in m_scene.Entities.Values)
{
if (obj is SceneObjectGroup)
{
m_scene.EventManager.TriggerParcelPrimCountAdd((SceneObjectGroup)obj);
}
}
}
public void performParcelPrimCountUpdate()
{
resetAllLandPrimCounts();
m_scene.EventManager.TriggerParcelPrimCountUpdate();
finalizeLandPrimCountUpdate();
landPrimCountTainted = false;
}
#endregion
#region Parcel Updating
@ -466,8 +511,8 @@ namespace OpenSim.Region.Environment.LandManagement
{
for (x = 0; x < 64; x++)
{
byte tempByte = (byte) 0; //This represents the byte for the current 4x4
Land currentParcelBlock = null;
byte tempByte = (byte)0; //This represents the byte for the current 4x4
ILandObject currentParcelBlock = null;
try
{
@ -475,7 +520,7 @@ namespace OpenSim.Region.Environment.LandManagement
}
catch (Exception)
{
m_log.Warn("[LAND]: " + "unable to get land at x: " + (x * 4) + " y: " + (y * 4));
//m_log.Warn("[LAND]: " + "unable to get land at x: " + (x * 4) + " y: " + (y * 4));
}
@ -508,15 +553,15 @@ namespace OpenSim.Region.Environment.LandManagement
//Now for border control
try
{
Land westParcel = null;
Land southParcel = null;
ILandObject westParcel = null;
ILandObject southParcel = null;
if (x > 0)
{
westParcel = getLandObject((x - 1)*4, y*4);
westParcel = getLandObject((x - 1) * 4, y * 4);
}
if (y > 0)
{
southParcel = getLandObject(x*4, (y - 1)*4);
southParcel = getLandObject(x * 4, (y - 1) * 4);
}
if (x == 0)
@ -542,17 +587,17 @@ namespace OpenSim.Region.Environment.LandManagement
if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
{
byteArrayCount = 0;
packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay);
packet = (ParcelOverlayPacket)PacketPool.Instance.GetPacket(PacketType.ParcelOverlay);
packet.ParcelData.Data = byteArray;
packet.ParcelData.SequenceID = sequenceID;
remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
remote_client.OutPacket((Packet)packet, ThrottleOutPacketType.Task);
sequenceID++;
byteArray = new byte[LAND_BLOCKS_PER_PACKET];
}
}
catch (Exception e)
{
m_log.Debug("[LAND]: Skipped Land checks because avatar is out of bounds: " + e.Message);
//m_log.Debug("[LAND]: Skipped Land checks because avatar is out of bounds: " + e.Message);
}
}
}
@ -563,7 +608,7 @@ namespace OpenSim.Region.Environment.LandManagement
bool snap_selection, IClientAPI remote_client)
{
//Get the land objects within the bounds
List<Land> temp = new List<Land>();
List<ILandObject> temp = new List<ILandObject>();
int x, y, i;
int inc_x = end_x - start_x;
int inc_y = end_y - start_y;
@ -572,14 +617,14 @@ namespace OpenSim.Region.Environment.LandManagement
for (y = 0; y < inc_y; y++)
{
Land currentParcel = null;
ILandObject currentParcel = null;
try
{
currentParcel = getLandObject(start_x + x, start_y + y);
}
catch (Exception)
{
m_log.Warn("[LAND]: " + "unable to get land at x: " + (start_x + x) + " y: " + (start_y + y));
//m_log.Warn("[LAND]: " + "unable to get land at x: " + (start_x + x) + " y: " + (start_y + y));
}
if (currentParcel != null)
{
@ -647,23 +692,23 @@ namespace OpenSim.Region.Environment.LandManagement
lastLandLocalID = START_LAND_LOCAL_ID - 1;
landIDList.Initialize();
Land fullSimParcel = new Land(LLUUID.Zero, false, m_scene);
ILandObject fullSimParcel = new LandObject(LLUUID.Zero, false, m_scene);
fullSimParcel.setLandBitmap(Land.getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID;
fullSimParcel.setLandBitmap(fullSimParcel.getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
fullSimParcel.landData.ownerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
addLandObject(fullSimParcel);
}
public List<Land> parcelsNearPoint(LLVector3 position)
public List<ILandObject> parcelsNearPoint(LLVector3 position)
{
List<Land> parcelsNear = new List<Land>();
List<ILandObject> parcelsNear = new List<ILandObject>();
int x, y;
for (x = -4; x <= 4; x += 4)
{
for (y = -4; y <= 4; y += 4)
{
Land check = getLandObject(position.X + x, position.Y + y);
ILandObject check = getLandObject(position.X + x, position.Y + y);
if (check != null)
{
if (!parcelsNear.Contains(check))
@ -702,7 +747,7 @@ namespace OpenSim.Region.Environment.LandManagement
{
if (landList[localLandID] != null)
{
Land parcelAvatarIsEntering = landList[localLandID];
ILandObject parcelAvatarIsEntering = landList[localLandID];
if (avatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT)
{
if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID))
@ -735,17 +780,17 @@ namespace OpenSim.Region.Environment.LandManagement
if (presence.UUID == avatar.AgentId)
{
List<Land> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition);
foreach (Land checkBan in checkLandParcels)
List<ILandObject> checkLandParcels = parcelsNearPoint(presence.AbsolutePosition);
foreach (ILandObject checkBan in checkLandParcels)
{
if (checkBan.isBannedFromLand(avatar.AgentId))
{
checkBan.sendLandProperties(-30000, false, (int) ParcelManager.ParcelResult.Single, avatar);
checkBan.sendLandProperties(-30000, false, (int)ParcelManager.ParcelResult.Single, avatar);
return; //Only send one
}
else if (checkBan.isRestrictedFromLand(avatar.AgentId))
{
checkBan.sendLandProperties(-40000, false, (int) ParcelManager.ParcelResult.Single, avatar);
checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar);
return; //Only send one
}
}
@ -756,7 +801,7 @@ namespace OpenSim.Region.Environment.LandManagement
public void sendLandUpdate(ScenePresence avatar, bool force)
{
Land over = null;
ILandObject over = null;
try
{
over = getLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
@ -764,7 +809,7 @@ namespace OpenSim.Region.Environment.LandManagement
}
catch (Exception)
{
m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + Math.Round(avatar.AbsolutePosition.Y));
//m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + Math.Round(avatar.AbsolutePosition.Y));
}
if (over != null)
@ -804,14 +849,14 @@ namespace OpenSim.Region.Environment.LandManagement
{
sendLandUpdate(clientAvatar);
sendOutNearestBanLine(remote_client);
Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
ILandObject parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
if (parcel != null)
{
if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT &&
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
{
handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID);
//They are going below the safety line!
//They are going below the safety line!
if (!parcel.isBannedFromLand(clientAvatar.UUID))
{
clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
@ -827,9 +872,9 @@ namespace OpenSim.Region.Environment.LandManagement
}
public void handleAnyClientMovement(ScenePresence avatar)
//Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance.
//Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance.
{
Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
ILandObject over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
if (over != null)
{
if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT)
@ -867,76 +912,5 @@ namespace OpenSim.Region.Environment.LandManagement
}
}
public void resetAllLandPrimCounts()
{
foreach (Land p in landList.Values)
{
p.resetLandPrimCounts();
}
}
public void setPrimsTainted()
{
landPrimCountTainted = true;
}
public void addPrimToLandPrimCounts(SceneObjectGroup obj)
{
LLVector3 position = obj.AbsolutePosition;
Land landUnderPrim = getLandObject(position.X, position.Y);
if (landUnderPrim != null)
{
landUnderPrim.addPrimToCount(obj);
}
}
public void removePrimFromLandPrimCounts(SceneObjectGroup obj)
{
foreach (Land p in landList.Values)
{
p.removePrimFromCount(obj);
}
}
public void finalizeLandPrimCountUpdate()
{
//Get Simwide prim count for owner
Dictionary<LLUUID, List<Land>> landOwnersAndParcels = new Dictionary<LLUUID, List<Land>>();
foreach (Land p in landList.Values)
{
if (!landOwnersAndParcels.ContainsKey(p.landData.ownerID))
{
List<Land> tempList = new List<Land>();
tempList.Add(p);
landOwnersAndParcels.Add(p.landData.ownerID, tempList);
}
else
{
landOwnersAndParcels[p.landData.ownerID].Add(p);
}
}
foreach (LLUUID owner in landOwnersAndParcels.Keys)
{
int simArea = 0;
int simPrims = 0;
foreach (Land p in landOwnersAndParcels[owner])
{
simArea += p.landData.area;
simPrims += p.landData.ownerPrims + p.landData.otherPrims + p.landData.groupPrims +
p.landData.selectedPrims;
}
foreach (Land p in landOwnersAndParcels[owner])
{
p.landData.simwideArea = simArea;
p.landData.simwidePrims = simPrims;
}
}
}
#endregion
}
#endregion
}

View File

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules.LandManagement
{
public class LandManagementModule : IRegionModule
{
private LandChannel landChannel;
private Scene m_scene;
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource source)
{
m_scene = scene;
landChannel = new LandChannel(scene);
m_scene.EventManager.OnParcelPrimCountAdd += landChannel.addPrimToLandPrimCounts;
m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts;
m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel);
m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement);
lock (m_scene)
{
m_scene.LandChannel = (ILandChannel)landChannel;
}
}
public void PostInitialise()
{
}
public void Close()
{
}
public string Name
{
get { return "LandManagementModule"; }
}
public bool IsSharedModule
{
get { return false; }
}
#endregion
}
}

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@ -34,31 +34,66 @@ using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.LandManagement
namespace OpenSim.Region.Environment.Modules.LandManagement
{
#region Parcel Class
#region LandObject Class
/// <summary>
/// Keeps track of a specific piece of land's information
/// </summary>
public class Land
public class LandObject : ILandObject
{
#region Member Variables
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public LandData landData = new LandData();
public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
public Scene m_scene;
protected LandData m_landData = new LandData();
protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
protected Scene m_scene;
private bool[,] landBitmap = new bool[64,64];
private bool[,] m_landBitmap = new bool[64,64];
public bool[,] landBitmap
{
get
{
return m_landBitmap;
}
set
{
m_landBitmap = value;
}
}
#endregion
#region ILandObject Members
public LandData landData
{
get
{
return m_landData;
}
set
{
m_landData = value;
}
}
public LLUUID regionUUID
{
get { return m_scene.RegionInfo.RegionID; }
}
#endregion
#region Constructors
public Land(LLUUID owner_id, bool is_group_owned, Scene scene)
public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene)
{
m_scene = scene;
landData.ownerID = owner_id;
@ -89,9 +124,9 @@ namespace OpenSim.Region.Environment.LandManagement
}
}
public Land Copy()
public ILandObject Copy()
{
Land newLand = new Land(landData.ownerID, landData.isGroupOwned, m_scene);
ILandObject newLand = new LandObject(landData.ownerID, landData.isGroupOwned, m_scene);
//Place all new variables here!
newLand.landBitmap = (bool[,]) (landBitmap.Clone());
@ -222,7 +257,7 @@ namespace OpenSim.Region.Environment.LandManagement
newData.userLocation = packet.ParcelData.UserLocation;
newData.userLookAt = packet.ParcelData.UserLookAt;
m_scene.LandManager.updateLandObject(landData.localID, newData);
m_scene.LandChannel.updateLandObject(landData.localID, newData);
sendLandUpdateToAvatarsOverMe();
}
@ -283,13 +318,13 @@ namespace OpenSim.Region.Environment.LandManagement
public void sendLandUpdateToAvatarsOverMe()
{
List<ScenePresence> avatars = m_scene.GetAvatars();
Land over = null;
ILandObject over = null;
for (int i = 0; i < avatars.Count; i++)
{
try
{
over =
m_scene.LandManager.getLandObject((int)Math.Max(255,Math.Min(0,Math.Round(avatars[i].AbsolutePosition.X))),
m_scene.LandChannel.getLandObject((int)Math.Max(255,Math.Min(0,Math.Round(avatars[i].AbsolutePosition.X))),
(int)Math.Max(255,Math.Min(0,Math.Round(avatars[i].AbsolutePosition.Y))));
}
catch (Exception)
@ -406,7 +441,7 @@ namespace OpenSim.Region.Environment.LandManagement
}
}
m_scene.LandManager.updateLandObject(landData.localID, newData);
m_scene.LandChannel.updateLandObject(landData.localID, newData);
}
#endregion
@ -566,7 +601,7 @@ namespace OpenSim.Region.Environment.LandManagement
/// Full sim land object creation
/// </summary>
/// <returns></returns>
public static bool[,] basicFullRegionLandBitmap()
public bool[,] basicFullRegionLandBitmap()
{
return getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize);
}
@ -579,7 +614,7 @@ namespace OpenSim.Region.Environment.LandManagement
/// <param name="end_x"></param>
/// <param name="end_y"></param>
/// <returns></returns>
public static bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
public bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
{
bool[,] tempBitmap = new bool[64,64];
tempBitmap.Initialize();
@ -598,7 +633,7 @@ namespace OpenSim.Region.Environment.LandManagement
/// <param name="end_y"></param>
/// <param name="set_value"></param>
/// <returns></returns>
public static bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y,
public bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y,
bool set_value)
{
if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2)
@ -628,7 +663,7 @@ namespace OpenSim.Region.Environment.LandManagement
/// <param name="bitmap_base"></param>
/// <param name="bitmap_add"></param>
/// <returns></returns>
public static bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
public bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
{
if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2)
{
@ -666,14 +701,14 @@ namespace OpenSim.Region.Environment.LandManagement
{
if (obj.LocalId > 0)
{
if (request_type == LandManager.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID)
if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.ownerID)
{
resultLocalIDs.Add(obj.LocalId);
}
// else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support
// {
// }
else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER &&
else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER &&
obj.OwnerID != remote_client.AgentId)
{
resultLocalIDs.Add(obj.LocalId);
@ -836,7 +871,9 @@ namespace OpenSim.Region.Environment.LandManagement
#endregion
#endregion
}
}
#endregion
}

View File

@ -26,9 +26,8 @@
*/
using libsecondlife;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment
{
public class PermissionManager
@ -126,7 +125,7 @@ namespace OpenSim.Region.Environment
string reason = "Insufficient permission";
Land land = m_scene.LandManager.getLandObject(position.X, position.Y);
ILandObject land = m_scene.LandChannel.getLandObject(position.X, position.Y);
if (land == null) return false;
if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
@ -230,7 +229,7 @@ namespace OpenSim.Region.Environment
}
// Users should be able to edit what is over their land.
Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
ILandObject parcel = m_scene.LandChannel.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
if (parcel != null && parcel.landData.ownerID == user)
return objectOwnerMask;
@ -324,7 +323,7 @@ namespace OpenSim.Region.Environment
}
// Users should be able to edit what is over their land.
Land parcel = m_scene.LandManager.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
ILandObject parcel = m_scene.LandChannel.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
if ((parcel != null) && (parcel.landData.ownerID == currentUser))
{
permission = true;
@ -551,7 +550,7 @@ namespace OpenSim.Region.Environment
Y = 0;
// Land owner can terraform too
Land parcel = m_scene.LandManager.getLandObject(X, Y);
ILandObject parcel = m_scene.LandChannel.getLandObject(X, Y);
if (parcel != null && GenericParcelPermission(user, parcel))
permission = true;
@ -596,7 +595,7 @@ namespace OpenSim.Region.Environment
#region Parcel Permissions
protected virtual bool GenericParcelPermission(LLUUID user, Land parcel)
protected virtual bool GenericParcelPermission(LLUUID user, ILandObject parcel)
{
bool permission = false;
@ -625,22 +624,22 @@ namespace OpenSim.Region.Environment
protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos)
{
Land parcel = m_scene.LandManager.getLandObject(pos.X, pos.Y);
ILandObject parcel = m_scene.LandChannel.getLandObject(pos.X, pos.Y);
if (parcel == null) return false;
return GenericParcelPermission(user, parcel);
}
public virtual bool CanEditParcel(LLUUID user, Land parcel)
public virtual bool CanEditParcel(LLUUID user, ILandObject parcel)
{
return GenericParcelPermission(user, parcel);
}
public virtual bool CanSellParcel(LLUUID user, Land parcel)
public virtual bool CanSellParcel(LLUUID user, ILandObject parcel)
{
return GenericParcelPermission(user, parcel);
}
public virtual bool CanAbandonParcel(LLUUID user, Land parcel)
public virtual bool CanAbandonParcel(LLUUID user, ILandObject parcel)
{
return GenericParcelPermission(user, parcel);
}

View File

@ -89,7 +89,7 @@ namespace OpenSim.Region.Environment.Scenes
{
((SceneObjectGroup) ent).GetProperties(remoteClient);
((SceneObjectGroup) ent).IsSelected = true;
LandManager.setPrimsTainted();
LandChannel.setPrimsTainted();
}
break;
}
@ -115,7 +115,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
{
((SceneObjectGroup) ent).IsSelected = false;
LandManager.setPrimsTainted();
LandChannel.setPrimsTainted();
break;
}
}

View File

@ -40,7 +40,6 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Modules;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.Physics.Manager;
@ -154,13 +153,6 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_authenticateHandler; }
}
protected readonly LandManager m_LandManager;
// LandManager object instance that manages land related things. Parcel, primcounts etc..
public LandManager LandManager
{
get { return m_LandManager; }
}
protected readonly EstateManager m_estateManager;
// an instance to the physics plugin's Scene object.
public PhysicsScene PhysicsScene
@ -256,8 +248,6 @@ namespace OpenSim.Region.Environment.Scenes
m_eventManager = new EventManager();
m_LandManager = new LandManager(this, m_regInfo);
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
@ -335,8 +325,6 @@ namespace OpenSim.Region.Environment.Scenes
protected virtual void RegisterDefaultSceneEvents()
{
m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts;
m_eventManager.OnParcelPrimCountUpdate += addPrimsToParcelCounts;
m_eventManager.OnPermissionError += SendPermissionAlert;
}
@ -837,10 +825,12 @@ namespace OpenSim.Region.Environment.Scenes
private void UpdateLand()
{
if (m_LandManager.landPrimCountTainted)
if (LandChannel != null)
{
//Perform land update of prim count
performParcelPrimCountUpdate();
if (LandChannel.isLandPrimCountTainted())
{
LandChannel.performParcelPrimCountUpdate();
}
}
}
@ -974,12 +964,12 @@ namespace OpenSim.Region.Environment.Scenes
if (dGridSettings["allow_forceful_banlines"] != "TRUE")
{
m_log.Info("[GRID]: Grid is disabling forceful parcel banlists");
m_LandManager.allowedForcefulBans = false;
LandChannel.allowedForcefulBans = false;
}
else
{
m_log.Info("[GRID]: Grid is allowing forceful parcel banlists");
m_LandManager.allowedForcefulBans = true;
LandChannel.allowedForcefulBans = true;
}
}
}
@ -1016,11 +1006,11 @@ namespace OpenSim.Region.Environment.Scenes
if (landData.Count == 0)
{
m_LandManager.NoLandDataFromStorage();
LandChannel.NoLandDataFromStorage();
}
else
{
m_LandManager.IncomingLandObjectsFromStorage(landData);
LandChannel.IncomingLandObjectsFromStorage(landData);
}
}
@ -1196,9 +1186,9 @@ namespace OpenSim.Region.Environment.Scenes
{
if (Entities.ContainsKey(sceneObject.UUID))
{
m_LandManager.removePrimFromLandPrimCounts(sceneObject);
LandChannel.removePrimFromLandPrimCounts(sceneObject);
Entities.Remove(sceneObject.UUID);
m_LandManager.setPrimsTainted();
LandChannel.setPrimsTainted();
m_innerScene.RemoveAPrimCount();
}
}
@ -1209,7 +1199,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="prim"></param>
public void AcknowledgeNewPrim(SceneObjectGroup prim)
{
prim.OnPrimCountTainted += m_LandManager.setPrimsTainted;
prim.OnPrimCountTainted += LandChannel.setPrimsTainted;
}
public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset)
@ -1350,7 +1340,7 @@ namespace OpenSim.Region.Environment.Scenes
CreateAndAddScenePresence(client, child);
m_LandManager.sendParcelOverlay(client);
LandChannel.sendParcelOverlay(client);
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
}
}
@ -1387,17 +1377,17 @@ namespace OpenSim.Region.Environment.Scenes
client.OnObjectDuplicate += m_innerScene.DuplicateObject;
client.OnUpdatePrimFlags += m_innerScene.UpdatePrimFlags;
client.OnRequestObjectPropertiesFamily += m_innerScene.RequestObjectPropertiesFamily;
client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(m_LandManager.handleParcelPropertiesRequest);
client.OnParcelDivideRequest += new ParcelDivideRequest(m_LandManager.handleParcelDivideRequest);
client.OnParcelJoinRequest += new ParcelJoinRequest(m_LandManager.handleParcelJoinRequest);
client.OnParcelPropertiesRequest += new ParcelPropertiesRequest(LandChannel.handleParcelPropertiesRequest);
client.OnParcelDivideRequest += new ParcelDivideRequest(LandChannel.handleParcelDivideRequest);
client.OnParcelJoinRequest += new ParcelJoinRequest(LandChannel.handleParcelJoinRequest);
client.OnParcelPropertiesUpdateRequest +=
new ParcelPropertiesUpdateRequest(m_LandManager.handleParcelPropertiesUpdateRequest);
client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest);
new ParcelPropertiesUpdateRequest(LandChannel.handleParcelPropertiesUpdateRequest);
client.OnParcelSelectObjects += new ParcelSelectObjects(LandChannel.handleParcelSelectObjectsRequest);
client.OnParcelObjectOwnerRequest +=
new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
client.OnParcelAccessListRequest += new ParcelAccessListRequest(m_LandManager.handleParcelAccessRequest);
new ParcelObjectOwnerRequest(LandChannel.handleParcelObjectOwnersRequest);
client.OnParcelAccessListRequest += new ParcelAccessListRequest(LandChannel.handleParcelAccessRequest);
client.OnParcelAccessListUpdateRequest +=
new ParcelAccessListUpdateRequest(m_LandManager.handleParcelAccessUpdateRequest);
new ParcelAccessListUpdateRequest(LandChannel.handleParcelAccessUpdateRequest);
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
client.OnRegionInfoRequest += m_estateManager.HandleRegionInfoRequest;
@ -1445,7 +1435,7 @@ namespace OpenSim.Region.Environment.Scenes
if (avatar.IsChildAgent)
{
avatar.OnSignificantClientMovement += m_LandManager.handleSignificantClientMovement;
avatar.OnSignificantClientMovement += LandChannel.handleSignificantClientMovement;
}
return avatar;
@ -2022,30 +2012,6 @@ namespace OpenSim.Region.Environment.Scenes
return LLUUID.Zero;
}
/// <summary>
///
/// </summary>
public void performParcelPrimCountUpdate()
{
m_LandManager.resetAllLandPrimCounts();
m_eventManager.TriggerParcelPrimCountUpdate();
m_LandManager.finalizeLandPrimCountUpdate();
m_LandManager.landPrimCountTainted = false;
}
/// <summary>
///
/// </summary>
public void addPrimsToParcelCounts()
{
foreach (EntityBase obj in Entities.Values)
{
if (obj is SceneObjectGroup)
{
m_eventManager.TriggerParcelPrimCountAdd((SceneObjectGroup)obj);
}
}
}
/// <summary>
/// This method is a way for the Friends Module to create an instant
@ -2455,7 +2421,7 @@ namespace OpenSim.Region.Environment.Scenes
public LLUUID GetLandOwner(float x, float y)
{
Land land = LandManager.getLandObject(x, y);
ILandObject land = LandChannel.getLandObject(x, y);
if (land == null)
{
return LLUUID.Zero;
@ -2468,12 +2434,12 @@ namespace OpenSim.Region.Environment.Scenes
public LandData GetLandData(float x, float y)
{
return LandManager.getLandObject(x, y).landData;
return LandChannel.getLandObject(x, y).landData;
}
public void SetLandMusicURL(float x, float y, string url)
{
Land land = LandManager.getLandObject(x, y);
ILandObject land = LandChannel.getLandObject(x, y);
if (land == null)
{
return;
@ -2487,7 +2453,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetLandMediaURL(float x, float y, string url)
{
Land land = LandManager.getLandObject(x, y);
ILandObject land = LandChannel.getLandObject(x, y);
if (land == null)
{

View File

@ -62,6 +62,8 @@ namespace OpenSim.Region.Environment.Scenes
//public TerrainEngine Terrain;
public ITerrainChannel Heightmap;
public ILandChannel LandChannel;
protected EventManager m_eventManager;
public EventManager EventManager
@ -69,6 +71,7 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_eventManager; }
}
protected string m_datastore;
private uint m_nextLocalId = 8880000;

View File

@ -29,7 +29,6 @@ using libsecondlife;
using System;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.LandManagement;
namespace OpenSim.Region.Environment.Scenes
{
@ -106,7 +105,7 @@ namespace OpenSim.Region.Environment.Scenes
public event SceneGroupGrabed OnSceneGroupGrab;
public delegate void LandObjectAdded(Land newParcel, LLUUID regionUUID);
public delegate void LandObjectAdded(ILandObject newParcel);
public event LandObjectAdded OnLandObjectAdded;
@ -352,13 +351,13 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void TriggerLandObjectAdded(Land newParcel, LLUUID regionID)
public void TriggerLandObjectAdded(ILandObject newParcel)
{
handlerLandObjectAdded = OnLandObjectAdded;
if (handlerLandObjectAdded != null)
{
handlerLandObjectAdded(newParcel, regionID);
handlerLandObjectAdded(newParcel);
}
}
@ -371,11 +370,11 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void TriggerLandObjectUpdated(uint localParcelID, Land newParcel)
public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
{
//triggerLandObjectRemoved(localParcelID);
TriggerLandObjectAdded(newParcel, newParcel.m_scene.RegionInfo.RegionID);
TriggerLandObjectAdded(newParcel);
}
public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID)

View File

@ -371,7 +371,7 @@ namespace OpenSim.Region.Environment.Scenes
RegisterToEvents();
SetDirectionVectors();
m_scene.LandManager.sendLandUpdate(this, true);
m_scene.LandChannel.sendLandUpdate(this, true);
}
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
@ -549,7 +549,7 @@ namespace OpenSim.Region.Environment.Scenes
//if (!m_gotAllObjectsInScene)
//{
m_scene.SendAllSceneObjectsToClient(this);
m_scene.LandManager.sendLandUpdate(this, true);
m_scene.LandChannel.sendLandUpdate(this, true);
//m_gotAllObjectsInScene = true;
//}

View File

@ -29,7 +29,7 @@ using System;
using System.Text;
using Axiom.Math;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Key = libsecondlife.LLUUID;
using Rotation = libsecondlife.LLQuaternion;
@ -105,7 +105,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
public void osAddToLandPassList(Key avatar, float hours)
{
Vector myPosition = Task.AbsolutePosition;
Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
ILandObject myParcel = Scene.LandChannel.getLandObject(myPosition.X, myPosition.Y);
if (myParcel == null)
{
//Dont do anything!

View File

@ -4311,7 +4311,7 @@ namespace OpenSim.Region.ScriptEngine.Common
public int llGetParcelFlags(LSL_Types.Vector3 pos)
{
m_host.AddScriptLPS(1);
return (int)World.LandManager.getLandObject((float)pos.x, (float)pos.y).landData.landFlags;
return (int)World.LandChannel.getLandObject((float)pos.x, (float)pos.y).landData.landFlags;
}
public int llGetRegionFlags()

View File

@ -35,7 +35,6 @@ using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Data;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.DataStore.MSSQL
@ -304,7 +303,7 @@ namespace OpenSim.DataStore.MSSQL
{
}
public void StoreLandObject(Land parcel, LLUUID regionUUID)
public void StoreLandObject(ILandObject parcel)
{
}

View File

@ -29,7 +29,6 @@ using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.DataStore.NullStorage
@ -72,7 +71,7 @@ namespace OpenSim.DataStore.NullStorage
{
}
public void StoreLandObject(Land land, LLUUID regionUUID)
public void StoreLandObject(ILandObject land)
{
}