*RegionInfo in Avatar class now protected again (oops, my fault)

Sugilite
mingchen 2007-06-08 19:30:27 +00:00
parent 2239ecba18
commit 8157182d37
8 changed files with 97 additions and 87 deletions

View File

@ -31,7 +31,7 @@ namespace OpenSim.Framework.Types
public RegionInfo()
{
estateSettings = new EstateSettings();
}

View File

@ -43,7 +43,7 @@ namespace OpenSim.world
public void SendInitialPosition()
{
Console.WriteLine("sending initial Avatar data");
this.ControllingClient.SendAvatarData(this.m_world.m_regInfo, this.firstname, this.lastname, this.uuid, this.localid, new LLVector3(128, 128, 60));
this.ControllingClient.SendAvatarData(m_regInfo, this.firstname, this.lastname, this.uuid, this.localid, new LLVector3(128, 128, 60));
}
/// <summary>

View File

@ -35,6 +35,7 @@ namespace OpenSim.world
private Dictionary<uint, IClientAPI> m_clientThreads;
private bool childAvatar = false;
private RegionInfo m_regInfo;
/// <summary>
///
/// </summary>
@ -42,13 +43,14 @@ namespace OpenSim.world
/// <param name="world"></param>
/// <param name="clientThreads"></param>
/// <param name="regionDat"></param>
public Avatar(IClientAPI theClient, World world, Dictionary<uint, IClientAPI> clientThreads)
public Avatar(IClientAPI theClient, World world, Dictionary<uint, IClientAPI> clientThreads, RegionInfo reginfo)
{
m_world = world;
m_clientThreads = clientThreads;
this.uuid = theClient.AgentId;
m_regInfo = reginfo;
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Avatar.cs - Loading details from grid (DUMMY)");
ControllingClient = theClient;
this.firstname = ControllingClient.FirstName;
@ -140,7 +142,7 @@ namespace OpenSim.world
/// </summary>
public void CompleteMovement()
{
this.ControllingClient.MoveAgentIntoRegion(this.m_world.m_regInfo);
this.ControllingClient.MoveAgentIntoRegion(m_regInfo);
}
/// <summary>

View File

@ -19,10 +19,12 @@ namespace OpenSim.world.Estate
public class EstateManager
{
private World m_world;
private RegionInfo m_regInfo;
public EstateManager(World world)
public EstateManager(World world,RegionInfo reginfo)
{
m_world = world; //Estate settings found at world.m_regInfo.estateSettings
m_world = world; //Estate settings found at world.m_regInfo.estateSettings
m_regInfo = reginfo;
}
private bool convertParamStringToBool(byte[] field)
@ -37,7 +39,7 @@ namespace OpenSim.world.Estate
public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client)
{
if (remote_client.AgentId == m_world.m_regInfo.MasterAvatarAssignedUUID)
if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID)
{
switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
{
@ -53,47 +55,47 @@ namespace OpenSim.world.Estate
}
else
{
m_world.m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None;
m_regInfo.estateSettings.regionFlags = libsecondlife.Simulator.RegionFlags.None;
if (convertParamStringToBool(packet.ParamList[0].Parameter))
{
m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform;
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockTerraform;
}
if (convertParamStringToBool(packet.ParamList[1].Parameter))
{
m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly;
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.NoFly;
}
if (convertParamStringToBool(packet.ParamList[2].Parameter))
{
m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowDamage;
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowDamage;
}
if (convertParamStringToBool(packet.ParamList[3].Parameter) == false)
{
m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockLandResell;
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.BlockLandResell;
}
int tempMaxAgents = Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
m_world.m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents;
m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents;
float tempObjectBonusFactor = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
m_world.m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
m_world.m_regInfo.estateSettings.simAccess = (libsecondlife.Simulator.SimAccess)tempMatureLevel;
m_regInfo.estateSettings.simAccess = (libsecondlife.Simulator.SimAccess)tempMatureLevel;
if (convertParamStringToBool(packet.ParamList[7].Parameter))
{
m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.RestrictPushObject;
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.RestrictPushObject;
}
if (convertParamStringToBool(packet.ParamList[8].Parameter))
{
m_world.m_regInfo.estateSettings.regionFlags = m_world.m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowParcelChanges;
m_regInfo.estateSettings.regionFlags = m_regInfo.estateSettings.regionFlags | libsecondlife.Simulator.RegionFlags.AllowParcelChanges;
}
sendRegionInfoPacketToAll();
@ -111,16 +113,16 @@ namespace OpenSim.world.Estate
switch (Convert.ToInt16(splitField[0]))
{
case 0:
m_world.m_regInfo.estateSettings.terrainBase0 = tempUUID;
m_regInfo.estateSettings.terrainBase0 = tempUUID;
break;
case 1:
m_world.m_regInfo.estateSettings.terrainBase1 = tempUUID;
m_regInfo.estateSettings.terrainBase1 = tempUUID;
break;
case 2:
m_world.m_regInfo.estateSettings.terrainBase2 = tempUUID;
m_regInfo.estateSettings.terrainBase2 = tempUUID;
break;
case 3:
m_world.m_regInfo.estateSettings.terrainBase3 = tempUUID;
m_regInfo.estateSettings.terrainBase3 = tempUUID;
break;
}
}
@ -138,16 +140,16 @@ namespace OpenSim.world.Estate
switch (Convert.ToInt16(splitField[0]))
{
case 0:
m_world.m_regInfo.estateSettings.terrainDetail0 = tempUUID;
m_regInfo.estateSettings.terrainDetail0 = tempUUID;
break;
case 1:
m_world.m_regInfo.estateSettings.terrainDetail1 = tempUUID;
m_regInfo.estateSettings.terrainDetail1 = tempUUID;
break;
case 2:
m_world.m_regInfo.estateSettings.terrainDetail2 = tempUUID;
m_regInfo.estateSettings.terrainDetail2 = tempUUID;
break;
case 3:
m_world.m_regInfo.estateSettings.terrainDetail3 = tempUUID;
m_regInfo.estateSettings.terrainDetail3 = tempUUID;
break;
}
}
@ -168,20 +170,20 @@ namespace OpenSim.world.Estate
switch (Convert.ToInt16(splitField[0]))
{
case 0:
m_world.m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow;
m_world.m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh;
m_regInfo.estateSettings.terrainStartHeight0 = tempHeightLow;
m_regInfo.estateSettings.terrainHeightRange0 = tempHeightHigh;
break;
case 1:
m_world.m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow;
m_world.m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh;
m_regInfo.estateSettings.terrainStartHeight1 = tempHeightLow;
m_regInfo.estateSettings.terrainHeightRange1 = tempHeightHigh;
break;
case 2:
m_world.m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow;
m_world.m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh;
m_regInfo.estateSettings.terrainStartHeight2 = tempHeightLow;
m_regInfo.estateSettings.terrainHeightRange2 = tempHeightHigh;
break;
case 3:
m_world.m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow;
m_world.m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh;
m_regInfo.estateSettings.terrainStartHeight3 = tempHeightLow;
m_regInfo.estateSettings.terrainHeightRange3 = tempHeightHigh;
break;
}
}
@ -197,11 +199,11 @@ namespace OpenSim.world.Estate
}
else
{
m_world.m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
m_world.m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
m_world.m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
m_world.m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter);
m_world.m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
m_regInfo.estateSettings.waterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
m_regInfo.estateSettings.terrainRaiseLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
m_regInfo.estateSettings.terrainLowerLimit = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
m_regInfo.estateSettings.useFixedSun = this.convertParamStringToBool(packet.ParamList[4].Parameter);
m_regInfo.estateSettings.sunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
sendRegionInfoPacketToAll();
}
@ -237,22 +239,22 @@ namespace OpenSim.world.Estate
RegionInfoPacket regionInfoPacket = new RegionInfoPacket();
regionInfoPacket.AgentData.AgentID = circuitData.AgentID;
regionInfoPacket.AgentData.SessionID = circuitData.SessionID;
regionInfoPacket.RegionInfo.BillableFactor = m_world.m_regInfo.estateSettings.billableFactor;
regionInfoPacket.RegionInfo.EstateID = m_world.m_regInfo.estateSettings.estateID;
regionInfoPacket.RegionInfo.MaxAgents = m_world.m_regInfo.estateSettings.maxAgents;
regionInfoPacket.RegionInfo.ObjectBonusFactor = m_world.m_regInfo.estateSettings.objectBonusFactor;
regionInfoPacket.RegionInfo.ParentEstateID = m_world.m_regInfo.estateSettings.parentEstateID;
regionInfoPacket.RegionInfo.PricePerMeter = m_world.m_regInfo.estateSettings.pricePerMeter;
regionInfoPacket.RegionInfo.RedirectGridX = m_world.m_regInfo.estateSettings.redirectGridX;
regionInfoPacket.RegionInfo.RedirectGridY = m_world.m_regInfo.estateSettings.redirectGridY;
regionInfoPacket.RegionInfo.RegionFlags = (uint)m_world.m_regInfo.estateSettings.regionFlags;
regionInfoPacket.RegionInfo.SimAccess = (byte)m_world.m_regInfo.estateSettings.simAccess;
regionInfoPacket.RegionInfo.SimName = Helpers.StringToField(m_world.m_regInfo.RegionName);
regionInfoPacket.RegionInfo.SunHour = m_world.m_regInfo.estateSettings.sunHour;
regionInfoPacket.RegionInfo.TerrainLowerLimit = m_world.m_regInfo.estateSettings.terrainLowerLimit;
regionInfoPacket.RegionInfo.TerrainRaiseLimit = m_world.m_regInfo.estateSettings.terrainRaiseLimit;
regionInfoPacket.RegionInfo.UseEstateSun = !m_world.m_regInfo.estateSettings.useFixedSun;
regionInfoPacket.RegionInfo.WaterHeight = m_world.m_regInfo.estateSettings.waterHeight;
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 = Helpers.StringToField(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;
remote_client.OutPacket(regionInfoPacket);
}
@ -262,32 +264,32 @@ namespace OpenSim.world.Estate
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
RegionHandshakePacket handshake = new RegionHandshakePacket();
handshake.RegionInfo.BillableFactor = m_world.m_regInfo.estateSettings.billableFactor;
handshake.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor;
handshake.RegionInfo.IsEstateManager = false;
handshake.RegionInfo.TerrainHeightRange00 = m_world.m_regInfo.estateSettings.terrainHeightRange0;
handshake.RegionInfo.TerrainHeightRange01 = m_world.m_regInfo.estateSettings.terrainHeightRange1;
handshake.RegionInfo.TerrainHeightRange10 = m_world.m_regInfo.estateSettings.terrainHeightRange2;
handshake.RegionInfo.TerrainHeightRange11 = m_world.m_regInfo.estateSettings.terrainHeightRange3;
handshake.RegionInfo.TerrainStartHeight00 = m_world.m_regInfo.estateSettings.terrainStartHeight0;
handshake.RegionInfo.TerrainStartHeight01 = m_world.m_regInfo.estateSettings.terrainStartHeight1;
handshake.RegionInfo.TerrainStartHeight10 = m_world.m_regInfo.estateSettings.terrainStartHeight2;
handshake.RegionInfo.TerrainStartHeight11 = m_world.m_regInfo.estateSettings.terrainStartHeight3;
handshake.RegionInfo.SimAccess = (byte)m_world.m_regInfo.estateSettings.simAccess;
handshake.RegionInfo.WaterHeight = m_world.m_regInfo.estateSettings.waterHeight;
handshake.RegionInfo.TerrainHeightRange00 = m_regInfo.estateSettings.terrainHeightRange0;
handshake.RegionInfo.TerrainHeightRange01 = m_regInfo.estateSettings.terrainHeightRange1;
handshake.RegionInfo.TerrainHeightRange10 = m_regInfo.estateSettings.terrainHeightRange2;
handshake.RegionInfo.TerrainHeightRange11 = m_regInfo.estateSettings.terrainHeightRange3;
handshake.RegionInfo.TerrainStartHeight00 = m_regInfo.estateSettings.terrainStartHeight0;
handshake.RegionInfo.TerrainStartHeight01 = m_regInfo.estateSettings.terrainStartHeight1;
handshake.RegionInfo.TerrainStartHeight10 = m_regInfo.estateSettings.terrainStartHeight2;
handshake.RegionInfo.TerrainStartHeight11 = m_regInfo.estateSettings.terrainStartHeight3;
handshake.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
handshake.RegionInfo.WaterHeight = m_regInfo.estateSettings.waterHeight;
handshake.RegionInfo.RegionFlags = (uint)m_world.m_regInfo.estateSettings.regionFlags;
handshake.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
handshake.RegionInfo.SimName = _enc.GetBytes(m_world.m_regInfo.estateSettings.waterHeight + "\0");
handshake.RegionInfo.SimOwner = m_world.m_regInfo.MasterAvatarAssignedUUID;
handshake.RegionInfo.TerrainBase0 = m_world.m_regInfo.estateSettings.terrainBase0;
handshake.RegionInfo.TerrainBase1 = m_world.m_regInfo.estateSettings.terrainBase1;
handshake.RegionInfo.TerrainBase2 = m_world.m_regInfo.estateSettings.terrainBase2;
handshake.RegionInfo.TerrainBase3 = m_world.m_regInfo.estateSettings.terrainBase3;
handshake.RegionInfo.TerrainDetail0 = m_world.m_regInfo.estateSettings.terrainDetail0;
handshake.RegionInfo.TerrainDetail1 = m_world.m_regInfo.estateSettings.terrainDetail1;
handshake.RegionInfo.TerrainDetail2 = m_world.m_regInfo.estateSettings.terrainDetail2;
handshake.RegionInfo.TerrainDetail3 = m_world.m_regInfo.estateSettings.terrainDetail3;
handshake.RegionInfo.SimName = _enc.GetBytes(m_regInfo.estateSettings.waterHeight + "\0");
handshake.RegionInfo.SimOwner = m_regInfo.MasterAvatarAssignedUUID;
handshake.RegionInfo.TerrainBase0 = m_regInfo.estateSettings.terrainBase0;
handshake.RegionInfo.TerrainBase1 = m_regInfo.estateSettings.terrainBase1;
handshake.RegionInfo.TerrainBase2 = m_regInfo.estateSettings.terrainBase2;
handshake.RegionInfo.TerrainBase3 = m_regInfo.estateSettings.terrainBase3;
handshake.RegionInfo.TerrainDetail0 = m_regInfo.estateSettings.terrainDetail0;
handshake.RegionInfo.TerrainDetail1 = m_regInfo.estateSettings.terrainDetail1;
handshake.RegionInfo.TerrainDetail2 = m_regInfo.estateSettings.terrainDetail2;
handshake.RegionInfo.TerrainDetail3 = m_regInfo.estateSettings.terrainDetail3;
handshake.RegionInfo.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
remote_client.OutPacket(handshake);

