aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneManager.cs
diff options
context:
space:
mode:
authorSean Dague2007-09-17 12:52:03 +0000
committerSean Dague2007-09-17 12:52:03 +0000
commitb8d9737a47696952bedec33dface8f18df47341f (patch)
tree9279f45510f8a9285ac5b9c9165ab6c741009eac /OpenSim/Region/Environment/Scenes/SceneManager.cs
parentI think this is the last bits for a consistant pristine (diff)
downloadopensim-SC_OLD-b8d9737a47696952bedec33dface8f18df47341f.zip
opensim-SC_OLD-b8d9737a47696952bedec33dface8f18df47341f.tar.gz
opensim-SC_OLD-b8d9737a47696952bedec33dface8f18df47341f.tar.bz2
opensim-SC_OLD-b8d9737a47696952bedec33dface8f18df47341f.tar.xz
fixing me some line endings
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneManager.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs474
1 files changed, 237 insertions, 237 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index dfac406..4a99a80 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -1,237 +1,237 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using System; 2using System;
3using OpenSim.Framework.Console; 3using OpenSim.Framework.Console;
4using OpenSim.Framework.Types; 4using OpenSim.Framework.Types;
5 5
6namespace OpenSim.Region.Environment.Scenes 6namespace OpenSim.Region.Environment.Scenes
7{ 7{
8 public class SceneManager 8 public class SceneManager
9 { 9 {
10 private readonly List<Scene> m_localScenes; 10 private readonly List<Scene> m_localScenes;
11 private Scene m_currentScene = null; 11 private Scene m_currentScene = null;
12 public Scene CurrentScene 12 public Scene CurrentScene
13 { 13 {
14 get 14 get
15 { 15 {
16 return m_currentScene; 16 return m_currentScene;
17 } 17 }
18 } 18 }
19 19
20 private Scene CurrentOrFirstScene 20 private Scene CurrentOrFirstScene
21 { 21 {
22 get 22 get
23 { 23 {
24 if (m_currentScene == null) 24 if (m_currentScene == null)
25 { 25 {
26 return m_localScenes[0]; 26 return m_localScenes[0];
27 } 27 }
28 else 28 else
29 { 29 {
30 return m_currentScene; 30 return m_currentScene;
31 } 31 }
32 } 32 }
33 } 33 }
34 34
35 public SceneManager() 35 public SceneManager()
36 { 36 {
37 m_localScenes = new List<Scene>(); 37 m_localScenes = new List<Scene>();
38 } 38 }
39 39
40 public void Close() 40 public void Close()
41 { 41 {
42 for (int i = 0; i < m_localScenes.Count; i++) 42 for (int i = 0; i < m_localScenes.Count; i++)
43 { 43 {
44 m_localScenes[i].Close(); 44 m_localScenes[i].Close();
45 } 45 }
46 } 46 }
47 47
48 public void Add(Scene scene) 48 public void Add(Scene scene)
49 { 49 {
50 m_localScenes.Add(scene); 50 m_localScenes.Add(scene);
51 } 51 }
52 52
53 public void SavePrimsToXml(string filename) 53 public void SavePrimsToXml(string filename)
54 { 54 {
55 CurrentOrFirstScene.SavePrimsToXml(filename); 55 CurrentOrFirstScene.SavePrimsToXml(filename);
56 } 56 }
57 57
58 public void LoadPrimsFromXml(string filename) 58 public void LoadPrimsFromXml(string filename)
59 { 59 {
60 CurrentOrFirstScene.LoadPrimsFromXml(filename); 60 CurrentOrFirstScene.LoadPrimsFromXml(filename);
61 } 61 }
62 62
63 public bool RunTerrainCmd(string[] cmdparams, ref string result) 63 public bool RunTerrainCmd(string[] cmdparams, ref string result)
64 { 64 {
65 if (m_currentScene == null) 65 if (m_currentScene == null)
66 { 66 {
67 bool success = true; 67 bool success = true;
68 foreach (Scene scene in m_localScenes) 68 foreach (Scene scene in m_localScenes)
69 { 69 {
70 if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) 70 if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
71 { 71 {
72 success = false; 72 success = false;
73 } 73 }
74 } 74 }
75 75
76 return success; 76 return success;
77 } 77 }
78 else 78 else
79 { 79 {
80 return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); 80 return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName);
81 } 81 }
82 } 82 }
83 83
84 public void SendCommandToScripts(string[] cmdparams) 84 public void SendCommandToScripts(string[] cmdparams)
85 { 85 {
86 ForEach(delegate(Scene scene) 86 ForEach(delegate(Scene scene)
87 { 87 {
88 scene.SendCommandToScripts(cmdparams); 88 scene.SendCommandToScripts(cmdparams);
89 }); 89 });
90 } 90 }
91 91
92 public void BypassPermissions(bool bypassPermissions) 92 public void BypassPermissions(bool bypassPermissions)
93 { 93 {
94 ForEach(delegate(Scene scene) 94 ForEach(delegate(Scene scene)
95 { 95 {
96 scene.PermissionsMngr.BypassPermissions = bypassPermissions; 96 scene.PermissionsMngr.BypassPermissions = bypassPermissions;
97 }); 97 });
98 } 98 }
99 99
100 private void ForEach(Action<Scene> func) 100 private void ForEach(Action<Scene> func)
101 { 101 {
102 if (m_currentScene == null) 102 if (m_currentScene == null)
103 { 103 {
104 m_localScenes.ForEach(func); 104 m_localScenes.ForEach(func);
105 } 105 }
106 else 106 else
107 { 107 {
108 func(m_currentScene); 108 func(m_currentScene);
109 } 109 }
110 } 110 }
111 111
112 public void Backup() 112 public void Backup()
113 { 113 {
114 ForEach(delegate(Scene scene) 114 ForEach(delegate(Scene scene)
115 { 115 {
116 scene.Backup(); 116 scene.Backup();
117 }); 117 });
118 } 118 }
119 119
120 public void HandleAlertCommand(string[] cmdparams) 120 public void HandleAlertCommand(string[] cmdparams)
121 { 121 {
122 ForEach(delegate(Scene scene) 122 ForEach(delegate(Scene scene)
123 { 123 {
124 scene.HandleAlertCommand(cmdparams); 124 scene.HandleAlertCommand(cmdparams);
125 }); 125 });
126 } 126 }
127 127
128 public bool TrySetCurrentRegion(string regionName) 128 public bool TrySetCurrentRegion(string regionName)
129 { 129 {
130 if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) 130 if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0))
131 { 131 {
132 m_currentScene = null; 132 m_currentScene = null;
133 return true; 133 return true;
134 } 134 }
135 else 135 else
136 { 136 {
137 Console.WriteLine("Searching for Region: '" + regionName + "'"); 137 Console.WriteLine("Searching for Region: '" + regionName + "'");
138 Scene foundScene = null; 138 Scene foundScene = null;
139 139
140 foreach (Scene scene in m_localScenes) 140 foreach (Scene scene in m_localScenes)
141 { 141 {
142 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) 142 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
143 { 143 {
144 m_currentScene = scene; 144 m_currentScene = scene;
145 return true; 145 return true;
146 } 146 }
147 } 147 }
148 148
149 return false; 149 return false;
150 } 150 }
151 } 151 }
152 152
153 public void DebugPacket(LogBase log, int newDebug) 153 public void DebugPacket(LogBase log, int newDebug)
154 { 154 {
155 ForEach(delegate(Scene scene) 155 ForEach(delegate(Scene scene)
156 { 156 {
157 foreach (EntityBase entity in scene.Entities.Values) 157 foreach (EntityBase entity in scene.Entities.Values)
158 { 158 {
159 if (entity is ScenePresence) 159 if (entity is ScenePresence)
160 { 160 {
161 ScenePresence scenePrescence = entity as ScenePresence; 161 ScenePresence scenePrescence = entity as ScenePresence;
162 if (!scenePrescence.childAgent) 162 if (!scenePrescence.childAgent)
163 { 163 {
164 log.Error(String.Format("Packet debug for {0} {1} set to {2}", 164 log.Error(String.Format("Packet debug for {0} {1} set to {2}",
165 scenePrescence.Firstname, scenePrescence.Lastname, 165 scenePrescence.Firstname, scenePrescence.Lastname,
166 newDebug)); 166 newDebug));
167 167
168 scenePrescence.ControllingClient.SetDebug(newDebug); 168 scenePrescence.ControllingClient.SetDebug(newDebug);
169 } 169 }
170 } 170 }
171 } 171 }
172 }); 172 });
173 } 173 }
174 174
175 public List<ScenePresence> GetAvatars() 175 public List<ScenePresence> GetAvatars()
176 { 176 {
177 List<ScenePresence> avatars = new List<ScenePresence>(); 177 List<ScenePresence> avatars = new List<ScenePresence>();
178 178
179 ForEach(delegate(Scene scene) 179 ForEach(delegate(Scene scene)
180 { 180 {
181 foreach (EntityBase entity in scene.Entities.Values) 181 foreach (EntityBase entity in scene.Entities.Values)
182 { 182 {
183 if (entity is ScenePresence) 183 if (entity is ScenePresence)
184 { 184 {
185 ScenePresence scenePrescence = entity as ScenePresence; 185 ScenePresence scenePrescence = entity as ScenePresence;
186 if (!scenePrescence.childAgent) 186 if (!scenePrescence.childAgent)
187 { 187 {
188 avatars.Add(scenePrescence); 188 avatars.Add(scenePrescence);
189 } 189 }
190 } 190 }
191 } 191 }
192 }); 192 });
193 193
194 return avatars; 194 return avatars;
195 } 195 }
196 196
197 public RegionInfo GetRegionInfo(ulong regionHandle) 197 public RegionInfo GetRegionInfo(ulong regionHandle)
198 { 198 {
199 foreach (Scene scene in m_localScenes) 199 foreach (Scene scene in m_localScenes)
200 { 200 {
201 if (scene.RegionInfo.RegionHandle == regionHandle) 201 if (scene.RegionInfo.RegionHandle == regionHandle)
202 { 202 {
203 return scene.RegionInfo; 203 return scene.RegionInfo;
204 } 204 }
205 } 205 }
206 206
207 return null; 207 return null;
208 } 208 }
209 209
210 public void SetTimePhase(int timePhase) 210 public void SetTimePhase(int timePhase)
211 { 211 {
212 ForEach(delegate(Scene scene) 212 ForEach(delegate(Scene scene)
213 { 213 {
214 scene.SetTimePhase( 214 scene.SetTimePhase(
215 timePhase) 215 timePhase)
216 ; 216 ;
217 }); 217 });
218 } 218 }
219 219
220 220
221 public void ForceClientUpdate() 221 public void ForceClientUpdate()
222 { 222 {
223 ForEach(delegate(Scene scene) 223 ForEach(delegate(Scene scene)
224 { 224 {
225 scene.ForceClientUpdate(); 225 scene.ForceClientUpdate();
226 }); 226 });
227 } 227 }
228 228
229 public void HandleEditCommand(string[] cmdparams) 229 public void HandleEditCommand(string[] cmdparams)
230 { 230 {
231 ForEach(delegate(Scene scene) 231 ForEach(delegate(Scene scene)
232 { 232 {
233 scene.HandleEditCommand(cmdparams); 233 scene.HandleEditCommand(cmdparams);
234 }); 234 });
235 } 235 }
236 } 236 }
237} 237}