aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs34
1 files changed, 6 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index bb7ae7f..0a5bfd2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -561,39 +561,15 @@ namespace OpenSim.Region.Framework.Scenes
561 protected internal ScenePresence CreateAndAddChildScenePresence( 561 protected internal ScenePresence CreateAndAddChildScenePresence(
562 IClientAPI client, AvatarAppearance appearance, PresenceType type) 562 IClientAPI client, AvatarAppearance appearance, PresenceType type)
563 { 563 {
564 ScenePresence newAvatar = null;
565
566 // ScenePresence always defaults to child agent 564 // ScenePresence always defaults to child agent
567 newAvatar = new ScenePresence(client, m_parentScene, appearance, type); 565 ScenePresence presence = new ScenePresence(client, m_parentScene, appearance, type);
568
569 AddScenePresence(newAvatar);
570
571 return newAvatar;
572 }
573
574 /// <summary>
575 /// Add a presence to the scene
576 /// </summary>
577 /// <param name="presence"></param>
578 protected internal void AddScenePresence(ScenePresence presence)
579 {
580 // Always a child when added to the scene
581 bool child = presence.IsChildAgent;
582
583 if (child)
584 {
585 m_numChildAgents++;
586 }
587 else
588 {
589 m_numRootAgents++;
590 presence.AddToPhysicalScene(false);
591 }
592 566
593 Entities[presence.UUID] = presence; 567 Entities[presence.UUID] = presence;
594 568
595 lock (m_presenceLock) 569 lock (m_presenceLock)
596 { 570 {
571 m_numChildAgents++;
572
597 Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap); 573 Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap);
598 List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray); 574 List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray);
599 575
@@ -604,7 +580,7 @@ namespace OpenSim.Region.Framework.Scenes
604 } 580 }
605 else 581 else
606 { 582 {
607 // Remember the old presene reference from the dictionary 583 // Remember the old presence reference from the dictionary
608 ScenePresence oldref = newmap[presence.UUID]; 584 ScenePresence oldref = newmap[presence.UUID];
609 // Replace the presence reference in the dictionary with the new value 585 // Replace the presence reference in the dictionary with the new value
610 newmap[presence.UUID] = presence; 586 newmap[presence.UUID] = presence;
@@ -616,6 +592,8 @@ namespace OpenSim.Region.Framework.Scenes
616 m_scenePresenceMap = newmap; 592 m_scenePresenceMap = newmap;
617 m_scenePresenceArray = newlist; 593 m_scenePresenceArray = newlist;
618 } 594 }
595
596 return presence;
619 } 597 }
620 598
621 /// <summary> 599 /// <summary>