aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs65
2 files changed, 21 insertions, 55 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index e3cf43c..7861a54 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1147,7 +1147,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1147 // Past this point we have to attempt clean up if the teleport fails, so update transfer state. 1147 // Past this point we have to attempt clean up if the teleport fails, so update transfer state.
1148 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); 1148 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
1149 1149
1150
1151 // We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator, 1150 // We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator,
1152 // where that neighbour simulator could otherwise request a child agent create on the source which then 1151 // where that neighbour simulator could otherwise request a child agent create on the source which then
1153 // closes our existing agent which is still signalled as root. 1152 // closes our existing agent which is still signalled as root.
@@ -2184,7 +2183,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2184 int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize; 2183 int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize;
2185 return new Vector3(shiftx, shifty, 0f); 2184 return new Vector3(shiftx, shifty, 0f);
2186 */ 2185 */
2187 return new Vector3( sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX, 2186 return new Vector3(sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX,
2188 sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY, 2187 sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
2189 0f); 2188 0f);
2190 } 2189 }
@@ -2496,10 +2495,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2496 uint startY = Util.RegionToWorldLoc(pRegionLocY) + m_regionInfo.RegionSizeY / 2; 2495 uint startY = Util.RegionToWorldLoc(pRegionLocY) + m_regionInfo.RegionSizeY / 2;
2497 uint endY = startY; 2496 uint endY = startY;
2498 2497
2499 startX -= dd; 2498 startX -= ddX;
2500 startY -= dd; 2499 startY -= ddY;
2501 endX += dd; 2500 endX += ddX;
2502 endY += dd; 2501 endY += ddY;
2503 2502
2504 neighbours 2503 neighbours
2505 = avatar.Scene.GridService.GetRegionRange( 2504 = avatar.Scene.GridService.GetRegionRange(
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 41f8871..605c788 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1129,17 +1129,9 @@ namespace OpenSim.Region.Framework.Scenes
1129 /// <returns>True after all operations complete, throws exceptions otherwise.</returns> 1129 /// <returns>True after all operations complete, throws exceptions otherwise.</returns>
1130 public override void OtherRegionUp(GridRegion otherRegion) 1130 public override void OtherRegionUp(GridRegion otherRegion)
1131 { 1131 {
1132 uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize);
1133 uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize);
1134 //m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
1135 // RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell);
1136
1137 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 1132 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
1138 { 1133 {
1139 // If these are cast to INT because long + negative values + abs returns invalid data 1134 if (isNeighborRegion(otherRegion))
1140 int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
1141 int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
1142 if (resultX <= 1 && resultY <= 1)
1143 { 1135 {
1144 // Let the grid service module know, so this can be cached 1136 // Let the grid service module know, so this can be cached
1145 m_eventManager.TriggerOnRegionUp(otherRegion); 1137 m_eventManager.TriggerOnRegionUp(otherRegion);
@@ -1174,6 +1166,21 @@ namespace OpenSim.Region.Framework.Scenes
1174 } 1166 }
1175 } 1167 }
1176 1168
1169 public bool isNeighborRegion(GridRegion otherRegion)
1170 {
1171 int tmp = otherRegion.RegionLocX - (int)RegionInfo.WorldLocX; ;
1172
1173 if (tmp < -otherRegion.RegionSizeX && tmp > RegionInfo.RegionSizeX)
1174 return false;
1175
1176 tmp = otherRegion.RegionLocY - (int)RegionInfo.WorldLocY;
1177
1178 if (tmp < -otherRegion.RegionSizeY && tmp > RegionInfo.RegionSizeY)
1179 return false;
1180
1181 return true;
1182 }
1183
1177 public void AddNeighborRegion(RegionInfo region) 1184 public void AddNeighborRegion(RegionInfo region)
1178 { 1185 {
1179 lock (m_neighbours) 1186 lock (m_neighbours)
@@ -1202,46 +1209,6 @@ namespace OpenSim.Region.Framework.Scenes
1202 return found; 1209 return found;
1203 } 1210 }
1204 1211
1205 /// <summary>
1206 /// Checks whether this region has a neighbour in the given direction.
1207 /// </summary>
1208 /// <param name="car"></param>
1209 /// <param name="fix"></param>
1210 /// <returns>
1211 /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
1212 /// Returns a positive integer if there is a region in that direction, a negative integer if not.
1213 /// </returns>
1214 public int HaveNeighbor(Cardinals car, ref int[] fix)
1215 {
1216 uint neighbourx = RegionInfo.RegionLocX;
1217 uint neighboury = RegionInfo.RegionLocY;
1218
1219 int dir = (int)car;
1220
1221 if (dir > 1 && dir < 5) //Heading East
1222 neighbourx++;
1223 else if (dir > 5) // Heading West
1224 neighbourx--;
1225
1226 if (dir < 3 || dir == 8) // Heading North
1227 neighboury++;
1228 else if (dir > 3 && dir < 7) // Heading Sout
1229 neighboury--;
1230
1231 int x = (int)(neighbourx * Constants.RegionSize);
1232 int y = (int)(neighboury * Constants.RegionSize);
1233 GridRegion neighbourRegion = GridService.GetRegionByPosition(RegionInfo.ScopeID, x, y);
1234
1235 if (neighbourRegion == null)
1236 {
1237 fix[0] = (int)(RegionInfo.RegionLocX - neighbourx);
1238 fix[1] = (int)(RegionInfo.RegionLocY - neighboury);
1239 return dir * (-1);
1240 }
1241 else
1242 return dir;
1243 }
1244
1245 // Alias IncomingHelloNeighbour OtherRegionUp, for now 1212 // Alias IncomingHelloNeighbour OtherRegionUp, for now
1246 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour) 1213 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
1247 { 1214 {