aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.Region/Scenes/SceneBase.cs')
-rw-r--r--OpenSim/OpenSim.Region/Scenes/SceneBase.cs71
1 files changed, 66 insertions, 5 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
index e650127..4dbd374 100644
--- a/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
+++ b/OpenSim/OpenSim.Region/Scenes/SceneBase.cs
@@ -51,8 +51,11 @@ namespace OpenSim.Region.Scenes
51 protected string m_regionName; 51 protected string m_regionName;
52 protected RegionInfo m_regInfo; 52 protected RegionInfo m_regInfo;
53 53
54 public TerrainEngine Terrain; //TODO: Replace TerrainManager with this. 54 public TerrainEngine Terrain;
55 protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine 55
56 public string m_datastore;
57 public ILocalStorage localStorage;
58
56 protected object m_syncRoot = new object(); 59 protected object m_syncRoot = new object();
57 private uint m_nextLocalId = 8880000; 60 private uint m_nextLocalId = 8880000;
58 protected AssetCache assetCache; 61 protected AssetCache assetCache;
@@ -71,6 +74,51 @@ namespace OpenSim.Region.Scenes
71 /// Loads the World heightmap 74 /// Loads the World heightmap
72 /// </summary> 75 /// </summary>
73 public abstract void LoadWorldMap(); 76 public abstract void LoadWorldMap();
77
78 /// <summary>
79 /// Loads a new storage subsystem from a named library
80 /// </summary>
81 /// <param name="dllName">Storage Library</param>
82 /// <returns>Successful or not</returns>
83 public bool LoadStorageDLL(string dllName)
84 {
85 try
86 {
87 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
88 ILocalStorage store = null;
89
90 foreach (Type pluginType in pluginAssembly.GetTypes())
91 {
92 if (pluginType.IsPublic)
93 {
94 if (!pluginType.IsAbstract)
95 {
96 Type typeInterface = pluginType.GetInterface("ILocalStorage", true);
97
98 if (typeInterface != null)
99 {
100 ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
101 store = plug;
102
103 store.Initialise(this.m_datastore);
104 break;
105 }
106
107 typeInterface = null;
108 }
109 }
110 }
111 pluginAssembly = null;
112 this.localStorage = store;
113 return (store == null);
114 }
115 catch (Exception e)
116 {
117 OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: LoadStorageDLL() - Failed with exception " + e.ToString());
118 return false;
119 }
120 }
121
74 122
75 /// <summary> 123 /// <summary>
76 /// Send the region heightmap to the client 124 /// Send the region heightmap to the client
@@ -87,7 +135,10 @@ namespace OpenSim.Region.Scenes
87 /// <param name="px">Patch coordinate (x) 0..16</param> 135 /// <param name="px">Patch coordinate (x) 0..16</param>
88 /// <param name="py">Patch coordinate (y) 0..16</param> 136 /// <param name="py">Patch coordinate (y) 0..16</param>
89 /// <param name="RemoteClient">The client to send to</param> 137 /// <param name="RemoteClient">The client to send to</param>
90 public abstract void SendLayerData(int px, int py, IClientAPI RemoteClient); 138 public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient)
139 {
140 RemoteClient.SendLayerData(px, py, Terrain.getHeights1D());
141 }
91 142
92 #endregion 143 #endregion
93 144
@@ -114,7 +165,7 @@ namespace OpenSim.Region.Scenes
114 /// <returns></returns> 165 /// <returns></returns>
115 public virtual RegionInfo RegionInfo 166 public virtual RegionInfo RegionInfo
116 { 167 {
117 get { return null; } 168 get { return this.m_regInfo; }
118 } 169 }
119 170
120 public object SyncRoot 171 public object SyncRoot
@@ -131,7 +182,17 @@ namespace OpenSim.Region.Scenes
131 /// <summary> 182 /// <summary>
132 /// Tidy before shutdown 183 /// Tidy before shutdown
133 /// </summary> 184 /// </summary>
134 public abstract void Close(); 185 public virtual void Close()
186 {
187 try
188 {
189 this.localStorage.ShutDown();
190 }
191 catch (Exception e)
192 {
193 OpenSim.Framework.Console.MainLog.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString());
194 }
195 }
135 196
136 #endregion 197 #endregion
137 198