diff options
author | Sean Dague | 2008-04-21 12:42:56 +0000 |
---|---|---|
committer | Sean Dague | 2008-04-21 12:42:56 +0000 |
commit | bf1580fba45df7624180b07599c8170074500c99 (patch) | |
tree | 696a69c94554f0789b123c82fb34c658e9a0b6af /OpenSim/Region/Environment | |
parent | * Various refactorings. (diff) | |
download | opensim-SC-bf1580fba45df7624180b07599c8170074500c99.zip opensim-SC-bf1580fba45df7624180b07599c8170074500c99.tar.gz opensim-SC-bf1580fba45df7624180b07599c8170074500c99.tar.bz2 opensim-SC-bf1580fba45df7624180b07599c8170074500c99.tar.xz |
From: Dr Scofield <hud@zurich.ibm.com>
the attached patch set is centered around RemoteAdminPlugin and focuses
mainly on making it more robust (i.e. more parameter checking and better
error reporting) but also we've re-implemented the LoadTerrain stuff that
got disabled during the terrain code reworking:
* missing PostInitialize() calls on region modules that were loaded
for regions created via RemoteAdmin's CreateRegion XmlRpc call
* re-implements RemoteAdmin's LoadTerrain XmlRpc call (probably lost
during the TerrainModule rework)
* adds lots more parameter checking and error reporting to RemoteAdmin
* adds a read-only property to RegionApplicationBase so that we can
access the CommsManager
* adds Exceptions to TerrainModule so that we get better error case
feedback (and can report more meaningful errors in turn)
* adds a CheckForTerrainUpdate() call to
TerrainModule.LoadFromFile() to make terrain changes effective
* adds TryGetCurrentScene(LLUUID) to SceneManager so that we can
retrieve Scenes not only by name but also by LLUUID
cheers,
dr scofield
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/ModuleLoader.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneManager.cs | 16 |
3 files changed, 31 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 43ca7bd..52a6fbd 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -62,14 +62,16 @@ namespace OpenSim.Region.Environment | |||
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public void PickupModules(Scene scene, string moduleDir) | 65 | public List<IRegionModule> PickupModules(Scene scene, string moduleDir) |
66 | { | 66 | { |
67 | DirectoryInfo dir = new DirectoryInfo(moduleDir); | 67 | DirectoryInfo dir = new DirectoryInfo(moduleDir); |
68 | List<IRegionModule> modules = new List<IRegionModule>(); | ||
68 | 69 | ||
69 | foreach (FileInfo fileInfo in dir.GetFiles("*.dll")) | 70 | foreach (FileInfo fileInfo in dir.GetFiles("*.dll")) |
70 | { | 71 | { |
71 | LoadRegionModules(fileInfo.FullName, scene); | 72 | modules.AddRange(LoadRegionModules(fileInfo.FullName, scene)); |
72 | } | 73 | } |
74 | return modules; | ||
73 | } | 75 | } |
74 | 76 | ||
75 | public void LoadDefaultSharedModules() | 77 | public void LoadDefaultSharedModules() |
@@ -190,9 +192,10 @@ namespace OpenSim.Region.Environment | |||
190 | } | 192 | } |
191 | } | 193 | } |
192 | 194 | ||
193 | public void LoadRegionModules(string dllName, Scene scene) | 195 | public List<IRegionModule> LoadRegionModules(string dllName, Scene scene) |
194 | { | 196 | { |
195 | IRegionModule[] modules = LoadModules(dllName); | 197 | IRegionModule[] modules = LoadModules(dllName); |
198 | List<IRegionModule> initializedModules = new List<IRegionModule>(); | ||
196 | 199 | ||
197 | if (modules.Length > 0) | 200 | if (modules.Length > 0) |
198 | { | 201 | { |
@@ -203,6 +206,7 @@ namespace OpenSim.Region.Environment | |||
203 | { | 206 | { |
204 | m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name); | 207 | m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name); |
205 | InitializeModule(module, scene); | 208 | InitializeModule(module, scene); |
209 | initializedModules.Add(module); | ||
206 | } | 210 | } |
207 | else | 211 | else |
208 | { | 212 | { |
@@ -211,6 +215,7 @@ namespace OpenSim.Region.Environment | |||
211 | } | 215 | } |
212 | } | 216 | } |
213 | } | 217 | } |
218 | return initializedModules; | ||
214 | } | 219 | } |
215 | 220 | ||
216 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) | 221 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs index 987c3d0..f758c91 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | |||
@@ -178,20 +178,24 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
178 | { | 178 | { |
179 | m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value + | 179 | m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value + |
180 | " parser does not support file loading. (May be save only)"); | 180 | " parser does not support file loading. (May be save only)"); |
181 | return; | 181 | throw new Exception(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value)); |
182 | } | 182 | } |
183 | catch (FileNotFoundException) | 183 | catch (FileNotFoundException) |
184 | { | 184 | { |
185 | m_log.Error( | 185 | m_log.Error( |
186 | "[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)"); | 186 | "[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)"); |
187 | return; | 187 | throw new Exception(String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", |
188 | filename)); | ||
188 | } | 189 | } |
189 | } | 190 | } |
191 | CheckForTerrainUpdates(); | ||
190 | m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully"); | 192 | m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully"); |
191 | return; | 193 | return; |
192 | } | 194 | } |
193 | } | 195 | } |
194 | m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader availible for that format."); | 196 | m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader availible for that format."); |
197 | throw new Exception(String.Format("unable to load heightmap from file {0}: no loader available for that format", | ||
198 | filename)); | ||
195 | } | 199 | } |
196 | 200 | ||
197 | /// <summary> | 201 | /// <summary> |
@@ -214,6 +218,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
214 | catch (NotImplementedException) | 218 | catch (NotImplementedException) |
215 | { | 219 | { |
216 | m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented."); | 220 | m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented."); |
221 | throw new Exception(String.Format("unable to save heightmap: {0}: saving of this file format not implemented")); | ||
217 | } | 222 | } |
218 | } | 223 | } |
219 | 224 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 61a4eae..40e313a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -250,6 +250,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
250 | } | 250 | } |
251 | } | 251 | } |
252 | 252 | ||
253 | public bool TrySetCurrentScene(LLUUID regionID) | ||
254 | { | ||
255 | Console.WriteLine("Searching for Region: '{0}'", regionID.ToString()); | ||
256 | |||
257 | foreach (Scene scene in m_localScenes) | ||
258 | { | ||
259 | if (scene.RegionInfo.RegionID == regionID) | ||
260 | { | ||
261 | m_currentScene = scene; | ||
262 | return true; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | return false; | ||
267 | } | ||
268 | |||
253 | public bool TryGetScene(string regionName, out Scene scene) | 269 | public bool TryGetScene(string regionName, out Scene scene) |
254 | { | 270 | { |
255 | foreach (Scene mscene in m_localScenes) | 271 | foreach (Scene mscene in m_localScenes) |