aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-26 00:47:36 +0000
committerJustin Clarke Casey2008-05-26 00:47:36 +0000
commita28ca7b78b518d033437404caeff0f852dcc1094 (patch)
tree98c8b2ac6c71702d9371812da0b30e33797f2603
parent* Refactor: Separate out RemoveScenePresence and add into InnerScene to match... (diff)
downloadopensim-SC_OLD-a28ca7b78b518d033437404caeff0f852dcc1094.zip
opensim-SC_OLD-a28ca7b78b518d033437404caeff0f852dcc1094.tar.gz
opensim-SC_OLD-a28ca7b78b518d033437404caeff0f852dcc1094.tar.bz2
opensim-SC_OLD-a28ca7b78b518d033437404caeff0f852dcc1094.tar.xz
* Refactor: remove code duplication between add ScenePresence methods in InnerScene
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs44
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs1
2 files changed, 4 insertions, 41 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index a2fdf66..45ce70a 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -488,51 +488,15 @@ namespace OpenSim.Region.Environment.Scenes
488 488
489 } 489 }
490 490
491 public ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance) 491 protected internal ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child, AvatarAppearance appearance)
492 { 492 {
493 ScenePresence newAvatar = null; 493 ScenePresence newAvatar = null;
494 494
495 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); 495 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
496 newAvatar.IsChildAgent = child; 496 newAvatar.IsChildAgent = child;
497 497
498 if (child) 498 AddScenePresence(newAvatar);
499 {
500 m_numChildAgents++;
501 m_log.Info("[SCENE]: " + m_regInfo.RegionName + ": Creating new child agent.");
502 }
503 else
504 {
505 m_numRootAgents++;
506 m_log.Info("[SCENE]: " + m_regInfo.RegionName + ": Creating new root agent.");
507 m_log.Info("[SCENE]: " + m_regInfo.RegionName + ": Adding Physical agent.");
508
509 newAvatar.AddToPhysicalScene();
510 }
511
512 lock (Entities)
513 {
514 if (!Entities.ContainsKey(client.AgentId))
515 {
516 Entities.Add(client.AgentId, newAvatar);
517 }
518 else
519 {
520 Entities[client.AgentId] = newAvatar;
521 }
522 }
523 499
524 lock (ScenePresences)
525 {
526 if (ScenePresences.ContainsKey(client.AgentId))
527 {
528 ScenePresences[client.AgentId] = newAvatar;
529 }
530 else
531 {
532 ScenePresences.Add(client.AgentId, newAvatar);
533 }
534 }
535
536 return newAvatar; 500 return newAvatar;
537 } 501 }
538 502
@@ -540,7 +504,7 @@ namespace OpenSim.Region.Environment.Scenes
540 /// Add a presence to the scene 504 /// Add a presence to the scene
541 /// </summary> 505 /// </summary>
542 /// <param name="presence"></param> 506 /// <param name="presence"></param>
543 internal void AddScenePresence(ScenePresence presence) 507 protected internal void AddScenePresence(ScenePresence presence)
544 { 508 {
545 bool child = presence.IsChildAgent; 509 bool child = presence.IsChildAgent;
546 510
@@ -572,7 +536,7 @@ namespace OpenSim.Region.Environment.Scenes
572 /// <summary> 536 /// <summary>
573 /// Remove a presence from the scene 537 /// Remove a presence from the scene
574 /// </summary> 538 /// </summary>
575 internal void RemoveScenePresence(LLUUID agentID) 539 protected internal void RemoveScenePresence(LLUUID agentID)
576 { 540 {
577 lock (Entities) 541 lock (Entities)
578 { 542 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index a44e88e..1beea2b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1826,7 +1826,6 @@ namespace OpenSim.Region.Environment.Scenes
1826 1826
1827 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) 1827 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
1828 { 1828 {
1829
1830 AvatarAppearance appearance = null; 1829 AvatarAppearance appearance = null;
1831 GetAvatarAppearance(client, out appearance); 1830 GetAvatarAppearance(client, out appearance);
1832 1831