aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/InnerScene.cs
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 /OpenSim/Region/Environment/Scenes/InnerScene.cs
parent* Refactor: Separate out RemoveScenePresence and add into InnerScene to match... (diff)
downloadopensim-SC-a28ca7b78b518d033437404caeff0f852dcc1094.zip
opensim-SC-a28ca7b78b518d033437404caeff0f852dcc1094.tar.gz
opensim-SC-a28ca7b78b518d033437404caeff0f852dcc1094.tar.bz2
opensim-SC-a28ca7b78b518d033437404caeff0f852dcc1094.tar.xz
* Refactor: remove code duplication between add ScenePresence methods in InnerScene
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs44
1 files changed, 4 insertions, 40 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 {