diff options
author | Melanie | 2012-08-15 18:22:16 +0200 |
---|---|---|
committer | Melanie | 2012-08-15 18:58:39 +0100 |
commit | c27ff70d5c9c7f91ff63b197359de84f7508ec60 (patch) | |
tree | 9c32da6e9bd392bc0a254f87e03d7cf1d6858ef2 /OpenSim/Region | |
parent | Fix and finish the extra parameters storage system for MySQL (diff) | |
download | opensim-SC_OLD-c27ff70d5c9c7f91ff63b197359de84f7508ec60.zip opensim-SC_OLD-c27ff70d5c9c7f91ff63b197359de84f7508ec60.tar.gz opensim-SC_OLD-c27ff70d5c9c7f91ff63b197359de84f7508ec60.tar.bz2 opensim-SC_OLD-c27ff70d5c9c7f91ff63b197359de84f7508ec60.tar.xz |
Add support for the extra params to scene and the event manager
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 39 |
2 files changed, 62 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 6dea2f0..4d65be9 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -213,6 +213,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
213 | /// </remarks> | 213 | /// </remarks> |
214 | public event NewScript OnNewScript; | 214 | public event NewScript OnNewScript; |
215 | 215 | ||
216 | public delegate void ExtraSettingChangedDelegate(Scene scene, string name, string value); | ||
217 | public event ExtraSettingChangedDelegate OnExtraSettingChanged; | ||
218 | |||
216 | public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) | 219 | public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) |
217 | { | 220 | { |
218 | NewScript handlerNewScript = OnNewScript; | 221 | NewScript handlerNewScript = OnNewScript; |
@@ -2591,5 +2594,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2591 | } | 2594 | } |
2592 | } | 2595 | } |
2593 | 2596 | ||
2597 | public void TriggerExtraSettingChanged(Scene scene, string name, string val) | ||
2598 | { | ||
2599 | ExtraSettingChangedDelegate handler = OnExtraSettingChanged; | ||
2600 | |||
2601 | if (handler != null) | ||
2602 | { | ||
2603 | foreach (ExtraSettingChangedDelegate d in handler.GetInvocationList()) | ||
2604 | { | ||
2605 | try | ||
2606 | { | ||
2607 | d(scene, name, val); | ||
2608 | } | ||
2609 | catch (Exception e) | ||
2610 | { | ||
2611 | m_log.ErrorFormat("[EVENT MANAGER]: Delegate for ExtraSettingChanged failed - continuing {0} - {1}", | ||
2612 | e.Message, e.StackTrace); | ||
2613 | } | ||
2614 | } | ||
2615 | } | ||
2616 | } | ||
2594 | } | 2617 | } |
2595 | } | 2618 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 59f49ea..0e5ddfd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -5447,5 +5447,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
5447 | 5447 | ||
5448 | callback(asset); | 5448 | callback(asset); |
5449 | } | 5449 | } |
5450 | |||
5451 | public string GetExtraSetting(string name) | ||
5452 | { | ||
5453 | string val; | ||
5454 | |||
5455 | if (!m_extraSettings.TryGetValue(name, out val)) | ||
5456 | return String.Empty; | ||
5457 | |||
5458 | return val; | ||
5459 | } | ||
5460 | |||
5461 | public void StoreExtraSetting(string name, string val) | ||
5462 | { | ||
5463 | string oldVal; | ||
5464 | |||
5465 | if (m_extraSettings.TryGetValue(name, out oldVal)) | ||
5466 | { | ||
5467 | if (oldVal == val) | ||
5468 | return; | ||
5469 | } | ||
5470 | |||
5471 | m_extraSettings[name] = val; | ||
5472 | |||
5473 | m_SimulationDataService.SaveExtra(RegionInfo.RegionID, name, val); | ||
5474 | |||
5475 | m_eventManager.TriggerExtraSettingChanged(this, name, val); | ||
5476 | } | ||
5477 | |||
5478 | public void RemoveExtraSetting(string name) | ||
5479 | { | ||
5480 | if (!m_extraSettings.ContainsKey(name)) | ||
5481 | return; | ||
5482 | |||
5483 | m_extraSettings.Remove(name); | ||
5484 | |||
5485 | m_SimulationDataService.RemoveExtra(RegionInfo.RegionID, name); | ||
5486 | |||
5487 | m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty); | ||
5488 | } | ||
5450 | } | 5489 | } |
5451 | } | 5490 | } |