From dfbec673a4ca24ab683ea403361efa4372cc1e0d Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 28 Nov 2008 20:11:17 +0000
Subject: * simplify AddNewClient since making this root without using
MakeRootAgent() no longer sets everything up properly
---
OpenSim/Region/Environment/Scenes/Scene.cs | 15 +++++++--------
OpenSim/Region/Environment/Scenes/SceneBase.cs | 8 ++++----
OpenSim/Region/Environment/Scenes/SceneGraph.cs | 4 ++--
.../Region/Environment/Scenes/Tests/ScenePresenceTests.cs | 2 +-
OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs | 9 ++++++++-
5 files changed, 22 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index e544703..97442fd 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2229,7 +2229,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Add/Remove Avatar Methods
- public override void AddNewClient(IClientAPI client, bool child)
+ public override void AddNewClient(IClientAPI client)
{
SubscribeToClientEvents(client);
ScenePresence presence;
@@ -2261,12 +2261,12 @@ namespace OpenSim.Region.Environment.Scenes
else
{
m_log.DebugFormat(
- "[SCENE]: Adding new {0} agent {1} {2} in {3}",
- (child ? "child" : "root"), client.Name, client.AgentId, RegionInfo.RegionName);
+ "[SCENE]: Adding new child agent {0} for new user connection in {1}",
+ client.Name, RegionInfo.RegionName);
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
- CreateAndAddScenePresence(client, child);
+ CreateAndAddScenePresence(client);
}
m_LastLogin = System.Environment.TickCount;
@@ -2547,17 +2547,16 @@ namespace OpenSim.Region.Environment.Scenes
}
///
- /// Create a scene presence and add it to this scene.
+ /// Create a child agent scene presence and add it to this scene.
///
///
- ///
///
- protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
+ protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
{
AvatarAppearance appearance = null;
GetAvatarAppearance(client, out appearance);
- ScenePresence avatar = m_sceneGraph.CreateAndAddScenePresence(client, child, appearance);
+ ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
return avatar;
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 7137c2f..6d1e808 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -142,14 +142,14 @@ namespace OpenSim.Region.Environment.Scenes
#region Add/Remove Agent/Avatar
///
- /// Register the new client with the scene
+ /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing
+ /// will promote it to a root agent during login.
///
///
- public abstract void AddNewClient(IClientAPI client, bool child);
+ public abstract void AddNewClient(IClientAPI client);
///
- ///
+ /// Remove a client from the scene
///
///
public abstract void RemoveClient(UUID agentID);
diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
index 8c9fdd4..da3be08 100644
--- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
@@ -574,12 +574,12 @@ namespace OpenSim.Region.Environment.Scenes
}
}
- protected internal ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance)
+ protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
{
ScenePresence newAvatar = null;
newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
- newAvatar.IsChildAgent = child;
+ newAvatar.IsChildAgent = true;
AddScenePresence(newAvatar);
diff --git a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs
index a16c26a..a19dbf7 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
agent.CapsPath = "http://wibble.com";
scene.NewUserConnection(agent);
- scene.AddNewClient(new TestClient(agent), false);
+ scene.AddNewClient(new TestClient(agent));
ScenePresence presence = scene.GetScenePresence(agentId);
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
index 468a4ad..b169d9a 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
@@ -97,9 +97,16 @@ namespace OpenSim.Region.Environment.Scenes.Tests
agent.startpos = Vector3.Zero;
agent.CapsPath = "http://wibble.com";
+ // We emulate the proper login sequence here by doing things in three stages
+ // Stage 1: simulate login by telling the scene to expect a new user connection
scene.NewUserConnection(agent);
+
+ // Stage 2: add the new client as a child agent to the scene
IClientAPI client = new TestClient(agent);
- scene.AddNewClient(client, true);
+ scene.AddNewClient(client);
+
+ // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance,
+ // inventory, etc.)
scene.AgentCrossing(agent.AgentID, new Vector3(90, 90, 90), false);
return client;
--
cgit v1.1