diff options
author | Robert Adams | 2013-11-08 20:53:37 -0800 |
---|---|---|
committer | Robert Adams | 2013-11-08 20:53:37 -0800 |
commit | beeec1c46726a266edf5c8260f9cf4e4e6f91c8a (patch) | |
tree | ac749f4db4d4ee640bf9091b9684d2a36eedb284 /OpenSim/Region/Framework/Scenes | |
parent | varregion: Massive work to LandManagementModule and LandObject to (diff) | |
download | opensim-SC_OLD-beeec1c46726a266edf5c8260f9cf4e4e6f91c8a.zip opensim-SC_OLD-beeec1c46726a266edf5c8260f9cf4e4e6f91c8a.tar.gz opensim-SC_OLD-beeec1c46726a266edf5c8260f9cf4e4e6f91c8a.tar.bz2 opensim-SC_OLD-beeec1c46726a266edf5c8260f9cf4e4e6f91c8a.tar.xz |
varregion: elimination of Constants.RegionSize from all over OpenSimulator.
Routines in Util to compute region world coordinates from region coordinates
as well as the conversion to and from region handles. These routines have
replaced a lot of math scattered throughout the simulator.
Should be no functional changes.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
5 files changed, 51 insertions, 39 deletions
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 | ||