From b3eeb5a8dcdb91d47037234540c5045cdfb9977a Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 23 Sep 2007 23:55:29 +0000 Subject: [PATCH] * Purged 'Regions' code pending Agent layer grok. * Changed so prims aren't loaded until AFTER parcels. * The region startup flow is still an ungodly rats nest. --- OpenSim/Region/Application/OpenSimMain.cs | 2 +- .../ClientStack/RegionApplicationBase.cs | 5 +- .../Environment/LandManagement/LandManager.cs | 4 +- OpenSim/Region/Environment/Regions/Region.cs | 49 ------------------- .../Environment/Regions/RegionSubscription.cs | 19 ------- .../Regions/RegionSubscriptionManager.cs | 16 ------ OpenSim/Region/Environment/Scenes/Scene.cs | 19 +++---- .../Environment/Scenes/ScenePresence.cs | 12 +---- OpenSim/Region/Examples/SimpleApp/Program.cs | 15 ++---- 9 files changed, 16 insertions(+), 125 deletions(-) delete mode 100644 OpenSim/Region/Environment/Regions/Region.cs delete mode 100644 OpenSim/Region/Environment/Regions/RegionSubscription.cs delete mode 100644 OpenSim/Region/Environment/Regions/RegionSubscriptionManager.cs diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 8e067ebbbf..161e73f5fd 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -147,7 +147,7 @@ namespace OpenSim Directory.CreateDirectory(Util.logDir()); } - m_log = new LogBase(Path.Combine(Util.logDir(), m_logFilename), "Region", this, m_silent); + m_log = CreateLog(); MainLog.Instance = m_log; base.StartUp(); diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index df8d74787e..a1ec4e3b9b 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -70,8 +70,6 @@ namespace OpenSim.Region.ClientStack Initialize(); - ScenePresence.CreateDefaultTextureEntry(); - m_httpServer = new BaseHttpServer(m_httpServerPort); m_log.Verbose("Starting HTTP server"); @@ -112,7 +110,6 @@ namespace OpenSim.Region.ClientStack scene.PhysScene = GetPhysicsScene(); scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D()); - scene.LoadPrimsFromStorage(); //Master Avatar Setup UserProfileData masterAvatar = m_commsManager.UserServer.SetupMasterUser(scene.RegionInfo.MasterAvatarFirstName, scene.RegionInfo.MasterAvatarLastName, scene.RegionInfo.MasterAvatarSandboxPassword); @@ -128,7 +125,9 @@ namespace OpenSim.Region.ClientStack scene.RegionInfo.MasterAvatarAssignedUUID = libsecondlife.LLUUID.Zero; //TODO: Load parcels from storageManager } + scene.LandManager.resetSimLandObjects(); + scene.LoadPrimsFromStorage(); scene.performParcelPrimCountUpdate(); scene.StartTimer(); diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index 731ce6129a..98b90b4794 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs @@ -87,8 +87,8 @@ namespace OpenSim.Region.Environment.LandManagement /// public bool landPrimCountTainted = false; - private Scene m_scene; - private RegionInfo m_regInfo; + private readonly Scene m_scene; + private readonly RegionInfo m_regInfo; #endregion diff --git a/OpenSim/Region/Environment/Regions/Region.cs b/OpenSim/Region/Environment/Regions/Region.cs deleted file mode 100644 index 536fed77a8..0000000000 --- a/OpenSim/Region/Environment/Regions/Region.cs +++ /dev/null @@ -1,49 +0,0 @@ -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 - { - // 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. - - private readonly Scene m_scene; - private Dictionary m_regionSubscriptions - { - 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); - } - } - - internal void Remove(LLUUID agentID) - { - // TODO : Well, remove it! - } - } -} diff --git a/OpenSim/Region/Environment/Regions/RegionSubscription.cs b/OpenSim/Region/Environment/Regions/RegionSubscription.cs deleted file mode 100644 index 13cd0d55f4..0000000000 --- a/OpenSim/Region/Environment/Regions/RegionSubscription.cs +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index 97d25911c7..0000000000 --- a/OpenSim/Region/Environment/Regions/RegionSubscriptionManager.cs +++ /dev/null @@ -1,16 +0,0 @@ -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( ); - } - } -} diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index adf501e0df..22f69a57f6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -49,7 +49,6 @@ using OpenSim.Region.Environment.Types; using OpenSim.Region.Physics.Manager; using OpenSim.Region.Terrain; using Timer = System.Timers.Timer; -using OpenSim.Region.Environment.Regions; namespace OpenSim.Region.Environment.Scenes { @@ -64,8 +63,6 @@ namespace OpenSim.Region.Environment.Scenes /// publicized so it can be accessed from SceneObjectGroup. protected float timeStep = 0.1f; - private Regions.Region m_region; - private Random Rand = new Random(); private uint _primCount = 702000; private readonly Mutex _primAllocateMutex = new Mutex(false); @@ -162,8 +159,6 @@ namespace OpenSim.Region.Environment.Scenes { updateLock = new Mutex(false); - m_region = new Regions.Region(this); - m_moduleLoader = moduleLoader; authenticateHandler = authen; commsManager = commsMan; @@ -373,7 +368,10 @@ namespace OpenSim.Region.Environment.Scenes /// internal void Broadcast(Action whatToDo) { - m_region.Broadcast(whatToDo); + ForEachScenePresence( delegate( ScenePresence presence ) + { + whatToDo(presence.ControllingClient); + }); } /// /// @@ -458,7 +456,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// Loads the World's objects /// - public void LoadPrimsFromStorage() + public virtual void LoadPrimsFromStorage() { MainLog.Instance.Verbose("Loading objects from datastore"); List PrimsFromDB = storageManager.DataStore.LoadObjects(m_regInfo.SimUUID); @@ -790,11 +788,6 @@ namespace OpenSim.Region.Environment.Scenes m_scenePresences.Remove(agentID); } - lock (m_region) - { - m_region.Remove(agentID); - } - lock (Entities) { Entities.Remove(agentID); @@ -1135,7 +1128,7 @@ namespace OpenSim.Region.Environment.Scenes } public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, - string message, string url) + string message, string url) { if (m_scenePresences.ContainsKey(avatarID)) { diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index fa37b9fd16..f594789fc6 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -35,7 +35,6 @@ using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Environment.Regions; namespace OpenSim.Region.Environment.Scenes { @@ -214,13 +213,6 @@ namespace OpenSim.Region.Environment.Scenes set { m_isChildAgent = value; } } - private RegionSubscription m_regionSubscription; - - public RegionSubscription RegionSubscription - { - get { return m_regionSubscription; } - } - #endregion #region Constructor(s) @@ -234,8 +226,6 @@ namespace OpenSim.Region.Environment.Scenes /// public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) { - m_regionSubscription = new RegionSubscription( client ); - m_scene = world; m_uuid = client.AgentId; @@ -881,7 +871,7 @@ namespace OpenSim.Region.Environment.Scenes } } - public static void CreateDefaultTextureEntry() + static ScenePresence() { LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index a7b92f4547..2ff9ff067b 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -1,23 +1,16 @@ using System; using System.Collections.Generic; +using System.IO; using System.Net; using libsecondlife; -using OpenSim.Framework; +using OpenSim.Framework.Communications.Caches; using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Servers; using OpenSim.Framework.Types; -using OpenSim.Region.Physics.Manager; - -using OpenSim.Region.Capabilities; using OpenSim.Region.ClientStack; using OpenSim.Region.Communications.Local; -using OpenSim.Framework.Communications.Caches; -using System.Timers; -using OpenSim.Region.Environment.Scenes; -using OpenSim.Framework.Data; using OpenSim.Region.Environment; -using System.IO; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Physics.Manager; namespace SimpleApp {