From b7d596a6af51bea7dba642cdc768ac5ff77af5f3 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 28 Nov 2007 06:18:07 +0000 Subject: * Restaring the sim works fine in grid mode now. Sims announce themselves to their neighbors when they start up. Neighbors get this message and tell their agents that there's a new sim up. * Certain unrecoverable physics based crashes in ODE are now hooked up to the 'restart the sim' routine. --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 53 +++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/InnerScene.cs') diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 8f7cbee..c1acde4 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -11,8 +11,14 @@ using OpenSim.Region.Physics.Manager; namespace OpenSim.Region.Environment.Scenes { + public delegate void PhysicsCrash(); + public class InnerScene { + #region Events + public event PhysicsCrash UnRecoverableError; + #endregion + #region Fields public Dictionary ScenePresences; public Dictionary SceneObjects; @@ -26,17 +32,47 @@ namespace OpenSim.Region.Environment.Scenes internal object m_syncRoot = new object(); - public PhysicsScene PhyScene; + public PhysicsScene _PhyScene; #endregion public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr) { + m_parentScene = parent; m_regInfo = regInfo; PermissionsMngr = permissionsMngr; QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256); QuadTree.Subdivide(); QuadTree.Subdivide(); + + + } + public PhysicsScene PhyScene + { + get + { return _PhyScene; } + set + { + // If we're not doing the initial set + // Then we've got to remove the previous + // event handler + try + { + _PhyScene.OnPhysicsCrash -= physicsBasedCrash; + } + catch (System.NullReferenceException) + { + // This occurs when storing to _PhyScene the first time. + // Is there a better way to check the event handler before + // getting here + // This can be safely ignored. We're setting the first inital + // there are no event handler's registered. + } + + _PhyScene = value; + + _PhyScene.OnPhysicsCrash += physicsBasedCrash; + } } public void Close() @@ -55,9 +91,9 @@ namespace OpenSim.Region.Environment.Scenes // PhysX does this (runs in the background). - if (PhyScene.IsThreaded) + if (_PhyScene.IsThreaded) { - PhyScene.GetResults(); + _PhyScene.GetResults(); } } @@ -75,7 +111,7 @@ namespace OpenSim.Region.Environment.Scenes { lock (m_syncRoot) { - PhyScene.Simulate((float)elapsed); + _PhyScene.Simulate((float)elapsed); } } @@ -338,6 +374,15 @@ namespace OpenSim.Region.Environment.Scenes #region Other Methods + + public void physicsBasedCrash() + { + if (UnRecoverableError != null) + { + UnRecoverableError(); + } + } + public LLUUID ConvertLocalIDToFullID(uint localID) { SceneObjectGroup group = GetGroupByPrim(localID); -- cgit v1.1