diff options
author | lbsa71 | 2007-11-29 15:27:57 +0000 |
---|---|---|
committer | lbsa71 | 2007-11-29 15:27:57 +0000 |
commit | 7704bb6f63f608df79fee2c3dcea7d5deabeee17 (patch) | |
tree | 63ece08049e04720639f1396d8d7ca6597e5089a /OpenSim/Region/Environment/Scenes/Scene.cs | |
parent | * Thanks to _SomeOne_, Server side permissions on object editing. Be aware, ... (diff) | |
download | opensim-SC-7704bb6f63f608df79fee2c3dcea7d5deabeee17.zip opensim-SC-7704bb6f63f608df79fee2c3dcea7d5deabeee17.tar.gz opensim-SC-7704bb6f63f608df79fee2c3dcea7d5deabeee17.tar.bz2 opensim-SC-7704bb6f63f608df79fee2c3dcea7d5deabeee17.tar.xz |
* Fixed neighbour range bug
* Various refactorings
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 9ea92b0..2d74913 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
74 | public bool m_physicalPrim; | 74 | public bool m_physicalPrim; |
75 | public bool m_sendTasksToChild; | 75 | public bool m_sendTasksToChild; |
76 | private int m_RestartTimerCounter; | 76 | private int m_RestartTimerCounter; |
77 | private Timer t_restartTimer = new Timer(15000); // Wait before firing | 77 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
78 | private int m_incrementsof15seconds = 0; | 78 | private int m_incrementsof15seconds = 0; |
79 | 79 | ||
80 | protected ModuleLoader m_moduleLoader; | 80 | protected ModuleLoader m_moduleLoader; |
@@ -137,16 +137,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
137 | 137 | ||
138 | private readonly EstateManager m_estateManager; | 138 | private readonly EstateManager m_estateManager; |
139 | 139 | ||
140 | private PhysicsScene phyScene | 140 | public PhysicsScene PhysicsScene |
141 | { | 141 | { |
142 | set { m_innerScene.PhyScene = value; } | 142 | set { m_innerScene.PhysicsScene = value; } |
143 | get { return (m_innerScene.PhyScene); } | 143 | get { return (m_innerScene.PhysicsScene); } |
144 | } | ||
145 | |||
146 | public PhysicsScene PhysScene | ||
147 | { | ||
148 | set { m_innerScene.PhyScene = value; } | ||
149 | get { return (m_innerScene.PhyScene); } | ||
150 | } | 144 | } |
151 | 145 | ||
152 | public object SyncRoot | 146 | public object SyncRoot |
@@ -239,7 +233,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
239 | // | 233 | // |
240 | // Out of memory | 234 | // Out of memory |
241 | // Operating system has killed the plugin | 235 | // Operating system has killed the plugin |
242 | m_innerScene.UnRecoverableError += restartNOW; | 236 | m_innerScene.UnRecoverableError += RestartNow; |
243 | 237 | ||
244 | m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo); | 238 | m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo); |
245 | 239 | ||
@@ -275,9 +269,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
275 | { | 269 | { |
276 | // Another region is up. We have to tell all our ScenePresences about it | 270 | // Another region is up. We have to tell all our ScenePresences about it |
277 | // This fails to get the desired effect and needs further work. | 271 | // This fails to get the desired effect and needs further work. |
272 | |||
278 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) | 273 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) |
279 | { | 274 | { |
280 | if (Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1 || Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1) | 275 | if ((Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1) && (Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1)) |
281 | { | 276 | { |
282 | if (!(m_regionRestartNotifyList.Contains(otherRegion))) | 277 | if (!(m_regionRestartNotifyList.Contains(otherRegion))) |
283 | { | 278 | { |
@@ -285,7 +280,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
285 | 280 | ||
286 | m_restartWaitTimer.Interval= 50000; | 281 | m_restartWaitTimer.Interval= 50000; |
287 | m_restartWaitTimer.AutoReset = false; | 282 | m_restartWaitTimer.AutoReset = false; |
288 | m_restartWaitTimer.Elapsed += new ElapsedEventHandler(restart_Notify_Wait_Elapsed); | 283 | m_restartWaitTimer.Elapsed += new ElapsedEventHandler(RestartNotifyWaitElapsed); |
289 | m_restartWaitTimer.Start(); | 284 | m_restartWaitTimer.Start(); |
290 | } | 285 | } |
291 | } | 286 | } |
@@ -302,25 +297,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
302 | { | 297 | { |
303 | if (seconds < 15) | 298 | if (seconds < 15) |
304 | { | 299 | { |
305 | t_restartTimer.Stop(); | 300 | m_restartTimer.Stop(); |
306 | SendGeneralAlert("Restart Aborted"); | 301 | SendGeneralAlert("Restart Aborted"); |
307 | } | 302 | } |
308 | else | 303 | else |
309 | { | 304 | { |
310 | t_restartTimer.Interval = 15000; | 305 | m_restartTimer.Interval = 15000; |
311 | m_incrementsof15seconds = (int) seconds/15; | 306 | m_incrementsof15seconds = (int) seconds/15; |
312 | m_RestartTimerCounter = 0; | 307 | m_RestartTimerCounter = 0; |
313 | t_restartTimer.AutoReset = true; | 308 | m_restartTimer.AutoReset = true; |
314 | t_restartTimer.Elapsed += new ElapsedEventHandler(restartTimer_Elapsed); | 309 | m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); |
315 | MainLog.Instance.Error("REGION", "Restarting Region in " + (seconds / 60) + " minutes"); | 310 | MainLog.Instance.Error("REGION", "Restarting Region in " + (seconds / 60) + " minutes"); |
316 | t_restartTimer.Start(); | 311 | m_restartTimer.Start(); |
317 | SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes"); | 312 | SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes"); |
318 | } | 313 | } |
319 | 314 | ||
320 | 315 | ||
321 | } | 316 | } |
322 | 317 | ||
323 | public void restartTimer_Elapsed(object sender, ElapsedEventArgs e) | 318 | public void RestartTimer_Elapsed(object sender, ElapsedEventArgs e) |
324 | { | 319 | { |
325 | m_RestartTimerCounter++; | 320 | m_RestartTimerCounter++; |
326 | if (m_RestartTimerCounter <= m_incrementsof15seconds) | 321 | if (m_RestartTimerCounter <= m_incrementsof15seconds) |
@@ -330,14 +325,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
330 | } | 325 | } |
331 | else | 326 | else |
332 | { | 327 | { |
333 | t_restartTimer.Stop(); | 328 | m_restartTimer.Stop(); |
334 | t_restartTimer.AutoReset = false; | 329 | m_restartTimer.AutoReset = false; |
335 | restartNOW(); | 330 | RestartNow(); |
336 | } | 331 | } |
337 | 332 | ||
338 | } | 333 | } |
339 | 334 | ||
340 | public void restartNOW() | 335 | public void RestartNow() |
341 | { | 336 | { |
342 | MainLog.Instance.Error("REGION", "Closing"); | 337 | MainLog.Instance.Error("REGION", "Closing"); |
343 | Close(); | 338 | Close(); |
@@ -345,7 +340,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
345 | base.Restart(0); | 340 | base.Restart(0); |
346 | } | 341 | } |
347 | 342 | ||
348 | public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) | 343 | public void RestartNotifyWaitElapsed(object sender, ElapsedEventArgs e) |
349 | { | 344 | { |
350 | m_restartWaitTimer.Stop(); | 345 | m_restartWaitTimer.Stop(); |
351 | foreach (RegionInfo region in m_regionRestartNotifyList) | 346 | foreach (RegionInfo region in m_regionRestartNotifyList) |
@@ -551,7 +546,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
551 | { | 546 | { |
552 | lock (SyncRoot) | 547 | lock (SyncRoot) |
553 | { | 548 | { |
554 | phyScene.SetTerrain(Terrain.GetHeights1D()); | 549 | PhysicsScene.SetTerrain(Terrain.GetHeights1D()); |
555 | } | 550 | } |
556 | 551 | ||
557 | m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); | 552 | m_storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD(), RegionInfo.RegionID); |
@@ -748,7 +743,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
748 | SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); | 743 | SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); |
749 | bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); | 744 | bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); |
750 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) | 745 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) |
751 | rootPart.PhysActor = phyScene.AddPrimShape( | 746 | rootPart.PhysActor = PhysicsScene.AddPrimShape( |
752 | rootPart.Name, | 747 | rootPart.Name, |
753 | rootPart.Shape, | 748 | rootPart.Shape, |
754 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, | 749 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, |
@@ -852,7 +847,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
852 | { | 847 | { |
853 | 848 | ||
854 | rootPart.PhysActor = | 849 | rootPart.PhysActor = |
855 | phyScene.AddPrimShape( | 850 | PhysicsScene.AddPrimShape( |
856 | rootPart.Name, | 851 | rootPart.Name, |
857 | rootPart.Shape, | 852 | rootPart.Shape, |
858 | new PhysicsVector(pos.X, pos.Y, pos.Z), | 853 | new PhysicsVector(pos.X, pos.Y, pos.Z), |