aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
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
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')
-rw-r--r--OpenSim/Framework/Util.cs5
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs43
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs49
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs53
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs20
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs10
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs12
-rw-r--r--OpenSim/Services/GridService/GridService.cs14
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs61
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs2
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginResponse.cs33
-rw-r--r--OpenSim/Tests/Clients/Grid/GridClient.cs8
32 files changed, 224 insertions, 239 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 2276951..b84673b 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -342,6 +342,11 @@ namespace OpenSim.Framework
342 return Utils.UIntsToLong(X, Y); 342 return Utils.UIntsToLong(X, Y);
343 } 343 }
344 344
345 public static ulong RegionLocToHandle(uint X, uint Y)
346 {
347 return Utils.UIntsToLong(Util.RegionToWorldLoc(X), Util.RegionToWorldLoc(Y));
348 }
349
345 public static void RegionHandleToWorldLoc(ulong handle, out uint X, out uint Y) 350 public static void RegionHandleToWorldLoc(ulong handle, out uint X, out uint Y)
346 { 351 {
347 X = (uint)(handle >> 32); 352 X = (uint)(handle >> 32);
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)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
index 33ff7ea..ae76288 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
82 return new List<GridRegion>(m_neighbours.Values); 82 return new List<GridRegion>(m_neighbours.Values);
83 } 83 }
84 84
85 // Get a region given its base coordinates. 85 // Get a region given its base coordinates (in meters).
86 // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST 86 // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
87 // be the base coordinate of the region. 87 // be the base coordinate of the region.
88 // The snapping is technically unnecessary but is harmless because regions are always 88 // The snapping is technically unnecessary but is harmless because regions are always
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index ac81337..ae5081c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
186 return rinfo; 186 return rinfo;
187 } 187 }
188 188
189 // Get a region given its base coordinates. 189 // Get a region given its base world coordinates (in meters).
190 // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST 190 // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
191 // be the base coordinate of the region. 191 // be the base coordinate of the region.
192 // The coordinates are world coords (meters), NOT region units. 192 // The coordinates are world coords (meters), NOT region units.
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
index fd89428..56d9937 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
132 if (s.RegionInfo.RegionHandle == regionHandle) 132 if (s.RegionInfo.RegionHandle == regionHandle)
133 { 133 {
134 m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}", 134 m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}",
135 thisRegion.RegionName, s.Name, x / Constants.RegionSize, y / Constants.RegionSize); 135 thisRegion.RegionName, s.Name, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y) );
136 136
137 //m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); 137 //m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour");
138 return s.IncomingHelloNeighbour(thisRegion); 138 return s.IncomingHelloNeighbour(thisRegion);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
index a990898..9f39aa2 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
@@ -533,7 +533,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
533 if (isMegaregion) 533 if (isMegaregion)
534 size = rcMod.GetSizeOfMegaregion(scene.RegionInfo.RegionID); 534 size = rcMod.GetSizeOfMegaregion(scene.RegionInfo.RegionID);
535 else 535 else
536 size = new Vector2((float)Constants.RegionSize, (float)Constants.RegionSize); 536 size = new Vector2((float)scene.RegionInfo.RegionSizeX, (float)scene.RegionInfo.RegionSizeY);
537 537
538 xtw.WriteElementString("is_megaregion", isMegaregion.ToString()); 538 xtw.WriteElementString("is_megaregion", isMegaregion.ToString());
539 xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); 539 xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y));
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index 40638f8..1007e0b 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -102,7 +102,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
102 102
103 terrainRenderer.Initialise(m_scene, m_config); 103 terrainRenderer.Initialise(m_scene, m_config);
104 104
105 mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb); 105 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height,
106 System.Drawing.Imaging.PixelFormat.Format24bppRgb);
106 //long t = System.Environment.TickCount; 107 //long t = System.Environment.TickCount;
107 //for (int i = 0; i < 10; ++i) { 108 //for (int i = 0; i < 10; ++i) {
108 terrainRenderer.TerrainToBitmap(mapbmp); 109 terrainRenderer.TerrainToBitmap(mapbmp);
@@ -273,7 +274,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
273 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) 274 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
274 { 275 {
275 int tc = 0; 276 int tc = 0;
276 double[,] hm = whichScene.Heightmap.GetDoubles(); 277 ITerrainChannel hm = whichScene.Heightmap;
277 tc = Environment.TickCount; 278 tc = Environment.TickCount;
278 m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); 279 m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
279 EntityBase[] objs = whichScene.GetEntities(); 280 EntityBase[] objs = whichScene.GetEntities();
@@ -356,7 +357,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
356 Vector3 pos = part.GetWorldPosition(); 357 Vector3 pos = part.GetWorldPosition();
357 358
358 // skip prim outside of retion 359 // skip prim outside of retion
359 if (pos.X < 0f || pos.X > 256f || pos.Y < 0f || pos.Y > 256f) 360 if (!m_scene.PositionIsInCurrentRegion(pos))
360 continue; 361 continue;
361 362
362 // skip prim in non-finite position 363 // skip prim in non-finite position
@@ -399,9 +400,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
399 int mapdrawendY = (int)(pos.Y + scale.Y); 400 int mapdrawendY = (int)(pos.Y + scale.Y);
400 401
401 // If object is beyond the edge of the map, don't draw it to avoid errors 402 // If object is beyond the edge of the map, don't draw it to avoid errors
402 if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1) 403 if (mapdrawstartX < 0
403 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0 404 || mapdrawstartX > (hm.Width - 1)
404 || mapdrawendY > ((int)Constants.RegionSize - 1)) 405 || mapdrawendX < 0
406 || mapdrawendX > (hm.Width - 1)
407 || mapdrawstartY < 0
408 || mapdrawstartY > (hm.Height - 1)
409 || mapdrawendY < 0
410 || mapdrawendY > (hm.Height - 1))
405 continue; 411 continue;
406 412
407#region obb face reconstruction part duex 413#region obb face reconstruction part duex
@@ -523,11 +529,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
523 for (int i = 0; i < FaceA.Length; i++) 529 for (int i = 0; i < FaceA.Length; i++)
524 { 530 {
525 Point[] working = new Point[5]; 531 Point[] working = new Point[5];
526 working[0] = project(FaceA[i], axPos); 532 working[0] = project(hm, FaceA[i], axPos);
527 working[1] = project(FaceB[i], axPos); 533 working[1] = project(hm, FaceB[i], axPos);
528 working[2] = project(FaceD[i], axPos); 534 working[2] = project(hm, FaceD[i], axPos);
529 working[3] = project(FaceC[i], axPos); 535 working[3] = project(hm, FaceC[i], axPos);
530 working[4] = project(FaceA[i], axPos); 536 working[4] = project(hm, FaceA[i], axPos);
531 537
532 face workingface = new face(); 538 face workingface = new face();
533 workingface.pts = working; 539 workingface.pts = working;
@@ -595,17 +601,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
595 return mapbmp; 601 return mapbmp;
596 } 602 }
597 603
598 private Point project(Vector3 point3d, Vector3 originpos) 604 private Point project(ITerrainChannel hm, Vector3 point3d, Vector3 originpos)
599 { 605 {
600 Point returnpt = new Point(); 606 Point returnpt = new Point();
601 //originpos = point3d; 607 //originpos = point3d;
602 //int d = (int)(256f / 1.5f); 608 //int d = (int)(256f / 1.5f);
603 609
604 //Vector3 topos = new Vector3(0, 0, 0); 610 //Vector3 topos = new Vector3(0, 0, 0);
605 // float z = -point3d.z - topos.z; 611 // float z = -point3d.z - topos.z;
606 612
607 returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d); 613 returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d);
608 returnpt.Y = (int)(((int)Constants.RegionSize - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); 614 returnpt.Y = (int)((hm.Width - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d)));
609 615
610 return returnpt; 616 return returnpt;
611 } 617 }
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
index 992bff3..9b939c9 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
35 36
36namespace OpenSim.Region.CoreModules.World.LegacyMap 37namespace OpenSim.Region.CoreModules.World.LegacyMap
@@ -39,8 +40,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
39 { 40 {
40 private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95); 41 private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
41 42
42 private static readonly ILog m_log = 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]";
44 45
45 private Scene m_scene; 46 private Scene m_scene;
46 //private IConfigSource m_config; // not used currently 47 //private IConfigSource m_config; // not used currently
@@ -53,19 +54,26 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
53 54
54 public void TerrainToBitmap(Bitmap mapbmp) 55 public void TerrainToBitmap(Bitmap mapbmp)
55 { 56 {
57 m_log.DebugFormat("{0} Generating Maptile Step 1: Terrain", LogHeader);
56 int tc = Environment.TickCount; 58 int tc = Environment.TickCount;
57 m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain");
58 59
59 double[,] hm = m_scene.Heightmap.GetDoubles(); 60 ITerrainChannel hm = m_scene.Heightmap;
61
62 if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height)
63 {
64 m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>",
65 LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height);
66 }
67
60 bool ShadowDebugContinue = true; 68 bool ShadowDebugContinue = true;
61 69
62 bool terraincorruptedwarningsaid = false; 70 bool terraincorruptedwarningsaid = false;
63 71
64 float low = 255; 72 float low = 255;
65 float high = 0; 73 float high = 0;
66 for (int x = 0; x < (int)Constants.RegionSize; x++) 74 for (int x = 0; x < hm.Width; x++)
67 { 75 {
68 for (int y = 0; y < (int)Constants.RegionSize; y++) 76 for (int y = 0; y < hm.Height; y++)
69 { 77 {
70 float hmval = (float)hm[x, y]; 78 float hmval = (float)hm[x, y];
71 if (hmval < low) 79 if (hmval < low)
@@ -77,12 +85,12 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
77 85
78 float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; 86 float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
79 87
80 for (int x = 0; x < (int)Constants.RegionSize; x++) 88 for (int x = 0; x < hm.Width; x++)
81 { 89 {
82 for (int y = 0; y < (int)Constants.RegionSize; y++) 90 for (int y = 0; y < hm.Height; y++)
83 { 91 {
84 // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left 92 // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left
85 int yr = ((int)Constants.RegionSize - 1) - y; 93 int yr = ((int)hm.Height - 1) - y;
86 94
87 float heightvalue = (float)hm[x, y]; 95 float heightvalue = (float)hm[x, y];
88 96
@@ -109,12 +117,12 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
109 // . 117 // .
110 // 118 //
111 // Shade the terrain for shadows 119 // Shade the terrain for shadows
112 if (x < ((int)Constants.RegionSize - 1) && yr < ((int)Constants.RegionSize - 1)) 120 if (x < (hm.Width - 1) && yr < (hm.Height - 1))
113 { 121 {
114 float hfvalue = (float)hm[x, y]; 122 float hfvalue = (float)hm[x, y];
115 float hfvaluecompare = 0f; 123 float hfvaluecompare = 0f;
116 124
117 if ((x + 1 < (int)Constants.RegionSize) && (y + 1 < (int)Constants.RegionSize)) 125 if ((x + 1 < hm.Width) && (y + 1 < hm.Height))
118 { 126 {
119 hfvaluecompare = (float)hm[x + 1, y + 1]; // light from north-east => look at land height there 127 hfvaluecompare = (float)hm[x + 1, y + 1]; // light from north-east => look at land height there
120 } 128 }
@@ -179,7 +187,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
179 187
180 if (ShadowDebugContinue) 188 if (ShadowDebugContinue)
181 { 189 {
182 if ((x - 1 > 0) && (yr + 1 < (int)Constants.RegionSize)) 190 if ((x - 1 > 0) && (yr + 1 < hm.Height))
183 { 191 {
184 color = mapbmp.GetPixel(x - 1, yr + 1); 192 color = mapbmp.GetPixel(x - 1, yr + 1);
185 int r = color.R; 193 int r = color.R;
@@ -233,7 +241,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
233 terraincorruptedwarningsaid = true; 241 terraincorruptedwarningsaid = true;
234 } 242 }
235 Color black = Color.Black; 243 Color black = Color.Black;
236 mapbmp.SetPixel(x, ((int)Constants.RegionSize - y) - 1, black); 244 mapbmp.SetPixel(x, (hm.Width - y) - 1, black);
237 } 245 }
238 } 246 }
239 } 247 }
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index d13c2ef..413ac64 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
@@ -34,6 +34,8 @@ using Nini.Config;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenMetaverse.Imaging; 35using OpenMetaverse.Imaging;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.Framework;
38using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
38 40
39namespace OpenSim.Region.CoreModules.World.LegacyMap 41namespace OpenSim.Region.CoreModules.World.LegacyMap
@@ -122,8 +124,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
122 { 124 {
123 #region Constants 125 #region Constants
124 126
125 private static readonly ILog m_log = 127 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
126 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 128 private static readonly string LogHeader = "[TEXTURED MAPTILE RENDERER]";
127 129
128 // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank"). 130 // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank").
129 // The color-values were choosen because they "look right" (at least to me) ;-) 131 // The color-values were choosen because they "look right" (at least to me) ;-)
@@ -173,7 +175,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
173 private Bitmap fetchTexture(UUID id) 175 private Bitmap fetchTexture(UUID id)
174 { 176 {
175 AssetBase asset = m_scene.AssetService.Get(id.ToString()); 177 AssetBase asset = m_scene.AssetService.Get(id.ToString());
176 m_log.DebugFormat("[TexturedMapTileRenderer]: Fetched texture {0}, found: {1}", id, asset != null); 178 m_log.DebugFormat("{0} Fetched texture {1}, found: {2}", LogHeader, id, asset != null);
177 if (asset == null) return null; 179 if (asset == null) return null;
178 180
179 ManagedImage managedImage; 181 ManagedImage managedImage;
@@ -188,18 +190,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
188 } 190 }
189 catch (DllNotFoundException) 191 catch (DllNotFoundException)
190 { 192 {
191 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id); 193 m_log.ErrorFormat("{0} OpenJpeg is not installed correctly on this system. Asset Data is empty for {1}", LogHeader, id);
192
193 } 194 }
194 catch (IndexOutOfRangeException) 195 catch (IndexOutOfRangeException)
195 { 196 {
196 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); 197 m_log.ErrorFormat("{0} OpenJpeg was unable to encode this. Asset Data is empty for {1}", LogHeader, id);
197
198 } 198 }
199 catch (Exception) 199 catch (Exception)
200 { 200 {
201 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); 201 m_log.ErrorFormat("{0} OpenJpeg was unable to encode this. Asset Data is empty for {1}", LogHeader, id);
202
203 } 202 }
204 return null; 203 return null;
205 204
@@ -267,8 +266,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
267 266
268 // the heigthfield might have some jumps in values. Rendered land is smooth, though, 267 // the heigthfield might have some jumps in values. Rendered land is smooth, though,
269 // as a slope is rendered at that place. So average 4 neighbour values to emulate that. 268 // as a slope is rendered at that place. So average 4 neighbour values to emulate that.
270 private float getHeight(double[,] hm, int x, int y) { 269 private float getHeight(ITerrainChannel hm, int x, int y) {
271 if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) 270 if (x < (hm.Width - 1) && y < (hm.Height - 1))
272 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); 271 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112);
273 else 272 else
274 return (float)hm[x, y]; 273 return (float)hm[x, y];
@@ -278,7 +277,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
278 public void TerrainToBitmap(Bitmap mapbmp) 277 public void TerrainToBitmap(Bitmap mapbmp)
279 { 278 {
280 int tc = Environment.TickCount; 279 int tc = Environment.TickCount;
281 m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain"); 280 m_log.DebugFormat("{0} Generating Maptile Step 1: Terrain", LogHeader);
281
282 ITerrainChannel hm = m_scene.Heightmap;
283
284 if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height)
285 {
286 m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>",
287 LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height);
288 }
282 289
283 // These textures should be in the AssetCache anyway, as every client conneting to this 290 // These textures should be in the AssetCache anyway, as every client conneting to this
284 // region needs them. Except on start, when the map is recreated (before anyone connected), 291 // region needs them. Except on start, when the map is recreated (before anyone connected),
@@ -306,19 +313,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
306 313
307 float waterHeight = (float)settings.WaterHeight; 314 float waterHeight = (float)settings.WaterHeight;
308 315
309 double[,] hm = m_scene.Heightmap.GetDoubles(); 316 for (int x = 0; x < hm.Width; x++)
310
311 for (int x = 0; x < (int)Constants.RegionSize; x++)
312 { 317 {
313 float columnRatio = x / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation 318 float columnRatio = x / (hm.Width - 1); // 0 - 1, for interpolation
314 for (int y = 0; y < (int)Constants.RegionSize; y++) 319 for (int y = 0; y < hm.Height; y++)
315 { 320 {
316 float rowRatio = y / ((float)Constants.RegionSize - 1); // 0 - 1, for interpolation 321 float rowRatio = y / (hm.Height - 1); // 0 - 1, for interpolation
317 322
318 // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left 323 // Y flip the cordinates for the bitmap: hf origin is lower left, bm origin is upper left
319 int yr = ((int)Constants.RegionSize - 1) - y; 324 int yr = (hm.Height - 1) - y;
320 325
321 float heightvalue = getHeight(hm, x, y); 326 float heightvalue = getHeight(m_scene.Heightmap, x, y);
322 if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) 327 if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue))
323 heightvalue = 0; 328 heightvalue = 0;
324 329
@@ -368,9 +373,9 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
368 } 373 }
369 374
370 // Shade the terrain for shadows 375 // Shade the terrain for shadows
371 if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) 376 if (x < (hm.Width - 1) && y < (hm.Height - 1))
372 { 377 {
373 float hfvaluecompare = getHeight(hm, x + 1, y + 1); // light from north-east => look at land height there 378 float hfvaluecompare = getHeight(m_scene.Heightmap, x + 1, y + 1); // light from north-east => look at land height there
374 if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare)) 379 if (Single.IsInfinity(hfvaluecompare) || Single.IsNaN(hfvaluecompare))
375 hfvaluecompare = 0f; 380 hfvaluecompare = 0f;
376 381
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 22a53a8..e8eaeb7 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -151,14 +151,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
151 break; 151 break;
152 152
153 case 2: // Sell a copy 153 case 2: // Sell a copy
154 Vector3 inventoryStoredPosition = new Vector3 154 Vector3 inventoryStoredPosition = new Vector3(
155 (((group.AbsolutePosition.X > (int)Constants.RegionSize) 155 Math.Min(group.AbsolutePosition.X, m_scene.RegionInfo.RegionSizeX - 6),
156 ? 250 156 Math.Min(group.AbsolutePosition.Y, m_scene.RegionInfo.RegionSizeY - 6),
157 : group.AbsolutePosition.X)
158 ,
159 (group.AbsolutePosition.X > (int)Constants.RegionSize)
160 ? 250
161 : group.AbsolutePosition.X,
162 group.AbsolutePosition.Z); 157 group.AbsolutePosition.Z);
163 158
164 Vector3 originalPosition = group.AbsolutePosition; 159 Vector3 originalPosition = group.AbsolutePosition;
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
index 630473e..b6c635c 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
45 { 45 {
46 if (fillArea[x, y]) 46 if (fillArea[x, y])
47 { 47 {
48 double noise = TerrainUtil.PerlinNoise2D((double) x / Constants.RegionSize, (double) y / Constants.RegionSize, 8, 1.0); 48 double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0);
49 49
50 map[x, y] += noise * strength; 50 map[x, y] += noise * strength;
51 } 51 }
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs
index 989b7d8..e7df3f8 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes
53 z *= z; 53 z *= z;
54 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 54 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
55 55
56 double noise = TerrainUtil.PerlinNoise2D(x / (double) Constants.RegionSize, y / (double) Constants.RegionSize, 8, 1.0); 56 double noise = TerrainUtil.PerlinNoise2D(x / (double) map.Width, y / (double) map.Height, 8, 1.0);
57 57
58 if (z > 0.0) 58 if (z > 0.0)
59 map[x, y] += noise * z * duration; 59 map[x, y] += noise * z * duration;
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
index ed2b06a..6d9e31b 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
@@ -128,7 +128,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
128 public Bitmap CreateMapTile() 128 public Bitmap CreateMapTile()
129 { 129 {
130 Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); 130 Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f);
131 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize); 131 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f,
132 (int)Constants.RegionSize, (int)Constants.RegionSize,
133 (float)Constants.RegionSize, (float)Constants.RegionSize);
132 return CreateMapTile(viewport, false); 134 return CreateMapTile(viewport, false);
133 } 135 }
134 136
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index 708a9a2..1fb1aba 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -184,8 +184,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
184 data.Name = info.RegionName; 184 data.Name = info.RegionName;
185 data.RegionFlags = 0; // TODO not used? 185 data.RegionFlags = 0; // TODO not used?
186 data.WaterHeight = 0; // not used 186 data.WaterHeight = 0; // not used
187 data.X = (ushort)(info.RegionLocX / Constants.RegionSize); 187 data.X = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocX);
188 data.Y = (ushort)(info.RegionLocY / Constants.RegionSize); 188 data.Y = (ushort)Util.WorldToRegionLoc((uint)info.RegionLocY);
189 blocks.Add(data); 189 blocks.Add(data);
190 } 190 }
191 } 191 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index cd315b1..4badb12 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -277,11 +277,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
277 { 277 {
278 List<MapBlockData> mapBlocks = new List<MapBlockData>(); ; 278 List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
279 279
280 // Get regions that are within 8 regions of here
280 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 281 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
281 (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize, 282 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 8),
282 (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize, 283 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 8),
283 (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize, 284 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 8),
284 (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize); 285 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) );
285 foreach (GridRegion r in regions) 286 foreach (GridRegion r in regions)
286 { 287 {
287 MapBlockData block = new MapBlockData(); 288 MapBlockData block = new MapBlockData();
@@ -1011,17 +1012,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1011 // on an unloaded square. 1012 // on an unloaded square.
1012 // But make sure: Look whether the one we requested is in there 1013 // But make sure: Look whether the one we requested is in there
1013 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1014 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1014 minX * (int)Constants.RegionSize, 1015 (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX),
1015 maxX * (int)Constants.RegionSize, 1016 (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) );
1016 minY * (int)Constants.RegionSize,
1017 maxY * (int)Constants.RegionSize);
1018 1017
1019 if (regions != null) 1018 if (regions != null)
1020 { 1019 {
1021 foreach (GridRegion r in regions) 1020 foreach (GridRegion r in regions)
1022 { 1021 {
1023 if ((r.RegionLocX == minX * (int)Constants.RegionSize) && 1022 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX)
1024 (r.RegionLocY == minY * (int)Constants.RegionSize)) 1023 && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) )
1025 { 1024 {
1026 // found it => add it to response 1025 // found it => add it to response
1027 MapBlockData block = new MapBlockData(); 1026 MapBlockData block = new MapBlockData();
@@ -1055,10 +1054,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1055 { 1054 {
1056 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 1055 List<MapBlockData> mapBlocks = new List<MapBlockData>();
1057 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1056 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1058 (minX - 4) * (int)Constants.RegionSize, 1057 (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)),
1059 (maxX + 4) * (int)Constants.RegionSize, 1058 (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) );
1060 (minY - 4) * (int)Constants.RegionSize,
1061 (maxY + 4) * (int)Constants.RegionSize);
1062 foreach (GridRegion r in regions) 1059 foreach (GridRegion r in regions)
1063 { 1060 {
1064 MapBlockData block = new MapBlockData(); 1061 MapBlockData block = new MapBlockData();
@@ -1086,8 +1083,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1086 break; 1083 break;
1087 } 1084 }
1088 block.Name = r.RegionName; 1085 block.Name = r.RegionName;
1089 block.X = (ushort)(r.RegionLocX / Constants.RegionSize); 1086 block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX);
1090 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); 1087 block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY);
1091 } 1088 }
1092 1089
1093 public Hashtable OnHTTPThrottled(Hashtable keysvals) 1090 public Hashtable OnHTTPThrottled(Hashtable keysvals)
@@ -1218,10 +1215,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1218 1215
1219 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 1216 List<MapBlockData> mapBlocks = new List<MapBlockData>();
1220 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1217 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1221 (int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize, 1218 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 9),
1222 (int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize, 1219 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 9),
1223 (int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize, 1220 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 9),
1224 (int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize); 1221 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 9));
1225 List<AssetBase> textures = new List<AssetBase>(); 1222 List<AssetBase> textures = new List<AssetBase>();
1226 List<Image> bitImages = new List<Image>(); 1223 List<Image> bitImages = new List<Image>();
1227 1224
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 10421ff..5a7e2dd 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1099,8 +1099,6 @@ namespace OpenSim.Region.Framework.Scenes
1099 /// <returns>True after all operations complete, throws exceptions otherwise.</returns> 1099 /// <returns>True after all operations complete, throws exceptions otherwise.</returns>
1100 public override void OtherRegionUp(GridRegion otherRegion) 1100 public override void OtherRegionUp(GridRegion otherRegion)
1101 { 1101 {
1102 // uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize);
1103 // uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize);
1104 uint xcell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocX); 1102 uint xcell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocX);
1105 uint ycell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocY); 1103 uint ycell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocY);
1106 1104
@@ -2450,9 +2448,9 @@ namespace OpenSim.Region.Framework.Scenes
2450 int xx = (int)Math.Floor(pos.X); 2448 int xx = (int)Math.Floor(pos.X);
2451 int yy = (int)Math.Floor(pos.Y); 2449 int yy = (int)Math.Floor(pos.Y);
2452 if (xx < 0 2450 if (xx < 0
2453 || xx > RegionInfo.RegionSizeX 2451 || xx >= RegionInfo.RegionSizeX
2454 || yy < 0 2452 || yy < 0
2455 || yy > RegionInfo.RegionSizeY) 2453 || yy >= RegionInfo.RegionSizeY)
2456 ret = false; 2454 ret = false;
2457 return ret; 2455 return ret;
2458 2456
@@ -4581,53 +4579,6 @@ namespace OpenSim.Region.Framework.Scenes
4581 ScenePresence sp = GetScenePresence(remoteClient.AgentId); 4579 ScenePresence sp = GetScenePresence(remoteClient.AgentId);
4582 if (sp != null) 4580 if (sp != null)
4583 { 4581 {
4584 /*
4585 uint regionX = RegionInfo.LegacyRegionLocX;
4586 uint regionY = RegionInfo.LegacyRegionLocY;
4587
4588 Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY);
4589 Utils.LongToUInts(regionHandle, out regionX, out regionY);
4590
4591 int shiftx = (int) regionX - (int) RegionInfo.LegacyRegionLocX * (int)Constants.RegionSize;
4592 int shifty = (int) regionY - (int) RegionInfo.LegacyRegionLocY * (int)Constants.RegionSize;
4593 */
4594
4595 uint regionX, regionY;
4596 Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY);
4597
4598 int shiftx = (int) regionX - (int)RegionInfo.WorldLocX;
4599 int shifty = (int) regionY - (int)RegionInfo.WorldLocY;
4600
4601 position.X += shiftx;
4602 position.Y += shifty;
4603
4604 bool result = false;
4605
4606 if (TestBorderCross(position,Cardinals.N))
4607 result = true;
4608
4609 if (TestBorderCross(position, Cardinals.S))
4610 result = true;
4611
4612 if (TestBorderCross(position, Cardinals.E))
4613 result = true;
4614
4615 if (TestBorderCross(position, Cardinals.W))
4616 result = true;
4617
4618 // bordercross if position is outside of region
4619
4620 if (!result)
4621 {
4622 regionHandle = RegionInfo.RegionHandle;
4623 }
4624 else
4625 {
4626 // not in this region, undo the shift!
4627 position.X -= shiftx;
4628 position.Y -= shifty;
4629 }
4630
4631 if (EntityTransferModule != null) 4582 if (EntityTransferModule != null)
4632 { 4583 {
4633 EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags); 4584 EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index f95220d..b059ecf 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes
42{ 42{
43 public abstract class SceneBase : IScene 43 public abstract class SceneBase : IScene
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 private static readonly string LogHeader = "[SCENE]"; 46 private static readonly string LogHeader = "[SCENE]";
47 47
48 #region Events 48 #region Events
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index d4cbf7d..44c476c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -331,7 +331,7 @@ namespace OpenSim.Region.Framework.Scenes
331 { 331 {
332 get 332 get
333 { 333 {
334 Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); 334 Vector3 minScale = new Vector3(Constants.MaximumRegionSize, Constants.MaximumRegionSize, Constants.MaximumRegionSize);
335 Vector3 maxScale = Vector3.Zero; 335 Vector3 maxScale = Vector3.Zero;
336 Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); 336 Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
337 337
@@ -517,14 +517,14 @@ namespace OpenSim.Region.Framework.Scenes
517 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 517 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
518 518
519 // Normalize 519 // Normalize
520 if (val.X >= Constants.RegionSize) 520 if (val.X >= m_scene.RegionInfo.RegionSizeX)
521 val.X -= Constants.RegionSize; 521 val.X -= m_scene.RegionInfo.RegionSizeX;
522 if (val.Y >= Constants.RegionSize) 522 if (val.Y >= m_scene.RegionInfo.RegionSizeY)
523 val.Y -= Constants.RegionSize; 523 val.Y -= m_scene.RegionInfo.RegionSizeY;
524 if (val.X < 0) 524 if (val.X < 0)
525 val.X += Constants.RegionSize; 525 val.X += m_scene.RegionInfo.RegionSizeX;
526 if (val.Y < 0) 526 if (val.Y < 0)
527 val.Y += Constants.RegionSize; 527 val.Y += m_scene.RegionInfo.RegionSizeY;
528 528
529 // If it's deleted, crossing was successful 529 // If it's deleted, crossing was successful
530 if (IsDeleted) 530 if (IsDeleted)
@@ -572,9 +572,9 @@ namespace OpenSim.Region.Framework.Scenes
572 } 572 }
573 } 573 }
574 Vector3 oldp = AbsolutePosition; 574 Vector3 oldp = AbsolutePosition;
575 val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f); 575 val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f);
576 val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f); 576 val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f);
577 val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f); 577 val.Z = Util.Clamp<float>(oldp.Z, 0.5f, Constants.RegionHeight);
578 } 578 }
579 } 579 }
580 580
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index b3fdd22..c8320d0 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -516,7 +516,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
516 516
517 public Vector3 StartPos 517 public Vector3 StartPos
518 { 518 {
519 get { return new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 50); } 519 get { return new Vector3(m_scene.RegionInfo.RegionSizeX * 0.5f, m_scene.RegionInfo.RegionSizeY * 0.5f, 50f); }
520 set { } 520 set { }
521 } 521 }
522 522
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
index c5cba8e..f5bd44d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
@@ -52,6 +52,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
52 52
53 // Local constants 53 // Local constants
54 54
55 // This computation is not the real region center if the region is larger than 256.
56 // This computation isn't fixed because there is not a handle back to the region.
55 private static readonly Vector3 CenterOfRegion = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20); 57 private static readonly Vector3 CenterOfRegion = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20);
56 private static readonly char[] CS_SPACE = { ' ' }; 58 private static readonly char[] CS_SPACE = { ' ' };
57 59
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs
index d4fe5e0..5505001 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs
@@ -44,6 +44,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
44 private static readonly ILog m_log = 44 private static readonly ILog m_log =
45 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 // This computation is not the real region center if the region is larger than 256.
48 // This computation isn't fixed because there is not a handle back to the region.
47 private static readonly OpenMetaverse.Vector3 CenterOfRegion = new OpenMetaverse.Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20); 49 private static readonly OpenMetaverse.Vector3 CenterOfRegion = new OpenMetaverse.Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20);
48 private const int DEBUG_CHANNEL = 2147483647; 50 private const int DEBUG_CHANNEL = 2147483647;
49 51
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
index 17ebed2..aca1ed4 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -1311,7 +1311,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
1311 /* TODO */ 1311 /* TODO */
1312 ConfigurationParameters[] configparms = new ConfigurationParameters[1]; 1312 ConfigurationParameters[] configparms = new ConfigurationParameters[1];
1313 configparms[0] = parms; 1313 configparms[0] = parms;
1314 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 1314 Vector3 worldExtent = maxPosition;
1315 m_maxCollisions = maxCollisions; 1315 m_maxCollisions = maxCollisions;
1316 m_maxUpdatesPerFrame = maxUpdates; 1316 m_maxUpdatesPerFrame = maxUpdates;
1317 specialCollisionObjects = new Dictionary<uint, GhostObject>(); 1317 specialCollisionObjects = new Dictionary<uint, GhostObject>();
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 83ef1f6..fe014fc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -208,6 +208,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
208 Name = EngineType + "/" + RegionName; 208 Name = EngineType + "/" + RegionName;
209 } 209 }
210 210
211 // Old version of initialization that assumes legacy sized regions (256x256)
211 public override void Initialise(IMesher meshmerizer, IConfigSource config) 212 public override void Initialise(IMesher meshmerizer, IConfigSource config)
212 { 213 {
213 m_log.ErrorFormat("{0} WARNING WARNING WARNING! BulletSim initialized without region extent specification. Terrain will be messed up."); 214 m_log.ErrorFormat("{0} WARNING WARNING WARNING! BulletSim initialized without region extent specification. Terrain will be messed up.");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 6861865..674885c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4333,7 +4333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4333 m_host.AddScriptLPS(1); 4333 m_host.AddScriptLPS(1);
4334 UUID agentId = new UUID(); 4334 UUID agentId = new UUID();
4335 4335
4336 ulong regionHandle = Utils.UIntsToLong((uint)global_coords.x, (uint)global_coords.y); 4336 ulong regionHandle = Util.RegionWorldLocToHandle((uint)global_coords.x, (uint)global_coords.y);
4337 4337
4338 if (UUID.TryParse(agent, out agentId)) 4338 if (UUID.TryParse(agent, out agentId))
4339 { 4339 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 4fb0856..31ea067 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -814,8 +814,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
814 private void TeleportAgent(string agent, int regionX, int regionY, 814 private void TeleportAgent(string agent, int regionX, int regionY,
815 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) 815 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
816 { 816 {
817 // ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); 817 // ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
818 ulong regionHandle = Util.RegionWorldLocToHandle(Util.RegionToWorldLoc((uint)regionX), Util.RegionToWorldLoc((uint)regionY)); 818 ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY);
819 819
820 m_host.AddScriptLPS(1); 820 m_host.AddScriptLPS(1);
821 UUID agentId = new UUID(); 821 UUID agentId = new UUID();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index e3f3fc7..d81cddc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -713,16 +713,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
713 } 713 }
714 private void Save() 714 private void Save()
715 { 715 {
716 /* Remove temporarily until we have a handle to the region size
716 if (Position.x > ((int)Constants.RegionSize - 1)) 717 if (Position.x > ((int)Constants.RegionSize - 1))
717 Position.x = ((int)Constants.RegionSize - 1); 718 Position.x = ((int)Constants.RegionSize - 1);
718 if (Position.x < 0)
719 Position.x = 0;
720 if (Position.y > ((int)Constants.RegionSize - 1)) 719 if (Position.y > ((int)Constants.RegionSize - 1))
721 Position.y = ((int)Constants.RegionSize - 1); 720 Position.y = ((int)Constants.RegionSize - 1);
722 if (Position.y < 0) 721 */
723 Position.y = 0;
724 if (Position.z > Constants.RegionHeight) 722 if (Position.z > Constants.RegionHeight)
725 Position.z = Constants.RegionHeight; 723 Position.z = Constants.RegionHeight;
724 if (Position.x < 0)
725 Position.x = 0;
726 if (Position.y < 0)
727 Position.y = 0;
726 if (Position.z < 0) 728 if (Position.z < 0)
727 Position.z = 0; 729 Position.z = 0;
728 prim.OSSL.llSetPos(Position); 730 prim.OSSL.llSetPos(Position);
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 816591b..fb424dc 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -101,7 +101,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
101 public string RegisterRegion(UUID scopeID, GridRegion regionInfo) 101 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
102 { 102 {
103 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 103 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
104 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 104 Vector3d maxPosition = minPosition + new Vector3d(regionInfo.RegionSizeX, regionInfo.RegionSizeY, Constants.RegionHeight);
105 105
106 OSDMap extraData = new OSDMap 106 OSDMap extraData = new OSDMap
107 { 107 {
@@ -156,15 +156,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
156 156
157 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) 157 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
158 { 158 {
159 const int NEIGHBOR_RADIUS = 128;
160
161 GridRegion region = GetRegionByUUID(scopeID, regionID); 159 GridRegion region = GetRegionByUUID(scopeID, regionID);
162 160
161 int NEIGHBOR_RADIUS = Math.Max(region.RegionSizeX, region.RegionSizeY) / 2;
162
163 if (region != null) 163 if (region != null)
164 { 164 {
165 List<GridRegion> regions = GetRegionRange(scopeID, 165 List<GridRegion> regions = GetRegionRange(scopeID,
166 region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + (int)Constants.RegionSize + NEIGHBOR_RADIUS, 166 region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + region.RegionSizeX + NEIGHBOR_RADIUS,
167 region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + (int)Constants.RegionSize + NEIGHBOR_RADIUS); 167 region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + region.RegionSizeY + NEIGHBOR_RADIUS);
168 168
169 for (int i = 0; i < regions.Count; i++) 169 for (int i = 0; i < regions.Count; i++)
170 { 170 {
@@ -229,7 +229,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
229 else 229 else
230 { 230 {
231 // m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}", 231 // m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}",
232 // x / Constants.RegionSize, y / Constants.RegionSize); 232 // Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y));
233 return null; 233 return null;
234 } 234 }
235 } 235 }
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index aa7ffc1..8198592 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -313,8 +313,10 @@ namespace OpenSim.Services.GridService
313 if (region != null) 313 if (region != null)
314 { 314 {
315 // Not really? Maybe? 315 // Not really? Maybe?
316 List<RegionData> rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1, 316 // The adjacent regions are presumed to be the same size as the current region
317 region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); 317 List<RegionData> rdatas = m_Database.Get(
318 region.posX - region.sizeX - 1, region.posY - region.sizeY - 1,
319 region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID);
318 320
319 foreach (RegionData rdata in rdatas) 321 foreach (RegionData rdata in rdatas)
320 { 322 {
@@ -642,20 +644,20 @@ namespace OpenSim.Services.GridService
642 return; 644 return;
643 } 645 }
644 646
645 int x, y; 647 uint x, y;
646 if (!int.TryParse(cmd[3], out x)) 648 if (!uint.TryParse(cmd[3], out x))
647 { 649 {
648 MainConsole.Instance.Output("x-coord must be an integer"); 650 MainConsole.Instance.Output("x-coord must be an integer");
649 return; 651 return;
650 } 652 }
651 653
652 if (!int.TryParse(cmd[4], out y)) 654 if (!uint.TryParse(cmd[4], out y))
653 { 655 {
654 MainConsole.Instance.Output("y-coord must be an integer"); 656 MainConsole.Instance.Output("y-coord must be an integer");
655 return; 657 return;
656 } 658 }
657 659
658 RegionData region = m_Database.Get(x * (int)Constants.RegionSize, y * (int)Constants.RegionSize, UUID.Zero); 660 RegionData region = m_Database.Get((int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y), UUID.Zero);
659 if (region == null) 661 if (region == null)
660 { 662 {
661 MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); 663 MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y);
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 4024295..4ebfd5c 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -183,8 +183,8 @@ namespace OpenSim.Services.GridService
183 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) 183 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
184 { 184 {
185 string reason = string.Empty; 185 string reason = string.Empty;
186 int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize; 186 uint xloc = Util.RegionToWorldLoc((uint)random.Next(0, Int16.MaxValue));
187 return TryLinkRegionToCoords(scopeID, regionDescriptor, xloc, 0, out reason); 187 return TryLinkRegionToCoords(scopeID, regionDescriptor, (int)xloc, 0, out reason);
188 } 188 }
189 189
190 private static Random random = new Random(); 190 private static Random random = new Random();
@@ -260,7 +260,7 @@ namespace OpenSim.Services.GridService
260 { 260 {
261 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", 261 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}",
262 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 262 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
263 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 263 remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc));
264 264
265 reason = string.Empty; 265 reason = string.Empty;
266 Uri uri = null; 266 Uri uri = null;
@@ -311,7 +311,7 @@ namespace OpenSim.Services.GridService
311 if (region != null) 311 if (region != null)
312 { 312 {
313 m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", 313 m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}",
314 regInfo.RegionLocX / Constants.RegionSize, regInfo.RegionLocY / Constants.RegionSize, 314 Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY),
315 region.RegionName, region.RegionID); 315 region.RegionName, region.RegionID);
316 reason = "Coordinates are already in use"; 316 reason = "Coordinates are already in use";
317 return false; 317 return false;
@@ -347,7 +347,7 @@ namespace OpenSim.Services.GridService
347 if (region != null) 347 if (region != null)
348 { 348 {
349 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", 349 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}",
350 region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); 350 Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY));
351 regInfo = region; 351 regInfo = region;
352 return true; 352 return true;
353 } 353 }
@@ -424,10 +424,10 @@ namespace OpenSim.Services.GridService
424// { 424// {
425// uint ux = 0, uy = 0; 425// uint ux = 0, uy = 0;
426// Utils.LongToUInts(realHandle, out ux, out uy); 426// Utils.LongToUInts(realHandle, out ux, out uy);
427// x = ux / Constants.RegionSize; 427// x = Util.WorldToRegionLoc(ux);
428// y = uy / Constants.RegionSize; 428// y = Util.WorldToRegionLoc(uy);
429// 429//
430// const uint limit = (4096 - 1) * Constants.RegionSize; 430// const uint limit = Util.RegionToWorldLoc(4096 - 1);
431// uint xmin = ux - limit; 431// uint xmin = ux - limit;
432// uint xmax = ux + limit; 432// uint xmax = ux + limit;
433// uint ymin = uy - limit; 433// uint ymin = uy - limit;
@@ -502,9 +502,14 @@ namespace OpenSim.Services.GridService
502 MainConsole.Instance.Output(new string('-', 72)); 502 MainConsole.Instance.Output(new string('-', 72));
503 foreach (RegionData r in regions) 503 foreach (RegionData r in regions)
504 { 504 {
505 MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n", 505 MainConsole.Instance.Output(
506 r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY, 506 String.Format("{0}\n{2,-32} {1}\n",
507 r.posX / Constants.RegionSize, r.posY / Constants.RegionSize))); 507 r.RegionName, r.RegionID,
508 String.Format("{0},{1} ({2},{3})", r.posX, r.posY,
509 Util.WorldToRegionLoc((uint)r.posX), Util.WorldToRegionLoc((uint)r.posY)
510 )
511 )
512 );
508 } 513 }
509 return; 514 return;
510 } 515 }
@@ -529,8 +534,8 @@ namespace OpenSim.Services.GridService
529 int xloc, yloc; 534 int xloc, yloc;
530 string serverURI; 535 string serverURI;
531 string remoteName = null; 536 string remoteName = null;
532 xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; 537 xloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[0]));
533 yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; 538 yloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[1]));
534 serverURI = cmdparams[2]; 539 serverURI = cmdparams[2];
535 if (cmdparams.Length > 3) 540 if (cmdparams.Length > 3)
536 remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3); 541 remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3);
@@ -601,13 +606,13 @@ namespace OpenSim.Services.GridService
601 { 606 {
602 // old format 607 // old format
603 GridRegion regInfo; 608 GridRegion regInfo;
604 int xloc, yloc; 609 uint xloc, yloc;
605 uint externalPort; 610 uint externalPort;
606 string externalHostName; 611 string externalHostName;
607 try 612 try
608 { 613 {
609 xloc = Convert.ToInt32(cmdparams[0]); 614 xloc = Convert.ToUInt32(cmdparams[0]);
610 yloc = Convert.ToInt32(cmdparams[1]); 615 yloc = Convert.ToUInt32(cmdparams[1]);
611 externalPort = Convert.ToUInt32(cmdparams[3]); 616 externalPort = Convert.ToUInt32(cmdparams[3]);
612 externalHostName = cmdparams[2]; 617 externalHostName = cmdparams[2];
613 //internalPort = Convert.ToUInt32(cmdparams[4]); 618 //internalPort = Convert.ToUInt32(cmdparams[4]);
@@ -621,10 +626,11 @@ namespace OpenSim.Services.GridService
621 } 626 }
622 627
623 // Convert cell coordinates given by the user to meters 628 // Convert cell coordinates given by the user to meters
624 xloc = xloc * (int)Constants.RegionSize; 629 xloc = Util.RegionToWorldLoc(xloc);
625 yloc = yloc * (int)Constants.RegionSize; 630 yloc = Util.RegionToWorldLoc(yloc);
626 string reason = string.Empty; 631 string reason = string.Empty;
627 if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) 632 if (TryCreateLink(UUID.Zero, (int)xloc, (int)yloc,
633 string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
628 { 634 {
629 // What is this? The GridRegion instance will be discarded anyway, 635 // What is this? The GridRegion instance will be discarded anyway,
630 // which effectively ignores any local name given with the command. 636 // which effectively ignores any local name given with the command.
@@ -704,13 +710,13 @@ namespace OpenSim.Services.GridService
704 private void ReadLinkFromConfig(IConfig config) 710 private void ReadLinkFromConfig(IConfig config)
705 { 711 {
706 GridRegion regInfo; 712 GridRegion regInfo;
707 int xloc, yloc; 713 uint xloc, yloc;
708 uint externalPort; 714 uint externalPort;
709 string externalHostName; 715 string externalHostName;
710 uint realXLoc, realYLoc; 716 uint realXLoc, realYLoc;
711 717
712 xloc = Convert.ToInt32(config.GetString("xloc", "0")); 718 xloc = Convert.ToUInt32(config.GetString("xloc", "0"));
713 yloc = Convert.ToInt32(config.GetString("yloc", "0")); 719 yloc = Convert.ToUInt32(config.GetString("yloc", "0"));
714 externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); 720 externalPort = Convert.ToUInt32(config.GetString("externalPort", "0"));
715 externalHostName = config.GetString("externalHostName", ""); 721 externalHostName = config.GetString("externalHostName", "");
716 realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); 722 realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0"));
@@ -718,18 +724,19 @@ namespace OpenSim.Services.GridService
718 724
719 if (m_enableAutoMapping) 725 if (m_enableAutoMapping)
720 { 726 {
721 xloc = (int)((xloc % 100) + m_autoMappingX); 727 xloc = (xloc % 100) + m_autoMappingX;
722 yloc = (int)((yloc % 100) + m_autoMappingY); 728 yloc = (yloc % 100) + m_autoMappingY;
723 } 729 }
724 730
725 if (((realXLoc == 0) && (realYLoc == 0)) || 731 if (((realXLoc == 0) && (realYLoc == 0)) ||
726 (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && 732 (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
727 ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896)))) 733 ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
728 { 734 {
729 xloc = xloc * (int)Constants.RegionSize; 735 xloc = Util.RegionToWorldLoc(xloc);
730 yloc = yloc * (int)Constants.RegionSize; 736 yloc = Util.RegionToWorldLoc(yloc);
731 string reason = string.Empty; 737 string reason = string.Empty;
732 if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) 738 if (TryCreateLink(UUID.Zero, (int)xloc, (int)yloc,
739 string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
733 { 740 {
734 regInfo.RegionName = config.GetString("localName", ""); 741 regInfo.RegionName = config.GetString("localName", "");
735 } 742 }
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 4a9a2fe..adc32df 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -223,6 +223,7 @@ namespace OpenSim.Services.Interfaces
223 m_serverURI = string.Empty; 223 m_serverURI = string.Empty;
224 } 224 }
225 225
226 /*
226 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) 227 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
227 { 228 {
228 m_regionLocX = regionLocX; 229 m_regionLocX = regionLocX;
@@ -245,6 +246,7 @@ namespace OpenSim.Services.Interfaces
245 246
246 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); 247 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port);
247 } 248 }
249 */
248 250
249 public GridRegion(uint xcell, uint ycell) 251 public GridRegion(uint xcell, uint ycell)
250 { 252 {
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
index ff51f09..6a0a799 100644
--- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs
@@ -362,7 +362,6 @@ namespace OpenSim.Services.LLLoginService
362 362
363 private void FillOutHomeData(GridUserInfo pinfo, GridRegion home) 363 private void FillOutHomeData(GridUserInfo pinfo, GridRegion home)
364 { 364 {
365 // int x = 1000 * (int)Constants.RegionSize, y = 1000 * (int)Constants.RegionSize;
366 int x = (int)Util.RegionToWorldLoc(1000); 365 int x = (int)Util.RegionToWorldLoc(1000);
367 int y = (int)Util.RegionToWorldLoc(1000); 366 int y = (int)Util.RegionToWorldLoc(1000);
368 if (home != null) 367 if (home != null)
@@ -438,22 +437,22 @@ namespace OpenSim.Services.LLLoginService
438 ErrorReason = "key"; 437 ErrorReason = "key";
439 welcomeMessage = "Welcome to OpenSim!"; 438 welcomeMessage = "Welcome to OpenSim!";
440 seedCapability = String.Empty; 439 seedCapability = String.Empty;
441 home = "{'region_handle':[r" 440 home = "{'region_handle':["
442 + Util.RegionToWorldLoc(1000).ToString() 441 + "r" + Util.RegionToWorldLoc(1000).ToString()
443 + ",r" 442 + ","
444 + Util.RegionToWorldLoc(1000).ToString() 443 + "r" + Util.RegionToWorldLoc(1000).ToString()
445 + "], 'position':[r" 444 + "], 'position':["
446 + userProfile.homepos.X.ToString() 445 + "r" + userProfile.homepos.X.ToString()
447 + ",r" 446 + ","
448 + userProfile.homepos.Y.ToString() 447 + "r" + userProfile.homepos.Y.ToString()
449 + ",r" 448 + ","
450 + userProfile.homepos.Z.ToString() 449 + "r" + userProfile.homepos.Z.ToString()
451 + "], 'look_at':[r" 450 + "], 'look_at':["
452 + userProfile.homelookat.X.ToString() 451 + "r" + userProfile.homelookat.X.ToString()
453 + ",r" 452 + ","
454 + userProfile.homelookat.Y.ToString() 453 + "r" + userProfile.homelookat.Y.ToString()
455 + ",r" 454 + ","
456 + userProfile.homelookat.Z.ToString() 455 + "r" + userProfile.homelookat.Z.ToString()
457 + "]}"; 456 + "]}";
458 lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; 457 lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
459 RegionX = (uint) 255232; 458 RegionX = (uint) 255232;
diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs
index 8e33373..fed7a16 100644
--- a/OpenSim/Tests/Clients/Grid/GridClient.cs
+++ b/OpenSim/Tests/Clients/Grid/GridClient.cs
@@ -150,16 +150,16 @@ namespace OpenSim.Tests.Clients.GridClient
150 150
151 Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)"); 151 Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)");
152 regions = m_Connector.GetRegionRange(UUID.Zero, 152 regions = m_Connector.GetRegionRange(UUID.Zero,
153 900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize, 153 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002),
154 900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize); 154 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002) );
155 if (regions == null) 155 if (regions == null)
156 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null"); 156 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
157 else 157 else
158 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions"); 158 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
159 Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)"); 159 Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)");
160 regions = m_Connector.GetRegionRange(UUID.Zero, 160 regions = m_Connector.GetRegionRange(UUID.Zero,
161 900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize, 161 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950),
162 900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize); 162 (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950) );
163 if (regions == null) 163 if (regions == null)
164 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null"); 164 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
165 else 165 else