* Made EstateSetting static since there's only one instance, and we only need to create it once

* Now cacheing RegionInfos indefinitively; we should add a tiomeout to this cache
afrisby
lbsa71 2007-10-22 17:55:49 +00:00
parent 81e5cf14ce
commit dd770c384c
7 changed files with 141 additions and 109 deletions

View File

@ -181,12 +181,25 @@ namespace OpenSim.Framework.Types
public string MasterAvatarLastName = "";
public string MasterAvatarSandboxPassword = "";
public EstateSettings estateSettings;
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
private static EstateSettings m_estateSettings;
public EstateSettings EstateSettings
{
get
{
if( m_estateSettings == null )
{
m_estateSettings = new EstateSettings();
}
return m_estateSettings;
}
}
public ConfigurationMember configMember;
public RegionInfo(string description, string filename)
{
estateSettings = new EstateSettings();
configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
configMember.performConfigurationRetrieve();
}
@ -195,7 +208,7 @@ namespace OpenSim.Framework.Types
base(regionLocX, regionLocY, internalEndPoint, externalUri)
{
estateSettings = new EstateSettings();
}
//not in use, should swap to nini though.

View File

@ -169,32 +169,32 @@ namespace OpenSim.Region.ClientStack
Encoding _enc = Encoding.ASCII;
RegionHandshakePacket handshake = new RegionHandshakePacket();
handshake.RegionInfo.BillableFactor = regionInfo.estateSettings.billableFactor;
handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor;
handshake.RegionInfo.IsEstateManager = false;
handshake.RegionInfo.TerrainHeightRange00 = regionInfo.estateSettings.terrainHeightRange0;
handshake.RegionInfo.TerrainHeightRange01 = regionInfo.estateSettings.terrainHeightRange1;
handshake.RegionInfo.TerrainHeightRange10 = regionInfo.estateSettings.terrainHeightRange2;
handshake.RegionInfo.TerrainHeightRange11 = regionInfo.estateSettings.terrainHeightRange3;
handshake.RegionInfo.TerrainStartHeight00 = regionInfo.estateSettings.terrainStartHeight0;
handshake.RegionInfo.TerrainStartHeight01 = regionInfo.estateSettings.terrainStartHeight1;
handshake.RegionInfo.TerrainStartHeight10 = regionInfo.estateSettings.terrainStartHeight2;
handshake.RegionInfo.TerrainStartHeight11 = regionInfo.estateSettings.terrainStartHeight3;
handshake.RegionInfo.SimAccess = (byte)regionInfo.estateSettings.simAccess;
handshake.RegionInfo.WaterHeight = regionInfo.estateSettings.waterHeight;
handshake.RegionInfo.TerrainHeightRange00 = regionInfo.EstateSettings.terrainHeightRange0;
handshake.RegionInfo.TerrainHeightRange01 = regionInfo.EstateSettings.terrainHeightRange1;
handshake.RegionInfo.TerrainHeightRange10 = regionInfo.EstateSettings.terrainHeightRange2;
handshake.RegionInfo.TerrainHeightRange11 = regionInfo.EstateSettings.terrainHeightRange3;
handshake.RegionInfo.TerrainStartHeight00 = regionInfo.EstateSettings.terrainStartHeight0;
handshake.RegionInfo.TerrainStartHeight01 = regionInfo.EstateSettings.terrainStartHeight1;
handshake.RegionInfo.TerrainStartHeight10 = regionInfo.EstateSettings.terrainStartHeight2;
handshake.RegionInfo.TerrainStartHeight11 = regionInfo.EstateSettings.terrainStartHeight3;
handshake.RegionInfo.SimAccess = (byte)regionInfo.EstateSettings.simAccess;
handshake.RegionInfo.WaterHeight = regionInfo.EstateSettings.waterHeight;
handshake.RegionInfo.RegionFlags = (uint)regionInfo.estateSettings.regionFlags;
handshake.RegionInfo.RegionFlags = (uint)regionInfo.EstateSettings.regionFlags;
handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.RegionName + "\0");
handshake.RegionInfo.SimOwner = regionInfo.MasterAvatarAssignedUUID;
handshake.RegionInfo.TerrainBase0 = regionInfo.estateSettings.terrainBase0;
handshake.RegionInfo.TerrainBase1 = regionInfo.estateSettings.terrainBase1;
handshake.RegionInfo.TerrainBase2 = regionInfo.estateSettings.terrainBase2;
handshake.RegionInfo.TerrainBase3 = regionInfo.estateSettings.terrainBase3;
handshake.RegionInfo.TerrainDetail0 = regionInfo.estateSettings.terrainDetail0;
handshake.RegionInfo.TerrainDetail1 = regionInfo.estateSettings.terrainDetail1;
handshake.RegionInfo.TerrainDetail2 = regionInfo.estateSettings.terrainDetail2;
handshake.RegionInfo.TerrainDetail3 = regionInfo.estateSettings.terrainDetail3;
handshake.RegionInfo.TerrainBase0 = regionInfo.EstateSettings.terrainBase0;
handshake.RegionInfo.TerrainBase1 = regionInfo.EstateSettings.terrainBase1;
handshake.RegionInfo.TerrainBase2 = regionInfo.EstateSettings.terrainBase2;
handshake.RegionInfo.TerrainBase3 = regionInfo.EstateSettings.terrainBase3;
handshake.RegionInfo.TerrainDetail0 = regionInfo.EstateSettings.terrainDetail0;
handshake.RegionInfo.TerrainDetail1 = regionInfo.EstateSettings.terrainDetail1;
handshake.RegionInfo.TerrainDetail2 = regionInfo.EstateSettings.terrainDetail2;
handshake.RegionInfo.TerrainDetail3 = regionInfo.EstateSettings.terrainDetail3;
handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
this.OutPacket(handshake);

