diff options
author | Justin Clark-Casey (justincc) | 2014-03-06 02:12:58 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-03-06 02:12:58 +0000 |
commit | 58c0ed78d484c99a9fb5052d555955423e998da1 (patch) | |
tree | de2ae0761fd433e9daa4d6e49358c6dfa04904a0 | |
parent | minor: slightly simplify code in LandObject.ContainsPoint() (diff) | |
download | opensim-SC-58c0ed78d484c99a9fb5052d555955423e998da1.zip opensim-SC-58c0ed78d484c99a9fb5052d555955423e998da1.tar.gz opensim-SC-58c0ed78d484c99a9fb5052d555955423e998da1.tar.bz2 opensim-SC-58c0ed78d484c99a9fb5052d555955423e998da1.tar.xz |
refactor: Simplify land object by using c# get/set auto-properties where applicable.
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index f5cb1d7..920eee8 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -47,12 +47,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | private static readonly string LogHeader = "[LAND OBJECT]"; | 48 | private static readonly string LogHeader = "[LAND OBJECT]"; |
49 | 49 | ||
50 | private bool[,] m_landBitmap; | ||
51 | private readonly int landUnit = 4; | 50 | private readonly int landUnit = 4; |
52 | 51 | ||
53 | private int m_lastSeqId = 0; | 52 | private int m_lastSeqId = 0; |
54 | 53 | ||
55 | protected LandData m_landData = new LandData(); | ||
56 | protected Scene m_scene; | 54 | protected Scene m_scene; |
57 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 55 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
58 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); | 56 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); |
@@ -60,27 +58,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
60 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); | 58 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); |
61 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds | 59 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds |
62 | 60 | ||
63 | public bool[,] LandBitmap | 61 | public bool[,] LandBitmap { get; set; } |
64 | { | ||
65 | get { return m_landBitmap; } | ||
66 | set { m_landBitmap = value; } | ||
67 | } | ||
68 | 62 | ||
69 | #endregion | 63 | #endregion |
70 | 64 | ||
71 | public int GetPrimsFree() | 65 | public int GetPrimsFree() |
72 | { | 66 | { |
73 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 67 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
74 | int free = GetSimulatorMaxPrimCount() - m_landData.SimwidePrims; | 68 | int free = GetSimulatorMaxPrimCount() - LandData.SimwidePrims; |
75 | return free; | 69 | return free; |
76 | } | 70 | } |
77 | 71 | ||
78 | public LandData LandData | 72 | public LandData LandData { get; set; } |
79 | { | ||
80 | get { return m_landData; } | ||
81 | |||
82 | set { m_landData = value; } | ||
83 | } | ||
84 | 73 | ||
85 | public IPrimCounts PrimCounts { get; set; } | 74 | public IPrimCounts PrimCounts { get; set; } |
86 | 75 | ||
@@ -135,10 +124,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
135 | { | 124 | { |
136 | m_scene = scene; | 125 | m_scene = scene; |
137 | if (m_scene == null) | 126 | if (m_scene == null) |
138 | m_landBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit]; | 127 | LandBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit]; |
139 | else | 128 | else |
140 | m_landBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | 129 | LandBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; |
141 | 130 | ||
131 | LandData = new LandData(); | ||
142 | LandData.OwnerID = owner_id; | 132 | LandData.OwnerID = owner_id; |
143 | if (is_group_owned) | 133 | if (is_group_owned) |
144 | LandData.GroupID = owner_id; | 134 | LandData.GroupID = owner_id; |
@@ -1099,7 +1089,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1099 | { | 1089 | { |
1100 | foreach (SceneObjectGroup obj in primsOverMe) | 1090 | foreach (SceneObjectGroup obj in primsOverMe) |
1101 | { | 1091 | { |
1102 | if (obj.OwnerID == m_landData.OwnerID) | 1092 | if (obj.OwnerID == LandData.OwnerID) |
1103 | { | 1093 | { |
1104 | if (!returns.ContainsKey(obj.OwnerID)) | 1094 | if (!returns.ContainsKey(obj.OwnerID)) |
1105 | returns[obj.OwnerID] = | 1095 | returns[obj.OwnerID] = |
@@ -1108,11 +1098,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1108 | } | 1098 | } |
1109 | } | 1099 | } |
1110 | } | 1100 | } |
1111 | else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero) | 1101 | else if (type == (uint)ObjectReturnType.Group && LandData.GroupID != UUID.Zero) |
1112 | { | 1102 | { |
1113 | foreach (SceneObjectGroup obj in primsOverMe) | 1103 | foreach (SceneObjectGroup obj in primsOverMe) |
1114 | { | 1104 | { |
1115 | if (obj.GroupID == m_landData.GroupID) | 1105 | if (obj.GroupID == LandData.GroupID) |
1116 | { | 1106 | { |
1117 | if (!returns.ContainsKey(obj.OwnerID)) | 1107 | if (!returns.ContainsKey(obj.OwnerID)) |
1118 | returns[obj.OwnerID] = | 1108 | returns[obj.OwnerID] = |
@@ -1125,9 +1115,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1125 | { | 1115 | { |
1126 | foreach (SceneObjectGroup obj in primsOverMe) | 1116 | foreach (SceneObjectGroup obj in primsOverMe) |
1127 | { | 1117 | { |
1128 | if (obj.OwnerID != m_landData.OwnerID && | 1118 | if (obj.OwnerID != LandData.OwnerID && |
1129 | (obj.GroupID != m_landData.GroupID || | 1119 | (obj.GroupID != LandData.GroupID || |
1130 | m_landData.GroupID == UUID.Zero)) | 1120 | LandData.GroupID == UUID.Zero)) |
1131 | { | 1121 | { |
1132 | if (!returns.ContainsKey(obj.OwnerID)) | 1122 | if (!returns.ContainsKey(obj.OwnerID)) |
1133 | returns[obj.OwnerID] = | 1123 | returns[obj.OwnerID] = |