diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-29 03:36:41 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-29 03:36:41 -0400 |
commit | d45f871d8f3abcc58556d6f5a834b132da6ec0ab (patch) | |
tree | 8bf9f262ad2d3c5d783115583031ae1e0a13c7b7 /OpenSim | |
parent | * Deal with teleports to other virtual regions in the same scene. (diff) | |
download | opensim-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')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs | 73 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 179 |
2 files changed, 184 insertions, 68 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs b/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs index 22ef107..2fc1623 100644 --- a/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs +++ b/OpenSim/Region/CoreModules/World/Land/PhysicsCombiner.cs | |||
@@ -236,20 +236,31 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
236 | m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", | 236 | m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", |
237 | conn.RegionScene.RegionInfo.RegionName, | 237 | conn.RegionScene.RegionInfo.RegionName, |
238 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 238 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
239 | 239 | ||
240 | |||
241 | scene.BordersLocked = true; | ||
242 | conn.RegionScene.BordersLocked = true; | ||
240 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 243 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
241 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 244 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
242 | 245 | ||
243 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 246 | lock (conn.RegionScene.EastBorders) |
244 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 247 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
245 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 248 | |
249 | lock (conn.RegionScene.NorthBorders) | ||
250 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
251 | |||
252 | lock (conn.RegionScene.SouthBorders) | ||
253 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
246 | 254 | ||
247 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West | 255 | lock (scene.WestBorders) |
256 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West | ||
248 | 257 | ||
249 | // Reset Terrain.. since terrain normally loads first. | 258 | // Reset Terrain.. since terrain normally loads first. |
250 | // | 259 | // |
251 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 260 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
252 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 261 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
262 | conn.RegionScene.BordersLocked = false; | ||
263 | scene.BordersLocked = false; | ||
253 | 264 | ||
254 | connectedYN = true; | 265 | connectedYN = true; |
255 | break; | 266 | break; |
@@ -277,23 +288,33 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
277 | extents.X = conn.XEnd; | 288 | extents.X = conn.XEnd; |
278 | conn.UpdateExtents(extents); | 289 | conn.UpdateExtents(extents); |
279 | 290 | ||
291 | |||
292 | scene.BordersLocked = true; | ||
293 | conn.RegionScene.BordersLocked = true; | ||
294 | |||
280 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", | 295 | m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", |
281 | conn.RegionScene.RegionInfo.RegionName, | 296 | conn.RegionScene.RegionInfo.RegionName, |
282 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 297 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
283 | conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents); | 298 | conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents); |
284 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 299 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
285 | 300 | ||
286 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 301 | lock(conn.RegionScene.NorthBorders) |
287 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 302 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
288 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 303 | lock(conn.RegionScene.EastBorders) |
289 | 304 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | |
290 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | 305 | lock(conn.RegionScene.WestBorders) |
306 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
307 | lock(scene.SouthBorders) | ||
308 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | ||
291 | 309 | ||
292 | // Reset Terrain.. since terrain normally loads first. | 310 | // Reset Terrain.. since terrain normally loads first. |
293 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 311 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
294 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 312 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
295 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 313 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
296 | 314 | ||
315 | scene.BordersLocked = false; | ||
316 | conn.RegionScene.BordersLocked = false; | ||
317 | |||
297 | connectedYN = true; | 318 | connectedYN = true; |
298 | break; | 319 | break; |
299 | } | 320 | } |
@@ -318,36 +339,48 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
318 | extents.X = regionConnections.XEnd + conn.XEnd; | 339 | extents.X = regionConnections.XEnd + conn.XEnd; |
319 | conn.UpdateExtents(extents); | 340 | conn.UpdateExtents(extents); |
320 | 341 | ||
342 | scene.BordersLocked = true; | ||
343 | conn.RegionScene.BordersLocked = true; | ||
344 | |||
321 | m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", | 345 | m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", |
322 | conn.RegionScene.RegionInfo.RegionName, | 346 | conn.RegionScene.RegionInfo.RegionName, |
323 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); | 347 | regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); |
324 | 348 | ||
325 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); | 349 | conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); |
326 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); | 350 | scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); |
327 | 351 | lock(conn.RegionScene.NorthBorders) | |
328 | if (conn.RegionScene.NorthBorders.Count == 1)// && 2) | 352 | if (conn.RegionScene.NorthBorders.Count == 1)// && 2) |
329 | { | 353 | { |
330 | //compound border | 354 | //compound border |
355 | // already locked above | ||
331 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 356 | conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
332 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 357 | |
333 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 358 | lock(conn.RegionScene.EastBorders) |
359 | conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
360 | lock(conn.RegionScene.WestBorders) | ||
361 | conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
334 | 362 | ||
335 | 363 | ||
336 | 364 | ||
337 | } | 365 | } |
338 | 366 | lock(scene.SouthBorders) | |
339 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south | 367 | scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south |
340 | 368 | ||
369 | lock(conn.RegionScene.EastBorders) | ||
341 | if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) | 370 | if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) |
342 | { | 371 | { |
343 | 372 | ||
344 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; | 373 | conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; |
345 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 374 | lock(conn.RegionScene.NorthBorders) |
346 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | 375 | conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; |
376 | lock(conn.RegionScene.SouthBorders) | ||
377 | conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; | ||
347 | 378 | ||
348 | 379 | ||
349 | } | 380 | } |
350 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West | 381 | |
382 | lock (scene.WestBorders) | ||
383 | scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West | ||
351 | /* | 384 | /* |
352 | else | 385 | else |
353 | { | 386 | { |
@@ -363,6 +396,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
363 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 396 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
364 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 397 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
365 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); | 398 | //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); |
399 | scene.BordersLocked = false; | ||
400 | conn.RegionScene.BordersLocked = false; | ||
366 | 401 | ||
367 | connectedYN = true; | 402 | connectedYN = true; |
368 | 403 | ||
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 | } |