diff options
Diffstat (limited to 'OpenSim')
24 files changed, 156 insertions, 90 deletions
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs index 463c621..50433ba 100644 --- a/OpenSim/Data/IRegionData.cs +++ b/OpenSim/Data/IRegionData.cs | |||
@@ -54,12 +54,12 @@ namespace OpenSim.Data | |||
54 | /// <summary> | 54 | /// <summary> |
55 | /// Return the x-coordinate of this region. | 55 | /// Return the x-coordinate of this region. |
56 | /// </summary> | 56 | /// </summary> |
57 | public int coordX { get { return posX / (int)Constants.RegionSize; } } | 57 | public int coordX { get { return (int)Util.WorldToRegionLoc((uint)posX); } } |
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// Return the y-coordinate of this region. | 60 | /// Return the y-coordinate of this region. |
61 | /// </summary> | 61 | /// </summary> |
62 | public int coordY { get { return posY / (int)Constants.RegionSize; } } | 62 | public int coordY { get { return (int)Util.WorldToRegionLoc((uint)posY); } } |
63 | 63 | ||
64 | public Dictionary<string, object> Data; | 64 | public Dictionary<string, object> Data; |
65 | } | 65 | } |
diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs index d5dad8f..75446d1 100644 --- a/OpenSim/Framework/TerrainData.cs +++ b/OpenSim/Framework/TerrainData.cs | |||
@@ -408,8 +408,8 @@ namespace OpenSim.Framework | |||
408 | } | 408 | } |
409 | ClearTaint(); | 409 | ClearTaint(); |
410 | 410 | ||
411 | m_log.InfoFormat("{0} Read compressed 2d heightmap. Heightmap size=<{1},{2}>. Region size={<{3},{4}>. CompFact={5}", LogHeader, | 411 | m_log.InfoFormat("{0} Read compressed 2d heightmap. Heightmap size=<{1},{2}>. Region size=<{3},{4}>. CompFact={5}", |
412 | hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor); | 412 | LogHeader, hmSizeX, hmSizeY, SizeX, SizeY, hmCompressionFactor); |
413 | } | 413 | } |
414 | } | 414 | } |
415 | } | 415 | } |
diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs index 9bac739..266ccf0 100644 --- a/OpenSim/Framework/UserProfileData.cs +++ b/OpenSim/Framework/UserProfileData.cs | |||
@@ -160,15 +160,19 @@ namespace OpenSim.Framework | |||
160 | public virtual ulong HomeRegion | 160 | public virtual ulong HomeRegion |
161 | { | 161 | { |
162 | get | 162 | get |
163 | { | 163 | { |
164 | return Utils.UIntsToLong( | 164 | return Util.RegionWorldLocToHandle(Util.RegionToWorldLoc(m_homeRegionX), Util.RegionToWorldLoc(m_homeRegionY)); |
165 | m_homeRegionX * (uint)Constants.RegionSize, m_homeRegionY * (uint)Constants.RegionSize); | 165 | // return Utils.UIntsToLong( m_homeRegionX * (uint)Constants.RegionSize, m_homeRegionY * (uint)Constants.RegionSize); |
166 | } | 166 | } |
167 | 167 | ||
168 | set | 168 | set |
169 | { | 169 | { |
170 | m_homeRegionX = (uint) (value >> 40); | 170 | uint regionWorldLocX, regionWorldLocY; |
171 | m_homeRegionY = (((uint) (value)) >> 8); | 171 | Util.RegionHandleToWorldLoc(value, out regionWorldLocX, out regionWorldLocY); |
172 | m_homeRegionX = Util.WorldToRegionLoc(regionWorldLocX); | ||
173 | m_homeRegionY = Util.WorldToRegionLoc(regionWorldLocY); | ||
174 | // m_homeRegionX = (uint) (value >> 40); | ||
175 | // m_homeRegionY = (((uint) (value)) >> 8); | ||
172 | } | 176 | } |
173 | } | 177 | } |
174 | 178 | ||
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e8dfec1..105e75d 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -333,6 +333,43 @@ namespace OpenSim.Framework | |||
333 | return Utils.UIntsToLong(X, Y); | 333 | return Utils.UIntsToLong(X, Y); |
334 | } | 334 | } |
335 | 335 | ||
336 | // Regions are identified with a 'handle' made up of its region coordinates packed into a ulong. | ||
337 | // Several places rely on the ability to extract a region's location from its handle. | ||
338 | // Note the location is in 'world coordinates' (see below). | ||
339 | public static ulong RegionWorldLocToHandle(uint X, uint Y) | ||
340 | { | ||
341 | return Utils.UIntsToLong(X, Y); | ||
342 | } | ||
343 | |||
344 | public static void RegionHandleToWorldLoc(ulong handle, out uint X, out uint Y) | ||
345 | { | ||
346 | X = (uint)(handle >> 32); | ||
347 | Y = (uint)(handle & (ulong)uint.MaxValue); | ||
348 | } | ||
349 | |||
350 | public static void RegionHandleToRegionLoc(ulong handle, out uint X, out uint Y) | ||
351 | { | ||
352 | uint worldX, worldY; | ||
353 | RegionHandleToWorldLoc(handle, out worldX, out worldY); | ||
354 | X = WorldToRegionLoc(worldX); | ||
355 | Y = WorldToRegionLoc(worldY); | ||
356 | } | ||
357 | |||
358 | // A region location can be 'world coordinates' (meters from zero) or 'region coordinates' | ||
359 | // (number of regions from zero). This measurement of regions relies on the legacy 256 region size. | ||
360 | // These routines exist to make what is being converted explicit so the next person knows what was meant. | ||
361 | // Convert a region's 'world coordinate' to its 'region coordinate'. | ||
362 | public static uint WorldToRegionLoc(uint worldCoord) | ||
363 | { | ||
364 | return worldCoord / Constants.RegionSize; | ||
365 | } | ||
366 | |||
367 | // Convert a region's 'region coordinate' to its 'world coordinate'. | ||
368 | public static uint RegionToWorldLoc(uint regionCoord) | ||
369 | { | ||
370 | return regionCoord * Constants.RegionSize; | ||
371 | } | ||
372 | |||
336 | public static T Clamp<T>(T x, T min, T max) | 373 | public static T Clamp<T>(T x, T min, T max) |
337 | where T : IComparable<T> | 374 | where T : IComparable<T> |
338 | { | 375 | { |
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/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/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/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 64b3baf..99c7079 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1099,8 +1099,11 @@ 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); | 1102 | // uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize); |
1103 | uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize); | 1103 | // uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize); |
1104 | uint xcell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocX); | ||
1105 | uint ycell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocY); | ||
1106 | |||
1104 | //m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}", | 1107 | //m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}", |
1105 | // RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell); | 1108 | // RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell); |
1106 | 1109 | ||
@@ -1198,9 +1201,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1198 | else if (dir > 3 && dir < 7) // Heading Sout | 1201 | else if (dir > 3 && dir < 7) // Heading Sout |
1199 | neighboury--; | 1202 | neighboury--; |
1200 | 1203 | ||
1201 | int x = (int)(neighbourx * Constants.RegionSize); | 1204 | // int x = (int)(neighbourx * Constants.RegionSize); |
1202 | int y = (int)(neighboury * Constants.RegionSize); | 1205 | // int y = (int)(neighboury * Constants.RegionSize); |
1203 | GridRegion neighbourRegion = GridService.GetRegionByPosition(RegionInfo.ScopeID, x, y); | 1206 | uint x = Util.RegionToWorldLoc(neighbourx); |
1207 | uint y = Util.RegionToWorldLoc(neighboury); | ||
1208 | GridRegion neighbourRegion = GridService.GetRegionByPosition(RegionInfo.ScopeID, (int)x, (int)y); | ||
1204 | 1209 | ||
1205 | if (neighbourRegion == null) | 1210 | if (neighbourRegion == null) |
1206 | { | 1211 | { |
@@ -4293,7 +4298,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4293 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); | 4298 | "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); |
4294 | 4299 | ||
4295 | // TODO: This check should probably be in QueryAccess(). | 4300 | // TODO: This check should probably be in QueryAccess(). |
4296 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4301 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2); |
4297 | if (nearestParcel == null) | 4302 | if (nearestParcel == null) |
4298 | { | 4303 | { |
4299 | m_log.InfoFormat( | 4304 | m_log.InfoFormat( |
@@ -4600,13 +4605,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
4600 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); | 4605 | ScenePresence sp = GetScenePresence(remoteClient.AgentId); |
4601 | if (sp != null) | 4606 | if (sp != null) |
4602 | { | 4607 | { |
4608 | /* | ||
4603 | uint regionX = RegionInfo.LegacyRegionLocX; | 4609 | uint regionX = RegionInfo.LegacyRegionLocX; |
4604 | uint regionY = RegionInfo.LegacyRegionLocY; | 4610 | uint regionY = RegionInfo.LegacyRegionLocY; |
4605 | 4611 | ||
4612 | Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY); | ||
4606 | Utils.LongToUInts(regionHandle, out regionX, out regionY); | 4613 | Utils.LongToUInts(regionHandle, out regionX, out regionY); |
4607 | 4614 | ||
4608 | int shiftx = (int) regionX - (int) RegionInfo.LegacyRegionLocX * (int)Constants.RegionSize; | 4615 | int shiftx = (int) regionX - (int) RegionInfo.LegacyRegionLocX * (int)Constants.RegionSize; |
4609 | int shifty = (int) regionY - (int) RegionInfo.LegacyRegionLocY * (int)Constants.RegionSize; | 4616 | int shifty = (int) regionY - (int) RegionInfo.LegacyRegionLocY * (int)Constants.RegionSize; |
4617 | */ | ||
4618 | |||
4619 | uint regionX, regionY; | ||
4620 | Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY); | ||
4621 | |||
4622 | int shiftx = (int) regionX - (int)RegionInfo.RegionWorldLocX; | ||
4623 | int shifty = (int) regionY - (int)RegionInfo.RegionWorldLocY; | ||
4610 | 4624 | ||
4611 | position.X += shiftx; | 4625 | position.X += shiftx; |
4612 | position.Y += shifty; | 4626 | position.Y += shifty; |
@@ -4817,7 +4831,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4817 | else | 4831 | else |
4818 | { | 4832 | { |
4819 | 4833 | ||
4820 | if (pos.X > 0f && pos.X < Constants.RegionSize && pos.Y > 0f && pos.Y < Constants.RegionSize) | 4834 | if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY) |
4821 | { | 4835 | { |
4822 | // The only time parcel != null when an object is inside a region is when | 4836 | // The only time parcel != null when an object is inside a region is when |
4823 | // there is nothing behind the landchannel. IE, no land plugin loaded. | 4837 | // there is nothing behind the landchannel. IE, no land plugin loaded. |
@@ -5478,7 +5492,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5478 | { | 5492 | { |
5479 | Vector3 unitDirection = Vector3.Normalize(direction); | 5493 | Vector3 unitDirection = Vector3.Normalize(direction); |
5480 | //Making distance to search go through some sane limit of distance | 5494 | //Making distance to search go through some sane limit of distance |
5481 | for (float distance = 0; distance < Constants.RegionSize * 2; distance += .5f) | 5495 | for (float distance = 0; distance < Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY) * 2; distance += .5f) |
5482 | { | 5496 | { |
5483 | Vector3 testPos = Vector3.Add(pos, Vector3.Multiply(unitDirection, distance)); | 5497 | Vector3 testPos = Vector3.Add(pos, Vector3.Multiply(unitDirection, distance)); |
5484 | if (parcel.ContainsPoint((int)testPos.X, (int)testPos.Y)) | 5498 | if (parcel.ContainsPoint((int)testPos.X, (int)testPos.Y)) |
@@ -5532,9 +5546,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
5532 | int count = 0; | 5546 | int count = 0; |
5533 | int avgx = 0; | 5547 | int avgx = 0; |
5534 | int avgy = 0; | 5548 | int avgy = 0; |
5535 | for (int x = 0; x < Constants.RegionSize; x++) | 5549 | for (int x = 0; x < RegionInfo.RegionSizeX; x++) |
5536 | { | 5550 | { |
5537 | for (int y = 0; y < Constants.RegionSize; y++) | 5551 | for (int y = 0; y < RegionInfo.RegionSizeY; y++) |
5538 | { | 5552 | { |
5539 | //Just keep a running average as we check if all the points are inside or not | 5553 | //Just keep a running average as we check if all the points are inside or not |
5540 | if (parcel.ContainsPoint(x, y)) | 5554 | if (parcel.ContainsPoint(x, y)) |
@@ -5558,31 +5572,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
5558 | 5572 | ||
5559 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) | 5573 | private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) |
5560 | { | 5574 | { |
5561 | float xdistance = avatar.AbsolutePosition.X < Constants.RegionSize / 2 ? avatar.AbsolutePosition.X : Constants.RegionSize - avatar.AbsolutePosition.X; | 5575 | float xdistance = avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2 |
5562 | float ydistance = avatar.AbsolutePosition.Y < Constants.RegionSize / 2 ? avatar.AbsolutePosition.Y : Constants.RegionSize - avatar.AbsolutePosition.Y; | 5576 | ? avatar.AbsolutePosition.X : RegionInfo.RegionSizeX - avatar.AbsolutePosition.X; |
5577 | float ydistance = avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2 | ||
5578 | ? avatar.AbsolutePosition.Y : RegionInfo.RegionSizeY - avatar.AbsolutePosition.Y; | ||
5563 | 5579 | ||
5564 | //find out what vertical edge to go to | 5580 | //find out what vertical edge to go to |
5565 | if (xdistance < ydistance) | 5581 | if (xdistance < ydistance) |
5566 | { | 5582 | { |
5567 | if (avatar.AbsolutePosition.X < Constants.RegionSize / 2) | 5583 | if (avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2) |
5568 | { | 5584 | { |
5569 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, 0.0f, avatar.AbsolutePosition.Y); | 5585 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, 0.0f, avatar.AbsolutePosition.Y); |
5570 | } | 5586 | } |
5571 | else | 5587 | else |
5572 | { | 5588 | { |
5573 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, Constants.RegionSize, avatar.AbsolutePosition.Y); | 5589 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, RegionInfo.RegionSizeY, avatar.AbsolutePosition.Y); |
5574 | } | 5590 | } |
5575 | } | 5591 | } |
5576 | //find out what horizontal edge to go to | 5592 | //find out what horizontal edge to go to |
5577 | else | 5593 | else |
5578 | { | 5594 | { |
5579 | if (avatar.AbsolutePosition.Y < Constants.RegionSize / 2) | 5595 | if (avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2) |
5580 | { | 5596 | { |
5581 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, 0.0f); | 5597 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, 0.0f); |
5582 | } | 5598 | } |
5583 | else | 5599 | else |
5584 | { | 5600 | { |
5585 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, Constants.RegionSize); | 5601 | return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, RegionInfo.RegionSizeY); |
5586 | } | 5602 | } |
5587 | } | 5603 | } |
5588 | } | 5604 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 77889fa..262b882 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -92,7 +92,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
92 | { | 92 | { |
93 | m_log.DebugFormat( | 93 | m_log.DebugFormat( |
94 | "[SCENE COMMUNICATION SERVICE]: Region {0} successfully informed neighbour {1} at {2}-{3} that it is up", | 94 | "[SCENE COMMUNICATION SERVICE]: Region {0} successfully informed neighbour {1} at {2}-{3} that it is up", |
95 | m_scene.Name, neighbour.RegionName, x / Constants.RegionSize, y / Constants.RegionSize); | 95 | m_scene.Name, neighbour.RegionName, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y)); |
96 | 96 | ||
97 | m_scene.EventManager.TriggerOnRegionUp(neighbour); | 97 | m_scene.EventManager.TriggerOnRegionUp(neighbour); |
98 | } | 98 | } |
@@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
100 | { | 100 | { |
101 | m_log.WarnFormat( | 101 | m_log.WarnFormat( |
102 | "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.", | 102 | "[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.", |
103 | m_scene.Name, x / Constants.RegionSize, y / Constants.RegionSize); | 103 | m_scene.Name, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y)); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 297ee5f..2c64c85 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -707,9 +707,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
707 | foreach (ulong handle in seeds.Keys) | 707 | foreach (ulong handle in seeds.Keys) |
708 | { | 708 | { |
709 | uint x, y; | 709 | uint x, y; |
710 | Utils.LongToUInts(handle, out x, out y); | 710 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
711 | x = x / Constants.RegionSize; | 711 | |
712 | y = y / Constants.RegionSize; | ||
713 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.LegacyRegionLocX, y, Scene.RegionInfo.LegacyRegionLocY)) | 712 | if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.LegacyRegionLocX, y, Scene.RegionInfo.LegacyRegionLocY)) |
714 | { | 713 | { |
715 | old.Add(handle); | 714 | old.Add(handle); |
@@ -731,9 +730,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
731 | foreach (KeyValuePair<ulong, string> kvp in KnownRegions) | 730 | foreach (KeyValuePair<ulong, string> kvp in KnownRegions) |
732 | { | 731 | { |
733 | uint x, y; | 732 | uint x, y; |
734 | Utils.LongToUInts(kvp.Key, out x, out y); | 733 | Util.RegionHandleToRegionLoc(kvp.Key, out x, out y); |
735 | x = x / Constants.RegionSize; | ||
736 | y = y / Constants.RegionSize; | ||
737 | m_log.Info(" >> "+x+", "+y+": "+kvp.Value); | 734 | m_log.Info(" >> "+x+", "+y+": "+kvp.Value); |
738 | } | 735 | } |
739 | } | 736 | } |
@@ -971,7 +968,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
971 | 968 | ||
972 | float posZLimit = 0; | 969 | float posZLimit = 0; |
973 | 970 | ||
974 | if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) | 971 | if (pos.X < m_scene.RegionInfo.RegionSizeX && pos.Y < m_scene.RegionInfo.RegionSizeY) |
975 | posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; | 972 | posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; |
976 | 973 | ||
977 | float newPosZ = posZLimit + localAVHeight / 2; | 974 | float newPosZ = posZLimit + localAVHeight / 2; |
@@ -2076,7 +2073,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2076 | if (regionCombinerModule != null) | 2073 | if (regionCombinerModule != null) |
2077 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); | 2074 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); |
2078 | else | 2075 | else |
2079 | regionSize = new Vector2(Constants.RegionSize); | 2076 | regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY); |
2080 | 2077 | ||
2081 | if (pos.X < 0 || pos.X >= regionSize.X | 2078 | if (pos.X < 0 || pos.X >= regionSize.X |
2082 | || pos.Y < 0 || pos.Y >= regionSize.Y | 2079 | || pos.Y < 0 || pos.Y >= regionSize.Y |
@@ -2106,7 +2103,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2106 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) | 2103 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) |
2107 | targetScene = m_scene; | 2104 | targetScene = m_scene; |
2108 | 2105 | ||
2109 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)]; | 2106 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; |
2110 | pos.Z = Math.Max(terrainHeight, pos.Z); | 2107 | pos.Z = Math.Max(terrainHeight, pos.Z); |
2111 | 2108 | ||
2112 | // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is | 2109 | // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is |
@@ -3199,11 +3196,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3199 | Vector3 pos = AbsolutePosition; | 3196 | Vector3 pos = AbsolutePosition; |
3200 | if (AbsolutePosition.X < 0) | 3197 | if (AbsolutePosition.X < 0) |
3201 | pos.X += Velocity.X * 2; | 3198 | pos.X += Velocity.X * 2; |
3202 | else if (AbsolutePosition.X > Constants.RegionSize) | 3199 | else if (AbsolutePosition.X > m_scene.RegionInfo.RegionSizeX) |
3203 | pos.X -= Velocity.X * 2; | 3200 | pos.X -= Velocity.X * 2; |
3204 | if (AbsolutePosition.Y < 0) | 3201 | if (AbsolutePosition.Y < 0) |
3205 | pos.Y += Velocity.Y * 2; | 3202 | pos.Y += Velocity.Y * 2; |
3206 | else if (AbsolutePosition.Y > Constants.RegionSize) | 3203 | else if (AbsolutePosition.Y > m_scene.RegionInfo.RegionSizeY) |
3207 | pos.Y -= Velocity.Y * 2; | 3204 | pos.Y -= Velocity.Y * 2; |
3208 | Velocity = Vector3.Zero; | 3205 | Velocity = Vector3.Zero; |
3209 | AbsolutePosition = pos; | 3206 | AbsolutePosition = pos; |
@@ -3226,11 +3223,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3226 | Vector3 pos = AbsolutePosition; | 3223 | Vector3 pos = AbsolutePosition; |
3227 | if (AbsolutePosition.X < 0) | 3224 | if (AbsolutePosition.X < 0) |
3228 | pos.X += Velocity.X * 2; | 3225 | pos.X += Velocity.X * 2; |
3229 | else if (AbsolutePosition.X > Constants.RegionSize) | 3226 | else if (AbsolutePosition.X > m_scene.RegionInfo.RegionSizeX) |
3230 | pos.X -= Velocity.X * 2; | 3227 | pos.X -= Velocity.X * 2; |
3231 | if (AbsolutePosition.Y < 0) | 3228 | if (AbsolutePosition.Y < 0) |
3232 | pos.Y += Velocity.Y * 2; | 3229 | pos.Y += Velocity.Y * 2; |
3233 | else if (AbsolutePosition.Y > Constants.RegionSize) | 3230 | else if (AbsolutePosition.Y > m_scene.RegionInfo.RegionSizeY) |
3234 | pos.Y -= Velocity.Y * 2; | 3231 | pos.Y -= Velocity.Y * 2; |
3235 | Velocity = Vector3.Zero; | 3232 | Velocity = Vector3.Zero; |
3236 | AbsolutePosition = pos; | 3233 | AbsolutePosition = pos; |
@@ -3279,7 +3276,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3279 | 3276 | ||
3280 | // Put the child agent back at the center | 3277 | // Put the child agent back at the center |
3281 | AbsolutePosition | 3278 | AbsolutePosition |
3282 | = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); | 3279 | = new Vector3(((float)m_scene.RegionInfo.RegionSizeX * 0.5f), ((float)m_scene.RegionInfo.RegionSizeY * 0.5f), 70); |
3283 | 3280 | ||
3284 | Animator.ResetAnimations(); | 3281 | Animator.ResetAnimations(); |
3285 | } | 3282 | } |
@@ -3306,9 +3303,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3306 | if (handle != Scene.RegionInfo.RegionHandle) | 3303 | if (handle != Scene.RegionInfo.RegionHandle) |
3307 | { | 3304 | { |
3308 | uint x, y; | 3305 | uint x, y; |
3309 | Utils.LongToUInts(handle, out x, out y); | 3306 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
3310 | x = x / Constants.RegionSize; | ||
3311 | y = y / Constants.RegionSize; | ||
3312 | 3307 | ||
3313 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | 3308 | // m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); |
3314 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | 3309 | // m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); |
@@ -3389,8 +3384,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3389 | return; | 3384 | return; |
3390 | 3385 | ||
3391 | //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); | 3386 | //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); |
3392 | int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; | 3387 | // Find the distance (in meters) between the two regions |
3393 | int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; | 3388 | uint shiftx = Util.RegionToWorldLoc(rRegionX - tRegionX); |
3389 | uint shifty = Util.RegionToWorldLoc(rRegionY - tRegionY); | ||
3394 | 3390 | ||
3395 | Vector3 offset = new Vector3(shiftx, shifty, 0f); | 3391 | Vector3 offset = new Vector3(shiftx, shifty, 0f); |
3396 | 3392 | ||
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index 03499e8..a5b42ff 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs | |||
@@ -264,7 +264,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | byte[] dataArray = (byte[])serializer.Deserialize(xmlReader); | 264 | byte[] dataArray = (byte[])serializer.Deserialize(xmlReader); |
265 | int index = 0; | 265 | int index = 0; |
266 | 266 | ||
267 | m_terrainData = new HeightmapTerrainData((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); | 267 | m_terrainData = new HeightmapTerrainData(Height, Width, (int)Constants.RegionHeight); |
268 | 268 | ||
269 | for (int y = 0; y < Height; y++) | 269 | for (int y = 0; y < Height; y++) |
270 | { | 270 | { |
diff --git a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs index 5ecde87..ced62e2 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | |||
@@ -194,7 +194,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
194 | 194 | ||
195 | int wbits; | 195 | int wbits; |
196 | int[] patch = CompressPatch(patchData, header, 10, out wbits); | 196 | int[] patch = CompressPatch(patchData, header, 10, out wbits); |
197 | wbits = EncodePatchHeader(output, header, patch, Constants.RegionSize, Constants.RegionSize, wbits); | 197 | wbits = EncodePatchHeader(output, header, patch, (uint)pRegionSizeX, (uint)pRegionSizeY, wbits); |
198 | EncodePatch(output, patch, 0, wbits); | 198 | EncodePatch(output, patch, 0, wbits); |
199 | } | 199 | } |
200 | 200 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index c550c44..3317b21 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs | |||
@@ -169,7 +169,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
169 | c.Channel = m_channelNotify; | 169 | c.Channel = m_channelNotify; |
170 | c.Message += numScriptsFailed.ToString() + "," + message; | 170 | c.Message += numScriptsFailed.ToString() + "," + message; |
171 | c.Type = ChatTypeEnum.Region; | 171 | c.Type = ChatTypeEnum.Region; |
172 | c.Position = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30); | 172 | if (m_scene != null) |
173 | c.Position = new Vector3((m_scene.RegionInfo.RegionSizeX * 0.5f), (m_scene.RegionInfo.RegionSizeY * 0.5f), 30); | ||
174 | else | ||
175 | c.Position = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30); | ||
173 | c.Sender = null; | 176 | c.Sender = null; |
174 | c.SenderUUID = UUID.Zero; | 177 | c.SenderUUID = UUID.Zero; |
175 | c.Scene = m_scene; | 178 | c.Scene = m_scene; |
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 8144870..e4a3382 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs | |||
@@ -748,8 +748,8 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
748 | position.X = s_tree.AbsolutePosition.X + (float)randX; | 748 | position.X = s_tree.AbsolutePosition.X + (float)randX; |
749 | position.Y = s_tree.AbsolutePosition.Y + (float)randY; | 749 | position.Y = s_tree.AbsolutePosition.Y + (float)randY; |
750 | 750 | ||
751 | if (position.X <= ((int)Constants.RegionSize - 1) && position.X >= 0 && | 751 | if (position.X <= (m_scene.RegionInfo.RegionSizeX - 1) && position.X >= 0 && |
752 | position.Y <= ((int)Constants.RegionSize - 1) && position.Y >= 0 && | 752 | position.Y <= (m_scene.RegionInfo.RegionSizeY - 1) && position.Y >= 0 && |
753 | Util.GetDistanceTo(position, copse.m_seed_point) <= copse.m_range) | 753 | Util.GetDistanceTo(position, copse.m_seed_point) <= copse.m_range) |
754 | { | 754 | { |
755 | UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; | 755 | UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; |
diff --git a/OpenSim/Region/RegionCombinerModule/RegionConnections.cs b/OpenSim/Region/RegionCombinerModule/RegionConnections.cs index fba51d2..62a3a91 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionConnections.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionConnections.cs | |||
@@ -64,12 +64,12 @@ namespace OpenSim.Region.RegionCombinerModule | |||
64 | /// <summary> | 64 | /// <summary> |
65 | /// The X meters position of this connection. | 65 | /// The X meters position of this connection. |
66 | /// </summary> | 66 | /// </summary> |
67 | public uint PosX { get { return X * Constants.RegionSize; } } | 67 | public uint PosX { get { return Util.RegionToWorldLoc(X); } } |
68 | 68 | ||
69 | /// <summary> | 69 | /// <summary> |
70 | /// The Y meters co-ordinate of this connection. | 70 | /// The Y meters co-ordinate of this connection. |
71 | /// </summary> | 71 | /// </summary> |
72 | public uint PosY { get { return Y * Constants.RegionSize; } } | 72 | public uint PosY { get { return Util.RegionToWorldLoc(Y); } } |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// The size of the megaregion in meters. | 75 | /// The size of the megaregion in meters. |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 44a0165..f46bdf3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2107,7 +2107,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2107 | // | 2107 | // |
2108 | // This workaround is to prevent silent failure of this function. | 2108 | // This workaround is to prevent silent failure of this function. |
2109 | // According to the specification on the SL Wiki, providing a position outside of the | 2109 | // According to the specification on the SL Wiki, providing a position outside of the |
2110 | if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize) | 2110 | if (pos.x < 0 || pos.x > World.RegionInfo.RegionSizeX || pos.y < 0 || pos.y > World.RegionInfo.RegionSizeY) |
2111 | { | 2111 | { |
2112 | return 0; | 2112 | return 0; |
2113 | } | 2113 | } |
@@ -2117,9 +2117,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2117 | m_host.ParentGroup.IsAttachment || // return FALSE if attachment | 2117 | m_host.ParentGroup.IsAttachment || // return FALSE if attachment |
2118 | ( | 2118 | ( |
2119 | pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. | 2119 | pos.x < -10.0 || // return FALSE if more than 10 meters into a west-adjacent region. |
2120 | pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region. | 2120 | pos.x > (World.RegionInfo.RegionSizeX + 10) || // return FALSE if more than 10 meters into a east-adjacent region. |
2121 | pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. | 2121 | pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region. |
2122 | pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region. | 2122 | pos.y > (World.RegionInfo.RegionSizeY + 10) || // return FALSE if more than 10 meters into a north-adjacent region. |
2123 | pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m | 2123 | pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m |
2124 | ) | 2124 | ) |
2125 | ) | 2125 | ) |
@@ -5625,7 +5625,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5625 | LSL_Float mag; | 5625 | LSL_Float mag; |
5626 | if (dir.x > 0) | 5626 | if (dir.x > 0) |
5627 | { | 5627 | { |
5628 | mag = (Constants.RegionSize - pos.x) / dir.x; | 5628 | mag = (World.RegionInfo.RegionSizeX - pos.x) / dir.x; |
5629 | } | 5629 | } |
5630 | else | 5630 | else |
5631 | { | 5631 | { |
@@ -5636,7 +5636,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5636 | 5636 | ||
5637 | edge.y = pos.y + (dir.y * mag); | 5637 | edge.y = pos.y + (dir.y * mag); |
5638 | 5638 | ||
5639 | if (edge.y > Constants.RegionSize || edge.y < 0) | 5639 | if (edge.y > World.RegionInfo.RegionSizeY || edge.y < 0) |
5640 | { | 5640 | { |
5641 | // Y goes out of bounds first | 5641 | // Y goes out of bounds first |
5642 | edge.y = dir.y / Math.Abs(dir.y); | 5642 | edge.y = dir.y / Math.Abs(dir.y); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index f4d5562..4fb0856 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -450,7 +450,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
450 | { | 450 | { |
451 | m_host.AddScriptLPS(1); | 451 | m_host.AddScriptLPS(1); |
452 | 452 | ||
453 | if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) | 453 | if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) |
454 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); | 454 | OSSLError("osSetTerrainHeight: Coordinate out of bounds"); |
455 | 455 | ||
456 | if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) | 456 | if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) |
@@ -480,7 +480,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
480 | private LSL_Float GetTerrainHeight(int x, int y) | 480 | private LSL_Float GetTerrainHeight(int x, int y) |
481 | { | 481 | { |
482 | m_host.AddScriptLPS(1); | 482 | m_host.AddScriptLPS(1); |
483 | if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) | 483 | if (x > (World.RegionInfo.RegionSizeX - 1) || x < 0 || y > (World.RegionInfo.RegionSizeY - 1) || y < 0) |
484 | OSSLError("osGetTerrainHeight: Coordinate out of bounds"); | 484 | OSSLError("osGetTerrainHeight: Coordinate out of bounds"); |
485 | 485 | ||
486 | return World.Heightmap[x, y]; | 486 | return World.Heightmap[x, y]; |
@@ -814,7 +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 | 819 | ||
819 | m_host.AddScriptLPS(1); | 820 | m_host.AddScriptLPS(1); |
820 | 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 c9902e4..e3f3fc7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -721,8 +721,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
721 | Position.y = ((int)Constants.RegionSize - 1); | 721 | Position.y = ((int)Constants.RegionSize - 1); |
722 | if (Position.y < 0) | 722 | if (Position.y < 0) |
723 | Position.y = 0; | 723 | Position.y = 0; |
724 | if (Position.z > 768) | 724 | if (Position.z > Constants.RegionHeight) |
725 | Position.z = 768; | 725 | Position.z = Constants.RegionHeight; |
726 | if (Position.z < 0) | 726 | if (Position.z < 0) |
727 | Position.z = 0; | 727 | Position.z = 0; |
728 | prim.OSSL.llSetPos(Position); | 728 | prim.OSSL.llSetPos(Position); |
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index a830f17..e1a3cef 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -168,12 +168,12 @@ namespace OpenSim.Services.Interfaces | |||
168 | /// <summary> | 168 | /// <summary> |
169 | /// The co-ordinate of this region. | 169 | /// The co-ordinate of this region. |
170 | /// </summary> | 170 | /// </summary> |
171 | public int RegionCoordX { get { return RegionLocX / (int)Constants.RegionSize; } } | 171 | public int RegionCoordX { get { return (int)Util.WorldToRegionLoc((uint)RegionLocX); } } |
172 | 172 | ||
173 | /// <summary> | 173 | /// <summary> |
174 | /// The co-ordinate of this region | 174 | /// The co-ordinate of this region |
175 | /// </summary> | 175 | /// </summary> |
176 | public int RegionCoordY { get { return RegionLocY / (int)Constants.RegionSize; } } | 176 | public int RegionCoordY { get { return (int)Util.WorldToRegionLoc((uint)RegionLocY); } } |
177 | 177 | ||
178 | /// <summary> | 178 | /// <summary> |
179 | /// The location of this region in meters. | 179 | /// The location of this region in meters. |
@@ -246,8 +246,8 @@ namespace OpenSim.Services.Interfaces | |||
246 | 246 | ||
247 | public GridRegion(uint xcell, uint ycell) | 247 | public GridRegion(uint xcell, uint ycell) |
248 | { | 248 | { |
249 | m_regionLocX = (int)(xcell * Constants.RegionSize); | 249 | m_regionLocX = (int)Util.RegionToWorldLoc(xcell); |
250 | m_regionLocY = (int)(ycell * Constants.RegionSize); | 250 | m_regionLocY = (int)Util.RegionToWorldLoc(ycell); |
251 | RegionSizeX = (int)Constants.RegionSize; | 251 | RegionSizeX = (int)Constants.RegionSize; |
252 | RegionSizeY = (int)Constants.RegionSize; | 252 | RegionSizeY = (int)Constants.RegionSize; |
253 | } | 253 | } |
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index f96480c..ff51f09 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -362,7 +362,9 @@ 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; | 365 | // int x = 1000 * (int)Constants.RegionSize, y = 1000 * (int)Constants.RegionSize; |
366 | int x = (int)Util.RegionToWorldLoc(1000); | ||
367 | int y = (int)Util.RegionToWorldLoc(1000); | ||
366 | if (home != null) | 368 | if (home != null) |
367 | { | 369 | { |
368 | x = home.RegionLocX; | 370 | x = home.RegionLocX; |
@@ -436,10 +438,23 @@ namespace OpenSim.Services.LLLoginService | |||
436 | ErrorReason = "key"; | 438 | ErrorReason = "key"; |
437 | welcomeMessage = "Welcome to OpenSim!"; | 439 | welcomeMessage = "Welcome to OpenSim!"; |
438 | seedCapability = String.Empty; | 440 | seedCapability = String.Empty; |
439 | home = "{'region_handle':[r" + (1000*Constants.RegionSize).ToString() + ",r" + (1000*Constants.RegionSize).ToString() + "], 'position':[r" + | 441 | home = "{'region_handle':[r" |
440 | userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" + | 442 | + Util.RegionToWorldLoc(1000).ToString() |
441 | userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" + | 443 | + ",r" |
442 | userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}"; | 444 | + Util.RegionToWorldLoc(1000).ToString() |
445 | + "], 'position':[r" | ||
446 | + userProfile.homepos.X.ToString() | ||
447 | + ",r" | ||
448 | + userProfile.homepos.Y.ToString() | ||
449 | + ",r" | ||
450 | + userProfile.homepos.Z.ToString() | ||
451 | + "], 'look_at':[r" | ||
452 | + userProfile.homelookat.X.ToString() | ||
453 | + ",r" | ||
454 | + userProfile.homelookat.Y.ToString() | ||
455 | + ",r" | ||
456 | + userProfile.homelookat.Z.ToString() | ||
457 | + "]}"; | ||
443 | lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; | 458 | lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; |
444 | RegionX = (uint) 255232; | 459 | RegionX = (uint) 255232; |
445 | RegionY = (uint) 254976; | 460 | RegionY = (uint) 254976; |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index e2f9966..150c2c0 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -684,7 +684,7 @@ namespace OpenSim.Services.LLLoginService | |||
684 | private GridRegion FindAlternativeRegion(UUID scopeID) | 684 | private GridRegion FindAlternativeRegion(UUID scopeID) |
685 | { | 685 | { |
686 | List<GridRegion> hyperlinks = null; | 686 | List<GridRegion> hyperlinks = null; |
687 | List<GridRegion> regions = m_GridService.GetFallbackRegions(scopeID, 1000 * (int)Constants.RegionSize, 1000 * (int)Constants.RegionSize); | 687 | List<GridRegion> regions = m_GridService.GetFallbackRegions(scopeID, (int)Util.RegionToWorldLoc(1000), (int)Util.RegionToWorldLoc(1000)); |
688 | if (regions != null && regions.Count > 0) | 688 | if (regions != null && regions.Count > 0) |
689 | { | 689 | { |
690 | hyperlinks = m_GridService.GetHyperlinks(scopeID); | 690 | hyperlinks = m_GridService.GetHyperlinks(scopeID); |
diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs index 52a17e7..049200c 100644 --- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs | |||
@@ -69,9 +69,7 @@ namespace OpenSim.Tests.Common | |||
69 | tc.OnTestClientInformClientOfNeighbour += (neighbourHandle, neighbourExternalEndPoint) => | 69 | tc.OnTestClientInformClientOfNeighbour += (neighbourHandle, neighbourExternalEndPoint) => |
70 | { | 70 | { |
71 | uint x, y; | 71 | uint x, y; |
72 | Utils.LongToUInts(neighbourHandle, out x, out y); | 72 | Util.RegionHandleToRegionLoc(neighbourHandle, out x, out y); |
73 | x /= Constants.RegionSize; | ||
74 | y /= Constants.RegionSize; | ||
75 | 73 | ||
76 | m_log.DebugFormat( | 74 | m_log.DebugFormat( |
77 | "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", | 75 | "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", |
@@ -104,9 +102,7 @@ namespace OpenSim.Tests.Common | |||
104 | += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) => | 102 | += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) => |
105 | { | 103 | { |
106 | uint x, y; | 104 | uint x, y; |
107 | Utils.LongToUInts(regionHandle, out x, out y); | 105 | Util.RegionHandleToRegionLoc(regionHandle, out x, out y); |
108 | x /= Constants.RegionSize; | ||
109 | y /= Constants.RegionSize; | ||
110 | 106 | ||
111 | m_log.DebugFormat( | 107 | m_log.DebugFormat( |
112 | "[TEST CLIENT]: Processing send region teleport for destination at {0},{1} at {2}", | 108 | "[TEST CLIENT]: Processing send region teleport for destination at {0},{1} at {2}", |