aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorMelanie2011-10-25 03:17:11 +0100
committerMelanie2011-10-25 03:17:11 +0100
commitd1028b36477c91562f92ef85236e6c330e70aecf (patch)
tree7e5e2d10a85704305f1e7f1cf0f02430f951bba6 /OpenSim/Region/Framework/Scenes/Scene.cs
parentMerge commit '8b20faf06c4850df800945c8135aa90c2eebe034' into bigmerge (diff)
parentMoved HaveNeighbor utility function from ScenePresence to Scene. Fixed line e... (diff)
downloadopensim-SC_OLD-d1028b36477c91562f92ef85236e6c330e70aecf.zip
opensim-SC_OLD-d1028b36477c91562f92ef85236e6c330e70aecf.tar.gz
opensim-SC_OLD-d1028b36477c91562f92ef85236e6c330e70aecf.tar.bz2
opensim-SC_OLD-d1028b36477c91562f92ef85236e6c330e70aecf.tar.xz
Merge commit 'eac29396d98a4864923a69e0eb73cecdd8a225b3' into bigmerge
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index aa0b47a..cabba04 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -987,6 +987,46 @@ namespace OpenSim.Region.Framework.Scenes
987 return found; 987 return found;
988 } 988 }
989 989
990 /// <summary>
991 /// Checks whether this region has a neighbour in the given direction.
992 /// </summary>
993 /// <param name="car"></param>
994 /// <param name="fix"></param>
995 /// <returns>
996 /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
997 /// Returns a positive integer if there is a region in that direction, a negative integer if not.
998 /// </returns>
999 public int HaveNeighbor(Cardinals car, ref int[] fix)
1000 {
1001 uint neighbourx = RegionInfo.RegionLocX;
1002 uint neighboury = RegionInfo.RegionLocY;
1003
1004 int dir = (int)car;
1005
1006 if (dir > 1 && dir < 5) //Heading East
1007 neighbourx++;
1008 else if (dir > 5) // Heading West
1009 neighbourx--;
1010
1011 if (dir < 3 || dir == 8) // Heading North
1012 neighboury++;
1013 else if (dir > 3 && dir < 7) // Heading Sout
1014 neighboury--;
1015
1016 int x = (int)(neighbourx * Constants.RegionSize);
1017 int y = (int)(neighboury * Constants.RegionSize);
1018 GridRegion neighbourRegion = GridService.GetRegionByPosition(RegionInfo.ScopeID, x, y);
1019
1020 if (neighbourRegion == null)
1021 {
1022 fix[0] = (int)(RegionInfo.RegionLocX - neighbourx);
1023 fix[1] = (int)(RegionInfo.RegionLocY - neighboury);
1024 return dir * (-1);
1025 }
1026 else
1027 return dir;
1028 }
1029
990 // Alias IncomingHelloNeighbour OtherRegionUp, for now 1030 // Alias IncomingHelloNeighbour OtherRegionUp, for now
991 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour) 1031 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
992 { 1032 {