diff options
author | Teravus Ovares | 2007-11-25 04:52:14 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-25 04:52:14 +0000 |
commit | d263a044b1ebb13477b2b391637ccc2da4368838 (patch) | |
tree | 6288ef8e8f2a1c073705b23db8aba8603a28c34d /OpenSim/Region/Environment/Scenes/SceneManager.cs | |
parent | Ignore nullreferenceexception in removeclient. The avatar is already gone. (diff) | |
download | opensim-SC_OLD-d263a044b1ebb13477b2b391637ccc2da4368838.zip opensim-SC_OLD-d263a044b1ebb13477b2b391637ccc2da4368838.tar.gz opensim-SC_OLD-d263a044b1ebb13477b2b391637ccc2da4368838.tar.bz2 opensim-SC_OLD-d263a044b1ebb13477b2b391637ccc2da4368838.tar.xz |
* 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.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneManager.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneManager.cs | 56 |
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 | ||
35 | namespace OpenSim.Region.Environment.Scenes | 35 | namespace 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); |