diff options
author | Justin Clark-Casey (justincc) | 2014-01-28 00:23:10 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-01-28 00:23:10 +0000 |
commit | cd35d298faa06382e87297d464badd5a1cf231af (patch) | |
tree | c9657bc670440c45386d6b3f9631e5dcaedad33b /OpenSim/Region | |
parent | Reinsert attachments list taking code in SP.MakeRootAgent() (diff) | |
parent | Added osGetRegionSize(), which returns the region size in meters and recogniz... (diff) | |
download | opensim-SC_OLD-cd35d298faa06382e87297d464badd5a1cf231af.zip opensim-SC_OLD-cd35d298faa06382e87297d464badd5a1cf231af.tar.gz opensim-SC_OLD-cd35d298faa06382e87297d464badd5a1cf231af.tar.bz2 opensim-SC_OLD-cd35d298faa06382e87297d464badd5a1cf231af.tar.xz |
Merge branch 'justincc-master'
Diffstat (limited to 'OpenSim/Region')
4 files changed, 75 insertions, 24 deletions
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index e3e0c01..52e520c 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs | |||
@@ -124,7 +124,7 @@ namespace OpenSim | |||
124 | else | 124 | else |
125 | { | 125 | { |
126 | Application.iniFilePath = Path.GetFullPath( | 126 | Application.iniFilePath = Path.GetFullPath( |
127 | Path.Combine(Util.configDir(), iniFileName)); | 127 | Path.Combine(Util.configDir(), iniFileName)); |
128 | 128 | ||
129 | if (!File.Exists(Application.iniFilePath)) | 129 | if (!File.Exists(Application.iniFilePath)) |
130 | { | 130 | { |
@@ -139,12 +139,29 @@ namespace OpenSim | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | m_config = new OpenSimConfigSource(); | ||
143 | m_config.Source = new IniConfigSource(); | ||
144 | m_config.Source.Merge(DefaultConfig()); | ||
145 | |||
146 | m_log.Info("[CONFIG]: Reading configuration settings"); | ||
147 | |||
148 | for (int i = 0 ; i < sources.Count ; i++) | ||
149 | { | ||
150 | if (ReadConfig(m_config, sources[i])) | ||
151 | { | ||
152 | iniFileExists = true; | ||
153 | AddIncludes(m_config, sources); | ||
154 | } | ||
155 | } | ||
156 | |||
157 | // Override distro settings with contents of inidirectory | ||
142 | string iniDirName = startupConfig.GetString("inidirectory", "config"); | 158 | string iniDirName = startupConfig.GetString("inidirectory", "config"); |
143 | string iniDirPath = Path.Combine(Util.configDir(), iniDirName); | 159 | string iniDirPath = Path.Combine(Util.configDir(), iniDirName); |
144 | 160 | ||
145 | if (Directory.Exists(iniDirPath)) | 161 | if (Directory.Exists(iniDirPath)) |
146 | { | 162 | { |
147 | m_log.InfoFormat("Searching folder {0} for config ini files", iniDirPath); | 163 | m_log.InfoFormat("[CONFIG]: Searching folder {0} for config ini files", iniDirPath); |
164 | List<string> overrideSources = new List<string>(); | ||
148 | 165 | ||
149 | string[] fileEntries = Directory.GetFiles(iniDirName); | 166 | string[] fileEntries = Directory.GetFiles(iniDirName); |
150 | foreach (string filePath in fileEntries) | 167 | foreach (string filePath in fileEntries) |
@@ -152,33 +169,38 @@ namespace OpenSim | |||
152 | if (Path.GetExtension(filePath).ToLower() == ".ini") | 169 | if (Path.GetExtension(filePath).ToLower() == ".ini") |
153 | { | 170 | { |
154 | if (!sources.Contains(Path.GetFullPath(filePath))) | 171 | if (!sources.Contains(Path.GetFullPath(filePath))) |
172 | { | ||
173 | overrideSources.Add(Path.GetFullPath(filePath)); | ||
174 | // put it in sources too, to avoid circularity | ||
155 | sources.Add(Path.GetFullPath(filePath)); | 175 | sources.Add(Path.GetFullPath(filePath)); |
176 | } | ||
156 | } | 177 | } |
157 | } | 178 | } |
158 | } | ||
159 | 179 | ||
160 | m_config = new OpenSimConfigSource(); | ||
161 | m_config.Source = new IniConfigSource(); | ||
162 | m_config.Source.Merge(DefaultConfig()); | ||
163 | 180 | ||
164 | m_log.Info("[CONFIG]: Reading configuration settings"); | 181 | if (overrideSources.Count > 0) |
182 | { | ||
183 | OpenSimConfigSource overrideConfig = new OpenSimConfigSource(); | ||
184 | overrideConfig.Source = new IniConfigSource(); | ||
185 | |||
186 | for (int i = 0 ; i < overrideSources.Count ; i++) | ||
187 | { | ||
188 | if (ReadConfig(overrideConfig, overrideSources[i])) | ||
189 | { | ||
190 | iniFileExists = true; | ||
191 | AddIncludes(overrideConfig, overrideSources); | ||
192 | } | ||
193 | } | ||
194 | m_config.Source.Merge(overrideConfig.Source); | ||
195 | } | ||
196 | } | ||
165 | 197 | ||
166 | if (sources.Count == 0) | 198 | if (sources.Count == 0) |
167 | { | 199 | { |
168 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); | 200 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); |
169 | Environment.Exit(1); | 201 | Environment.Exit(1); |
170 | } | 202 | } |
171 | 203 | else if (!iniFileExists) | |
172 | for (int i = 0 ; i < sources.Count ; i++) | ||
173 | { | ||
174 | if (ReadConfig(sources[i])) | ||
175 | { | ||
176 | iniFileExists = true; | ||
177 | AddIncludes(sources); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | if (!iniFileExists) | ||
182 | { | 204 | { |
183 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); | 205 | m_log.FatalFormat("[CONFIG]: Could not load any configuration"); |
184 | m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); | 206 | m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!"); |
@@ -214,10 +236,10 @@ namespace OpenSim | |||
214 | /// Adds the included files as ini configuration files | 236 | /// Adds the included files as ini configuration files |
215 | /// </summary> | 237 | /// </summary> |
216 | /// <param name="sources">List of URL strings or filename strings</param> | 238 | /// <param name="sources">List of URL strings or filename strings</param> |
217 | private void AddIncludes(List<string> sources) | 239 | private void AddIncludes(OpenSimConfigSource configSource, List<string> sources) |
218 | { | 240 | { |
219 | //loop over config sources | 241 | //loop over config sources |
220 | foreach (IConfig config in m_config.Source.Configs) | 242 | foreach (IConfig config in configSource.Source.Configs) |
221 | { | 243 | { |
222 | // Look for Include-* in the key name | 244 | // Look for Include-* in the key name |
223 | string[] keys = config.GetKeys(); | 245 | string[] keys = config.GetKeys(); |
@@ -284,7 +306,7 @@ namespace OpenSim | |||
284 | /// </summary> | 306 | /// </summary> |
285 | /// <param name="iniPath">Full path to the ini</param> | 307 | /// <param name="iniPath">Full path to the ini</param> |
286 | /// <returns></returns> | 308 | /// <returns></returns> |
287 | private bool ReadConfig(string iniPath) | 309 | private bool ReadConfig(OpenSimConfigSource configSource, string iniPath) |
288 | { | 310 | { |
289 | bool success = false; | 311 | bool success = false; |
290 | 312 | ||
@@ -292,7 +314,7 @@ namespace OpenSim | |||
292 | { | 314 | { |
293 | m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath)); | 315 | m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath)); |
294 | 316 | ||
295 | m_config.Source.Merge(new IniConfigSource(iniPath)); | 317 | configSource.Source.Merge(new IniConfigSource(iniPath)); |
296 | success = true; | 318 | success = true; |
297 | } | 319 | } |
298 | else | 320 | else |
@@ -305,7 +327,7 @@ namespace OpenSim | |||
305 | { | 327 | { |
306 | XmlReader r = XmlReader.Create(iniPath); | 328 | XmlReader r = XmlReader.Create(iniPath); |
307 | XmlConfigSource cs = new XmlConfigSource(r); | 329 | XmlConfigSource cs = new XmlConfigSource(r); |
308 | m_config.Source.Merge(cs); | 330 | configSource.Source.Merge(cs); |
309 | 331 | ||
310 | success = true; | 332 | success = true; |
311 | } | 333 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f4d5562..15fbbfd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2926,6 +2926,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2926 | return ret; | 2926 | return ret; |
2927 | } | 2927 | } |
2928 | 2928 | ||
2929 | public LSL_Vector osGetRegionSize() | ||
2930 | { | ||
2931 | CheckThreatLevel(ThreatLevel.None, "osGetRegionSize"); | ||
2932 | m_host.AddScriptLPS(1); | ||
2933 | |||
2934 | bool isMegaregion; | ||
2935 | IRegionCombinerModule rcMod = World.RequestModuleInterface<IRegionCombinerModule>(); | ||
2936 | if (rcMod != null) | ||
2937 | isMegaregion = rcMod.IsRootForMegaregion(World.RegionInfo.RegionID); | ||
2938 | else | ||
2939 | isMegaregion = false; | ||
2940 | |||
2941 | if (isMegaregion) | ||
2942 | { | ||
2943 | Vector2 size = rcMod.GetSizeOfMegaregion(World.RegionInfo.RegionID); | ||
2944 | return new LSL_Vector(size.X, size.Y, Constants.RegionHeight); | ||
2945 | } | ||
2946 | else | ||
2947 | { | ||
2948 | return new LSL_Vector((float)Constants.RegionSize, (float)Constants.RegionSize, Constants.RegionHeight); | ||
2949 | } | ||
2950 | } | ||
2951 | |||
2929 | public int osGetSimulatorMemory() | 2952 | public int osGetSimulatorMemory() |
2930 | { | 2953 | { |
2931 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); | 2954 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 51d0581..519779e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -337,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
337 | key osGetMapTexture(); | 337 | key osGetMapTexture(); |
338 | key osGetRegionMapTexture(string regionName); | 338 | key osGetRegionMapTexture(string regionName); |
339 | LSL_List osGetRegionStats(); | 339 | LSL_List osGetRegionStats(); |
340 | vector osGetRegionSize(); | ||
340 | 341 | ||
341 | int osGetSimulatorMemory(); | 342 | int osGetSimulatorMemory(); |
342 | void osKickAvatar(string FirstName,string SurName,string alert); | 343 | void osKickAvatar(string FirstName,string SurName,string alert); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index c9902e4..02a3541 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -863,6 +863,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
863 | return m_OSSL_Functions.osGetRegionStats(); | 863 | return m_OSSL_Functions.osGetRegionStats(); |
864 | } | 864 | } |
865 | 865 | ||
866 | public vector osGetRegionSize() | ||
867 | { | ||
868 | return m_OSSL_Functions.osGetRegionSize(); | ||
869 | } | ||
870 | |||
866 | /// <summary> | 871 | /// <summary> |
867 | /// Returns the amount of memory in use by the Simulator Daemon. | 872 | /// Returns the amount of memory in use by the Simulator Daemon. |
868 | /// Amount in bytes - if >= 4GB, returns 4GB. (LSL is not 64-bit aware) | 873 | /// Amount in bytes - if >= 4GB, returns 4GB. (LSL is not 64-bit aware) |