From f202c36106815949e56c58612770a00c65ab80a3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 29 Jun 2012 00:03:22 +0100
Subject: Add IScene.Name for code clarity to replace the RegionInfo.RegionName
used in many, many log messages.
---
OpenSim/Framework/IScene.cs | 5 +++
.../ClientStack/Linden/UDP/Tests/MockScene.cs | 3 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 50 +++++++++++-----------
OpenSim/Region/Framework/Scenes/SceneBase.cs | 12 ++++--
4 files changed, 38 insertions(+), 32 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index b2604f4..a9432c2 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -56,6 +56,11 @@ namespace OpenSim.Framework
public interface IScene
{
+ ///
+ /// The name of this scene.
+ ///
+ string Name { get; }
+
RegionInfo RegionInfo { get; }
RegionStatus RegionStatus { get; set; }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
index d76927b..119a677 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
@@ -44,9 +44,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
}
protected int m_objectNameCallsReceived;
- public MockScene()
+ public MockScene() : base(new RegionInfo(1000, 1000, null, null))
{
- m_regInfo = new RegionInfo(1000, 1000, null, null);
m_regStatus = RegionStatus.Up;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d449116..c28979e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -614,8 +614,7 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService = sceneGridService;
m_SimulationDataService = simDataService;
m_EstateDataService = estateDataService;
- m_regionHandle = m_regInfo.RegionHandle;
- m_regionName = m_regInfo.RegionName;
+ m_regionHandle = RegionInfo.RegionHandle;
m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
m_asyncSceneObjectDeleter.Enabled = true;
@@ -630,7 +629,7 @@ namespace OpenSim.Region.Framework.Scenes
// resave.
// FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new
// region is set up and avoid these gyrations.
- RegionSettings rs = simDataService.LoadRegionSettings(m_regInfo.RegionID);
+ RegionSettings rs = simDataService.LoadRegionSettings(RegionInfo.RegionID);
bool updatedTerrainTextures = false;
if (rs.TerrainTexture1 == UUID.Zero)
{
@@ -659,10 +658,10 @@ namespace OpenSim.Region.Framework.Scenes
if (updatedTerrainTextures)
rs.Save();
- m_regInfo.RegionSettings = rs;
+ RegionInfo.RegionSettings = rs;
if (estateDataService != null)
- m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
+ RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false);
#endregion Region Settings
@@ -828,7 +827,7 @@ namespace OpenSim.Region.Framework.Scenes
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
}
- public Scene(RegionInfo regInfo)
+ public Scene(RegionInfo regInfo) : base(regInfo)
{
PhysicalPrims = true;
CollidablePrims = true;
@@ -855,7 +854,6 @@ namespace OpenSim.Region.Framework.Scenes
WestBorders.Add(westBorder);
BordersLocked = false;
- m_regInfo = regInfo;
m_eventManager = new EventManager();
m_permissions = new ScenePermissions(this);
@@ -1199,8 +1197,8 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.Close();
- if (!GridService.DeregisterRegion(m_regInfo.RegionID))
- m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
+ if (!GridService.DeregisterRegion(RegionInfo.RegionID))
+ m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
// call the base class Close method.
base.Close();
@@ -1720,14 +1718,14 @@ namespace OpenSim.Region.Framework.Scenes
public void StoreWindlightProfile(RegionLightShareData wl)
{
- m_regInfo.WindlightSettings = wl;
+ RegionInfo.WindlightSettings = wl;
SimulationDataService.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
public void LoadWindlightProfile()
{
- m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
+ RegionInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
@@ -2218,7 +2216,7 @@ namespace OpenSim.Region.Framework.Scenes
ForceSceneObjectBackup(so);
so.DetachFromBackup();
- SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
+ SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID);
}
// We need to keep track of this state in case this group is still queued for further backup.
@@ -2553,7 +2551,7 @@ namespace OpenSim.Region.Framework.Scenes
// If the user is banned, we won't let any of their objects
// enter. Period.
//
- if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID))
+ if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID))
{
m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID);
@@ -3734,9 +3732,9 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- if (m_regInfo.EstateSettings != null)
+ if (RegionInfo.EstateSettings != null)
{
- if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
+ if (RegionInfo.EstateSettings.IsBanned(agent.AgentID))
{
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist",
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
@@ -3768,7 +3766,7 @@ namespace OpenSim.Region.Framework.Scenes
}
bool groupAccess = false;
- UUID[] estateGroups = m_regInfo.EstateSettings.EstateGroups;
+ UUID[] estateGroups = RegionInfo.EstateSettings.EstateGroups;
if (estateGroups != null)
{
@@ -3786,8 +3784,8 @@ namespace OpenSim.Region.Framework.Scenes
m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!");
}
- if (!m_regInfo.EstateSettings.PublicAccess &&
- !m_regInfo.EstateSettings.HasAccess(agent.AgentID) &&
+ if (!RegionInfo.EstateSettings.PublicAccess &&
+ !RegionInfo.EstateSettings.HasAccess(agent.AgentID) &&
!groupAccess)
{
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate",
@@ -3860,7 +3858,7 @@ namespace OpenSim.Region.Framework.Scenes
// if (loggingOffUser != null)
// {
// UUID localRegionSecret = UUID.Zero;
-// bool parsedsecret = UUID.TryParse(m_regInfo.regionSecret, out localRegionSecret);
+// bool parsedsecret = UUID.TryParse(RegionInfo.regionSecret, out localRegionSecret);
//
// // Region Secret is used here in case a new sessionid overwrites an old one on the user server.
// // Will update the user server in a few revisions to use it.
@@ -4079,13 +4077,13 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence sp = GetScenePresence(remoteClient.AgentId);
if (sp != null)
{
- uint regionX = m_regInfo.RegionLocX;
- uint regionY = m_regInfo.RegionLocY;
+ uint regionX = RegionInfo.RegionLocX;
+ uint regionY = RegionInfo.RegionLocY;
Utils.LongToUInts(regionHandle, out regionX, out regionY);
- int shiftx = (int) regionX - (int) m_regInfo.RegionLocX * (int)Constants.RegionSize;
- int shifty = (int) regionY - (int) m_regInfo.RegionLocY * (int)Constants.RegionSize;
+ int shiftx = (int) regionX - (int) RegionInfo.RegionLocX * (int)Constants.RegionSize;
+ int shifty = (int) regionY - (int) RegionInfo.RegionLocY * (int)Constants.RegionSize;
position.X += shiftx;
position.Y += shifty;
@@ -4108,7 +4106,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!result)
{
- regionHandle = m_regInfo.RegionHandle;
+ regionHandle = RegionInfo.RegionHandle;
}
else
{
@@ -4614,7 +4612,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteFromStorage(UUID uuid)
{
- SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID);
+ SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID);
}
public int GetHealth()
@@ -5039,7 +5037,7 @@ namespace OpenSim.Region.Framework.Scenes
IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null)
{
- m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
+ RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false);
TriggerEstateSunUpdate();
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 9c6b884..f50fbfc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -51,6 +51,8 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region Fields
+
+ public string Name { get { return RegionInfo.RegionName; } }
public IConfigSource Config
{
@@ -146,6 +148,11 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
+ public SceneBase(RegionInfo regInfo)
+ {
+ RegionInfo = regInfo;
+ }
+
#region Update Methods
///
@@ -209,10 +216,7 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
- public virtual RegionInfo RegionInfo
- {
- get { return m_regInfo; }
- }
+ public virtual RegionInfo RegionInfo { get; private set; }
#region admin stuff
--
cgit v1.1