diff options
Merge commit 'eac29396d98a4864923a69e0eb73cecdd8a225b3' into bigmerge
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 40 |
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 | { |