aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorUbitUmarov2012-11-04 14:57:27 +0000
committerUbitUmarov2012-11-04 14:57:27 +0000
commit1090ff727851b0ee571a0d99e232a81b95f2bdef (patch)
treef2d98a36533b85715f9ebaf79d0b9670decb9c35 /OpenSim/Region/OptionalModules
parent actually remove the use of random on persist timmings (diff)
downloadopensim-SC_OLD-1090ff727851b0ee571a0d99e232a81b95f2bdef.zip
opensim-SC_OLD-1090ff727851b0ee571a0d99e232a81b95f2bdef.tar.gz
opensim-SC_OLD-1090ff727851b0ee571a0d99e232a81b95f2bdef.tar.bz2
opensim-SC_OLD-1090ff727851b0ee571a0d99e232a81b95f2bdef.tar.xz
removed potencial null refs and rearrange code a bit
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs32
1 files changed, 19 insertions, 13 deletions
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 59ff9b8..39cabb5 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -121,34 +121,40 @@ namespace OpenSim.Region.OptionalModules
121 121
122 private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene) 122 private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene)
123 { 123 {
124 if ((newPoint.X > 257f || newPoint.X < -1f || newPoint.Y > 257f || newPoint.Y < -1f)) 124 if (newPoint.X < -1f || newPoint.X > (float)(Constants.RegionSize + 1) ||
125 newPoint.Y < -1f || newPoint.Y > (float)(Constants.RegionSize + 1))
125 return true; 126 return true;
126 127
127 SceneObjectPart obj = scene.GetSceneObjectPart(objectID); 128 SceneObjectPart obj = scene.GetSceneObjectPart(objectID);
128 Vector3 oldPoint = obj.GroupPosition; 129
129 int objectCount = obj.ParentGroup.PrimCount; 130 if (obj == null)
130 ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); 131 return false;
132
133 // Prim counts are determined by the location of the root prim. if we're
134 // moving a child prim, just let it pass
135 if (!obj.IsRoot)
136 {
137 return true;
138 }
139
131 ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); 140 ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
132 141
133 if (newParcel == null) 142 if (newParcel == null)
134 return true; 143 return true;
135 144
136 int usedPrims = newParcel.PrimCounts.Total; 145 Vector3 oldPoint = obj.GroupPosition;
137 int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); 146 ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
138 147
139 // The prim hasn't crossed a region boundry so we don't need to worry 148 // The prim hasn't crossed a region boundry so we don't need to worry
140 // about prim counts here 149 // about prim counts here
141 if(oldParcel.Equals(newParcel)) 150 if(oldParcel != null && oldParcel.Equals(newParcel))
142 { 151 {
143 return true; 152 return true;
144 } 153 }
145 154
146 // Prim counts are determined by the location of the root prim. if we're 155 int objectCount = obj.ParentGroup.PrimCount;
147 // moving a child prim, just let it pass 156 int usedPrims = newParcel.PrimCounts.Total;
148 if(!obj.IsRoot) 157 int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount();
149 {
150 return true;
151 }
152 158
153 // TODO: Add Special Case here for temporary prims 159 // TODO: Add Special Case here for temporary prims
154 160