aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs145
1 files changed, 125 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index acf0375..dfd06bb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1706,37 +1706,86 @@ namespace OpenSim.Region.Framework.Scenes
1706 ulong newRegionHandle = 0; 1706 ulong newRegionHandle = 0;
1707 Vector3 pos = attemptedPosition; 1707 Vector3 pos = attemptedPosition;
1708 1708
1709 1709 if (TestBorderCross(attemptedPosition, Cardinals.W))
1710
1711 if (TestBorderCross(attemptedPosition, Cardinals.E))
1712 { 1710 {
1713 pos.X = ((pos.X - Constants.RegionSize)); 1711 if (TestBorderCross(attemptedPosition, Cardinals.S))
1714 newRegionHandle 1712 {
1715 = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); 1713 //Border crossedBorderx = GetCrossedBorder(attemptedPosition,Cardinals.W);
1716 // x + 1 1714 //Border crossedBordery = GetCrossedBorder(attemptedPosition, Cardinals.S);
1715 //(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
1716 pos.X = ((pos.X + Constants.RegionSize));
1717 pos.Y = ((pos.Y + Constants.RegionSize));
1718 newRegionHandle
1719 = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
1720 (uint)((thisy - 1) * Constants.RegionSize));
1721 // x - 1
1722 // y - 1
1723 }
1724 else if (TestBorderCross(attemptedPosition, Cardinals.N))
1725 {
1726 pos.X = ((pos.X + Constants.RegionSize));
1727 pos.Y = ((pos.Y - Constants.RegionSize));
1728 newRegionHandle
1729 = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
1730 (uint)((thisy + 1) * Constants.RegionSize));
1731 // x - 1
1732 // y + 1
1733 }
1734 else
1735 {
1736 pos.X = ((pos.X + Constants.RegionSize));
1737 newRegionHandle
1738 = Util.UIntsToLong((uint) ((thisx - 1)*Constants.RegionSize),
1739 (uint) (thisy*Constants.RegionSize));
1740 // x - 1
1741 }
1717 } 1742 }
1718 else if (TestBorderCross(attemptedPosition, Cardinals.W)) 1743 else if (TestBorderCross(attemptedPosition, Cardinals.E))
1719 { 1744 {
1720 pos.X = ((pos.X + Constants.RegionSize)); 1745 if (TestBorderCross(attemptedPosition, Cardinals.S))
1746 {
1747 pos.X = ((pos.X - Constants.RegionSize));
1748 pos.Y = ((pos.Y + Constants.RegionSize));
1749 newRegionHandle
1750 = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
1751 (uint)((thisy - 1) * Constants.RegionSize));
1752 // x + 1
1753 // y - 1
1754 }
1755 else if (TestBorderCross(attemptedPosition, Cardinals.N))
1756 {
1757 pos.X = ((pos.X - Constants.RegionSize));
1758 pos.Y = ((pos.Y - Constants.RegionSize));
1759 newRegionHandle
1760 = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
1761 (uint)((thisy + 1) * Constants.RegionSize));
1762 // x + 1
1763 // y + 1
1764 }
1765 else
1766 {
1767 pos.X = ((pos.X - Constants.RegionSize));
1768 newRegionHandle
1769 = Util.UIntsToLong((uint) ((thisx + 1)*Constants.RegionSize),
1770 (uint) (thisy*Constants.RegionSize));
1771 // x + 1
1772 }
1773 }
1774 else if (TestBorderCross(attemptedPosition, Cardinals.S))
1775 {
1776 pos.Y = ((pos.Y + Constants.RegionSize));
1721 newRegionHandle 1777 newRegionHandle
1722 = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize)); 1778 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
1723 // x - 1 1779 // y - 1
1724 } 1780 }
1725 1781 else if (TestBorderCross(attemptedPosition, Cardinals.N))
1726 if (TestBorderCross(attemptedPosition, Cardinals.N))
1727 { 1782 {
1783
1728 pos.Y = ((pos.Y - Constants.RegionSize)); 1784 pos.Y = ((pos.Y - Constants.RegionSize));
1729 newRegionHandle 1785 newRegionHandle
1730 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize)); 1786 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
1731 // y + 1 1787 // y + 1
1732 } 1788 }
1733 else if (TestBorderCross(attemptedPosition, Cardinals.S))
1734 {
1735 pos.Y = ((pos.Y + Constants.RegionSize));
1736 newRegionHandle
1737 = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
1738 // y - 1
1739 }
1740 1789
1741 // Offset the positions for the new region across the border 1790 // Offset the positions for the new region across the border
1742 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 1791 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
@@ -1750,6 +1799,62 @@ namespace OpenSim.Region.Framework.Scenes
1750 } 1799 }
1751 } 1800 }
1752 1801
1802 public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
1803 {
1804
1805 switch (gridline)
1806 {
1807 case Cardinals.N:
1808 lock (NorthBorders)
1809 {
1810 foreach (Border b in NorthBorders)
1811 {
1812 if (b.TestCross(position))
1813 return b;
1814 }
1815 }
1816 break;
1817 case Cardinals.S:
1818
1819
1820 lock (SouthBorders)
1821 {
1822 foreach (Border b in SouthBorders)
1823 {
1824 if (b.TestCross(position))
1825 return b;
1826 }
1827 }
1828
1829 break;
1830 case Cardinals.E:
1831 lock (EastBorders)
1832 {
1833 foreach (Border b in EastBorders)
1834 {
1835 if (b.TestCross(position))
1836 return b;
1837 }
1838 }
1839
1840 break;
1841 case Cardinals.W:
1842
1843 lock (WestBorders)
1844 {
1845 foreach (Border b in WestBorders)
1846 {
1847 if (b.TestCross(position))
1848 return b;
1849 }
1850 }
1851 break;
1852
1853 }
1854
1855 return null;
1856 }
1857
1753 public bool TestBorderCross(Vector3 position, Cardinals border) 1858 public bool TestBorderCross(Vector3 position, Cardinals border)
1754 { 1859 {
1755 switch (border) 1860 switch (border)