From 4cbf0444df4b4c0eb3616e19279203e5f17a939b Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 1 Aug 2009 14:26:00 +0000 Subject: * Tweak the caps manager so that the NPCAvatar works again. --- .../Framework/Scenes/SceneCommunicationService.cs | 40 ++++++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 6653544..4f2b6ec 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -360,15 +360,33 @@ namespace OpenSim.Region.Framework.Scenes } // we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be // So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/ - neighbours = + if (m_regionInfo != null) + { + neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); + } + else + { + m_log.Debug("[ENABLENEIGHBOURCHILDAGENTS]: m_regionInfo was null in EnableNeighbourChildAgents, is this a NPC?"); + } + /// We need to find the difference between the new regions where there are no child agents /// and the regions where there are already child agents. We only send notification to the former. List neighbourHandles = NeighbourHandles(neighbours); // on this region neighbourHandles.Add(avatar.Scene.RegionInfo.RegionHandle); // add this region too - List previousRegionNeighbourHandles - = new List(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID).Keys); + List previousRegionNeighbourHandles ; + + if (avatar.Scene.CapsModule != null) + { + previousRegionNeighbourHandles = + new List(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID).Keys); + } + else + { + previousRegionNeighbourHandles = new List(); + } + List newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles); List oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles); @@ -381,8 +399,12 @@ namespace OpenSim.Region.Framework.Scenes avatar.DropOldNeighbours(oldRegions); /// Collect as many seeds as possible - Dictionary seeds - = new Dictionary(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID)); + Dictionary seeds; + if (avatar.Scene.CapsModule != null) + seeds + = new Dictionary(avatar.Scene.CapsModule.GetChildrenSeeds(avatar.UUID)); + else + seeds = new Dictionary(); //m_log.Debug(" !!! No. of seeds: " + seeds.Count); if (!seeds.ContainsKey(avatar.Scene.RegionInfo.RegionHandle)) @@ -419,8 +441,12 @@ namespace OpenSim.Region.Framework.Scenes { a.ChildrenCapSeeds = new Dictionary(seeds); } - // These two are the same thing! - avatar.Scene.CapsModule.SetChildrenSeed(avatar.UUID, seeds); + + if (avatar.Scene.CapsModule != null) + { + // These two are the same thing! + avatar.Scene.CapsModule.SetChildrenSeed(avatar.UUID, seeds); + } avatar.KnownRegions = seeds; //avatar.Scene.DumpChildrenSeeds(avatar.UUID); //avatar.DumpKnownRegions(); -- cgit v1.1