From d263a044b1ebb13477b2b391637ccc2da4368838 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 25 Nov 2007 04:52:14 +0000 Subject: * Added the ability to restart your individual sims from within them using the estate tools. * The sims properly restart, however they don't yet notify the existing avatars that they are up. To see the sim again, you'll need to log-out and back in until I can figure out how to get the proper data to the sims and to the avatar so they reconnect again. --- OpenSim/Region/Environment/Scenes/SceneManager.cs | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/SceneManager.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index e71d946..4360d97 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -34,8 +34,12 @@ using OpenSim.Framework.Console; namespace OpenSim.Region.Environment.Scenes { + public delegate void ReStartSim(RegionInfo thisregion); + public class SceneManager { + public event ReStartSim OnReStartSim; + private readonly List m_localScenes; private Scene m_currentScene = null; @@ -72,11 +76,63 @@ namespace OpenSim.Region.Environment.Scenes } } + public void Close(Scene cscene) + { + if (m_localScenes.Contains(cscene)) + { + for (int i = 0; i < m_localScenes.Count; i++) + { + if (m_localScenes[i].Equals(cscene)) + { + + m_localScenes[i].Close(); + } + } + } + } + public void Add(Scene scene) { + scene.OnRestart += handleRestart; m_localScenes.Add(scene); + } + public void handleRestart(RegionInfo rdata) + { + MainLog.Instance.Error("SCENEMANAGER", "Got Restart message for region:" + rdata.RegionName +" Sending up to main"); + int RegionSceneElement = -1; + for (int i = 0; i < m_localScenes.Count; i++) + { + + if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) + RegionSceneElement = i; + } + + // Now we make sure the region is no longer known about by the SceneManager + // Prevents Duplicates. + + if (RegionSceneElement >= 0) + m_localScenes.RemoveAt(RegionSceneElement); + + // Send signal to main that we're restarting this sim. + OnReStartSim(rdata); + } + + public void SendSimOnlineNotification(ulong regionHandle) + { + + for (int i = 0; i < m_localScenes.Count; i++) + { + if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) + { + // Inform other regions to tell their avatar about me + m_localScenes[i].OtherRegionUp(m_localScenes[i].RegionInfo); + } + } + + + } public void SaveCurrentSceneToXml(string filename) { CurrentOrFirstScene.SavePrimsToXml(filename); -- cgit v1.1