diff options
author | Justin Clark-Casey (justincc) | 2012-05-19 04:01:05 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-19 04:01:05 +0100 |
commit | fb8705dd4de2dc28b283b105f21c56e2ca9d89ff (patch) | |
tree | 34aa91fec65ba1206a987a2965d444af66b0f64d /OpenSim/Region/RegionCombinerModule | |
parent | Correct some log messages in RegionCombinerModule about the position of the r... (diff) | |
download | opensim-SC_OLD-fb8705dd4de2dc28b283b105f21c56e2ca9d89ff.zip opensim-SC_OLD-fb8705dd4de2dc28b283b105f21c56e2ca9d89ff.tar.gz opensim-SC_OLD-fb8705dd4de2dc28b283b105f21c56e2ca9d89ff.tar.bz2 opensim-SC_OLD-fb8705dd4de2dc28b283b105f21c56e2ca9d89ff.tar.xz |
refactor: Rename connection paramaters from "conn" and "regionConnections" so that it's easy to tell whether they refer to the root region connection or a new region connection
Diffstat (limited to 'OpenSim/Region/RegionCombinerModule')
-rw-r--r-- | OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | 260 |
1 files changed, 133 insertions, 127 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 95db22b..b3750ca 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | |||
@@ -229,22 +229,21 @@ namespace OpenSim.Region.RegionCombinerModule | |||
229 | westBorder.CrossDirection = Cardinals.W; | 229 | westBorder.CrossDirection = Cardinals.W; |
230 | scene.WestBorders[0] = westBorder; | 230 | scene.WestBorders[0] = westBorder; |
231 | 231 | ||
232 | RegionConnections regionConnections = new RegionConnections(); | 232 | RegionConnections newConn = new RegionConnections(); |
233 | regionConnections.ConnectedRegions = new List<RegionData>(); | 233 | newConn.ConnectedRegions = new List<RegionData>(); |
234 | regionConnections.RegionScene = scene; | 234 | newConn.RegionScene = scene; |
235 | regionConnections.RegionLandChannel = scene.LandChannel; | 235 | newConn.RegionLandChannel = scene.LandChannel; |
236 | regionConnections.RegionId = scene.RegionInfo.originRegionID; | 236 | newConn.RegionId = scene.RegionInfo.originRegionID; |
237 | regionConnections.X = scene.RegionInfo.RegionLocX; | 237 | newConn.X = scene.RegionInfo.RegionLocX; |
238 | regionConnections.Y = scene.RegionInfo.RegionLocY; | 238 | newConn.Y = scene.RegionInfo.RegionLocY; |
239 | regionConnections.XEnd = (int)Constants.RegionSize; | 239 | newConn.XEnd = (int)Constants.RegionSize; |
240 | regionConnections.YEnd = (int)Constants.RegionSize; | 240 | newConn.YEnd = (int)Constants.RegionSize; |
241 | |||
242 | 241 | ||
243 | lock (m_regions) | 242 | lock (m_regions) |
244 | { | 243 | { |
245 | bool connectedYN = false; | 244 | bool connectedYN = false; |
246 | 245 | ||
247 | foreach (RegionConnections conn in m_regions.Values) | 246 | foreach (RegionConnections rootConn in m_regions.Values) |
248 | { | 247 | { |
249 | #region commented | 248 | #region commented |
250 | /* | 249 | /* |
@@ -410,12 +409,12 @@ namespace OpenSim.Region.RegionCombinerModule | |||
410 | //xxx | 409 | //xxx |
411 | 410 | ||
412 | 411 | ||
413 | if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd | 412 | if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd |
414 | >= (regionConnections.X * (int)Constants.RegionSize)) | 413 | >= (newConn.X * (int)Constants.RegionSize)) |
415 | && (((int)conn.Y * (int)Constants.RegionSize) | 414 | && (((int)rootConn.Y * (int)Constants.RegionSize) |
416 | >= (regionConnections.Y * (int)Constants.RegionSize))) | 415 | >= (newConn.Y * (int)Constants.RegionSize))) |
417 | { | 416 | { |
418 | connectedYN = DoWorkForOneRegionOverPlusXY(conn, regionConnections, scene); | 417 | connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); |
419 | break; | 418 | break; |
420 | } | 419 | } |
421 | 420 | ||
@@ -423,12 +422,12 @@ namespace OpenSim.Region.RegionCombinerModule | |||
423 | //xyx | 422 | //xyx |
424 | //xxx | 423 | //xxx |
425 | //xxx | 424 | //xxx |
426 | if ((((int)conn.X * (int)Constants.RegionSize) | 425 | if ((((int)rootConn.X * (int)Constants.RegionSize) |
427 | >= (regionConnections.X * (int)Constants.RegionSize)) | 426 | >= (newConn.X * (int)Constants.RegionSize)) |
428 | && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd | 427 | && (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd |
429 | >= (regionConnections.Y * (int)Constants.RegionSize))) | 428 | >= (newConn.Y * (int)Constants.RegionSize))) |
430 | { | 429 | { |
431 | connectedYN = DoWorkForOneRegionOverXPlusY(conn, regionConnections, scene); | 430 | connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene); |
432 | break; | 431 | break; |
433 | } | 432 | } |
434 | 433 | ||
@@ -436,12 +435,12 @@ namespace OpenSim.Region.RegionCombinerModule | |||
436 | //xxy | 435 | //xxy |
437 | //xxx | 436 | //xxx |
438 | //xxx | 437 | //xxx |
439 | if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd | 438 | if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd |
440 | >= (regionConnections.X * (int)Constants.RegionSize)) | 439 | >= (newConn.X * (int)Constants.RegionSize)) |
441 | && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd | 440 | && (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd |
442 | >= (regionConnections.Y * (int)Constants.RegionSize))) | 441 | >= (newConn.Y * (int)Constants.RegionSize))) |
443 | { | 442 | { |
444 | connectedYN = DoWorkForOneRegionOverPlusXPlusY(conn, regionConnections, scene); | 443 | connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene); |
445 | break; | 444 | break; |
446 | 445 | ||
447 | } | 446 | } |
@@ -450,7 +449,7 @@ namespace OpenSim.Region.RegionCombinerModule | |||
450 | // If !connectYN means that this region is a root region | 449 | // If !connectYN means that this region is a root region |
451 | if (!connectedYN) | 450 | if (!connectedYN) |
452 | { | 451 | { |
453 | DoWorkForRootRegion(regionConnections, scene); | 452 | DoWorkForRootRegion(newConn, scene); |
454 | } | 453 | } |
455 | } | 454 | } |
456 | 455 | ||
@@ -458,59 +457,57 @@ namespace OpenSim.Region.RegionCombinerModule | |||
458 | AdjustLargeRegionBounds(); | 457 | AdjustLargeRegionBounds(); |
459 | } | 458 | } |
460 | 459 | ||
461 | private bool DoWorkForOneRegionOverPlusXY(RegionConnections conn, RegionConnections regionConnections, Scene scene) | 460 | private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene) |
462 | { | 461 | { |
463 | Vector3 offset = Vector3.Zero; | 462 | Vector3 offset = Vector3.Zero; |
464 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | 463 | offset.X = (((newConn.X * (int)Constants.RegionSize)) - |
465 | ((conn.X * (int)Constants.RegionSize))); | 464 | ((rootConn.X * (int)Constants.RegionSize))); |
466 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | 465 | offset.Y = (((newConn.Y * (int)Constants.RegionSize)) - |
467 | ((conn.Y * (int)Constants.RegionSize))); | 466 | ((rootConn.Y * (int)Constants.RegionSize))); |
468 | 467 | ||
469 | Vector3 extents = Vector3.Zero; | 468 | Vector3 extents = Vector3.Zero; |
470 | extents.Y = conn.YEnd; | 469 | extents.Y = rootConn.YEnd; |
471 | extents.X = conn.XEnd + regionConnections.XEnd; | 470 | extents.X = rootConn.XEnd + newConn.XEnd; |
472 | 471 | ||
473 | conn.UpdateExtents(extents); | 472 | rootConn.UpdateExtents(extents); |
474 | 473 | ||
475 | m_log.DebugFormat( | 474 | m_log.DebugFormat( |
476 | "[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}", | 475 | "[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}", |
477 | conn.RegionScene.RegionInfo.RegionName, | 476 | rootConn.RegionScene.RegionInfo.RegionName, |
478 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 477 | newConn.RegionScene.RegionInfo.RegionName, offset, extents); |
479 | 478 | ||
480 | scene.BordersLocked = true; | 479 | scene.BordersLocked = true; |
481 | conn.RegionScene.BordersLocked = true; | 480 | rootConn.RegionScene.BordersLocked = true; |
482 | 481 | ||
483 | RegionData ConnectedRegion = new RegionData(); | 482 | RegionData ConnectedRegion = new RegionData(); |
484 | ConnectedRegion.Offset = offset; | 483 | ConnectedRegion.Offset = offset; |
485 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | 484 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; |
486 | ConnectedRegion.RegionScene = scene; | 485 | ConnectedRegion.RegionScene = scene; |
487 | conn.ConnectedRegions.Add(ConnectedRegion); | 486 | rootConn.ConnectedRegions.Add(ConnectedRegion); |
488 | 487 | ||
489 | // Inform root region Physics about the extents of this region | 488 | // Inform root region Physics about the extents of this region |
490 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 489 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
491 | 490 | ||
492 | // Inform Child region that it needs to forward it's terrain to the root region | 491 | // Inform Child region that it needs to forward it's terrain to the root region |
493 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 492 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
494 | 493 | ||
495 | // Extend the borders as appropriate | 494 | // Extend the borders as appropriate |
496 | lock (conn.RegionScene.EastBorders) | 495 | lock (rootConn.RegionScene.EastBorders) |
497 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 496 | rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
498 | 497 | ||
499 | lock (conn.RegionScene.NorthBorders) | 498 | lock (rootConn.RegionScene.NorthBorders) |
500 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 499 | rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
501 | 500 | ||
502 | lock (conn.RegionScene.SouthBorders) | 501 | lock (rootConn.RegionScene.SouthBorders) |
503 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 502 | rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
504 | 503 | ||
505 | lock (scene.WestBorders) | 504 | lock (scene.WestBorders) |
506 | { | 505 | { |
507 | 506 | scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West | |
508 | |||
509 | scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West | ||
510 | 507 | ||
511 | // Trigger auto teleport to root region | 508 | // Trigger auto teleport to root region |
512 | scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX; | 509 | scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; |
513 | scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; | 510 | scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; |
514 | } | 511 | } |
515 | 512 | ||
516 | // Reset Terrain.. since terrain loads before we get here, we need to load | 513 | // Reset Terrain.. since terrain loads before we get here, we need to load |
@@ -519,57 +516,60 @@ namespace OpenSim.Region.RegionCombinerModule | |||
519 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 516 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
520 | 517 | ||
521 | // Unlock borders | 518 | // Unlock borders |
522 | conn.RegionScene.BordersLocked = false; | 519 | rootConn.RegionScene.BordersLocked = false; |
523 | scene.BordersLocked = false; | 520 | scene.BordersLocked = false; |
524 | 521 | ||
525 | // Create a client event forwarder and add this region's events to the root region. | 522 | // Create a client event forwarder and add this region's events to the root region. |
526 | if (conn.ClientEventForwarder != null) | 523 | if (rootConn.ClientEventForwarder != null) |
527 | conn.ClientEventForwarder.AddSceneToEventForwarding(scene); | 524 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); |
528 | 525 | ||
529 | return true; | 526 | return true; |
530 | } | 527 | } |
531 | 528 | ||
532 | private bool DoWorkForOneRegionOverXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene) | 529 | private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) |
533 | { | 530 | { |
534 | Vector3 offset = Vector3.Zero; | 531 | Vector3 offset = Vector3.Zero; |
535 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | 532 | offset.X = (((newConn.X * (int)Constants.RegionSize)) - |
536 | ((conn.X * (int)Constants.RegionSize))); | 533 | ((rootConn.X * (int)Constants.RegionSize))); |
537 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | 534 | offset.Y = (((newConn.Y * (int)Constants.RegionSize)) - |
538 | ((conn.Y * (int)Constants.RegionSize))); | 535 | ((rootConn.Y * (int)Constants.RegionSize))); |
539 | 536 | ||
540 | Vector3 extents = Vector3.Zero; | 537 | Vector3 extents = Vector3.Zero; |
541 | extents.Y = regionConnections.YEnd + conn.YEnd; | 538 | extents.Y = newConn.YEnd + rootConn.YEnd; |
542 | extents.X = conn.XEnd; | 539 | extents.X = rootConn.XEnd; |
543 | conn.UpdateExtents(extents); | 540 | rootConn.UpdateExtents(extents); |
544 | 541 | ||
545 | scene.BordersLocked = true; | 542 | scene.BordersLocked = true; |
546 | conn.RegionScene.BordersLocked = true; | 543 | rootConn.RegionScene.BordersLocked = true; |
547 | 544 | ||
548 | RegionData ConnectedRegion = new RegionData(); | 545 | RegionData ConnectedRegion = new RegionData(); |
549 | ConnectedRegion.Offset = offset; | 546 | ConnectedRegion.Offset = offset; |
550 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | 547 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; |
551 | ConnectedRegion.RegionScene = scene; | 548 | ConnectedRegion.RegionScene = scene; |
552 | conn.ConnectedRegions.Add(ConnectedRegion); | 549 | rootConn.ConnectedRegions.Add(ConnectedRegion); |
553 | 550 | ||
554 | m_log.DebugFormat( | 551 | m_log.DebugFormat( |
555 | "[REGION COMBINER MODULE]: Root region {0} is to the south of region {1}, Offset: {2}, Extents: {3}", | 552 | "[REGION COMBINER MODULE]: Root region {0} is to the south of region {1}, Offset: {2}, Extents: {3}", |
556 | conn.RegionScene.RegionInfo.RegionName, | 553 | rootConn.RegionScene.RegionInfo.RegionName, |
557 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 554 | newConn.RegionScene.RegionInfo.RegionName, offset, extents); |
558 | 555 | ||
559 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 556 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
560 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 557 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
561 | 558 | ||
562 | lock (conn.RegionScene.NorthBorders) | 559 | lock (rootConn.RegionScene.NorthBorders) |
563 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 560 | rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
564 | lock (conn.RegionScene.EastBorders) | 561 | |
565 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 562 | lock (rootConn.RegionScene.EastBorders) |
566 | lock (conn.RegionScene.WestBorders) | 563 | rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
567 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 564 | |
565 | lock (rootConn.RegionScene.WestBorders) | ||
566 | rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
567 | |||
568 | lock (scene.SouthBorders) | 568 | lock (scene.SouthBorders) |
569 | { | 569 | { |
570 | scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south | 570 | scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south |
571 | scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX; | 571 | scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; |
572 | scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; | 572 | scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; |
573 | } | 573 | } |
574 | 574 | ||
575 | // Reset Terrain.. since terrain normally loads first. | 575 | // Reset Terrain.. since terrain normally loads first. |
@@ -578,19 +578,21 @@ namespace OpenSim.Region.RegionCombinerModule | |||
578 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 578 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
579 | 579 | ||
580 | scene.BordersLocked = false; | 580 | scene.BordersLocked = false; |
581 | conn.RegionScene.BordersLocked = false; | 581 | rootConn.RegionScene.BordersLocked = false; |
582 | if (conn.ClientEventForwarder != null) | 582 | |
583 | conn.ClientEventForwarder.AddSceneToEventForwarding(scene); | 583 | if (rootConn.ClientEventForwarder != null) |
584 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); | ||
585 | |||
584 | return true; | 586 | return true; |
585 | } | 587 | } |
586 | 588 | ||
587 | private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene) | 589 | private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) |
588 | { | 590 | { |
589 | Vector3 offset = Vector3.Zero; | 591 | Vector3 offset = Vector3.Zero; |
590 | offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - | 592 | offset.X = (((newConn.X * (int)Constants.RegionSize)) - |
591 | ((conn.X * (int)Constants.RegionSize))); | 593 | ((rootConn.X * (int)Constants.RegionSize))); |
592 | offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - | 594 | offset.Y = (((newConn.Y * (int)Constants.RegionSize)) - |
593 | ((conn.Y * (int)Constants.RegionSize))); | 595 | ((rootConn.Y * (int)Constants.RegionSize))); |
594 | 596 | ||
595 | Vector3 extents = Vector3.Zero; | 597 | Vector3 extents = Vector3.Zero; |
596 | 598 | ||
@@ -600,68 +602,70 @@ namespace OpenSim.Region.RegionCombinerModule | |||
600 | // extents.X = regionConnections.XEnd + conn.XEnd; | 602 | // extents.X = regionConnections.XEnd + conn.XEnd; |
601 | // conn.UpdateExtents(extents); | 603 | // conn.UpdateExtents(extents); |
602 | 604 | ||
603 | extents.Y = conn.YEnd; | 605 | extents.Y = rootConn.YEnd; |
604 | extents.X = conn.XEnd; | 606 | extents.X = rootConn.XEnd; |
605 | 607 | ||
606 | scene.BordersLocked = true; | 608 | scene.BordersLocked = true; |
607 | conn.RegionScene.BordersLocked = true; | 609 | rootConn.RegionScene.BordersLocked = true; |
608 | 610 | ||
609 | RegionData ConnectedRegion = new RegionData(); | 611 | RegionData ConnectedRegion = new RegionData(); |
610 | ConnectedRegion.Offset = offset; | 612 | ConnectedRegion.Offset = offset; |
611 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; | 613 | ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; |
612 | ConnectedRegion.RegionScene = scene; | 614 | ConnectedRegion.RegionScene = scene; |
613 | 615 | ||
614 | conn.ConnectedRegions.Add(ConnectedRegion); | 616 | rootConn.ConnectedRegions.Add(ConnectedRegion); |
615 | 617 | ||
616 | m_log.DebugFormat( | 618 | m_log.DebugFormat( |
617 | "[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}", | 619 | "[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}", |
618 | conn.RegionScene.RegionInfo.RegionName, | 620 | rootConn.RegionScene.RegionInfo.RegionName, |
619 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 621 | newConn.RegionScene.RegionInfo.RegionName, offset, extents); |
620 | 622 | ||
621 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 623 | rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
622 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 624 | scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
623 | lock (conn.RegionScene.NorthBorders) | 625 | |
626 | lock (rootConn.RegionScene.NorthBorders) | ||
624 | { | 627 | { |
625 | if (conn.RegionScene.NorthBorders.Count == 1)// && 2) | 628 | if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2) |
626 | { | 629 | { |
627 | //compound border | 630 | //compound border |
628 | // already locked above | 631 | // already locked above |
629 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 632 | rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
633 | |||
634 | lock (rootConn.RegionScene.EastBorders) | ||
635 | rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
630 | 636 | ||
631 | lock (conn.RegionScene.EastBorders) | 637 | lock (rootConn.RegionScene.WestBorders) |
632 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 638 | rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
633 | lock (conn.RegionScene.WestBorders) | ||
634 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
635 | } | 639 | } |
636 | } | 640 | } |
637 | 641 | ||
638 | lock (scene.SouthBorders) | 642 | lock (scene.SouthBorders) |
639 | { | 643 | { |
640 | scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south | 644 | scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south |
641 | scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX; | 645 | scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; |
642 | scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; | 646 | scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; |
643 | } | 647 | } |
644 | 648 | ||
645 | lock (conn.RegionScene.EastBorders) | 649 | lock (rootConn.RegionScene.EastBorders) |
646 | { | 650 | { |
647 | if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) | 651 | if (rootConn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) |
648 | { | 652 | { |
649 | 653 | ||
650 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 654 | rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
651 | lock (conn.RegionScene.NorthBorders) | ||
652 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
653 | lock (conn.RegionScene.SouthBorders) | ||
654 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
655 | 655 | ||
656 | lock (rootConn.RegionScene.NorthBorders) | ||
657 | rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
656 | 658 | ||
659 | lock (rootConn.RegionScene.SouthBorders) | ||
660 | rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
657 | } | 661 | } |
658 | } | 662 | } |
659 | 663 | ||
660 | lock (scene.WestBorders) | 664 | lock (scene.WestBorders) |
661 | { | 665 | { |
662 | scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West | 666 | scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West |
663 | scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX; | 667 | scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; |
664 | scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; | 668 | scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; |
665 | } | 669 | } |
666 | 670 | ||
667 | /* | 671 | /* |
@@ -680,18 +684,17 @@ namespace OpenSim.Region.RegionCombinerModule | |||
680 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 684 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
681 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 685 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
682 | scene.BordersLocked = false; | 686 | scene.BordersLocked = false; |
683 | conn.RegionScene.BordersLocked = false; | 687 | rootConn.RegionScene.BordersLocked = false; |
684 | 688 | ||
685 | if (conn.ClientEventForwarder != null) | 689 | if (rootConn.ClientEventForwarder != null) |
686 | conn.ClientEventForwarder.AddSceneToEventForwarding(scene); | 690 | rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); |
687 | 691 | ||
688 | return true; | 692 | return true; |
689 | 693 | ||
690 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); | 694 | //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); |
691 | |||
692 | } | 695 | } |
693 | 696 | ||
694 | private void DoWorkForRootRegion(RegionConnections regionConnections, Scene scene) | 697 | private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene) |
695 | { | 698 | { |
696 | m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName); | 699 | m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName); |
697 | 700 | ||
@@ -700,28 +703,31 @@ namespace OpenSim.Region.RegionCombinerModule | |||
700 | rdata.RegionId = scene.RegionInfo.originRegionID; | 703 | rdata.RegionId = scene.RegionInfo.originRegionID; |
701 | rdata.RegionScene = scene; | 704 | rdata.RegionScene = scene; |
702 | // save it's land channel | 705 | // save it's land channel |
703 | regionConnections.RegionLandChannel = scene.LandChannel; | 706 | rootConn.RegionLandChannel = scene.LandChannel; |
704 | 707 | ||
705 | // Substitue our landchannel | 708 | // Substitue our landchannel |
706 | RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, | 709 | RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, |
707 | regionConnections.ConnectedRegions); | 710 | rootConn.ConnectedRegions); |
711 | |||
708 | scene.LandChannel = lnd; | 712 | scene.LandChannel = lnd; |
713 | |||
709 | // Forward the permissions modules of each of the connected regions to the root region | 714 | // Forward the permissions modules of each of the connected regions to the root region |
710 | lock (m_regions) | 715 | lock (m_regions) |
711 | { | 716 | { |
712 | foreach (RegionData r in regionConnections.ConnectedRegions) | 717 | foreach (RegionData r in rootConn.ConnectedRegions) |
713 | { | 718 | { |
714 | ForwardPermissionRequests(regionConnections, r.RegionScene); | 719 | ForwardPermissionRequests(rootConn, r.RegionScene); |
715 | } | 720 | } |
716 | } | 721 | } |
722 | |||
717 | // Create the root region's Client Event Forwarder | 723 | // Create the root region's Client Event Forwarder |
718 | regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections); | 724 | rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn); |
719 | 725 | ||
720 | // Sets up the CoarseLocationUpdate forwarder for this root region | 726 | // Sets up the CoarseLocationUpdate forwarder for this root region |
721 | scene.EventManager.OnNewPresence += SetCourseLocationDelegate; | 727 | scene.EventManager.OnNewPresence += SetCourseLocationDelegate; |
722 | 728 | ||
723 | // Adds this root region to a dictionary of regions that are connectable | 729 | // Adds this root region to a dictionary of regions that are connectable |
724 | m_regions.Add(scene.RegionInfo.originRegionID, regionConnections); | 730 | m_regions.Add(scene.RegionInfo.originRegionID, rootConn); |
725 | } | 731 | } |
726 | 732 | ||
727 | private void SetCourseLocationDelegate(ScenePresence presence) | 733 | private void SetCourseLocationDelegate(ScenePresence presence) |