aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs48
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/DearchiveScenesGroup.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs308
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs174
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Effects/DefaultTerrainGenerator.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs45
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs22
18 files changed, 387 insertions, 272 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 27ace68..db62b31 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -189,8 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
189 string message = c.Message; 189 string message = c.Message;
190 Scene scene = (Scene)c.Scene; 190 Scene scene = (Scene)c.Scene;
191 Vector3 fromPos = c.Position; 191 Vector3 fromPos = c.Position;
192 Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, 192 Vector3 regionPos = new Vector3(scene.RegionInfo.RegionWorldLocX, scene.RegionInfo.RegionWorldLocY, 0);
193 scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
194 193
195 if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel; 194 if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel;
196 195
@@ -342,8 +341,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
342 { 341 {
343 Vector3 fromRegionPos = fromPos + regionPos; 342 Vector3 fromRegionPos = fromPos + regionPos;
344 Vector3 toRegionPos = presence.AbsolutePosition + 343 Vector3 toRegionPos = presence.AbsolutePosition +
345 new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize, 344 new Vector3(presence.Scene.RegionInfo.RegionWorldLocX, presence.Scene.RegionInfo.RegionWorldLocY, 0);
346 presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
347 345
348 int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); 346 int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
349 347
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 56ff2bd..a982466 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -663,8 +663,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
663 663
664 Vector3 avaPos = p.AbsolutePosition; 664 Vector3 avaPos = p.AbsolutePosition;
665 // Getting the global position for the Avatar 665 // Getting the global position for the Avatar
666 Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.RegionLocX*Constants.RegionSize + avaPos.X, 666 Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.RegionWorldLocX + avaPos.X,
667 remoteClient.Scene.RegionInfo.RegionLocY*Constants.RegionSize + avaPos.Y, 667 remoteClient.Scene.RegionInfo.RegionWorldLocY + avaPos.Y,
668 avaPos.Z); 668 avaPos.Z);
669 669
670 string landOwnerName = string.Empty; 670 string landOwnerName = string.Empty;
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
index 6545a99..13cc99a 100644
--- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
@@ -269,9 +269,7 @@ namespace OpenSim.Region.CoreModules.Framework
269 foreach (KeyValuePair<ulong, string> kvp in m_childrenSeeds[agentID]) 269 foreach (KeyValuePair<ulong, string> kvp in m_childrenSeeds[agentID])
270 { 270 {
271 uint x, y; 271 uint x, y;
272 Utils.LongToUInts(kvp.Key, out x, out y); 272 Util.RegionHandleToRegionLoc(kvp.Key, out x, out y);
273 x = x / Constants.RegionSize;
274 y = y / Constants.RegionSize;
275 m_log.Info(" >> "+x+", "+y+": "+kvp.Value); 273 m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
276 } 274 }
277 } 275 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index aa8a4db..eb1b271 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -494,8 +494,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
494 } 494 }
495 495
496 // Check that these are not the same coordinates 496 // Check that these are not the same coordinates
497 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && 497 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.LegacyRegionLocX &&
498 finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY) 498 finalDestination.RegionLocY == sp.Scene.RegionInfo.LegacyRegionLocY)
499 { 499 {
500 // Can't do. Viewer crashes 500 // Can't do. Viewer crashes
501 sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again."); 501 sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again.");
@@ -567,8 +567,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
567// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI); 567// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI);
568 568
569 // Insanely, RegionLoc on RegionInfo is the 256m map co-ord whilst GridRegion.RegionLoc is the raw meters position. 569 // Insanely, RegionLoc on RegionInfo is the 256m map co-ord whilst GridRegion.RegionLoc is the raw meters position.
570 return Math.Abs(sourceRegion.RegionLocX - destRegion.RegionCoordX) <= MaxTransferDistance 570 return Math.Abs(sourceRegion.LegacyRegionLocX - destRegion.RegionCoordX) <= MaxTransferDistance
571 && Math.Abs(sourceRegion.RegionLocY - destRegion.RegionCoordY) <= MaxTransferDistance; 571 && Math.Abs(sourceRegion.LegacyRegionLocY - destRegion.RegionCoordY) <= MaxTransferDistance;
572 } 572 }
573 573
574 /// <summary> 574 /// <summary>
@@ -635,7 +635,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
635 string.Format( 635 string.Format(
636 "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", 636 "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way",
637 finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY, 637 finalDestination.RegionName, finalDestination.RegionCoordX, finalDestination.RegionCoordY,
638 sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY, 638 sourceRegion.RegionName, sourceRegion.LegacyRegionLocX, sourceRegion.LegacyRegionLocY,
639 MaxTransferDistance)); 639 MaxTransferDistance));
640 640
641 return; 641 return;
@@ -1374,8 +1374,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1374// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name); 1374// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
1375 1375
1376 Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z); 1376 Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z);
1377 uint neighbourx = scene.RegionInfo.RegionLocX; 1377 uint neighbourx = scene.RegionInfo.LegacyRegionLocX;
1378 uint neighboury = scene.RegionInfo.RegionLocY; 1378 uint neighboury = scene.RegionInfo.LegacyRegionLocY;
1379 const float boundaryDistance = 1.7f; 1379 const float boundaryDistance = 1.7f;
1380 Vector3 northCross = new Vector3(0, boundaryDistance, 0); 1380 Vector3 northCross = new Vector3(0, boundaryDistance, 0);
1381 Vector3 southCross = new Vector3(0, -1 * boundaryDistance, 0); 1381 Vector3 southCross = new Vector3(0, -1 * boundaryDistance, 0);
@@ -1408,8 +1408,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1408 neighbourx = b.TriggerRegionX; 1408 neighbourx = b.TriggerRegionX;
1409 1409
1410 Vector3 newposition = pos; 1410 Vector3 newposition = pos;
1411 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; 1411 newposition.X += (scene.RegionInfo.LegacyRegionLocX - neighbourx) * Constants.RegionSize;
1412 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; 1412 newposition.Y += (scene.RegionInfo.LegacyRegionLocY - neighboury) * Constants.RegionSize;
1413 agent.ControllingClient.SendAgentAlertMessage( 1413 agent.ControllingClient.SendAgentAlertMessage(
1414 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); 1414 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
1415 InformClientToInitiateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); 1415 InformClientToInitiateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
@@ -1431,8 +1431,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1431 neighbourx = ba.TriggerRegionX; 1431 neighbourx = ba.TriggerRegionX;
1432 1432
1433 Vector3 newposition = pos; 1433 Vector3 newposition = pos;
1434 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; 1434 newposition.X += (scene.RegionInfo.LegacyRegionLocX - neighbourx) * Constants.RegionSize;
1435 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; 1435 newposition.Y += (scene.RegionInfo.LegacyRegionLocY - neighboury) * Constants.RegionSize;
1436 agent.ControllingClient.SendAgentAlertMessage( 1436 agent.ControllingClient.SendAgentAlertMessage(
1437 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); 1437 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
1438 InformClientToInitiateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); 1438 InformClientToInitiateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
@@ -1462,8 +1462,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1462 neighboury = ba.TriggerRegionY; 1462 neighboury = ba.TriggerRegionY;
1463 neighbourx = ba.TriggerRegionX; 1463 neighbourx = ba.TriggerRegionX;
1464 Vector3 newposition = pos; 1464 Vector3 newposition = pos;
1465 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; 1465 newposition.X += (scene.RegionInfo.LegacyRegionLocX - neighbourx) * Constants.RegionSize;
1466 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; 1466 newposition.Y += (scene.RegionInfo.LegacyRegionLocY - neighboury) * Constants.RegionSize;
1467 agent.ControllingClient.SendAgentAlertMessage( 1467 agent.ControllingClient.SendAgentAlertMessage(
1468 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); 1468 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
1469 InformClientToInitiateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); 1469 InformClientToInitiateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
@@ -1492,8 +1492,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1492 neighboury = b.TriggerRegionY; 1492 neighboury = b.TriggerRegionY;
1493 neighbourx = b.TriggerRegionX; 1493 neighbourx = b.TriggerRegionX;
1494 Vector3 newposition = pos; 1494 Vector3 newposition = pos;
1495 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize; 1495 newposition.X += (scene.RegionInfo.LegacyRegionLocX - neighbourx) * Constants.RegionSize;
1496 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize; 1496 newposition.Y += (scene.RegionInfo.LegacyRegionLocY - neighboury) * Constants.RegionSize;
1497 agent.ControllingClient.SendAgentAlertMessage( 1497 agent.ControllingClient.SendAgentAlertMessage(
1498 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false); 1498 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
1499 InformClientToInitiateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene); 1499 InformClientToInitiateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
@@ -1901,7 +1901,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1901 1901
1902 if (m_regionInfo != null) 1902 if (m_regionInfo != null)
1903 { 1903 {
1904 neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 1904 neighbours = RequestNeighbours(sp, m_regionInfo.LegacyRegionLocX, m_regionInfo.LegacyRegionLocY);
1905 } 1905 }
1906 else 1906 else
1907 { 1907 {
@@ -2057,8 +2057,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2057 2057
2058 Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) 2058 Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
2059 { 2059 {
2060 int rRegionX = (int)sp.Scene.RegionInfo.RegionLocX; 2060 int rRegionX = (int)sp.Scene.RegionInfo.LegacyRegionLocX;
2061 int rRegionY = (int)sp.Scene.RegionInfo.RegionLocY; 2061 int rRegionY = (int)sp.Scene.RegionInfo.LegacyRegionLocY;
2062 int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize; 2062 int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize;
2063 int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize; 2063 int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize;
2064 int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize; 2064 int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize;
@@ -2161,10 +2161,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2161 extent.X = ((int)extent.X / (int)Constants.RegionSize); 2161 extent.X = ((int)extent.X / (int)Constants.RegionSize);
2162 extent.Y = ((int)extent.Y / (int)Constants.RegionSize); 2162 extent.Y = ((int)extent.Y / (int)Constants.RegionSize);
2163 2163
2164 swCorner.X = Scene.RegionInfo.RegionLocX - 1; 2164 swCorner.X = Scene.RegionInfo.LegacyRegionLocX - 1;
2165 swCorner.Y = Scene.RegionInfo.RegionLocY - 1; 2165 swCorner.Y = Scene.RegionInfo.LegacyRegionLocY - 1;
2166 neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; 2166 neCorner.X = Scene.RegionInfo.LegacyRegionLocX + extent.X;
2167 neCorner.Y = Scene.RegionInfo.RegionLocY + extent.Y; 2167 neCorner.Y = Scene.RegionInfo.LegacyRegionLocY + extent.Y;
2168 } 2168 }
2169 2169
2170 /// <summary> 2170 /// <summary>
@@ -2301,8 +2301,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2301 return; 2301 return;
2302 } 2302 }
2303 2303
2304 int thisx = (int)scene.RegionInfo.RegionLocX; 2304 int thisx = (int)scene.RegionInfo.LegacyRegionLocX;
2305 int thisy = (int)scene.RegionInfo.RegionLocY; 2305 int thisy = (int)scene.RegionInfo.LegacyRegionLocY;
2306 Vector3 EastCross = new Vector3(0.1f, 0, 0); 2306 Vector3 EastCross = new Vector3(0.1f, 0, 0);
2307 Vector3 WestCross = new Vector3(-0.1f, 0, 0); 2307 Vector3 WestCross = new Vector3(-0.1f, 0, 0);
2308 Vector3 NorthCross = new Vector3(0, 0.1f, 0); 2308 Vector3 NorthCross = new Vector3(0, 0.1f, 0);
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
index d943b20..bf87392 100644
--- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
@@ -213,8 +213,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
213 if (part != null) 213 if (part != null)
214 { 214 {
215 ObjectRegionName = s.RegionInfo.RegionName; 215 ObjectRegionName = s.RegionInfo.RegionName;
216 uint localX = (s.RegionInfo.RegionLocX * (int)Constants.RegionSize); 216 uint localX = s.RegionInfo.RegionWorldLocX;
217 uint localY = (s.RegionInfo.RegionLocY * (int)Constants.RegionSize); 217 uint localY = s.RegionInfo.RegionWorldLocY;
218 ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")"; 218 ObjectRegionName = ObjectRegionName + " (" + localX + ", " + localY + ")";
219 return part; 219 return part;
220 } 220 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 31ef79b..828240b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -268,7 +268,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
268 caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key); 268 caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key);
269 List<GridRegion> regions = kvp.Value.GetNeighbours(); 269 List<GridRegion> regions = kvp.Value.GetNeighbours();
270 foreach (GridRegion r in regions) 270 foreach (GridRegion r in regions)
271 caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); 271 caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
272 } 272 }
273 } 273 }
274 274
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
index 9172536..a6b1b56 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
66 return; 66 return;
67 67
68 m_log.DebugFormat("[REGION CACHE]: (on region {0}) Region {1} is up @ {2}-{3}", 68 m_log.DebugFormat("[REGION CACHE]: (on region {0}) Region {1} is up @ {2}-{3}",
69 m_scene.RegionInfo.RegionName, otherRegion.RegionName, otherRegion.RegionLocX / Constants.RegionSize, otherRegion.RegionLocY / Constants.RegionSize); 69 m_scene.RegionInfo.RegionName, otherRegion.RegionName, Util.WorldToRegionLoc((uint)otherRegion.RegionLocX), Util.WorldToRegionLoc((uint)otherRegion.RegionLocY));
70 70
71 m_neighbours[otherRegion.RegionHandle] = otherRegion; 71 m_neighbours[otherRegion.RegionHandle] = otherRegion;
72 } 72 }
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
86 { 86 {
87 uint xsnap = (uint)(x / Constants.RegionSize) * Constants.RegionSize; 87 uint xsnap = (uint)(x / Constants.RegionSize) * Constants.RegionSize;
88 uint ysnap = (uint)(y / Constants.RegionSize) * Constants.RegionSize; 88 uint ysnap = (uint)(y / Constants.RegionSize) * Constants.RegionSize;
89 ulong handle = Utils.UIntsToLong(xsnap, ysnap); 89 ulong handle = Util.RegionWorldLocToHandle(xsnap, ysnap);
90 90
91 if (m_neighbours.ContainsKey(handle)) 91 if (m_neighbours.ContainsKey(handle))
92 return m_neighbours[handle]; 92 return m_neighbours[handle];
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
index 26d22b8..c1f2f04 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
@@ -224,10 +224,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
224 } 224 }
225 225
226 string reason = string.Empty; 226 string reason = string.Empty;
227 if (!m_MapService.AddMapTile((int)scene.RegionInfo.RegionLocX, (int)scene.RegionInfo.RegionLocY, jpgData, out reason)) 227 if (!m_MapService.AddMapTile((int)scene.RegionInfo.LegacyRegionLocX, (int)scene.RegionInfo.LegacyRegionLocY, jpgData, out reason))
228 { 228 {
229 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: Unable to upload tile image for {0} at {1}-{2}: {3}", 229 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: Unable to upload tile image for {0} at {1}-{2}: {3}",
230 scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, reason); 230 scene.RegionInfo.RegionName, scene.RegionInfo.LegacyRegionLocX, scene.RegionInfo.LegacyRegionLocY, reason);
231 } 231 }
232 } 232 }
233 } 233 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
index d8dace2..9aa4243 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
@@ -71,8 +71,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
71 71
72 public void AddScene(Scene scene) 72 public void AddScene(Scene scene)
73 { 73 {
74 uint x = scene.RegionInfo.RegionLocX; 74 uint x = scene.RegionInfo.LegacyRegionLocX;
75 uint y = scene.RegionInfo.RegionLocY; 75 uint y = scene.RegionInfo.LegacyRegionLocY;
76 76
77 SortedDictionary<uint, Scene> row; 77 SortedDictionary<uint, Scene> row;
78 if (!Regions.TryGetValue(y, out row)) 78 if (!Regions.TryGetValue(y, out row))
@@ -120,8 +120,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
120 { 120 {
121 // We add the region's coordinates to ensure uniqueness even if multiple regions have the same name 121 // We add the region's coordinates to ensure uniqueness even if multiple regions have the same name
122 string path = string.Format("{0}_{1}_{2}", 122 string path = string.Format("{0}_{1}_{2}",
123 scene.RegionInfo.RegionLocX - Rect.X + 1, 123 scene.RegionInfo.LegacyRegionLocX - Rect.X + 1,
124 scene.RegionInfo.RegionLocY - Rect.Y + 1, 124 scene.RegionInfo.LegacyRegionLocY - Rect.Y + 1,
125 scene.RegionInfo.RegionName.Replace(' ', '_')); 125 scene.RegionInfo.RegionName.Replace(' ', '_'));
126 m_regionDirs[scene.RegionInfo.RegionID] = path; 126 m_regionDirs[scene.RegionInfo.RegionID] = path;
127 }); 127 });
diff --git a/OpenSim/Region/CoreModules/World/Archiver/DearchiveScenesGroup.cs b/OpenSim/Region/CoreModules/World/Archiver/DearchiveScenesGroup.cs
index 3dcc020..25f1e5c 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/DearchiveScenesGroup.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/DearchiveScenesGroup.cs
@@ -145,7 +145,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
145 { 145 {
146 foreach (RegionInfo archivedRegion in m_directory2region.Values) 146 foreach (RegionInfo archivedRegion in m_directory2region.Values)
147 { 147 {
148 Point location = new Point((int)rootScene.RegionInfo.RegionLocX, (int)rootScene.RegionInfo.RegionLocY); 148 Point location = new Point((int)rootScene.RegionInfo.LegacyRegionLocX, (int)rootScene.RegionInfo.LegacyRegionLocY);
149 location.Offset(archivedRegion.Location); 149 location.Offset(archivedRegion.Location);
150 150
151 Scene scene; 151 Scene scene;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
index 173b603..bc172a4 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -96,9 +96,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
96 int x = (args.Length > 5 ? int.Parse(args[5]) : -1); 96 int x = (args.Length > 5 ? int.Parse(args[5]) : -1);
97 int y = (args.Length > 6 ? int.Parse(args[6]) : -1); 97 int y = (args.Length > 6 ? int.Parse(args[6]) : -1);
98 98
99 if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x) 99 if (x == -1 || m_module.Scene.RegionInfo.LegacyRegionLocX == x)
100 { 100 {
101 if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y) 101 if (y == -1 || m_module.Scene.RegionInfo.LegacyRegionLocY == y)
102 { 102 {
103 int corner = int.Parse(num); 103 int corner = int.Parse(num);
104 UUID texture = UUID.Parse(uuid); 104 UUID texture = UUID.Parse(uuid);
@@ -135,9 +135,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
135 int x = (args.Length > 4 ? int.Parse(args[4]) : -1); 135 int x = (args.Length > 4 ? int.Parse(args[4]) : -1);
136 int y = (args.Length > 5 ? int.Parse(args[5]) : -1); 136 int y = (args.Length > 5 ? int.Parse(args[5]) : -1);
137 137
138 if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x) 138 if (x == -1 || m_module.Scene.RegionInfo.LegacyRegionLocX == x)
139 { 139 {
140 if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y) 140 if (y == -1 || m_module.Scene.RegionInfo.LegacyRegionLocY == y)
141 { 141 {
142 double selectedheight = double.Parse(heightstring); 142 double selectedheight = double.Parse(heightstring);
143 143
@@ -159,9 +159,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
159 int x = (args.Length > 6 ? int.Parse(args[6]) : -1); 159 int x = (args.Length > 6 ? int.Parse(args[6]) : -1);
160 int y = (args.Length > 7 ? int.Parse(args[7]) : -1); 160 int y = (args.Length > 7 ? int.Parse(args[7]) : -1);
161 161
162 if (x == -1 || m_module.Scene.RegionInfo.RegionLocX == x) 162 if (x == -1 || m_module.Scene.RegionInfo.LegacyRegionLocX == x)
163 { 163 {
164 if (y == -1 || m_module.Scene.RegionInfo.RegionLocY == y) 164 if (y == -1 || m_module.Scene.RegionInfo.LegacyRegionLocY == y)
165 { 165 {
166 int corner = int.Parse(num); 166 int corner = int.Parse(num);
167 float lowValue = float.Parse(min, Culture.NumberFormatInfo); 167 float lowValue = float.Parse(min, Culture.NumberFormatInfo);
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 1789d6d..3f21f85 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -65,6 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Land
65 public class LandManagementModule : INonSharedRegionModule 65 public class LandManagementModule : INonSharedRegionModule
66 { 66 {
67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
68 private static readonly string LogHeader = "[LAND MANAGEMENT MODULE]";
68 69
69 private static readonly string remoteParcelRequestPath = "0009/"; 70 private static readonly string remoteParcelRequestPath = "0009/";
70 71
@@ -76,15 +77,11 @@ namespace OpenSim.Region.CoreModules.World.Land
76 protected IPrimCountModule m_primCountModule; 77 protected IPrimCountModule m_primCountModule;
77 protected IDialogModule m_Dialog; 78 protected IDialogModule m_Dialog;
78 79
79 // Minimum for parcels to work is 64m even if we don't actually use them.
80 #pragma warning disable 0429
81 private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64;
82 #pragma warning restore 0429
83
84 /// <value> 80 /// <value>
85 /// Local land ids at specified region co-ordinates (region size / 4) 81 /// Local land ids at specified region co-ordinates (region size / 4)
86 /// </value> 82 /// </value>
87 private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; 83 private int[,] m_landIDList;
84 private const int landUnit = 4;
88 85
89 /// <value> 86 /// <value>
90 /// Land objects keyed by local id 87 /// Land objects keyed by local id
@@ -117,6 +114,8 @@ namespace OpenSim.Region.CoreModules.World.Land
117 public void AddRegion(Scene scene) 114 public void AddRegion(Scene scene)
118 { 115 {
119 m_scene = scene; 116 m_scene = scene;
117 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
118
120 m_landIDList.Initialize(); 119 m_landIDList.Initialize();
121 landChannel = new LandChannel(scene, this); 120 landChannel = new LandChannel(scene, this);
122 121
@@ -326,6 +325,7 @@ namespace OpenSim.Region.CoreModules.World.Land
326 { 325 {
327 m_landList.Clear(); 326 m_landList.Clear();
328 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 327 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
328 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
329 m_landIDList.Initialize(); 329 m_landIDList.Initialize();
330 } 330 }
331 } 331 }
@@ -340,7 +340,8 @@ namespace OpenSim.Region.CoreModules.World.Land
340 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); 340 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
341 341
342 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 342 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
343 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 343 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
344 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
344 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 345 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
345 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); 346 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
346 347
@@ -467,8 +468,8 @@ namespace OpenSim.Region.CoreModules.World.Land
467 468
468 public void SendLandUpdate(ScenePresence avatar, bool force) 469 public void SendLandUpdate(ScenePresence avatar, bool force)
469 { 470 {
470 ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), 471 ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
471 (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); 472 (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
472 473
473 if (over != null) 474 if (over != null)
474 { 475 {
@@ -634,17 +635,29 @@ namespace OpenSim.Region.CoreModules.World.Land
634 new_land.LandData.LocalID = newLandLocalID; 635 new_land.LandData.LocalID = newLandLocalID;
635 636
636 bool[,] landBitmap = new_land.GetLandBitmap(); 637 bool[,] landBitmap = new_land.GetLandBitmap();
637 for (int x = 0; x < landArrayMax; x++) 638 m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). bitmap[600/4,600/4]={3}, newLocalID={4}",
639 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), landBitmap[600/4, 600/4], newLandLocalID);
640
641 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1))
642 {
643 // Going to variable sized regions can cause mismatches
644 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})",
645 LogHeader, landBitmap.GetLength(0), m_landIDList.GetLength(1), landBitmap.GetLength(0), m_landIDList.GetLength(1) );
646 }
647 else
638 { 648 {
639 for (int y = 0; y < landArrayMax; y++) 649 for (int x = 0; x < landBitmap.GetLength(0); x++)
640 { 650 {
641 if (landBitmap[x, y]) 651 for (int y = 0; y < landBitmap.GetLength(1); y++)
642 { 652 {
643// m_log.DebugFormat( 653 if (landBitmap[x, y])
644// "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", 654 {
645// new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); 655 // m_log.DebugFormat(
646 656 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
647 m_landIDList[x, y] = newLandLocalID; 657 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
658
659 m_landIDList[x, y] = newLandLocalID;
660 }
648 } 661 }
649 } 662 }
650 } 663 }
@@ -666,9 +679,9 @@ namespace OpenSim.Region.CoreModules.World.Land
666 ILandObject land; 679 ILandObject land;
667 lock (m_landList) 680 lock (m_landList)
668 { 681 {
669 for (int x = 0; x < 64; x++) 682 for (int x = 0; x < m_landIDList.GetLength(0); x++)
670 { 683 {
671 for (int y = 0; y < 64; y++) 684 for (int y = 0; y < m_landIDList.GetLength(1); y++)
672 { 685 {
673 if (m_landIDList[x, y] == local_id) 686 if (m_landIDList[x, y] == local_id)
674 { 687 {
@@ -720,9 +733,9 @@ namespace OpenSim.Region.CoreModules.World.Land
720 bool[,] landBitmapSlave = slave.GetLandBitmap(); 733 bool[,] landBitmapSlave = slave.GetLandBitmap();
721 lock (m_landList) 734 lock (m_landList)
722 { 735 {
723 for (int x = 0; x < 64; x++) 736 for (int x = 0; x < landBitmapSlave.GetLength(0); x++)
724 { 737 {
725 for (int y = 0; y < 64; y++) 738 for (int y = 0; y < landBitmapSlave.GetLength(1); y++)
726 { 739 {
727 if (landBitmapSlave[x, y]) 740 if (landBitmapSlave[x, y])
728 { 741 {
@@ -756,23 +769,28 @@ namespace OpenSim.Region.CoreModules.World.Land
756 /// <returns>Land object at the point supplied</returns> 769 /// <returns>Land object at the point supplied</returns>
757 public ILandObject GetLandObject(float x_float, float y_float) 770 public ILandObject GetLandObject(float x_float, float y_float)
758 { 771 {
772 return GetLandObject((int)x_float, (int)y_float);
773 /*
759 int x; 774 int x;
760 int y; 775 int y;
761 776
762 if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) 777 if (x_float >= m_scene.RegionInfo.RegionSizeX || x_float < 0 || y_float >= m_scene.RegionInfo.RegionSizeX || y_float < 0)
763 return null; 778 return null;
764 779
765 try 780 try
766 { 781 {
767 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); 782 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / (float)landUnit));
768 y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / 4.0)); 783 y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / (float)landUnit));
769 } 784 }
770 catch (OverflowException) 785 catch (OverflowException)
771 { 786 {
772 return null; 787 return null;
773 } 788 }
774 789
775 if (x >= 64 || y >= 64 || x < 0 || y < 0) 790 if (x >= (m_scene.RegionInfo.RegionSizeX / landUnit)
791 || y >= (m_scene.RegionInfo.RegionSizeY / landUnit)
792 || x < 0
793 || y < 0)
776 { 794 {
777 return null; 795 return null;
778 } 796 }
@@ -788,38 +806,112 @@ namespace OpenSim.Region.CoreModules.World.Land
788// m_log.DebugFormat( 806// m_log.DebugFormat(
789// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}", 807// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}",
790// x, y, m_scene.RegionInfo.RegionName); 808// x, y, m_scene.RegionInfo.RegionName);
791 809
792 if (m_landList.ContainsKey(m_landIDList[x, y])) 810 try
793 return m_landList[m_landIDList[x, y]]; 811 {
812 if (m_landList.ContainsKey(m_landIDList[x, y]))
813 return m_landList[m_landIDList[x, y]];
814 }
815 catch (Exception e)
816 {
817 m_log.DebugFormat("{0} GetLandObject exception. x={1}, y={2}, m_landIDList.len=({3},{4})",
818 LogHeader, x, y, m_landIDList.GetLength(0), m_landIDList.GetLength(1));
819 }
794 820
795 return null; 821 return null;
796 } 822 }
823 */
797 } 824 }
798 825
826 // Given a region position, return the parcel land object for that location
799 public ILandObject GetLandObject(int x, int y) 827 public ILandObject GetLandObject(int x, int y)
800 { 828 {
801 if (x >= Convert.ToInt32(Constants.RegionSize) || y >= Convert.ToInt32(Constants.RegionSize) || x < 0 || y < 0) 829 ILandObject ret = null;
830
831 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
802 { 832 {
803 // These exceptions here will cause a lot of complaints from the users specifically because 833 // These exceptions here will cause a lot of complaints from the users specifically because
804 // they happen every time at border crossings 834 // they happen every time at border crossings
805 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 835 throw new Exception(
836 String.Format("{0} GetLandObject for non-existant position. Region={1}, pos=<{2},{3}",
837 LogHeader, m_scene.RegionInfo.RegionName, x, y)
838 );
806 } 839 }
807 840
808 lock (m_landIDList) 841 lock (m_landIDList)
809 { 842 {
810 try 843 try
811 { 844 {
812 return m_landList[m_landIDList[x / 4, y / 4]]; 845 int landID = m_landIDList[x / landUnit, y / landUnit];
846 if (landID == 0)
847 {
848 // Zero is the uninitialized value saying there is no parcel for this location.
849 // This sometimes happens when terrain is resized.
850 if (m_landList.Count == 1)
851 {
852 int onlyParcelID = 0;
853 ILandObject onlyLandObject = null;
854 foreach (KeyValuePair<int, ILandObject> kvp in m_landList)
855 {
856 onlyParcelID = kvp.Key;
857 onlyLandObject = kvp.Value;
858 break;
859 }
860
861 // There is only one parcel. Grow it to fill all the unallocated spaces.
862 for (int xx = 0; xx < m_landIDList.GetLength(0); xx++)
863 for (int yy = 0; yy < m_landIDList.GetLength(1); yy++)
864 if (m_landIDList[xx, yy] == 0)
865 m_landIDList[xx, yy] = onlyParcelID;
866
867 onlyLandObject.LandBitmap = CreateBitmapForID(onlyParcelID);
868 landID = onlyParcelID;
869 }
870 else
871 {
872 // There are several other parcels so we must create a new one for the unassigned space
873 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
874 // Claim all the unclaimed "0" ids
875 newLand.SetLandBitmap(CreateBitmapForID(0));
876 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
877 newLand.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
878 AddLandObject(newLand);
879 landID = m_lastLandLocalID;
880 }
881 }
882
883 ret = m_landList[landID];
813 } 884 }
814 catch (IndexOutOfRangeException) 885 catch (IndexOutOfRangeException)
815 { 886 {
816// m_log.WarnFormat( 887 m_log.ErrorFormat(
817// "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", 888 "{0} GetLandObject: Tried to retrieve land object from out of bounds co-ordinate ({1},{2}) in {3}. landListSize=({4},{5})",
818// x, y, m_scene.RegionInfo.RegionName); 889 LogHeader, x, y, m_scene.RegionInfo.RegionName, m_landIDList.GetLength(0), m_landIDList.GetLength(1));
819 890 return null;
891 }
892 catch
893 {
894 m_log.ErrorFormat(
895 "{0} GetLandObject: LandID not in landlist. XY=<{1},{2}> in {3}. landID[x,y]={4}",
896 LogHeader, x, y, m_scene.RegionInfo.RegionName, m_landIDList[x/landUnit, y/landUnit]);
820 return null; 897 return null;
821 } 898 }
822 } 899 }
900 return ret;
901 }
902
903 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID
904 private bool[,] CreateBitmapForID(int landID)
905 {
906 bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)];
907 ret.Initialize();
908
909 for (int xx = 0; xx < m_landIDList.GetLength(0); xx++)
910 for (int yy = 0; yy < m_landIDList.GetLength(0); yy++)
911 if (m_landIDList[xx, yy] == landID)
912 ret[xx, yy] = true;
913
914 return ret;
823 } 915 }
824 916
825 #endregion 917 #endregion
@@ -1082,85 +1174,93 @@ namespace OpenSim.Region.CoreModules.World.Land
1082 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 1174 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1083 int byteArrayCount = 0; 1175 int byteArrayCount = 0;
1084 int sequenceID = 0; 1176 int sequenceID = 0;
1085 int blockmeters = 4 * (int) Constants.RegionSize/(int)Constants.TerrainPatchSize;
1086 1177
1087 1178 // Layer data is in landUnit (4m) chunks
1088 for (int y = 0; y < blockmeters; y++) 1179 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++)
1089 { 1180 {
1090 for (int x = 0; x < blockmeters; x++) 1181 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++)
1091 { 1182 {
1092 byte tempByte = 0; //This represents the byte for the current 4x4 1183 byteArray[byteArrayCount] = BuildLayerByte(GetLandObject(x * landUnit, y * landUnit), x, y, remote_client);
1184 byteArrayCount++;
1185 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
1186 {
1187 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1188 byteArrayCount = 0;
1189 sequenceID++;
1190 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1191 }
1093 1192
1094 ILandObject currentParcelBlock = GetLandObject(x * 4, y * 4); 1193 }
1194 }
1195 if (byteArrayCount != 0)
1196 {
1197 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1198 }
1199 }
1095 1200
1096 if (currentParcelBlock != null) 1201 private byte BuildLayerByte(ILandObject currentParcelBlock, int x, int y, IClientAPI remote_client)
1097 { 1202 {
1098 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) 1203 byte tempByte = 0; //This represents the byte for the current 4x4
1099 {
1100 //Owner Flag
1101 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
1102 }
1103 else if (currentParcelBlock.LandData.SalePrice > 0 &&
1104 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
1105 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
1106 {
1107 //Sale Flag
1108 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE);
1109 }
1110 else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
1111 {
1112 //Public Flag
1113 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC);
1114 }
1115 else
1116 {
1117 //Other Flag
1118 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER);
1119 }
1120 1204
1121 //Now for border control 1205 if (currentParcelBlock != null)
1206 {
1207 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1208 {
1209 //Owner Flag
1210 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
1211 }
1212 else if (currentParcelBlock.LandData.SalePrice > 0 &&
1213 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
1214 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
1215 {
1216 //Sale Flag
1217 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE);
1218 }
1219 else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
1220 {
1221 //Public Flag
1222 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC);
1223 }
1224 else
1225 {
1226 //Other Flag
1227 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER);
1228 }
1122 1229
1123 ILandObject westParcel = null; 1230 //Now for border control
1124 ILandObject southParcel = null;
1125 if (x > 0)
1126 {
1127 westParcel = GetLandObject((x - 1) * 4, y * 4);
1128 }
1129 if (y > 0)
1130 {
1131 southParcel = GetLandObject(x * 4, (y - 1) * 4);
1132 }
1133 1231
1134 if (x == 0) 1232 ILandObject westParcel = null;
1135 { 1233 ILandObject southParcel = null;
1136 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST); 1234 if (x > 0)
1137 } 1235 {
1138 else if (westParcel != null && westParcel != currentParcelBlock) 1236 westParcel = GetLandObject((x - 1) * landUnit, y * landUnit);
1139 { 1237 }
1140 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST); 1238 if (y > 0)
1141 } 1239 {
1240 southParcel = GetLandObject(x * landUnit, (y - 1) * landUnit);
1241 }
1142 1242
1143 if (y == 0) 1243 if (x == 0)
1144 { 1244 {
1145 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); 1245 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1146 } 1246 }
1147 else if (southParcel != null && southParcel != currentParcelBlock) 1247 else if (westParcel != null && westParcel != currentParcelBlock)
1148 { 1248 {
1149 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); 1249 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1150 } 1250 }
1151 1251
1152 byteArray[byteArrayCount] = tempByte; 1252 if (y == 0)
1153 byteArrayCount++; 1253 {
1154 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) 1254 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1155 { 1255 }
1156 remote_client.SendLandParcelOverlay(byteArray, sequenceID); 1256 else if (southParcel != null && southParcel != currentParcelBlock)
1157 byteArrayCount = 0; 1257 {
1158 sequenceID++; 1258 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1159 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1160 }
1161 }
1162 } 1259 }
1260
1163 } 1261 }
1262
1263 return tempByte;
1164 } 1264 }
1165 1265
1166 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, 1266 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id,
@@ -1717,8 +1817,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1717 // HACK for now 1817 // HACK for now
1718 RegionInfo r = new RegionInfo(); 1818 RegionInfo r = new RegionInfo();
1719 r.RegionName = info.RegionName; 1819 r.RegionName = info.RegionName;
1720 r.RegionLocX = (uint)info.RegionLocX; 1820 r.LegacyRegionLocX = (uint)info.RegionLocX;
1721 r.RegionLocY = (uint)info.RegionLocY; 1821 r.LegacyRegionLocY = (uint)info.RegionLocY;
1722 r.RegionSettings.Maturity = (int)Util.ConvertAccessLevelToMaturity(data.RegionAccess); 1822 r.RegionSettings.Maturity = (int)Util.ConvertAccessLevelToMaturity(data.RegionAccess);
1723 remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y); 1823 remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
1724 } 1824 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index e55c9ed..0bde877 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -45,10 +45,10 @@ namespace OpenSim.Region.CoreModules.World.Land
45 #region Member Variables 45 #region Member Variables
46 46
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 #pragma warning disable 0429 48 private static readonly string LogHeader = "[LAND OBJECT]";
49 private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; 49
50 #pragma warning restore 0429 50 private bool[,] m_landBitmap;
51 private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; 51 private readonly int landUnit = 4;
52 52
53 private int m_lastSeqId = 0; 53 private int m_lastSeqId = 0;
54 54
@@ -93,12 +93,12 @@ namespace OpenSim.Region.CoreModules.World.Land
93 { 93 {
94 get 94 get
95 { 95 {
96 for (int y = 0; y < landArrayMax; y++) 96 for (int y = 0; y < LandBitmap.GetLength(1); y++)
97 { 97 {
98 for (int x = 0; x < landArrayMax; x++) 98 for (int x = 0; x < LandBitmap.GetLength(0); x++)
99 { 99 {
100 if (LandBitmap[x, y]) 100 if (LandBitmap[x, y])
101 return new Vector3(x * 4, y * 4, 0); 101 return new Vector3(x * landUnit, y * landUnit, 0);
102 } 102 }
103 } 103 }
104 104
@@ -110,13 +110,13 @@ namespace OpenSim.Region.CoreModules.World.Land
110 { 110 {
111 get 111 get
112 { 112 {
113 for (int y = landArrayMax - 1; y >= 0; y--) 113 for (int y = LandBitmap.GetLength(1) - 1; y >= 0; y--)
114 { 114 {
115 for (int x = landArrayMax - 1; x >= 0; x--) 115 for (int x = LandBitmap.GetLength(0) - 1; x >= 0; x--)
116 { 116 {
117 if (LandBitmap[x, y]) 117 if (LandBitmap[x, y])
118 { 118 {
119 return new Vector3(x * 4 + 4, y * 4 + 4, 0); 119 return new Vector3(x * landUnit + landUnit, y * landUnit + landUnit, 0);
120 } 120 }
121 } 121 }
122 } 122 }
@@ -130,6 +130,8 @@ namespace OpenSim.Region.CoreModules.World.Land
130 public LandObject(UUID owner_id, bool is_group_owned, Scene scene) 130 public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
131 { 131 {
132 m_scene = scene; 132 m_scene = scene;
133 m_landBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
134
133 LandData.OwnerID = owner_id; 135 LandData.OwnerID = owner_id;
134 if (is_group_owned) 136 if (is_group_owned)
135 LandData.GroupID = owner_id; 137 LandData.GroupID = owner_id;
@@ -152,9 +154,9 @@ namespace OpenSim.Region.CoreModules.World.Land
152 /// <returns>Returns true if the piece of land contains the specified point</returns> 154 /// <returns>Returns true if the piece of land contains the specified point</returns>
153 public bool ContainsPoint(int x, int y) 155 public bool ContainsPoint(int x, int y)
154 { 156 {
155 if (x >= 0 && y >= 0 && x < Constants.RegionSize && y < Constants.RegionSize) 157 if (x >= 0 && y >= 0 && x < m_scene.RegionInfo.RegionSizeX && y < m_scene.RegionInfo.RegionSizeY)
156 { 158 {
157 return (LandBitmap[x / 4, y / 4] == true); 159 return (LandBitmap[x / landUnit, y / landUnit] == true);
158 } 160 }
159 else 161 else
160 { 162 {
@@ -194,7 +196,7 @@ namespace OpenSim.Region.CoreModules.World.Land
194 else 196 else
195 { 197 {
196 // Normal Calculations 198 // Normal Calculations
197 int parcelMax = (int)(((float)LandData.Area / 65536.0f) 199 int parcelMax = (int)(((float)LandData.Area / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
198 * (float)m_scene.RegionInfo.ObjectCapacity 200 * (float)m_scene.RegionInfo.ObjectCapacity
199 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 201 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
200 // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! 202 // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL!
@@ -211,7 +213,7 @@ namespace OpenSim.Region.CoreModules.World.Land
211 else 213 else
212 { 214 {
213 //Normal Calculations 215 //Normal Calculations
214 int simMax = (int)(((float)LandData.SimwideArea / 65536.0f) 216 int simMax = (int)(((float)LandData.SimwideArea / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
215 * (float)m_scene.RegionInfo.ObjectCapacity); 217 * (float)m_scene.RegionInfo.ObjectCapacity);
216 return simMax; 218 return simMax;
217 } 219 }
@@ -224,7 +226,12 @@ namespace OpenSim.Region.CoreModules.World.Land
224 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) 226 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
225 { 227 {
226 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 228 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
227 uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); 229 // uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome));
230 uint regionFlags = (uint)(RegionFlags.PublicAllowed
231 | RegionFlags.AllowDirectTeleport
232 | RegionFlags.AllowParcelChanges
233 | RegionFlags.AllowVoice );
234
228 if (estateModule != null) 235 if (estateModule != null)
229 regionFlags = estateModule.GetRegionFlags(); 236 regionFlags = estateModule.GetRegionFlags();
230 237
@@ -546,8 +553,8 @@ namespace OpenSim.Region.CoreModules.World.Land
546 try 553 try
547 { 554 {
548 over = 555 over =
549 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), 556 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)m_scene.RegionInfo.RegionSizeX - 1)),
550 Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); 557 Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)m_scene.RegionInfo.RegionSizeY - 1)));
551 } 558 }
552 catch (Exception) 559 catch (Exception)
553 { 560 {
@@ -694,15 +701,15 @@ namespace OpenSim.Region.CoreModules.World.Land
694 /// </summary> 701 /// </summary>
695 private void UpdateAABBAndAreaValues() 702 private void UpdateAABBAndAreaValues()
696 { 703 {
697 int min_x = 64; 704 int min_x = 10000;
698 int min_y = 64; 705 int min_y = 10000;
699 int max_x = 0; 706 int max_x = 0;
700 int max_y = 0; 707 int max_y = 0;
701 int tempArea = 0; 708 int tempArea = 0;
702 int x, y; 709 int x, y;
703 for (x = 0; x < 64; x++) 710 for (x = 0; x < LandBitmap.GetLength(0); x++)
704 { 711 {
705 for (y = 0; y < 64; y++) 712 for (y = 0; y < LandBitmap.GetLength(1); y++)
706 { 713 {
707 if (LandBitmap[x, y] == true) 714 if (LandBitmap[x, y] == true)
708 { 715 {
@@ -710,31 +717,31 @@ namespace OpenSim.Region.CoreModules.World.Land
710 if (min_y > y) min_y = y; 717 if (min_y > y) min_y = y;
711 if (max_x < x) max_x = x; 718 if (max_x < x) max_x = x;
712 if (max_y < y) max_y = y; 719 if (max_y < y) max_y = y;
713 tempArea += 16; //16sqm peice of land 720 tempArea += landUnit * landUnit; //16sqm peice of land
714 } 721 }
715 } 722 }
716 } 723 }
717 int tx = min_x * 4; 724 int tx = min_x * landUnit;
718 if (tx > ((int)Constants.RegionSize - 1)) 725 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1))
719 tx = ((int)Constants.RegionSize - 1); 726 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1);
720 int ty = min_y * 4; 727 int ty = min_y * landUnit;
721 if (ty > ((int)Constants.RegionSize - 1)) 728 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1))
722 ty = ((int)Constants.RegionSize - 1); 729 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1);
723 730
724 LandData.AABBMin = 731 LandData.AABBMin =
725 new Vector3( 732 new Vector3(
726 (float)(min_x * 4), (float)(min_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); 733 (float)(min_x * landUnit), (float)(min_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
727 734
728 tx = max_x * 4; 735 tx = max_x * landUnit;
729 if (tx > ((int)Constants.RegionSize - 1)) 736 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1))
730 tx = ((int)Constants.RegionSize - 1); 737 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1);
731 ty = max_y * 4; 738 ty = max_y * landUnit;
732 if (ty > ((int)Constants.RegionSize - 1)) 739 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1))
733 ty = ((int)Constants.RegionSize - 1); 740 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1);
734 741
735 LandData.AABBMax 742 LandData.AABBMax
736 = new Vector3( 743 = new Vector3(
737 (float)(max_x * 4), (float)(max_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); 744 (float)(max_x * landUnit), (float)(max_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
738 745
739 LandData.Area = tempArea; 746 LandData.Area = tempArea;
740 } 747 }
@@ -746,20 +753,11 @@ namespace OpenSim.Region.CoreModules.World.Land
746 /// <summary> 753 /// <summary>
747 /// Sets the land's bitmap manually 754 /// Sets the land's bitmap manually
748 /// </summary> 755 /// </summary>
749 /// <param name="bitmap">64x64 block representing where this land is on a map</param> 756 /// <param name="bitmap">block representing where this land is on a map mapped in a 4x4 meter grid</param>
750 public void SetLandBitmap(bool[,] bitmap) 757 public void SetLandBitmap(bool[,] bitmap)
751 { 758 {
752 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) 759 LandBitmap = bitmap;
753 { 760 ForceUpdateLandInfo();
754 //Throw an exception - The bitmap is not 64x64
755 //throw new Exception("Error: Invalid Parcel Bitmap");
756 }
757 else
758 {
759 //Valid: Lets set it
760 LandBitmap = bitmap;
761 ForceUpdateLandInfo();
762 }
763 } 761 }
764 762
765 /// <summary> 763 /// <summary>
@@ -773,12 +771,12 @@ namespace OpenSim.Region.CoreModules.World.Land
773 771
774 public bool[,] BasicFullRegionLandBitmap() 772 public bool[,] BasicFullRegionLandBitmap()
775 { 773 {
776 return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); 774 return GetSquareLandBitmap(0, 0, (int)m_scene.RegionInfo.RegionSizeX, (int) m_scene.RegionInfo.RegionSizeY);
777 } 775 }
778 776
779 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) 777 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
780 { 778 {
781 bool[,] tempBitmap = new bool[64,64]; 779 bool[,] tempBitmap = new bool[(end_x-start_x)/landUnit,(end_y-start_y)/landUnit];
782 tempBitmap.Initialize(); 780 tempBitmap.Initialize();
783 781
784 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); 782 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
@@ -798,19 +796,13 @@ namespace OpenSim.Region.CoreModules.World.Land
798 public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, 796 public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y,
799 bool set_value) 797 bool set_value)
800 { 798 {
801 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2)
802 {
803 //Throw an exception - The bitmap is not 64x64
804 //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()");
805 }
806
807 int x, y; 799 int x, y;
808 for (y = 0; y < 64; y++) 800 for (y = 0; y < land_bitmap.GetLength(1); y++)
809 { 801 {
810 for (x = 0; x < 64; x++) 802 for (x = 0; x < land_bitmap.GetLength(0); x++)
811 { 803 {
812 if (x >= start_x / 4 && x < end_x / 4 804 if (x >= start_x / landUnit && x < end_x / landUnit
813 && y >= start_y / 4 && y < end_y / 4) 805 && y >= start_y / landUnit && y < end_y / landUnit)
814 { 806 {
815 land_bitmap[x, y] = set_value; 807 land_bitmap[x, y] = set_value;
816 } 808 }
@@ -827,21 +819,21 @@ namespace OpenSim.Region.CoreModules.World.Land
827 /// <returns></returns> 819 /// <returns></returns>
828 public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) 820 public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
829 { 821 {
830 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) 822 if (bitmap_base.GetLength(0) != bitmap_add.GetLength(0)
823 || bitmap_base.GetLength(1) != bitmap_add.GetLength(1)
824 || bitmap_add.Rank != 2
825 || bitmap_base.Rank != 2)
831 { 826 {
832 //Throw an exception - The bitmap is not 64x64 827 throw new Exception(
833 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); 828 String.Format("{0} MergeLandBitmaps. merging maps not same size. baseSizeXY=<{1},{2}>, addSizeXY=<{3},{4}>",
834 } 829 LogHeader, bitmap_base.GetLength(0), bitmap_base.GetLength(1), bitmap_add.GetLength(0), bitmap_add.GetLength(1))
835 if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) 830 );
836 {
837 //Throw an exception - The bitmap is not 64x64
838 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps");
839 } 831 }
840 832
841 int x, y; 833 int x, y;
842 for (y = 0; y < 64; y++) 834 for (y = 0; y < bitmap_base.GetLength(1); y++)
843 { 835 {
844 for (x = 0; x < 64; x++) 836 for (x = 0; x < bitmap_add.GetLength(0); x++)
845 { 837 {
846 if (bitmap_add[x, y]) 838 if (bitmap_add[x, y])
847 { 839 {
@@ -858,13 +850,13 @@ namespace OpenSim.Region.CoreModules.World.Land
858 /// <returns></returns> 850 /// <returns></returns>
859 private byte[] ConvertLandBitmapToBytes() 851 private byte[] ConvertLandBitmapToBytes()
860 { 852 {
861 byte[] tempConvertArr = new byte[512]; 853 byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8];
862 byte tempByte = 0; 854 byte tempByte = 0;
863 int x, y, i, byteNum = 0; 855 int byteNum = 0;
864 i = 0; 856 int i = 0;
865 for (y = 0; y < 64; y++) 857 for (int y = 0; y < LandBitmap.GetLength(1); y++)
866 { 858 {
867 for (x = 0; x < 64; x++) 859 for (int x = 0; x < LandBitmap.GetLength(0); x++)
868 { 860 {
869 tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8)); 861 tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8));
870 if (i % 8 == 0) 862 if (i % 8 == 0)
@@ -881,25 +873,45 @@ namespace OpenSim.Region.CoreModules.World.Land
881 873
882 private bool[,] ConvertBytesToLandBitmap() 874 private bool[,] ConvertBytesToLandBitmap()
883 { 875 {
884 bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax]; 876 bool[,] tempConvertMap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
885 tempConvertMap.Initialize(); 877 tempConvertMap.Initialize();
886 byte tempByte = 0; 878 byte tempByte = 0;
887 int x = 0, y = 0, i = 0, bitNum = 0; 879 // Math.Min overcomes an old bug that might have made it into the database. Only use the bytes that fit into convertMap.
888 for (i = 0; i < 512; i++) 880 int bitmapLen = Math.Min(LandData.Bitmap.Length, tempConvertMap.GetLength(0) * tempConvertMap.GetLength(1) / 8);
881 int xLen = (int)(m_scene.RegionInfo.RegionSizeX / landUnit);
882
883 if (bitmapLen == 512)
884 {
885 // Legacy bitmap being passed in. Use the legacy region size
886 // and only set the lower area of the larger region.
887 xLen = (int)(Constants.RegionSize / landUnit);
888 }
889 m_log.DebugFormat("{0} ConvertBytesToLandBitmap: bitmapLen={1}, xLen={2}", LogHeader, bitmapLen, xLen);
890
891 int x = 0, y = 0;
892 for (int i = 0; i < bitmapLen; i++)
889 { 893 {
890 tempByte = LandData.Bitmap[i]; 894 tempByte = LandData.Bitmap[i];
891 for (bitNum = 0; bitNum < 8; bitNum++) 895 for (int bitNum = 0; bitNum < 8; bitNum++)
892 { 896 {
893 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); 897 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
894 tempConvertMap[x, y] = bit; 898 try
899 {
900 tempConvertMap[x, y] = bit;
901 }
902 catch (Exception e)
903 {
904 m_log.DebugFormat("{0} ConvertBytestoLandBitmap: i={1}, x={2}, y={3}", LogHeader, i, x, y);
905 }
895 x++; 906 x++;
896 if (x > 63) 907 if (x >= xLen)
897 { 908 {
898 x = 0; 909 x = 0;
899 y++; 910 y++;
900 } 911 }
901 } 912 }
902 } 913 }
914
903 return tempConvertMap; 915 return tempConvertMap;
904 } 916 }
905 917
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f8e93e1..45617fc 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1571,10 +1571,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1571 float X = position.X; 1571 float X = position.X;
1572 float Y = position.Y; 1572 float Y = position.Y;
1573 1573
1574 if (X > ((int)Constants.RegionSize - 1)) 1574 if (X > ((int)m_scene.RegionInfo.RegionSizeX - 1))
1575 X = ((int)Constants.RegionSize - 1); 1575 X = ((int)m_scene.RegionInfo.RegionSizeX - 1);
1576 if (Y > ((int)Constants.RegionSize - 1)) 1576 if (Y > ((int)m_scene.RegionInfo.RegionSizeY - 1))
1577 Y = ((int)Constants.RegionSize - 1); 1577 Y = ((int)m_scene.RegionInfo.RegionSizeY - 1);
1578 if (X < 0) 1578 if (X < 0)
1579 X = 0; 1579 X = 0;
1580 if (Y < 0) 1580 if (Y < 0)
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Effects/DefaultTerrainGenerator.cs b/OpenSim/Region/CoreModules/World/Terrain/Effects/DefaultTerrainGenerator.cs
index 7186dd7..89087b1 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Effects/DefaultTerrainGenerator.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Effects/DefaultTerrainGenerator.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects
42 for (y = 0; y < map.Height; y++) 42 for (y = 0; y < map.Height; y++)
43 { 43 {
44 map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 3, 0.25) * 10; 44 map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 3, 0.25) * 10;
45 double spherFac = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2, Constants.RegionSize / 2, 50) * 0.01; 45 double spherFac = TerrainUtil.SphericalFactor(x, y, map.Width / 2, map.Height / 2, 50) * 0.01;
46 if (map[x, y] < spherFac) 46 if (map[x, y] < spherFac)
47 { 47 {
48 map[x, y] = spherFac; 48 map[x, y] = spherFac;
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
index d78ade5..d5c77ec 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
67 { 67 {
68 using (Bitmap bitmap = new Bitmap(filename)) 68 using (Bitmap bitmap = new Bitmap(filename))
69 { 69 {
70 ITerrainChannel retval = new TerrainChannel(true); 70 ITerrainChannel retval = new TerrainChannel(w, h);
71 71
72 for (int x = 0; x < retval.Width; x++) 72 for (int x = 0; x < retval.Width; x++)
73 { 73 {
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index fd30c46..459af73 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -30,10 +30,14 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Net; 32using System.Net;
33
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
36
35using OpenMetaverse; 37using OpenMetaverse;
36using Mono.Addins; 38using Mono.Addins;
39
40using OpenSim.Data;
37using OpenSim.Framework; 41using OpenSim.Framework;
38using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 42using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
39using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; 43using OpenSim.Region.CoreModules.World.Terrain.FileLoaders;
@@ -70,6 +74,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
70 #endregion 74 #endregion
71 75
72 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 76 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
77 private static readonly string LogHeader = "[TERRAIN MODULE]";
73 78
74 private readonly Commander m_commander = new Commander("terrain"); 79 private readonly Commander m_commander = new Commander("terrain");
75 80
@@ -130,15 +135,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
130 { 135 {
131 if (m_scene.Heightmap == null) 136 if (m_scene.Heightmap == null)
132 { 137 {
133 m_channel = new TerrainChannel(m_InitialTerrain); 138 m_channel = new TerrainChannel(m_InitialTerrain, (int)m_scene.RegionInfo.RegionSizeX,
139 (int)m_scene.RegionInfo.RegionSizeY,
140 (int)m_scene.RegionInfo.RegionSizeZ);
134 m_scene.Heightmap = m_channel; 141 m_scene.Heightmap = m_channel;
135 m_revert = new TerrainChannel();
136 UpdateRevertMap(); 142 UpdateRevertMap();
137 } 143 }
138 else 144 else
139 { 145 {
140 m_channel = m_scene.Heightmap; 146 m_channel = m_scene.Heightmap;
141 m_revert = new TerrainChannel();
142 UpdateRevertMap(); 147 UpdateRevertMap();
143 } 148 }
144 149
@@ -532,6 +537,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
532 /// </summary> 537 /// </summary>
533 public void UpdateRevertMap() 538 public void UpdateRevertMap()
534 { 539 {
540 /*
535 int x; 541 int x;
536 for (x = 0; x < m_channel.Width; x++) 542 for (x = 0; x < m_channel.Width; x++)
537 { 543 {
@@ -541,6 +547,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
541 m_revert[x, y] = m_channel[x, y]; 547 m_revert[x, y] = m_channel[x, y];
542 } 548 }
543 } 549 }
550 */
551 m_revert = m_channel.MakeCopy();
544 } 552 }
545 553
546 /// <summary> 554 /// <summary>
@@ -553,8 +561,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
553 /// <param name="fileStartY">Where to begin our slice</param> 561 /// <param name="fileStartY">Where to begin our slice</param>
554 public void LoadFromFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY) 562 public void LoadFromFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY)
555 { 563 {
556 int offsetX = (int) m_scene.RegionInfo.RegionLocX - fileStartX; 564 int offsetX = (int) m_scene.RegionInfo.LegacyRegionLocX - fileStartX;
557 int offsetY = (int) m_scene.RegionInfo.RegionLocY - fileStartY; 565 int offsetY = (int) m_scene.RegionInfo.LegacyRegionLocY - fileStartY;
558 566
559 if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight) 567 if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight)
560 { 568 {
@@ -594,14 +602,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain
594 /// <param name="fileStartY">The may y co-ordinate at which to begin the save.</param> 602 /// <param name="fileStartY">The may y co-ordinate at which to begin the save.</param>
595 public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY) 603 public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY)
596 { 604 {
597 int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX; 605 int offsetX = (int)m_scene.RegionInfo.LegacyRegionLocX - fileStartX;
598 int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY; 606 int offsetY = (int)m_scene.RegionInfo.LegacyRegionLocY - fileStartY;
599 607
600 if (offsetX < 0 || offsetX >= fileWidth || offsetY < 0 || offsetY >= fileHeight) 608 if (offsetX < 0 || offsetX >= fileWidth || offsetY < 0 || offsetY >= fileHeight)
601 { 609 {
602 MainConsole.Instance.OutputFormat( 610 MainConsole.Instance.OutputFormat(
603 "ERROR: file width + minimum X tile and file height + minimum Y tile must incorporate the current region at ({0},{1}). File width {2} from {3} and file height {4} from {5} does not.", 611 "ERROR: file width + minimum X tile and file height + minimum Y tile must incorporate the current region at ({0},{1}). File width {2} from {3} and file height {4} from {5} does not.",
604 m_scene.RegionInfo.RegionLocX, m_scene.RegionInfo.RegionLocY, fileWidth, fileStartX, fileHeight, fileStartY); 612 m_scene.RegionInfo.LegacyRegionLocX, m_scene.RegionInfo.LegacyRegionLocY, fileWidth, fileStartX, fileHeight, fileStartY);
605 613
606 return; 614 return;
607 } 615 }
@@ -705,7 +713,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
705 private void CheckForTerrainUpdates(bool respectEstateSettings) 713 private void CheckForTerrainUpdates(bool respectEstateSettings)
706 { 714 {
707 bool shouldTaint = false; 715 bool shouldTaint = false;
708 float[] serialised = m_channel.GetFloatsSerialised(); 716 float[] terrHeights = m_channel.GetFloatsSerialised();
709 int x; 717 int x;
710 for (x = 0; x < m_channel.Width; x += Constants.TerrainPatchSize) 718 for (x = 0; x < m_channel.Width; x += Constants.TerrainPatchSize)
711 { 719 {
@@ -714,16 +722,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
714 { 722 {
715 if (m_channel.Tainted(x, y)) 723 if (m_channel.Tainted(x, y))
716 { 724 {
717 // if we should respect the estate settings then 725 // If we should respect the estate settings then
718 // fixup and height deltas that don't respect them 726 // fixup and height deltas that don't respect them.
727 // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values.
719 if (respectEstateSettings && LimitChannelChanges(x, y)) 728 if (respectEstateSettings && LimitChannelChanges(x, y))
720 { 729 {
721 // this has been vetoed, so update 730 // Terrain heights were modified. Refetch the terrain info.
722 // what we are going to send to the client 731 terrHeights = m_channel.GetFloatsSerialised();
723 serialised = m_channel.GetFloatsSerialised();
724 } 732 }
725 733
726 SendToClients(serialised, x, y); 734 // m_log.DebugFormat("{0} Patch modified. Sending (x,y) = ({1},{2})", LogHeader, x, y);
735 SendToClients(terrHeights, x, y);
727 shouldTaint = true; 736 shouldTaint = true;
728 } 737 }
729 } 738 }
@@ -792,13 +801,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
792 /// <param name="serialised">A copy of the terrain as a 1D float array of size w*h</param> 801 /// <param name="serialised">A copy of the terrain as a 1D float array of size w*h</param>
793 /// <param name="x">The patch corner to send</param> 802 /// <param name="x">The patch corner to send</param>
794 /// <param name="y">The patch corner to send</param> 803 /// <param name="y">The patch corner to send</param>
795 private void SendToClients(float[] serialised, int x, int y) 804 private void SendToClients(float[] heightMap, int x, int y)
796 { 805 {
797 m_scene.ForEachClient( 806 m_scene.ForEachClient(
798 delegate(IClientAPI controller) 807 delegate(IClientAPI controller)
799 { controller.SendLayerData( 808 { controller.SendLayerData( x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, heightMap); }
800 x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, serialised);
801 }
802 ); 809 );
803 } 810 }
804 811
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index cdf1467..8383f4e 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -249,7 +249,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
249 // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is 249 // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is
250 // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. 250 // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks.
251 251
252 if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) 252 if (m_scene.RegionInfo.LegacyRegionLocX >= 2048 || m_scene.RegionInfo.LegacyRegionLocY >= 2048)
253 { 253 {
254 ScenePresence avatarPresence = null; 254 ScenePresence avatarPresence = null;
255 255
@@ -278,10 +278,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
278 List<MapBlockData> mapBlocks = new List<MapBlockData>(); ; 278 List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
279 279
280 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 280 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
281 (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize, 281 (int)(m_scene.RegionInfo.LegacyRegionLocX - 8) * (int)Constants.RegionSize,
282 (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize, 282 (int)(m_scene.RegionInfo.LegacyRegionLocX + 8) * (int)Constants.RegionSize,
283 (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize, 283 (int)(m_scene.RegionInfo.LegacyRegionLocY - 8) * (int)Constants.RegionSize,
284 (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize); 284 (int)(m_scene.RegionInfo.LegacyRegionLocY + 8) * (int)Constants.RegionSize);
285 foreach (GridRegion r in regions) 285 foreach (GridRegion r in regions)
286 { 286 {
287 MapBlockData block = new MapBlockData(); 287 MapBlockData block = new MapBlockData();
@@ -1218,10 +1218,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1218 1218
1219 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 1219 List<MapBlockData> mapBlocks = new List<MapBlockData>();
1220 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1220 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1221 (int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize, 1221 (int)(m_scene.RegionInfo.LegacyRegionLocX - 9) * (int)Constants.RegionSize,
1222 (int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize, 1222 (int)(m_scene.RegionInfo.LegacyRegionLocX + 9) * (int)Constants.RegionSize,
1223 (int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize, 1223 (int)(m_scene.RegionInfo.LegacyRegionLocY - 9) * (int)Constants.RegionSize,
1224 (int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize); 1224 (int)(m_scene.RegionInfo.LegacyRegionLocY + 9) * (int)Constants.RegionSize);
1225 List<AssetBase> textures = new List<AssetBase>(); 1225 List<AssetBase> textures = new List<AssetBase>();
1226 List<Image> bitImages = new List<Image>(); 1226 List<Image> bitImages = new List<Image>();
1227 1227
@@ -1262,8 +1262,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1262 1262
1263 for (int i = 0; i < mapBlocks.Count; i++) 1263 for (int i = 0; i < mapBlocks.Count; i++)
1264 { 1264 {
1265 ushort x = (ushort)((mapBlocks[i].X - m_scene.RegionInfo.RegionLocX) + 10); 1265 ushort x = (ushort)((mapBlocks[i].X - m_scene.RegionInfo.LegacyRegionLocX) + 10);
1266 ushort y = (ushort)((mapBlocks[i].Y - m_scene.RegionInfo.RegionLocY) + 10); 1266 ushort y = (ushort)((mapBlocks[i].Y - m_scene.RegionInfo.LegacyRegionLocY) + 10);
1267 g.DrawImage(bitImages[i], (x * 128), 2560 - (y * 128), 128, 128); // y origin is top 1267 g.DrawImage(bitImages[i], (x * 128), 2560 - (y * 128), 128, 128); // y origin is top
1268 } 1268 }
1269 1269