View File

@ -39,6 +39,7 @@ namespace OpenSim.Region.Communications.Local
{
protected Dictionary<ulong, RegionInfo> m_regions = new Dictionary<ulong, RegionInfo>();
protected Dictionary<ulong, RegionCommsListener> m_regionListeners = new Dictionary<ulong, RegionCommsListener>();
private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
public LocalBackEndServices()
{
@ -128,8 +129,8 @@ namespace OpenSim.Region.Communications.Local
map.Name = regInfo.RegionName;
map.X = (ushort)regInfo.RegionLocX;
map.Y = (ushort)regInfo.RegionLocY;
map.WaterHeight = (byte)regInfo.estateSettings.waterHeight;
map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007");
map.WaterHeight = (byte)regInfo.EstateSettings.waterHeight;
map.MapImageId = regInfo.EstateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007");
map.Agents = 1;
map.RegionFlags = 72458694;
map.Access = 13;

View File

@ -50,6 +50,7 @@ namespace OpenSim.Region.Communications.OGS1
public class OGS1GridServices : IGridServices, IInterRegionCommunications
{
private LocalBackEndServices m_localBackend = new LocalBackEndServices();
private Dictionary<ulong, RegionInfo> m_remoteRegionInfoCache = new Dictionary<ulong, RegionInfo>();
public BaseHttpServer httpListener;
public NetworkServersInfo serversInfo;
@ -89,7 +90,7 @@ namespace OpenSim.Region.Communications.OGS1
GridParams["sim_name"] = regionInfo.RegionName;
GridParams["http_port"] = serversInfo.HttpListenerPort.ToString();
GridParams["remoting_port"] = serversInfo.RemotingListenerPort.ToString();
GridParams["map-image-id"] = regionInfo.estateSettings.terrainImageID.ToStringHyphenated();
GridParams["map-image-id"] = regionInfo.EstateSettings.terrainImageID.ToStringHyphenated();
// Package into an XMLRPC Request
ArrayList SendParams = new ArrayList();
@ -152,6 +153,7 @@ namespace OpenSim.Region.Communications.OGS1
return neighbours;
}
/// <summary>
///
/// </summary>
@ -166,6 +168,11 @@ namespace OpenSim.Region.Communications.OGS1
return regionInfo;
}
if (m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo))
{
}
else
{
Hashtable requestData = new Hashtable();
requestData["region_handle"] = regionHandle.ToString();
requestData["authkey"] = this.serversInfo.GridSendKey;
@ -198,6 +205,9 @@ namespace OpenSim.Region.Communications.OGS1
regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
regionInfo.RegionName = (string) responseData["region_name"];
m_remoteRegionInfoCache.Add( regionHandle, regionInfo );
}
return regionInfo;
}

