aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-29 03:36:41 -0400
committerTeravus Ovares (Dan Olivares)2009-08-29 03:36:41 -0400
commitd45f871d8f3abcc58556d6f5a834b132da6ec0ab (patch)
tree8bf9f262ad2d3c5d783115583031ae1e0a13c7b7 /OpenSim/Region/Framework/Scenes/Scene.cs
parent* Deal with teleports to other virtual regions in the same scene. (diff)
downloadopensim-SC_OLD-d45f871d8f3abcc58556d6f5a834b132da6ec0ab.zip
opensim-SC_OLD-d45f871d8f3abcc58556d6f5a834b132da6ec0ab.tar.gz
opensim-SC_OLD-d45f871d8f3abcc58556d6f5a834b132da6ec0ab.tar.bz2
opensim-SC_OLD-d45f871d8f3abcc58556d6f5a834b132da6ec0ab.tar.xz
* Only lock the Borders when they're being changed, otherwise one avatar's movement could hinder another avatar's movement.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs179
1 files changed, 130 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2c1d0e5..3e573cf 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -81,6 +81,8 @@ namespace OpenSim.Region.Framework.Scenes
81 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); 81 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
82 protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); 82 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
83 83
84 public volatile bool BordersLocked = false;
85
84 public List<Border> NorthBorders = new List<Border>(); 86 public List<Border> NorthBorders = new List<Border>();
85 public List<Border> EastBorders = new List<Border>(); 87 public List<Border> EastBorders = new List<Border>();
86 public List<Border> SouthBorders = new List<Border>(); 88 public List<Border> SouthBorders = new List<Border>();
@@ -331,6 +333,8 @@ namespace OpenSim.Region.Framework.Scenes
331 m_config = config; 333 m_config = config;
332 334
333 Random random = new Random(); 335 Random random = new Random();
336
337 BordersLocked = true;
334 338
335 Border northBorder = new Border(); 339 Border northBorder = new Border();
336 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<--- 340 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
@@ -352,6 +356,7 @@ namespace OpenSim.Region.Framework.Scenes
352 westBorder.CrossDirection = Cardinals.W; 356 westBorder.CrossDirection = Cardinals.W;
353 WestBorders.Add(westBorder); 357 WestBorders.Add(westBorder);
354 358
359 BordersLocked = false;
355 360
356 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); 361 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4);
357 m_moduleLoader = moduleLoader; 362 m_moduleLoader = moduleLoader;
@@ -482,6 +487,7 @@ namespace OpenSim.Region.Framework.Scenes
482 /// <param name="regInfo"></param> 487 /// <param name="regInfo"></param>
483 public Scene(RegionInfo regInfo) 488 public Scene(RegionInfo regInfo)
484 { 489 {
490 BordersLocked = true;
485 Border northBorder = new Border(); 491 Border northBorder = new Border();
486 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<--- 492 northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
487 northBorder.CrossDirection = Cardinals.N; 493 northBorder.CrossDirection = Cardinals.N;
@@ -501,6 +507,7 @@ namespace OpenSim.Region.Framework.Scenes
501 westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //---> 507 westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
502 westBorder.CrossDirection = Cardinals.W; 508 westBorder.CrossDirection = Cardinals.W;
503 WestBorders.Add(westBorder); 509 WestBorders.Add(westBorder);
510 BordersLocked = false;
504 511
505 m_regInfo = regInfo; 512 m_regInfo = regInfo;
506 m_eventManager = new EventManager(); 513 m_eventManager = new EventManager();
@@ -1801,105 +1808,179 @@ namespace OpenSim.Region.Framework.Scenes
1801 1808
1802 public Border GetCrossedBorder(Vector3 position, Cardinals gridline) 1809 public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
1803 { 1810 {
1811 if (BordersLocked)
1812 {
1813 switch (gridline)
1814 {
1815 case Cardinals.N:
1816 lock (NorthBorders)
1817 {
1818 foreach (Border b in NorthBorders)
1819 {
1820 if (b.TestCross(position))
1821 return b;
1822 }
1823 }
1824 break;
1825 case Cardinals.S:
1826 lock (SouthBorders)
1827 {
1828 foreach (Border b in SouthBorders)
1829 {
1830 if (b.TestCross(position))
1831 return b;
1832 }
1833 }
1804 1834
1805 switch (gridline) 1835 break;
1836 case Cardinals.E:
1837 lock (EastBorders)
1838 {
1839 foreach (Border b in EastBorders)
1840 {
1841 if (b.TestCross(position))
1842 return b;
1843 }
1844 }
1845
1846 break;
1847 case Cardinals.W:
1848
1849 lock (WestBorders)
1850 {
1851 foreach (Border b in WestBorders)
1852 {
1853 if (b.TestCross(position))
1854 return b;
1855 }
1856 }
1857 break;
1858
1859 }
1860 }
1861 else
1806 { 1862 {
1807 case Cardinals.N: 1863 switch (gridline)
1808 lock (NorthBorders) 1864 {
1809 { 1865 case Cardinals.N:
1810 foreach (Border b in NorthBorders) 1866 foreach (Border b in NorthBorders)
1811 { 1867 {
1812 if (b.TestCross(position)) 1868 if (b.TestCross(position))
1813 return b; 1869 return b;
1814 } 1870 }
1815 } 1871
1816 break; 1872 break;
1817 case Cardinals.S: 1873 case Cardinals.S:
1818
1819
1820 lock (SouthBorders)
1821 {
1822 foreach (Border b in SouthBorders) 1874 foreach (Border b in SouthBorders)
1823 { 1875 {
1824 if (b.TestCross(position)) 1876 if (b.TestCross(position))
1825 return b; 1877 return b;
1826 } 1878 }
1827 } 1879 break;
1828 1880 case Cardinals.E:
1829 break;
1830 case Cardinals.E:
1831 lock (EastBorders)
1832 {
1833 foreach (Border b in EastBorders) 1881 foreach (Border b in EastBorders)
1834 { 1882 {
1835 if (b.TestCross(position)) 1883 if (b.TestCross(position))
1836 return b; 1884 return b;
1837 } 1885 }
1838 }
1839 1886
1840 break; 1887 break;
1841 case Cardinals.W: 1888 case Cardinals.W:
1842
1843 lock (WestBorders)
1844 {
1845 foreach (Border b in WestBorders) 1889 foreach (Border b in WestBorders)
1846 { 1890 {
1847 if (b.TestCross(position)) 1891 if (b.TestCross(position))
1848 return b; 1892 return b;
1849 } 1893 }
1850 } 1894 break;
1851 break;
1852 1895
1896 }
1853 } 1897 }
1898
1854 1899
1855 return null; 1900 return null;
1856 } 1901 }
1857 1902
1858 public bool TestBorderCross(Vector3 position, Cardinals border) 1903 public bool TestBorderCross(Vector3 position, Cardinals border)
1859 { 1904 {
1860 switch (border) 1905 if (BordersLocked)
1861 { 1906 {
1862 case Cardinals.N: 1907 switch (border)
1863 lock (NorthBorders) 1908 {
1864 { 1909 case Cardinals.N:
1865 foreach(Border b in NorthBorders) 1910 lock (NorthBorders)
1911 {
1912 foreach (Border b in NorthBorders)
1913 {
1914 if (b.TestCross(position))
1915 return true;
1916 }
1917 }
1918 break;
1919 case Cardinals.E:
1920 lock (EastBorders)
1921 {
1922 foreach (Border b in EastBorders)
1923 {
1924 if (b.TestCross(position))
1925 return true;
1926 }
1927 }
1928 break;
1929 case Cardinals.S:
1930 lock (SouthBorders)
1931 {
1932 foreach (Border b in SouthBorders)
1933 {
1934 if (b.TestCross(position))
1935 return true;
1936 }
1937 }
1938 break;
1939 case Cardinals.W:
1940 lock (WestBorders)
1941 {
1942 foreach (Border b in WestBorders)
1943 {
1944 if (b.TestCross(position))
1945 return true;
1946 }
1947 }
1948 break;
1949 }
1950 }
1951 else
1952 {
1953 switch (border)
1954 {
1955 case Cardinals.N:
1956 foreach (Border b in NorthBorders)
1866 { 1957 {
1867 if (b.TestCross(position)) 1958 if (b.TestCross(position))
1868 return true; 1959 return true;
1869 } 1960 }
1870 } 1961 break;
1871 break; 1962 case Cardinals.E:
1872 case Cardinals.E:
1873 lock (EastBorders)
1874 {
1875 foreach (Border b in EastBorders) 1963 foreach (Border b in EastBorders)
1876 { 1964 {
1877 if (b.TestCross(position)) 1965 if (b.TestCross(position))
1878 return true; 1966 return true;
1879 } 1967 }
1880 } 1968 break;
1881 break; 1969 case Cardinals.S:
1882 case Cardinals.S:
1883 lock (SouthBorders)
1884 {
1885 foreach (Border b in SouthBorders) 1970 foreach (Border b in SouthBorders)
1886 { 1971 {
1887 if (b.TestCross(position)) 1972 if (b.TestCross(position))
1888 return true; 1973 return true;
1889 } 1974 }
1890 } 1975 break;
1891 break; 1976 case Cardinals.W:
1892 case Cardinals.W:
1893 lock (WestBorders)
1894 {
1895 foreach (Border b in WestBorders) 1977 foreach (Border b in WestBorders)
1896 { 1978 {
1897 if (b.TestCross(position)) 1979 if (b.TestCross(position))
1898 return true; 1980 return true;
1899 } 1981 }
1900 } 1982 break;
1901 break; 1983 }
1902
1903 } 1984 }
1904 return false; 1985 return false;
1905 } 1986 }