From abd5d1f7470ba07b784c6dbad4cdcdeaedc58d37 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 21 May 2010 14:04:10 -0700 Subject: * Added code comments to Prioritizer.cs that document how to add a new update priority policy --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index af25014..e6a4642 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -5,6 +5,18 @@ using Nini.Config; using OpenSim.Framework; using OpenMetaverse; +/* + * Steps to add a new prioritization policy: + * + * - Add a new value to the UpdatePrioritizationSchemes enum. + * - Specify this new value in the [InterestManagement] section of your + * OpenSim.ini. The name in the config file must match the enum value name + * (although it is not case sensitive). + * - Write a new GetPriorityBy*() method in this class. + * - Add a new entry to the switch statement in GetUpdatePriority() that calls + * your method. + */ + namespace OpenSim.Region.Framework.Scenes { public enum UpdatePrioritizationSchemes @@ -35,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes case UpdatePrioritizationSchemes.Distance: return GetPriorityByDistance(client, entity); case UpdatePrioritizationSchemes.SimpleAngularDistance: - return GetPriorityByDistance(client, entity); + return GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance case UpdatePrioritizationSchemes.FrontBack: return GetPriorityByFrontBack(client, entity); default: -- cgit v1.1 From d0eecf03986b1b1bd7458123a2deed522587b6dc Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 21 May 2010 14:17:03 -0700 Subject: Added a sanity check before using m_config in the Scene constructor --- OpenSim/Region/Framework/Scenes/Scene.cs | 35 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f35dffc..46fbcd3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -794,25 +794,28 @@ namespace OpenSim.Region.Framework.Scenes #region Interest Management - IConfig interestConfig = m_config.Configs["InterestManagement"]; - if (interestConfig != null) + if (m_config != null) { - string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); - - try + IConfig interestConfig = m_config.Configs["InterestManagement"]; + if (interestConfig != null) { - m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); - } - catch (Exception) - { - m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); - m_priorityScheme = UpdatePrioritizationSchemes.Time; - } + string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); - m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); - m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); - m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); - m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); + try + { + m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); + } + catch (Exception) + { + m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); + m_priorityScheme = UpdatePrioritizationSchemes.Time; + } + + m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); + m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); + m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); + m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); + } } m_log.Info("[SCENE]: Using the " + m_priorityScheme + " prioritization scheme"); -- cgit v1.1