View File

@ -154,16 +154,16 @@
<Compile Include="WorldBase.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ParcelManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Avatar.Update.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="World.cs">
<Compile Include="Avatar.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Avatar.cs">
<Compile Include="ParcelManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="World.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="scripting\IScriptHandler.cs">

View File

@ -74,14 +74,17 @@ namespace OpenSim.world
private int lastParcelLocalID = START_PARCEL_LOCAL_ID - 1;
private int[,] parcelIDList = new int[64, 64];
private static World m_world;
private World m_world;
private RegionInfo m_regInfo;
#endregion
#region Constructors
public ParcelManager(World world)
public ParcelManager(World world, RegionInfo reginfo)
{
m_world = world;
m_regInfo = reginfo;
parcelIDList.Initialize();
}
@ -421,7 +424,7 @@ namespace OpenSim.world
fullSimParcel.parcelData.parcelName = "Your Sim Parcel";
fullSimParcel.parcelData.parcelDesc = "";
fullSimParcel.parcelData.ownerID = m_world.m_regInfo.MasterAvatarAssignedUUID;
fullSimParcel.parcelData.ownerID = m_regInfo.MasterAvatarAssignedUUID;
fullSimParcel.parcelData.salePrice = 1;
fullSimParcel.parcelData.parcelFlags = libsecondlife.Parcel.ParcelFlags.ForSale;
fullSimParcel.parcelData.parcelStatus = libsecondlife.Parcel.ParcelStatus.Leased;

View File

@ -83,6 +83,9 @@ namespace OpenSim.world
this.m_datastore = m_regInfo.DataStore;
this.RegisterRegionWithComms();
parcelManager = new ParcelManager(this,this.m_regInfo);
estateManager = new EstateManager(this,this.m_regInfo);
m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>();
m_scripts = new Dictionary<string, ScriptFactory>();
@ -463,7 +466,7 @@ namespace OpenSim.world
try
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
newAvatar = new Avatar(remoteClient, this, m_clientThreads);
newAvatar = new Avatar(remoteClient, this, m_clientThreads,this.m_regInfo);
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world");
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake ");
newAvatar.SendRegionHandshake();

View File

@ -23,7 +23,7 @@ namespace OpenSim.world
protected string m_regionName;
// protected InventoryCache _inventoryCache;
// protected AssetCache _assetCache;
public RegionInfo m_regInfo;
protected RegionInfo m_regInfo;
public TerrainEngine Terrain; //TODO: Replace TerrainManager with this.
protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine