aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-28 20:11:17 +0000
committerJustin Clarke Casey2008-11-28 20:11:17 +0000
commitdfbec673a4ca24ab683ea403361efa4372cc1e0d (patch)
tree4a561fa5ce77121f201008e6ea14ff5a0ba48fd4 /OpenSim/Region/Environment
parent* Committing a new test, that will fail until someone decides to fix Location... (diff)
downloadopensim-SC_OLD-dfbec673a4ca24ab683ea403361efa4372cc1e0d.zip
opensim-SC_OLD-dfbec673a4ca24ab683ea403361efa4372cc1e0d.tar.gz
opensim-SC_OLD-dfbec673a4ca24ab683ea403361efa4372cc1e0d.tar.bz2
opensim-SC_OLD-dfbec673a4ca24ab683ea403361efa4372cc1e0d.tar.xz
* simplify AddNewClient since making this root without using MakeRootAgent() no longer sets everything up properly
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneGraph.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs9
5 files changed, 22 insertions, 16 deletions
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
2229 2229
2230 #region Add/Remove Avatar Methods 2230 #region Add/Remove Avatar Methods
2231 2231
2232 public override void AddNewClient(IClientAPI client, bool child) 2232 public override void AddNewClient(IClientAPI client)
2233 { 2233 {
2234 SubscribeToClientEvents(client); 2234 SubscribeToClientEvents(client);
2235 ScenePresence presence; 2235 ScenePresence presence;
@@ -2261,12 +2261,12 @@ namespace OpenSim.Region.Environment.Scenes
2261 else 2261 else
2262 { 2262 {
2263 m_log.DebugFormat( 2263 m_log.DebugFormat(
2264 "[SCENE]: Adding new {0} agent {1} {2} in {3}", 2264 "[SCENE]: Adding new child agent {0} for new user connection in {1}",
2265 (child ? "child" : "root"), client.Name, client.AgentId, RegionInfo.RegionName); 2265 client.Name, RegionInfo.RegionName);
2266 2266
2267 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); 2267 CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
2268 2268
2269 CreateAndAddScenePresence(client, child); 2269 CreateAndAddScenePresence(client);
2270 } 2270 }
2271 2271
2272 m_LastLogin = System.Environment.TickCount; 2272 m_LastLogin = System.Environment.TickCount;
@@ -2547,17 +2547,16 @@ namespace OpenSim.Region.Environment.Scenes
2547 } 2547 }
2548 2548
2549 /// <summary> 2549 /// <summary>
2550 /// Create a scene presence and add it to this scene. 2550 /// Create a child agent scene presence and add it to this scene.
2551 /// </summary> 2551 /// </summary>
2552 /// <param name="client"></param> 2552 /// <param name="client"></param>
2553 /// <param name="child"></param>
2554 /// <returns></returns> 2553 /// <returns></returns>
2555 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) 2554 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
2556 { 2555 {
2557 AvatarAppearance appearance = null; 2556 AvatarAppearance appearance = null;
2558 GetAvatarAppearance(client, out appearance); 2557 GetAvatarAppearance(client, out appearance);
2559 2558
2560 ScenePresence avatar = m_sceneGraph.CreateAndAddScenePresence(client, child, appearance); 2559 ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
2561 2560
2562 return avatar; 2561 return avatar;
2563 } 2562 }
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
142 #region Add/Remove Agent/Avatar 142 #region Add/Remove Agent/Avatar
143 143
144 /// <summary> 144 /// <summary>
145 /// Register the new client with the scene 145 /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing
146 /// will promote it to a root agent during login.
146 /// </summary> 147 /// </summary>
147 /// <param name="client"></param 148 /// <param name="client"></param
148 /// <param name="child"></param> 149 public abstract void AddNewClient(IClientAPI client);
149 public abstract void AddNewClient(IClientAPI client, bool child);
150 150
151 /// <summary> 151 /// <summary>
152 /// 152 /// Remove a client from the scene
153 /// </summary> 153 /// </summary>
154 /// <param name="agentID"></param> 154 /// <param name="agentID"></param>
155 public abstract void RemoveClient(UUID agentID); 155 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
574 } 574 }
575 } 575 }
576 576
577 protected internal ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance) 577 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
578 { 578 {
579 ScenePresence newAvatar = null; 579 ScenePresence newAvatar = null;
580 580
581 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); 581 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
582 newAvatar.IsChildAgent = child; 582 newAvatar.IsChildAgent = true;
583 583
584 AddScenePresence(newAvatar); 584 AddScenePresence(newAvatar);
585 585
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
62 agent.CapsPath = "http://wibble.com"; 62 agent.CapsPath = "http://wibble.com";
63 63
64 scene.NewUserConnection(agent); 64 scene.NewUserConnection(agent);
65 scene.AddNewClient(new TestClient(agent), false); 65 scene.AddNewClient(new TestClient(agent));
66 66
67 ScenePresence presence = scene.GetScenePresence(agentId); 67 ScenePresence presence = scene.GetScenePresence(agentId);
68 68
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
97 agent.startpos = Vector3.Zero; 97 agent.startpos = Vector3.Zero;
98 agent.CapsPath = "http://wibble.com"; 98 agent.CapsPath = "http://wibble.com";
99 99
100 // We emulate the proper login sequence here by doing things in three stages
101 // Stage 1: simulate login by telling the scene to expect a new user connection
100 scene.NewUserConnection(agent); 102 scene.NewUserConnection(agent);
103
104 // Stage 2: add the new client as a child agent to the scene
101 IClientAPI client = new TestClient(agent); 105 IClientAPI client = new TestClient(agent);
102 scene.AddNewClient(client, true); 106 scene.AddNewClient(client);
107
108 // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance,
109 // inventory, etc.)
103 scene.AgentCrossing(agent.AgentID, new Vector3(90, 90, 90), false); 110 scene.AgentCrossing(agent.AgentID, new Vector3(90, 90, 90), false);
104 111
105 return client; 112 return client;