aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorRobert Adams2013-12-26 22:45:59 -0800
committerRobert Adams2013-12-26 22:45:59 -0800
commit2d2bea4aa75ff6e82384f0842fe3719bf946b1cc (patch)
tree9c1429ad59674925944ece4ec366888794e91822 /OpenSim/Region/CoreModules/Framework
parentvarregion: add lots of DEBUG level log messages. Especially for teleport. (diff)
downloadopensim-SC-2d2bea4aa75ff6e82384f0842fe3719bf946b1cc.zip
opensim-SC-2d2bea4aa75ff6e82384f0842fe3719bf946b1cc.tar.gz
opensim-SC-2d2bea4aa75ff6e82384f0842fe3719bf946b1cc.tar.bz2
opensim-SC-2d2bea4aa75ff6e82384f0842fe3719bf946b1cc.tar.xz
varregion: many more updates removing the constant RegionSize and replacing
with a passed region size. This time in the map code and grid services code.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs43
1 files changed, 21 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 2aa43bc..eb08257 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -337,6 +337,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
337 "[ENTITY TRANSFER MODULE]: Received teleport cancel request from {0} in {1}", client.Name, Scene.Name); 337 "[ENTITY TRANSFER MODULE]: Received teleport cancel request from {0} in {1}", client.Name, Scene.Name);
338 } 338 }
339 339
340 // Attempt to teleport the ScenePresence to the specified position in the specified region (spec'ed by its handle).
340 public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags) 341 public void Teleport(ScenePresence sp, ulong regionHandle, Vector3 position, Vector3 lookAt, uint teleportFlags)
341 { 342 {
342 if (sp.Scene.Permissions.IsGridGod(sp.UUID)) 343 if (sp.Scene.Permissions.IsGridGod(sp.UUID))
@@ -478,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
478 Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination) 479 Vector3 lookAt, uint teleportFlags, out GridRegion finalDestination)
479 { 480 {
480 uint x = 0, y = 0; 481 uint x = 0, y = 0;
481 Utils.LongToUInts(regionHandle, out x, out y); 482 Util.RegionHandleToWorldLoc(regionHandle, out x, out y);
482 GridRegion reg = Scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y); 483 GridRegion reg = Scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y);
483 484
484 if (reg != null) 485 if (reg != null)
@@ -532,8 +533,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
532 Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY); 533 Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY);
533 534
534 MapBlockData block = new MapBlockData(); 535 MapBlockData block = new MapBlockData();
535 block.X = (ushort)Util.WorldToRegionLoc(regX); 536 block.X = (ushort)regX;
536 block.Y = (ushort)Util.WorldToRegionLoc(regY); 537 block.Y = (ushort)regY;
537 block.Access = 254; // == not there 538 block.Access = 254; // == not there
538 539
539 List<MapBlockData> blocks = new List<MapBlockData>(); 540 List<MapBlockData> blocks = new List<MapBlockData>();
@@ -1505,7 +1506,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1505 1506
1506 agent.Scene.RequestTeleportLocation( 1507 agent.Scene.RequestTeleportLocation(
1507 agent.ControllingClient, 1508 agent.ControllingClient,
1508 Utils.UIntsToLong(regionX * (uint)Constants.RegionSize, regionY * (uint)Constants.RegionSize), 1509 Util.RegionLocToHandle(regionX, regionY),
1509 position, 1510 position,
1510 agent.Lookat, 1511 agent.Lookat,
1511 (uint)Constants.TeleportFlags.ViaLocation); 1512 (uint)Constants.TeleportFlags.ViaLocation);
@@ -1515,11 +1516,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1515 if (im != null) 1516 if (im != null)
1516 { 1517 {
1517 UUID gotoLocation = Util.BuildFakeParcelID( 1518 UUID gotoLocation = Util.BuildFakeParcelID(
1518 Util.UIntsToLong( 1519 Util.RegionLocToHandle(regionX, regionY),
1519 (regionX *
1520 (uint)Constants.RegionSize),
1521 (regionY *
1522 (uint)Constants.RegionSize)),
1523 (uint)(int)position.X, 1520 (uint)(int)position.X,
1524 (uint)(int)position.Y, 1521 (uint)(int)position.Y,
1525 (uint)(int)position.Z); 1522 (uint)(int)position.Z);
@@ -1991,8 +1988,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1991 int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize; 1988 int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize;
1992 return new Vector3(shiftx, shifty, 0f); 1989 return new Vector3(shiftx, shifty, 0f);
1993 */ 1990 */
1994 return new Vector3(sp.Scene.RegionInfo.RegionLocX - neighbour.RegionLocX, 1991 return new Vector3( sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX,
1995 sp.Scene.RegionInfo.RegionLocY - neighbour.RegionLocY, 1992 sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
1996 0f); 1993 0f);
1997 } 1994 }
1998 1995
@@ -2172,16 +2169,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2172 // view to include everything in the megaregion 2169 // view to include everything in the megaregion
2173 if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) 2170 if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
2174 { 2171 {
2175 int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; 2172 // The area to check is as big as the current region.
2173 // We presume all adjacent regions are the same size as this region.
2174 uint dd = Math.Max((uint)avatar.DrawDistance,
2175 Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY));
2176 2176
2177 int startX = (int)pRegionLocX * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); 2177 uint startX = Util.RegionToWorldLoc(pRegionLocX) - dd + Constants.RegionSize/2;
2178 int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2); 2178 uint startY = Util.RegionToWorldLoc(pRegionLocY) - dd + Constants.RegionSize/2;
2179 2179
2180 int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); 2180 uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2;
2181 int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2); 2181 uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2;
2182 2182
2183 List<GridRegion> neighbours = 2183 List<GridRegion> neighbours =
2184 avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY); 2184 avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
2185 2185
2186 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); 2186 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
2187 return neighbours; 2187 return neighbours;
@@ -2194,10 +2194,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2194 List<GridRegion> neighbours 2194 List<GridRegion> neighbours
2195 = pScene.GridService.GetRegionRange( 2195 = pScene.GridService.GetRegionRange(
2196 m_regionInfo.ScopeID, 2196 m_regionInfo.ScopeID,
2197 (int)swCorner.X * (int)Constants.RegionSize, 2197 (int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X),
2198 (int)neCorner.X * (int)Constants.RegionSize, 2198 (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y) );
2199 (int)swCorner.Y * (int)Constants.RegionSize,
2200 (int)neCorner.Y * (int)Constants.RegionSize);
2201 2199
2202 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); 2200 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
2203 2201
@@ -2300,7 +2298,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2300 double objectWorldLocY = (double)scene.RegionInfo.WorldLocY + attemptedPosition.Y; 2298 double objectWorldLocY = (double)scene.RegionInfo.WorldLocY + attemptedPosition.Y;
2301 2299
2302 // Ask the grid service for the region that contains the passed address 2300 // Ask the grid service for the region that contains the passed address
2303 GridRegion destination = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID, objectWorldLocX, objectWorldLocY); 2301 GridRegion destination = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID,
2302 objectWorldLocX, objectWorldLocY);
2304 2303
2305 Vector3 pos = Vector3.Zero; 2304 Vector3 pos = Vector3.Zero;
2306 if (destination != null) 2305 if (destination != null)