aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorDan Lake2011-10-19 15:38:25 -0700
committerDan Lake2011-10-19 15:38:25 -0700
commiteac29396d98a4864923a69e0eb73cecdd8a225b3 (patch)
treebd9ca40f69659cdeb5902211030d589ac01e6abf /OpenSim/Region/Framework
parentMerge branch 'master' of git://opensimulator.org/git/opensim (diff)
downloadopensim-SC_OLD-eac29396d98a4864923a69e0eb73cecdd8a225b3.zip
opensim-SC_OLD-eac29396d98a4864923a69e0eb73cecdd8a225b3.tar.gz
opensim-SC_OLD-eac29396d98a4864923a69e0eb73cecdd8a225b3.tar.bz2
opensim-SC_OLD-eac29396d98a4864923a69e0eb73cecdd8a225b3.tar.xz
Moved HaveNeighbor utility function from ScenePresence to Scene. Fixed line endings from previous commit.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs56
3 files changed, 50 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
index 98228e4..26bc922 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
@@ -32,8 +32,8 @@ using OpenSim.Framework;
32namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 public interface IAvatarFactoryModule 34 public interface IAvatarFactoryModule
35 { 35 {
36 36
37 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); 37 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
38 38
39 /// <summary> 39 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 724c635..64ed6c7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -960,6 +960,46 @@ namespace OpenSim.Region.Framework.Scenes
960 return found; 960 return found;
961 } 961 }
962 962
963 /// <summary>
964 /// Checks whether this region has a neighbour in the given direction.
965 /// </summary>
966 /// <param name="car"></param>
967 /// <param name="fix"></param>
968 /// <returns>
969 /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
970 /// Returns a positive integer if there is a region in that direction, a negative integer if not.
971 /// </returns>
972 public int HaveNeighbor(Cardinals car, ref int[] fix)
973 {
974 uint neighbourx = RegionInfo.RegionLocX;
975 uint neighboury = RegionInfo.RegionLocY;
976
977 int dir = (int)car;
978
979 if (dir > 1 && dir < 5) //Heading East
980 neighbourx++;
981 else if (dir > 5) // Heading West
982 neighbourx--;
983
984 if (dir < 3 || dir == 8) // Heading North
985 neighboury++;
986 else if (dir > 3 && dir < 7) // Heading Sout
987 neighboury--;
988
989 int x = (int)(neighbourx * Constants.RegionSize);
990 int y = (int)(neighboury * Constants.RegionSize);
991 GridRegion neighbourRegion = GridService.GetRegionByPosition(RegionInfo.ScopeID, x, y);
992
993 if (neighbourRegion == null)
994 {
995 fix[0] = (int)(RegionInfo.RegionLocX - neighbourx);
996 fix[1] = (int)(RegionInfo.RegionLocY - neighboury);
997 return dir * (-1);
998 }
999 else
1000 return dir;
1001 }
1002
963 // Alias IncomingHelloNeighbour OtherRegionUp, for now 1003 // Alias IncomingHelloNeighbour OtherRegionUp, for now
964 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour) 1004 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
965 { 1005 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 464f8f0..8eb069f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2782,17 +2782,17 @@ namespace OpenSim.Region.Framework.Scenes
2782 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2782 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2783 { 2783 {
2784 needsTransit = true; 2784 needsTransit = true;
2785 neighbor = HaveNeighbor(Cardinals.SW, ref fix); 2785 neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
2786 } 2786 }
2787 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2787 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2788 { 2788 {
2789 needsTransit = true; 2789 needsTransit = true;
2790 neighbor = HaveNeighbor(Cardinals.NW, ref fix); 2790 neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
2791 } 2791 }
2792 else 2792 else
2793 { 2793 {
2794 needsTransit = true; 2794 needsTransit = true;
2795 neighbor = HaveNeighbor(Cardinals.W, ref fix); 2795 neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
2796 } 2796 }
2797 } 2797 }
2798 else if (m_scene.TestBorderCross(pos2, Cardinals.E)) 2798 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
@@ -2800,28 +2800,28 @@ namespace OpenSim.Region.Framework.Scenes
2800 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2800 if (m_scene.TestBorderCross(pos2, Cardinals.S))
2801 { 2801 {
2802 needsTransit = true; 2802 needsTransit = true;
2803 neighbor = HaveNeighbor(Cardinals.SE, ref fix); 2803 neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
2804 } 2804 }
2805 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2805 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2806 { 2806 {
2807 needsTransit = true; 2807 needsTransit = true;
2808 neighbor = HaveNeighbor(Cardinals.NE, ref fix); 2808 neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
2809 } 2809 }
2810 else 2810 else
2811 { 2811 {
2812 needsTransit = true; 2812 needsTransit = true;
2813 neighbor = HaveNeighbor(Cardinals.E, ref fix); 2813 neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
2814 } 2814 }
2815 } 2815 }
2816 else if (m_scene.TestBorderCross(pos2, Cardinals.S)) 2816 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
2817 { 2817 {
2818 needsTransit = true; 2818 needsTransit = true;
2819 neighbor = HaveNeighbor(Cardinals.S, ref fix); 2819 neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
2820 } 2820 }
2821 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 2821 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
2822 { 2822 {
2823 needsTransit = true; 2823 needsTransit = true;
2824 neighbor = HaveNeighbor(Cardinals.N, ref fix); 2824 neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
2825 } 2825 }
2826 2826
2827 // Makes sure avatar does not end up outside region 2827 // Makes sure avatar does not end up outside region
@@ -2897,46 +2897,6 @@ namespace OpenSim.Region.Framework.Scenes
2897 } 2897 }
2898 2898
2899 /// <summary> 2899 /// <summary>
2900 /// Checks whether this region has a neighbour in the given direction.
2901 /// </summary>
2902 /// <param name="car"></param>
2903 /// <param name="fix"></param>
2904 /// <returns>
2905 /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
2906 /// Returns a positive integer if there is a region in that direction, a negative integer if not.
2907 /// </returns>
2908 protected int HaveNeighbor(Cardinals car, ref int[] fix)
2909 {
2910 uint neighbourx = m_scene.RegionInfo.RegionLocX;
2911 uint neighboury = m_scene.RegionInfo.RegionLocY;
2912
2913 int dir = (int)car;
2914
2915 if (dir > 1 && dir < 5) //Heading East
2916 neighbourx++;
2917 else if (dir > 5) // Heading West
2918 neighbourx--;
2919
2920 if (dir < 3 || dir == 8) // Heading North
2921 neighboury++;
2922 else if (dir > 3 && dir < 7) // Heading Sout
2923 neighboury--;
2924
2925 int x = (int)(neighbourx * Constants.RegionSize);
2926 int y = (int)(neighboury * Constants.RegionSize);
2927 GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y);
2928
2929 if (neighbourRegion == null)
2930 {
2931 fix[0] = (int)(m_scene.RegionInfo.RegionLocX - neighbourx);
2932 fix[1] = (int)(m_scene.RegionInfo.RegionLocY - neighboury);
2933 return dir * (-1);
2934 }
2935 else
2936 return dir;
2937 }
2938
2939 /// <summary>
2940 /// Moves the agent outside the region bounds 2900 /// Moves the agent outside the region bounds
2941 /// Tells neighbor region that we're crossing to it 2901 /// Tells neighbor region that we're crossing to it
2942 /// If the neighbor accepts, remove the agent's viewable avatar from this scene 2902 /// If the neighbor accepts, remove the agent's viewable avatar from this scene