diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index e017f22de0..0b80ec7800 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -235,6 +235,22 @@ namespace OpenSim.Region.ClientStack.Linden m_features[name] = value; } + public void AddOpenSimExtraFeature(string name, OSD value) + { + lock (m_features) + { + OSDMap extrasMap; + if (m_features.TryGetValue("OpenSimExtras", out OSD extra)) + extrasMap = extra as OSDMap; + else + { + extrasMap = new OSDMap(); + } + extrasMap[name] = value; + m_features["OpenSimExtras"] = extrasMap; + } + } + public bool RemoveFeature(string name) { lock (m_features) @@ -315,9 +331,15 @@ namespace OpenSim.Region.ClientStack.Linden lock (m_features) { - OSDMap extrasMap = new OSDMap(); + OSDMap extrasMap; + if (m_features.TryGetValue("OpenSimExtras", out OSD extra)) + extrasMap = extra as OSDMap; + else + { + extrasMap = new OSDMap(); + } - foreach(string key in extraFeatures.Keys) + foreach (string key in extraFeatures.Keys) { extrasMap[key] = (string)extraFeatures[key]; @@ -327,7 +349,6 @@ namespace OpenSim.Region.ClientStack.Linden } } m_features["OpenSimExtras"] = extrasMap; - } } diff --git a/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs b/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs index 6effcc1d5c..49ef22f876 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulatorFeaturesModule.cs @@ -40,6 +40,7 @@ namespace OpenSim.Region.Framework.Interfaces { event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest; void AddFeature(string name, OSD value); + void AddOpenSimExtraFeature(string name, OSD value); bool RemoveFeature(string name); bool TryGetFeature(string name, out OSD value); OSDMap GetFeatures(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 773878b83a..bca36eec7d 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1255,23 +1255,14 @@ namespace OpenSim.Region.Framework.Scenes ISimulatorFeaturesModule fm = RequestModuleInterface(); if (fm != null) { - OSD openSimExtras; - OSDMap openSimExtrasMap; - - if (!fm.TryGetFeature("OpenSimExtras", out openSimExtras)) - openSimExtras = new OSDMap(); - float statisticsFPSfactor = 1.0f; if(Normalized55FPS) statisticsFPSfactor = 55.0f * FrameTime; - openSimExtrasMap = (OSDMap)openSimExtras; - openSimExtrasMap["SimulatorFPS"] = OSD.FromReal(1.0f / FrameTime); - openSimExtrasMap["SimulatorFPSFactor"] = OSD.FromReal(statisticsFPSfactor); - openSimExtrasMap["SimulatorFPSWarnPercent"] = OSD.FromInteger(FrameTimeWarnPercent); - openSimExtrasMap["SimulatorFPSCritPercent"] = OSD.FromInteger(FrameTimeCritPercent); - - fm.AddFeature("OpenSimExtras", openSimExtrasMap); + fm.AddOpenSimExtraFeature("SimulatorFPS", OSD.FromReal(1.0f / FrameTime)); + fm.AddOpenSimExtraFeature("SimulatorFPSFactor", OSD.FromReal(statisticsFPSfactor)); + fm.AddOpenSimExtraFeature("SimulatorFPSWarnPercent", OSD.FromInteger(FrameTimeWarnPercent)); + fm.AddOpenSimExtraFeature("SimulatorFPSCritPercent", OSD.FromInteger(FrameTimeCritPercent)); } }