From b9808f831428876ec9ede8ce87a159566b97a850 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Fri, 21 Sep 2007 04:58:40 +0000 Subject: * First example of moving stuff to a Region layer * Also, changed RegionPresence to 'RegionSubscription' - let's just see where we land with this... --- OpenSim/Region/Environment/Regions/Region.cs | 35 ++++++++++++++++++++-- .../Region/Environment/Regions/RegionManager.cs | 16 ---------- .../Region/Environment/Regions/RegionPresence.cs | 14 --------- .../Environment/Regions/RegionSubscription.cs | 19 ++++++++++++ .../Regions/RegionSubscriptionManager.cs | 16 ++++++++++ 5 files changed, 67 insertions(+), 33 deletions(-) delete mode 100644 OpenSim/Region/Environment/Regions/RegionManager.cs delete mode 100644 OpenSim/Region/Environment/Regions/RegionPresence.cs create mode 100644 OpenSim/Region/Environment/Regions/RegionSubscription.cs create mode 100644 OpenSim/Region/Environment/Regions/RegionSubscriptionManager.cs (limited to 'OpenSim/Region/Environment/Regions') diff --git a/OpenSim/Region/Environment/Regions/Region.cs b/OpenSim/Region/Environment/Regions/Region.cs index f7669a9..e95d9dc 100644 --- a/OpenSim/Region/Environment/Regions/Region.cs +++ b/OpenSim/Region/Environment/Regions/Region.cs @@ -1,15 +1,44 @@ using System.Collections.Generic; using libsecondlife; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Terrain; +using OpenSim.Framework.Interfaces; +using System; namespace OpenSim.Region.Environment.Regions { public class Region { - private Dictionary m_regionPresences; + // This is a temporary (and real ugly) construct to emulate us really having a separate list + // of region subscribers. It should be removed ASAP, like. - public Region() + private readonly Scene m_scene; + private Dictionary m_regionSubscriptions { - m_regionPresences = new Dictionary( ); + get + { + Dictionary subscriptions = new Dictionary( ); + + foreach( ScenePresence presence in m_scene.GetScenePresences() ) + { + subscriptions.Add( presence.UUID, new RegionSubscription( presence.ControllingClient )); + } + + return subscriptions; + } + } + + public Region( Scene scene ) + { + m_scene = scene; // The Scene reference should be removed. + } + + internal void Broadcast( Action whatToDo ) + { + foreach (RegionSubscription subscription in m_regionSubscriptions.Values ) + { + whatToDo(subscription.Client); + } } } } diff --git a/OpenSim/Region/Environment/Regions/RegionManager.cs b/OpenSim/Region/Environment/Regions/RegionManager.cs deleted file mode 100644 index ab5b97c..0000000 --- a/OpenSim/Region/Environment/Regions/RegionManager.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.Environment.Regions -{ - public class RegionManager - { - private Dictionary m_regions; - - public RegionManager( ) - { - m_regions = new Dictionary( ); - } - } -} diff --git a/OpenSim/Region/Environment/Regions/RegionPresence.cs b/OpenSim/Region/Environment/Regions/RegionPresence.cs deleted file mode 100644 index 9720bb3..0000000 --- a/OpenSim/Region/Environment/Regions/RegionPresence.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OpenSim.Framework.Interfaces; - -namespace OpenSim.Region.Environment.Regions -{ - public class RegionPresence - { - private IClientAPI m_client; - - public RegionPresence(IClientAPI client ) - { - m_client = client; - } - } -} diff --git a/OpenSim/Region/Environment/Regions/RegionSubscription.cs b/OpenSim/Region/Environment/Regions/RegionSubscription.cs new file mode 100644 index 0000000..13cd0d5 --- /dev/null +++ b/OpenSim/Region/Environment/Regions/RegionSubscription.cs @@ -0,0 +1,19 @@ +using OpenSim.Framework.Interfaces; + +namespace OpenSim.Region.Environment.Regions +{ + public class RegionSubscription + { + private readonly IClientAPI m_client; + + public RegionSubscription(IClientAPI client ) + { + m_client = client; + } + + public IClientAPI Client + { + get { return m_client; } + } + } +} diff --git a/OpenSim/Region/Environment/Regions/RegionSubscriptionManager.cs b/OpenSim/Region/Environment/Regions/RegionSubscriptionManager.cs new file mode 100644 index 0000000..97d2591 --- /dev/null +++ b/OpenSim/Region/Environment/Regions/RegionSubscriptionManager.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.Environment.Regions +{ + public class RegionSubscriptionManager + { + private Dictionary m_regions; + + public RegionSubscriptionManager( ) + { + m_regions = new Dictionary( ); + } + } +} -- cgit v1.1