diff options
author | Justin Clark-Casey (justincc) | 2013-08-23 00:49:13 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-09-04 00:43:35 +0100 |
commit | 5c35aa560ee11e2b92cc71145c7145a8b45a137e (patch) | |
tree | 36d52c64c990c64540f974ab9a75af28a9dc32ce /OpenSim/Region | |
parent | minor: Correct typo on "debug stats record start" message (diff) | |
download | opensim-SC_OLD-5c35aa560ee11e2b92cc71145c7145a8b45a137e.zip opensim-SC_OLD-5c35aa560ee11e2b92cc71145c7145a8b45a137e.tar.gz opensim-SC_OLD-5c35aa560ee11e2b92cc71145c7145a8b45a137e.tar.bz2 opensim-SC_OLD-5c35aa560ee11e2b92cc71145c7145a8b45a137e.tar.xz |
Refactor: merge SceneGraph.AddScenePresence() into CreateAndAddChildScenePresence() since the former was only ever called from the latter
This allows us to remove dead code relating to adding root agents directly to the scenegraph, which never happens.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 34 |
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> |