View File

@ -73,20 +73,20 @@ namespace OpenSim.Region.Environment
switch (corner)
{
case 0:
m_regInfo.estateSettings.terrainStartHeight0 = lowValue;
m_regInfo.estateSettings.terrainHeightRange0 = highValue;
m_regInfo.EstateSettings.terrainStartHeight0 = lowValue;
m_regInfo.EstateSettings.terrainHeightRange0 = highValue;
break;
case 1:
m_regInfo.estateSettings.terrainStartHeight1 = lowValue;
m_regInfo.estateSettings.terrainHeightRange1 = highValue;
m_regInfo.EstateSettings.terrainStartHeight1 = lowValue;
m_regInfo.EstateSettings.terrainHeightRange1 = highValue;
break;
case 2:
m_regInfo.estateSettings.terrainStartHeight2 = lowValue;
m_regInfo.estateSettings.terrainHeightRange2 = highValue;
m_regInfo.EstateSettings.terrainStartHeight2 = lowValue;
m_regInfo.EstateSettings.terrainHeightRange2 = highValue;
break;
case 3:
m_regInfo.estateSettings.terrainStartHeight3 = lowValue;
m_regInfo.estateSettings.terrainHeightRange3 = highValue;
m_regInfo.EstateSettings.terrainStartHeight3 = lowValue;
m_regInfo.EstateSettings.terrainHeightRange3 = highValue;
break;
}
}
@ -101,16 +101,16 @@ namespace OpenSim.Region.Environment
switch (band)
{
case 0:
m_regInfo.estateSettings.terrainDetail0 = textureUUID;
m_regInfo.EstateSettings.terrainDetail0 = textureUUID;
break;
case 1:
m_regInfo.estateSettings.terrainDetail1 = textureUUID;
m_regInfo.EstateSettings.terrainDetail1 = textureUUID;
break;
case 2:
m_regInfo.estateSettings.terrainDetail2 = textureUUID;
m_regInfo.EstateSettings.terrainDetail2 = textureUUID;
break;
case 3:
m_regInfo.estateSettings.terrainDetail3 = textureUUID;
m_regInfo.EstateSettings.terrainDetail3 = textureUUID;
break;
}
}
@ -127,18 +127,18 @@ namespace OpenSim.Region.Environment
bool UseFixedSun, float SunHour)
{
// Water Height
m_regInfo.estateSettings.waterHeight = WaterHeight;
m_regInfo.EstateSettings.waterHeight = WaterHeight;
m_scene.Terrain.watermap.Fill(WaterHeight);
// Terraforming limits
m_regInfo.estateSettings.terrainRaiseLimit = TerrainRaiseLimit;
m_regInfo.estateSettings.terrainLowerLimit = TerrainLowerLimit;
m_regInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit;
m_regInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit;
m_scene.Terrain.maxRaise = TerrainRaiseLimit;
m_scene.Terrain.minLower = TerrainLowerLimit;
// Time of day / fixed sun
m_regInfo.estateSettings.useFixedSun = UseFixedSun;
m_regInfo.estateSettings.sunHour = SunHour;
m_regInfo.EstateSettings.useFixedSun = UseFixedSun;
m_regInfo.EstateSettings.sunHour = SunHour;
}
#region Packet Handlers
@ -187,54 +187,54 @@ namespace OpenSim.Region.Environment
}
else
{
m_regInfo.estateSettings.regionFlags = Simulator.RegionFlags.None;
m_regInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None;
if (convertParamStringToBool(packet.ParamList[0].Parameter))
{
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
m_regInfo.EstateSettings.regionFlags = m_regInfo.EstateSettings.regionFlags |
Simulator.RegionFlags.BlockTerraform;
}
if (convertParamStringToBool(packet.ParamList[1].Parameter))
{
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
m_regInfo.EstateSettings.regionFlags = m_regInfo.EstateSettings.regionFlags |
Simulator.RegionFlags.NoFly;
}
if (convertParamStringToBool(packet.ParamList[2].Parameter))
{
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
m_regInfo.EstateSettings.regionFlags = m_regInfo.EstateSettings.regionFlags |
Simulator.RegionFlags.AllowDamage;
}
if (convertParamStringToBool(packet.ParamList[3].Parameter) == false)
{
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
m_regInfo.EstateSettings.regionFlags = m_regInfo.EstateSettings.regionFlags |
Simulator.RegionFlags.BlockLandResell;
}
int tempMaxAgents =
Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents;
m_regInfo.EstateSettings.maxAgents = (byte)tempMaxAgents;
float tempObjectBonusFactor =
(float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
m_regInfo.EstateSettings.objectBonusFactor = tempObjectBonusFactor;
int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel;
m_regInfo.EstateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel;
if (convertParamStringToBool(packet.ParamList[7].Parameter))
{
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
m_regInfo.EstateSettings.regionFlags = m_regInfo.EstateSettings.regionFlags |
Simulator.RegionFlags.RestrictPushObject;
}
if (convertParamStringToBool(packet.ParamList[8].Parameter))
{
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags |
m_regInfo.EstateSettings.regionFlags = m_regInfo.EstateSettings.regionFlags |
Simulator.RegionFlags.AllowParcelChanges;
}
@ -309,16 +309,16 @@ namespace OpenSim.Region.Environment
switch (Convert.ToInt16(splitField[0]))
{
case 0:
m_regInfo.estateSettings.terrainBase0 = tempUUID;
m_regInfo.EstateSettings.terrainBase0 = tempUUID;
break;
case 1:
m_regInfo.estateSettings.terrainBase1 = tempUUID;
m_regInfo.EstateSettings.terrainBase1 = tempUUID;
break;
case 2:
m_regInfo.estateSettings.terrainBase2 = tempUUID;
m_regInfo.EstateSettings.terrainBase2 = tempUUID;
break;
case 3:
m_regInfo.estateSettings.terrainBase3 = tempUUID;
m_regInfo.EstateSettings.terrainBase3 = tempUUID;
break;
}
}
@ -355,22 +355,22 @@ namespace OpenSim.Region.Environment
RegionInfoPacket regionInfoPacket = new RegionInfoPacket();
regionInfoPacket.AgentData.AgentID = circuitData.AgentID;
regionInfoPacket.AgentData.SessionID = circuitData.SessionID;
regionInfoPacket.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor;
regionInfoPacket.RegionInfo.EstateID = m_regInfo.estateSettings.estateID;
regionInfoPacket.RegionInfo.MaxAgents = m_regInfo.estateSettings.maxAgents;
regionInfoPacket.RegionInfo.ObjectBonusFactor = m_regInfo.estateSettings.objectBonusFactor;
regionInfoPacket.RegionInfo.ParentEstateID = m_regInfo.estateSettings.parentEstateID;
regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter;
regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX;
regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
regionInfoPacket.RegionInfo.BillableFactor = m_regInfo.EstateSettings.billableFactor;
regionInfoPacket.RegionInfo.EstateID = m_regInfo.EstateSettings.estateID;
regionInfoPacket.RegionInfo.MaxAgents = m_regInfo.EstateSettings.maxAgents;
regionInfoPacket.RegionInfo.ObjectBonusFactor = m_regInfo.EstateSettings.objectBonusFactor;
regionInfoPacket.RegionInfo.ParentEstateID = m_regInfo.EstateSettings.parentEstateID;
regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.EstateSettings.pricePerMeter;
regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.EstateSettings.redirectGridX;
regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.EstateSettings.redirectGridY;
regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.EstateSettings.regionFlags;
regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.EstateSettings.simAccess;
regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName);
regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;
regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.estateSettings.terrainRaiseLimit;
regionInfoPacket.RegionInfo.UseEstateSun = !m_regInfo.estateSettings.useFixedSun;
regionInfoPacket.RegionInfo.WaterHeight = m_regInfo.estateSettings.waterHeight;
regionInfoPacket.RegionInfo.SunHour = m_regInfo.EstateSettings.sunHour;
regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.EstateSettings.terrainLowerLimit;
regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_regInfo.EstateSettings.terrainRaiseLimit;
regionInfoPacket.RegionInfo.UseEstateSun = !m_regInfo.EstateSettings.useFixedSun;
regionInfoPacket.RegionInfo.WaterHeight = m_regInfo.EstateSettings.waterHeight;
remote_client.OutPacket(regionInfoPacket);
}

