aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
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
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')
-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 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 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 02bceb9..fb25493 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3134,17 +3134,17 @@ namespace OpenSim.Region.Framework.Scenes
3134 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 3134 if (m_scene.TestBorderCross(pos2, Cardinals.S))
3135 { 3135 {
3136 needsTransit = true; 3136 needsTransit = true;
3137 neighbor = HaveNeighbor(Cardinals.SW, ref fix); 3137 neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
3138 } 3138 }
3139 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 3139 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
3140 { 3140 {
3141 needsTransit = true; 3141 needsTransit = true;
3142 neighbor = HaveNeighbor(Cardinals.NW, ref fix); 3142 neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
3143 } 3143 }
3144 else 3144 else
3145 { 3145 {
3146 needsTransit = true; 3146 needsTransit = true;
3147 neighbor = HaveNeighbor(Cardinals.W, ref fix); 3147 neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
3148 } 3148 }
3149 } 3149 }
3150 else if (m_scene.TestBorderCross(pos2, Cardinals.E)) 3150 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
@@ -3152,28 +3152,28 @@ namespace OpenSim.Region.Framework.Scenes
3152 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 3152 if (m_scene.TestBorderCross(pos2, Cardinals.S))
3153 { 3153 {
3154 needsTransit = true; 3154 needsTransit = true;
3155 neighbor = HaveNeighbor(Cardinals.SE, ref fix); 3155 neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
3156 } 3156 }
3157 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 3157 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
3158 { 3158 {
3159 needsTransit = true; 3159 needsTransit = true;
3160 neighbor = HaveNeighbor(Cardinals.NE, ref fix); 3160 neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
3161 } 3161 }
3162 else 3162 else
3163 { 3163 {
3164 needsTransit = true; 3164 needsTransit = true;
3165 neighbor = HaveNeighbor(Cardinals.E, ref fix); 3165 neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
3166 } 3166 }
3167 } 3167 }
3168 else if (m_scene.TestBorderCross(pos2, Cardinals.S)) 3168 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
3169 { 3169 {
3170 needsTransit = true; 3170 needsTransit = true;
3171 neighbor = HaveNeighbor(Cardinals.S, ref fix); 3171 neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
3172 } 3172 }
3173 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 3173 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
3174 { 3174 {
3175 needsTransit = true; 3175 needsTransit = true;
3176 neighbor = HaveNeighbor(Cardinals.N, ref fix); 3176 neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
3177 } 3177 }
3178 3178
3179 // Makes sure avatar does not end up outside region 3179 // Makes sure avatar does not end up outside region
@@ -3249,46 +3249,6 @@ namespace OpenSim.Region.Framework.Scenes
3249 } 3249 }
3250 3250
3251 /// <summary> 3251 /// <summary>
3252 /// Checks whether this region has a neighbour in the given direction.
3253 /// </summary>
3254 /// <param name="car"></param>
3255 /// <param name="fix"></param>
3256 /// <returns>
3257 /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
3258 /// Returns a positive integer if there is a region in that direction, a negative integer if not.
3259 /// </returns>
3260 protected int HaveNeighbor(Cardinals car, ref int[] fix)
3261 {
3262 uint neighbourx = m_scene.RegionInfo.RegionLocX;
3263 uint neighboury = m_scene.RegionInfo.RegionLocY;
3264
3265 int dir = (int)car;
3266
3267 if (dir > 1 && dir < 5) //Heading East
3268 neighbourx++;
3269 else if (dir > 5) // Heading West
3270 neighbourx--;
3271
3272 if (dir < 3 || dir == 8) // Heading North
3273 neighboury++;
3274 else if (dir > 3 && dir < 7) // Heading Sout
3275 neighboury--;
3276
3277 int x = (int)(neighbourx * Constants.RegionSize);
3278 int y = (int)(neighboury * Constants.RegionSize);
3279 GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y);
3280
3281 if (neighbourRegion == null)
3282 {
3283 fix[0] = (int)(m_scene.RegionInfo.RegionLocX - neighbourx);
3284 fix[1] = (int)(m_scene.RegionInfo.RegionLocY - neighboury);
3285 return dir * (-1);
3286 }
3287 else
3288 return dir;
3289 }
3290
3291 /// <summary>
3292 /// Moves the agent outside the region bounds 3252 /// Moves the agent outside the region bounds
3293 /// Tells neighbor region that we're crossing to it 3253 /// Tells neighbor region that we're crossing to it
3294 /// If the neighbor accepts, remove the agent's viewable avatar from this scene 3254 /// If the neighbor accepts, remove the agent's viewable avatar from this scene