aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneManager.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs56
1 files changed, 56 insertions, 0 deletions
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;
34 34
35namespace OpenSim.Region.Environment.Scenes 35namespace OpenSim.Region.Environment.Scenes
36{ 36{
37 public delegate void ReStartSim(RegionInfo thisregion);
38
37 public class SceneManager 39 public class SceneManager
38 { 40 {
41 public event ReStartSim OnReStartSim;
42
39 private readonly List<Scene> m_localScenes; 43 private readonly List<Scene> m_localScenes;
40 private Scene m_currentScene = null; 44 private Scene m_currentScene = null;
41 45
@@ -72,11 +76,63 @@ namespace OpenSim.Region.Environment.Scenes
72 } 76 }
73 } 77 }
74 78
79 public void Close(Scene cscene)
80 {
81 if (m_localScenes.Contains(cscene))
82 {
83 for (int i = 0; i < m_localScenes.Count; i++)
84 {
85 if (m_localScenes[i].Equals(cscene))
86 {
87
88 m_localScenes[i].Close();
89 }
90 }
91 }
92 }
93
75 public void Add(Scene scene) 94 public void Add(Scene scene)
76 { 95 {
96 scene.OnRestart += handleRestart;
77 m_localScenes.Add(scene); 97 m_localScenes.Add(scene);
98
78 } 99 }
79 100
101 public void handleRestart(RegionInfo rdata)
102 {
103 MainLog.Instance.Error("SCENEMANAGER", "Got Restart message for region:" + rdata.RegionName +" Sending up to main");
104 int RegionSceneElement = -1;
105 for (int i = 0; i < m_localScenes.Count; i++)
106 {
107
108 if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName)
109 RegionSceneElement = i;
110 }
111
112 // Now we make sure the region is no longer known about by the SceneManager
113 // Prevents Duplicates.
114
115 if (RegionSceneElement >= 0)
116 m_localScenes.RemoveAt(RegionSceneElement);
117
118 // Send signal to main that we're restarting this sim.
119 OnReStartSim(rdata);
120 }
121
122 public void SendSimOnlineNotification(ulong regionHandle)
123 {
124
125 for (int i = 0; i < m_localScenes.Count; i++)
126 {
127 if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle)
128 {
129 // Inform other regions to tell their avatar about me
130 m_localScenes[i].OtherRegionUp(m_localScenes[i].RegionInfo);
131 }
132 }
133
134
135 }
80 public void SaveCurrentSceneToXml(string filename) 136 public void SaveCurrentSceneToXml(string filename)
81 { 137 {
82 CurrentOrFirstScene.SavePrimsToXml(filename); 138 CurrentOrFirstScene.SavePrimsToXml(filename);