From 3658015de8f614b99f116b2971957307f0960c55 Mon Sep 17 00:00:00 2001
From: MW
Date: Sat, 9 Jun 2007 11:13:02 +0000
Subject: Number of small changes.
---
OpenSim/OpenSim.RegionServer/ClientView.API.cs | 40 +++++++++++++++++
.../ClientView.ProcessPackets.cs | 18 ++++++--
OpenSim/OpenSim.World/Avatar.cs | 31 -------------
OpenSim/OpenSim.World/Estate/EstateManager.cs | 23 +++++++---
OpenSim/OpenSim.World/ParcelManager.cs | 51 ++++++++++++----------
OpenSim/OpenSim.World/World.cs | 21 ++++-----
6 files changed, 109 insertions(+), 75 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index a6e5317..9e0cd48 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -98,6 +98,46 @@ namespace OpenSim
///
///
///
+ ///
+ public void SendRegionHandshake(RegionInfo regionInfo)
+ {
+ System.Text.Encoding _enc = System.Text.Encoding.ASCII;
+ RegionHandshakePacket handshake = new RegionHandshakePacket();
+
+ 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.RegionFlags = (uint)regionInfo.estateSettings.regionFlags;
+
+ handshake.RegionInfo.SimName = _enc.GetBytes(regionInfo.estateSettings.waterHeight + "\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.CacheID = LLUUID.Random(); //I guess this is for the client to remember an old setting?
+
+ this.OutPacket(handshake);
+ }
+
+ ///
+ ///
+ ///
///
public void MoveAgentIntoRegion(RegionInfo regInfo)
{
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index 8b94a82..d36e579 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -457,19 +457,31 @@ namespace OpenSim
#region Parcel related packets
case PacketType.ParcelPropertiesRequest:
ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket)Pack;
+ if(OnParcelPropertiesRequest != null)
+ {
OnParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), (int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.North), propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SnapSelection, this);
+ }
break;
case PacketType.ParcelDivide:
ParcelDividePacket parcelDivide = (ParcelDividePacket)Pack;
- OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this);
+ if (OnParcelDivideRequest != null)
+ {
+ OnParcelDivideRequest((int)Math.Round(parcelDivide.ParcelData.West), (int)Math.Round(parcelDivide.ParcelData.South), (int)Math.Round(parcelDivide.ParcelData.East), (int)Math.Round(parcelDivide.ParcelData.North), this);
+ }
break;
case PacketType.ParcelJoin:
ParcelJoinPacket parcelJoin = (ParcelJoinPacket)Pack;
- OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this);
+ if (OnParcelJoinRequest != null)
+ {
+ OnParcelJoinRequest((int)Math.Round(parcelJoin.ParcelData.West), (int)Math.Round(parcelJoin.ParcelData.South), (int)Math.Round(parcelJoin.ParcelData.East), (int)Math.Round(parcelJoin.ParcelData.North), this);
+ }
break;
case PacketType.ParcelPropertiesUpdate:
ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket)Pack;
- OnParcelPropertiesUpdateRequest(updatePacket, this);
+ if (OnParcelPropertiesUpdateRequest != null)
+ {
+ OnParcelPropertiesUpdateRequest(updatePacket, this);
+ }
break;
#endregion
diff --git a/OpenSim/OpenSim.World/Avatar.cs b/OpenSim/OpenSim.World/Avatar.cs
index 6a4c0f8..c251d57 100644
--- a/OpenSim/OpenSim.World/Avatar.cs
+++ b/OpenSim/OpenSim.World/Avatar.cs
@@ -175,38 +175,7 @@ namespace OpenSim.world
///
public void SendRegionHandshake()
{
- System.Text.Encoding _enc = System.Text.Encoding.ASCII;
- RegionHandshakePacket handshake = new RegionHandshakePacket();
- handshake.RegionInfo.BillableFactor = m_regInfo.estateSettings.billableFactor;
- handshake.RegionInfo.IsEstateManager = false;
- 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_regInfo.estateSettings.regionFlags;
-
- 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?
-
- this.ControllingClient.OutPacket(handshake);
}
///
diff --git a/OpenSim/OpenSim.World/Estate/EstateManager.cs b/OpenSim/OpenSim.World/Estate/EstateManager.cs
index 85d9b0c..c94587a 100644
--- a/OpenSim/OpenSim.World/Estate/EstateManager.cs
+++ b/OpenSim/OpenSim.World/Estate/EstateManager.cs
@@ -217,18 +217,22 @@ namespace OpenSim.world.Estate
public void sendRegionInfoPacketToAll()
{
- foreach (OpenSim.world.Avatar av in m_world.Avatars.Values)
- {
- this.sendRegionInfoPacket(av.ControllingClient);
- }
+ List avatars = m_world.RequestAvatarList();
+
+ for (int i = 0; i < avatars.Count; i++)
+ {
+ this.sendRegionInfoPacket(avatars[i].ControllingClient);
+ }
}
public void sendRegionHandshakeToAll()
{
- foreach (OpenSim.world.Avatar av in m_world.Avatars.Values)
+ List avatars = m_world.RequestAvatarList();
+
+ for (int i = 0; i < avatars.Count; i++)
{
- av.SendRegionHandshake();
- }
+ this.sendRegionHandshake(avatars[i].ControllingClient);
+ }
}
public void sendRegionInfoPacket(IClientAPI remote_client)
@@ -259,5 +263,10 @@ namespace OpenSim.world.Estate
remote_client.OutPacket(regionInfoPacket);
}
+ public void sendRegionHandshake(IClientAPI remoteClient)
+ {
+ remoteClient.SendRegionHandshake(m_regInfo);
+ }
+
}
}
diff --git a/OpenSim/OpenSim.World/ParcelManager.cs b/OpenSim/OpenSim.World/ParcelManager.cs
index 4a9bfb1..db6909d 100644
--- a/OpenSim/OpenSim.World/ParcelManager.cs
+++ b/OpenSim/OpenSim.World/ParcelManager.cs
@@ -35,7 +35,7 @@ using OpenSim.Framework.Types;
namespace OpenSim.world
{
-
+
#region ParcelManager Class
///
@@ -62,7 +62,7 @@ namespace OpenSim.world
public const byte PARCEL_FLAG_PROPERTY_BORDER_SOUTH = (byte)128; //Equals 10000000
//RequestResults (I think these are right, they seem to work):
- public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel
+ public const int PARCEL_RESULT_ONE_PARCEL = 0; // The request they made contained only one parcel
public const int PARCEL_RESULT_MULTIPLE_PARCELS = 1; // The request they made contained more than one parcel
//These are other constants. Yay!
@@ -143,7 +143,7 @@ namespace OpenSim.world
}
parcelList[lastParcelLocalID].forceUpdateParcelInfo();
-
+
}
///
/// Removes a parcel from the list. Will not remove if local_id is still owning an area in parcelIDList
@@ -258,12 +258,12 @@ namespace OpenSim.world
int startParcelIndex = startParcel.parcelData.localID;
parcelList[startParcelIndex].setParcelBitmap(Parcel.modifyParcelBitmapSquare(startParcel.getParcelBitmap(), start_x, start_y, end_x, end_y, false));
parcelList[startParcelIndex].forceUpdateParcelInfo();
-
+
//Now add the new parcel
addParcel(newParcel);
-
+
@@ -282,7 +282,7 @@ namespace OpenSim.world
{
end_x -= 4;
end_y -= 4;
-
+
//NOTE: The following only connects the parcels in each corner and not all the parcels that are within the selection box!
//This should be fixed later -- somewhat "incomplete code" --Ming
Parcel startParcel, endParcel;
@@ -456,7 +456,7 @@ namespace OpenSim.world
public void handleParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client)
{
join(west, south, east, north, remote_client.AgentId);
-
+
}
#endregion
@@ -543,7 +543,7 @@ namespace OpenSim.world
//Place all new variables here!
newParcel.parcelBitmap = (bool[,])(this.parcelBitmap.Clone());
newParcel.parcelData = parcelData.Copy();
-
+
return newParcel;
}
@@ -565,7 +565,7 @@ namespace OpenSim.world
updatePacket.ParcelData.AABBMin = parcelData.AABBMin;
updatePacket.ParcelData.Area = parcelData.area;
updatePacket.ParcelData.AuctionID = parcelData.auctionID;
- updatePacket.ParcelData.AuthBuyerID =parcelData.authBuyerID; //unemplemented
+ updatePacket.ParcelData.AuthBuyerID = parcelData.authBuyerID; //unemplemented
updatePacket.ParcelData.Bitmap = parcelData.parcelBitmapByteArray;
@@ -606,7 +606,7 @@ namespace OpenSim.world
updatePacket.ParcelData.SequenceID = sequence_id;
updatePacket.ParcelData.SimWideMaxPrims = 15000; //unemplemented
updatePacket.ParcelData.SimWideTotalPrims = 0; //unemplemented
- updatePacket.ParcelData.SnapSelection = snap_selection;
+ updatePacket.ParcelData.SnapSelection = snap_selection;
updatePacket.ParcelData.SnapshotID = parcelData.snapshotID;
updatePacket.ParcelData.Status = (byte)parcelData.parcelStatus;
updatePacket.ParcelData.TotalPrims = 0; //unemplemented
@@ -638,14 +638,17 @@ namespace OpenSim.world
parcelData.userLocation = packet.ParcelData.UserLocation;
parcelData.userLookAt = packet.ParcelData.UserLookAt;
- foreach (Avatar av in m_world.Avatars.Values)
+ List avatars = m_world.RequestAvatarList();
+
+ for (int i = 0; i < avatars.Count; i++)
{
- Parcel over = m_world.parcelManager.getParcel((int)Math.Round(av.Pos.X), (int)Math.Round(av.Pos.Y));
+ Parcel over = m_world.parcelManager.getParcel((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y));
if (over == this)
{
- sendParcelProperties(0, false, 0, av.ControllingClient);
+ sendParcelProperties(0, false, 0, avatars[i].ControllingClient);
}
}
+
}
}
#endregion
@@ -720,7 +723,7 @@ namespace OpenSim.world
//Valid: Lets set it
parcelBitmap = bitmap;
forceUpdateParcelInfo();
-
+
}
}
///
@@ -761,23 +764,23 @@ namespace OpenSim.world
private bool[,] convertBytesToParcelBitmap()
{
bool[,] tempConvertMap = new bool[64, 64];
- tempConvertMap.Initialize();
+ tempConvertMap.Initialize();
byte tempByte = 0;
int x = 0, y = 0, i = 0, bitNum = 0;
- for(i = 0; i < 512; i++)
+ for (i = 0; i < 512; i++)
{
tempByte = parcelData.parcelBitmapByteArray[i];
- for(bitNum = 0; bitNum < 8; bitNum++)
+ for (bitNum = 0; bitNum < 8; bitNum++)
{
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1);
tempConvertMap[x, y] = bit;
x++;
- if(x > 63)
+ if (x > 63)
{
- x = 0;
+ x = 0;
y++;
}
-
+
}
}
@@ -859,7 +862,7 @@ namespace OpenSim.world
{
//Throw an exception - The bitmap is not 64x64
throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeParcelBitmaps");
-
+
}
int x, y;
@@ -879,9 +882,9 @@ namespace OpenSim.world
#endregion
-
+
}
#endregion
-
-
+
+
}
diff --git a/OpenSim/OpenSim.World/World.cs b/OpenSim/OpenSim.World/World.cs
index dc9602e..3e74501 100644
--- a/OpenSim/OpenSim.World/World.cs
+++ b/OpenSim/OpenSim.World/World.cs
@@ -24,9 +24,8 @@ namespace OpenSim.world
{
protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
public object LockPhysicsEngine = new object();
- public Dictionary Avatars;
- public Dictionary Prims;
- //public ScriptEngine Scripts;
+ protected Dictionary Avatars;
+ protected Dictionary Prims;
public uint _localNumber = 0;
private PhysicsScene phyScene;
private float timeStep = 0.1f;
@@ -83,8 +82,8 @@ 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);
+ parcelManager = new ParcelManager(this, this.m_regInfo);
+ estateManager = new EstateManager(this, this.m_regInfo);
m_scriptHandlers = new Dictionary();
m_scripts = new Dictionary();
@@ -476,10 +475,12 @@ 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,this.m_regInfo);
+ 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();
+
+ //newAvatar.SendRegionHandshake();
+ this.estateManager.sendRegionHandshake(remoteClient);
PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
lock (this.LockPhysicsEngine)
@@ -522,7 +523,7 @@ namespace OpenSim.world
///
protected void InformClientOfNeighbours(IClientAPI remoteClient)
{
- // Console.WriteLine("informing client of neighbouring regions");
+ // Console.WriteLine("informing client of neighbouring regions");
List neighbours = this.commsManager.RequestNeighbours(this.m_regInfo);
//Console.WriteLine("we have " + neighbours.Count + " neighbouring regions");
@@ -530,7 +531,7 @@ namespace OpenSim.world
{
for (int i = 0; i < neighbours.Count; i++)
{
- // Console.WriteLine("sending neighbours data");
+ // Console.WriteLine("sending neighbours data");
AgentCircuitData agent = remoteClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
@@ -556,7 +557,7 @@ namespace OpenSim.world
// ie it could be all Avatars within a certain range of the calling prim/avatar.
///
- ///
+ /// Request a List of all Avatars in this World
///
///
public List RequestAvatarList()
--
cgit v1.1