refactor: Simplify land object by using c# get/set auto-properties where applicable.

0.8.0.3
Justin Clark-Casey (justincc) 2014-03-06 02:12:58 +00:00
parent 470d053443
commit 58c0ed78d4
1 changed files with 13 additions and 23 deletions

View File

@ -47,12 +47,10 @@ namespace OpenSim.Region.CoreModules.World.Land
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly string LogHeader = "[LAND OBJECT]"; private static readonly string LogHeader = "[LAND OBJECT]";
private bool[,] m_landBitmap;
private readonly int landUnit = 4; private readonly int landUnit = 4;
private int m_lastSeqId = 0; private int m_lastSeqId = 0;
protected LandData m_landData = new LandData();
protected Scene m_scene; protected Scene m_scene;
protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
@ -60,27 +58,18 @@ namespace OpenSim.Region.CoreModules.World.Land
protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>();
protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds
public bool[,] LandBitmap public bool[,] LandBitmap { get; set; }
{
get { return m_landBitmap; }
set { m_landBitmap = value; }
}
#endregion #endregion
public int GetPrimsFree() public int GetPrimsFree()
{ {
m_scene.EventManager.TriggerParcelPrimCountUpdate(); m_scene.EventManager.TriggerParcelPrimCountUpdate();
int free = GetSimulatorMaxPrimCount() - m_landData.SimwidePrims; int free = GetSimulatorMaxPrimCount() - LandData.SimwidePrims;
return free; return free;
} }
public LandData LandData public LandData LandData { get; set; }
{
get { return m_landData; }
set { m_landData = value; }
}
public IPrimCounts PrimCounts { get; set; } public IPrimCounts PrimCounts { get; set; }
@ -135,10 +124,11 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
m_scene = scene; m_scene = scene;
if (m_scene == null) if (m_scene == null)
m_landBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit]; LandBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit];
else else
m_landBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
LandData = new LandData();
LandData.OwnerID = owner_id; LandData.OwnerID = owner_id;
if (is_group_owned) if (is_group_owned)
LandData.GroupID = owner_id; LandData.GroupID = owner_id;
@ -1099,7 +1089,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
foreach (SceneObjectGroup obj in primsOverMe) foreach (SceneObjectGroup obj in primsOverMe)
{ {
if (obj.OwnerID == m_landData.OwnerID) if (obj.OwnerID == LandData.OwnerID)
{ {
if (!returns.ContainsKey(obj.OwnerID)) if (!returns.ContainsKey(obj.OwnerID))
returns[obj.OwnerID] = returns[obj.OwnerID] =
@ -1108,11 +1098,11 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
} }
else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero) else if (type == (uint)ObjectReturnType.Group && LandData.GroupID != UUID.Zero)
{ {
foreach (SceneObjectGroup obj in primsOverMe) foreach (SceneObjectGroup obj in primsOverMe)
{ {
if (obj.GroupID == m_landData.GroupID) if (obj.GroupID == LandData.GroupID)
{ {
if (!returns.ContainsKey(obj.OwnerID)) if (!returns.ContainsKey(obj.OwnerID))
returns[obj.OwnerID] = returns[obj.OwnerID] =
@ -1125,9 +1115,9 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
foreach (SceneObjectGroup obj in primsOverMe) foreach (SceneObjectGroup obj in primsOverMe)
{ {
if (obj.OwnerID != m_landData.OwnerID && if (obj.OwnerID != LandData.OwnerID &&
(obj.GroupID != m_landData.GroupID || (obj.GroupID != LandData.GroupID ||
m_landData.GroupID == UUID.Zero)) LandData.GroupID == UUID.Zero))
{ {
if (!returns.ContainsKey(obj.OwnerID)) if (!returns.ContainsKey(obj.OwnerID))
returns[obj.OwnerID] = returns[obj.OwnerID] =