View File

@ -135,7 +135,7 @@ namespace OpenSim.Region.Environment.LandManagement
updatePacket.ParcelData.MaxPrims =
Convert.ToInt32(
Math.Round((Convert.ToDecimal(landData.area)/Convert.ToDecimal(65536))*15000*
Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor)));
Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor)));
}
else
{
@ -152,12 +152,12 @@ namespace OpenSim.Region.Environment.LandManagement
updatePacket.ParcelData.OwnerID = landData.ownerID;
updatePacket.ParcelData.OwnerPrims = landData.ownerPrims;
updatePacket.ParcelData.ParcelFlags = landData.landFlags;
updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.estateSettings.objectBonusFactor;
updatePacket.ParcelData.ParcelPrimBonus = m_scene.RegionInfo.EstateSettings.objectBonusFactor;
updatePacket.ParcelData.PassHours = landData.passHours;
updatePacket.ParcelData.PassPrice = landData.passPrice;
updatePacket.ParcelData.PublicCount = 0; //unemplemented
uint regionFlags = (uint) m_scene.RegionInfo.estateSettings.regionFlags;
uint regionFlags = (uint) m_scene.RegionInfo.EstateSettings.regionFlags;
updatePacket.ParcelData.RegionDenyAnonymous = ((regionFlags & (uint) Simulator.RegionFlags.DenyAnonymous) >
0);
updatePacket.ParcelData.RegionDenyIdentified = ((regionFlags & (uint) Simulator.RegionFlags.DenyIdentified) >
@ -178,7 +178,7 @@ namespace OpenSim.Region.Environment.LandManagement
updatePacket.ParcelData.SimWideMaxPrims =
Convert.ToInt32(
Math.Round((Convert.ToDecimal(landData.simwideArea)/Convert.ToDecimal(65536))*15000*
Convert.ToDecimal(m_scene.RegionInfo.estateSettings.objectBonusFactor)));
Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor)));
}
else
{

View File

@ -469,7 +469,7 @@ namespace OpenSim.Region.Environment.Scenes
double[,] map = storageManager.DataStore.LoadTerrain();
if (map == null)
{
if (string.IsNullOrEmpty(m_regInfo.estateSettings.terrainFile))
if (string.IsNullOrEmpty(m_regInfo.EstateSettings.terrainFile))
{
MainLog.Instance.Verbose("TERRAIN", "No default terrain. Generating a new terrain.");
Terrain.HillsGenerator();
@ -480,8 +480,8 @@ namespace OpenSim.Region.Environment.Scenes
{
try
{
Terrain.LoadFromFileF32(m_regInfo.estateSettings.terrainFile);
Terrain *= m_regInfo.estateSettings.terrainMultiplier;
Terrain.LoadFromFileF32(m_regInfo.EstateSettings.terrainFile);
Terrain *= m_regInfo.EstateSettings.terrainMultiplier;
}
catch
{
@ -511,9 +511,9 @@ namespace OpenSim.Region.Environment.Scenes
{
//create a texture asset of the terrain
byte[] data = Terrain.ExportJpegImage("defaultstripe.png");
m_regInfo.estateSettings.terrainImageID = LLUUID.Random();
m_regInfo.EstateSettings.terrainImageID = LLUUID.Random();
AssetBase asset = new AssetBase();
asset.FullID = m_regInfo.estateSettings.terrainImageID;
asset.FullID = m_regInfo.EstateSettings.terrainImageID;
asset.Data = data;
asset.Name = "terrainImage";
asset.Type = 0;
@ -1001,12 +1001,20 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
///
/// </summary>
/// <param name="whatToDo"></param>
public void ForEachScenePresence(Action<ScenePresence> whatToDo)
/// <param name="action"></param>
public void ForEachScenePresence(Action<ScenePresence> action)
{
foreach (ScenePresence presence in m_scenePresences.Values)
{
whatToDo(presence);
action(presence);
}
}
public void ForEachObject(Action<SceneObjectGroup> action)
{
foreach (SceneObjectGroup presence in m_sceneObjects.Values)
{
action(presence);
}
}