diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index f139ba5..4668dae 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -505,6 +505,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
505 | } | 505 | } |
506 | } | 506 | } |
507 | 507 | ||
508 | public void AdjustKnownSeeds() | ||
509 | { | ||
510 | Dictionary<ulong, string> seeds = Scene.GetChildrenSeeds(UUID); | ||
511 | List<ulong> old = new List<ulong>(); | ||
512 | foreach (ulong handle in seeds.Keys) | ||
513 | { | ||
514 | uint x, y; | ||
515 | Utils.LongToUInts(handle, out x, out y); | ||
516 | x = x / Constants.RegionSize; | ||
517 | y = y / Constants.RegionSize; | ||
518 | if (Util.IsOutsideView(x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) | ||
519 | { | ||
520 | old.Add(handle); | ||
521 | } | ||
522 | } | ||
523 | DropOldNeighbours(old); | ||
524 | Scene.SetChildrenSeed(UUID, seeds); | ||
525 | KnownRegions = seeds; | ||
526 | //Console.WriteLine(" ++++++++++AFTER+++++++++++++ "); | ||
527 | //DumpKnownRegions(); | ||
528 | } | ||
529 | |||
508 | public void DumpKnownRegions() | 530 | public void DumpKnownRegions() |
509 | { | 531 | { |
510 | Console.WriteLine("================ KnownRegions {0} ================", Scene.RegionInfo.RegionName); | 532 | Console.WriteLine("================ KnownRegions {0} ================", Scene.RegionInfo.RegionName); |
@@ -545,6 +567,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
545 | m_grouptitle = gm.GetGroupTitle(m_uuid); | 567 | m_grouptitle = gm.GetGroupTitle(m_uuid); |
546 | 568 | ||
547 | AbsolutePosition = m_controllingClient.StartPos; | 569 | AbsolutePosition = m_controllingClient.StartPos; |
570 | AdjustKnownSeeds(); | ||
548 | 571 | ||
549 | TrySetMovementAnimation("STAND"); // TODO: I think, this won't send anything, as we are still a child here... | 572 | TrySetMovementAnimation("STAND"); // TODO: I think, this won't send anything, as we are still a child here... |
550 | 573 | ||
@@ -935,7 +958,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
935 | if (m_knownChildRegions.ContainsKey(regionHandle)) | 958 | if (m_knownChildRegions.ContainsKey(regionHandle)) |
936 | { | 959 | { |
937 | m_knownChildRegions.Remove(regionHandle); | 960 | m_knownChildRegions.Remove(regionHandle); |
938 | //Console.WriteLine(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); | 961 | //Console.WriteLine(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); |
939 | } | 962 | } |
940 | } | 963 | } |
941 | } | 964 | } |
@@ -1949,9 +1972,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1949 | CheckForBorderCrossing(); | 1972 | CheckForBorderCrossing(); |
1950 | CheckForSignificantMovement(); // sends update to the modules. | 1973 | CheckForSignificantMovement(); // sends update to the modules. |
1951 | } | 1974 | } |
1952 | |||
1953 | //if ((x++ % 30) == 0) | ||
1954 | // Console.WriteLine(" >> In {0} known regions: {0}, seeds:{1}", Scene.RegionInfo.RegionName, KnownRegions.Count, Scene.GetChildrenSeeds(UUID)); | ||
1955 | } | 1975 | } |
1956 | 1976 | ||
1957 | #endregion | 1977 | #endregion |
@@ -2412,6 +2432,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
2412 | m_physicsActor.Flying); | 2432 | m_physicsActor.Flying); |
2413 | if (crossingSuccessful) | 2433 | if (crossingSuccessful) |
2414 | { | 2434 | { |
2435 | // Next, let's close the child agent connections that are too far away. | ||
2436 | CloseChildAgents(neighbourx, neighboury); | ||
2437 | |||
2415 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); | 2438 | AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); |
2416 | 2439 | ||
2417 | //Console.WriteLine("BEFORE CROSS"); | 2440 | //Console.WriteLine("BEFORE CROSS"); |
@@ -2446,15 +2469,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
2446 | CrossAttachmentsIntoNewRegion(neighbourHandle, true); | 2469 | CrossAttachmentsIntoNewRegion(neighbourHandle, true); |
2447 | 2470 | ||
2448 | // m_scene.SendKillObject(m_localId); | 2471 | // m_scene.SendKillObject(m_localId); |
2449 | // Next, let's close the child agent connections that are too far away. | ||
2450 | CloseChildAgents(neighbourx, neighboury); | ||
2451 | 2472 | ||
2452 | m_scene.NotifyMyCoarseLocationChange(); | 2473 | m_scene.NotifyMyCoarseLocationChange(); |
2453 | // the user may change their profile information in other region, | 2474 | // the user may change their profile information in other region, |
2454 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 2475 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
2455 | if (m_scene.NeedSceneCacheClear(UUID)) | 2476 | if (m_scene.NeedSceneCacheClear(UUID)) |
2477 | { | ||
2456 | m_scene.CommsManager.UserProfileCacheService.RemoveUser(UUID); | 2478 | m_scene.CommsManager.UserProfileCacheService.RemoveUser(UUID); |
2457 | m_log.InfoFormat("[AVATAR]: User {0} is going to another region, profile cache removed", UUID); | 2479 | m_log.InfoFormat("[AVATAR]: User {0} is going to another region, profile cache removed", UUID); |
2480 | } | ||
2458 | } | 2481 | } |
2459 | else | 2482 | else |
2460 | { | 2483 | { |
@@ -2487,16 +2510,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
2487 | { | 2510 | { |
2488 | foreach (ulong handle in m_knownChildRegions.Keys) | 2511 | foreach (ulong handle in m_knownChildRegions.Keys) |
2489 | { | 2512 | { |
2490 | uint x, y; | 2513 | // Don't close the agent on this region yet |
2491 | Utils.LongToUInts(handle, out x, out y); | 2514 | if (handle != Scene.RegionInfo.RegionHandle) |
2492 | x = x / Constants.RegionSize; | ||
2493 | y = y / Constants.RegionSize; | ||
2494 | |||
2495 | //Console.WriteLine("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | ||
2496 | //Console.WriteLine("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
2497 | if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) | ||
2498 | { | 2515 | { |
2499 | byebyeRegions.Add(handle); | 2516 | uint x, y; |
2517 | Utils.LongToUInts(handle, out x, out y); | ||
2518 | x = x / Constants.RegionSize; | ||
2519 | y = y / Constants.RegionSize; | ||
2520 | |||
2521 | //Console.WriteLine("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | ||
2522 | //Console.WriteLine("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
2523 | if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) | ||
2524 | { | ||
2525 | byebyeRegions.Add(handle); | ||
2526 | } | ||
2500 | } | 2527 | } |
2501 | } | 2528 | } |
2502 | } | 2529 | } |
@@ -2510,7 +2537,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2510 | RemoveNeighbourRegion(handle); | 2537 | RemoveNeighbourRegion(handle); |
2511 | } | 2538 | } |
2512 | 2539 | ||
2513 | |||
2514 | } | 2540 | } |
2515 | 2541 | ||
2516 | #endregion | 2542 | #endregion |