aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs25
1 files changed, 10 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2965903..82508ad 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -842,9 +842,8 @@ namespace OpenSim.Region.Framework.Scenes
842 foreach (ulong handle in seeds.Keys) 842 foreach (ulong handle in seeds.Keys)
843 { 843 {
844 uint x, y; 844 uint x, y;
845 Utils.LongToUInts(handle, out x, out y); 845 Util.RegionHandleToRegionLoc(handle, out x, out y);
846 x = x / Constants.RegionSize; 846
847 y = y / Constants.RegionSize;
848 if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) 847 if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY))
849 { 848 {
850 old.Add(handle); 849 old.Add(handle);
@@ -866,9 +865,7 @@ namespace OpenSim.Region.Framework.Scenes
866 foreach (KeyValuePair<ulong, string> kvp in KnownRegions) 865 foreach (KeyValuePair<ulong, string> kvp in KnownRegions)
867 { 866 {
868 uint x, y; 867 uint x, y;
869 Utils.LongToUInts(kvp.Key, out x, out y); 868 Util.RegionHandleToRegionLoc(kvp.Key, out x, out y);
870 x = x / Constants.RegionSize;
871 y = y / Constants.RegionSize;
872 m_log.Info(" >> "+x+", "+y+": "+kvp.Value); 869 m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
873 } 870 }
874 } 871 }
@@ -1189,7 +1186,7 @@ namespace OpenSim.Region.Framework.Scenes
1189 1186
1190 float posZLimit = 0; 1187 float posZLimit = 0;
1191 1188
1192 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) 1189 if (pos.X < m_scene.RegionInfo.RegionSizeX && pos.Y < m_scene.RegionInfo.RegionSizeY)
1193 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 1190 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
1194 1191
1195 float newPosZ = posZLimit + localAVHeight / 2; 1192 float newPosZ = posZLimit + localAVHeight / 2;
@@ -2595,7 +2592,7 @@ namespace OpenSim.Region.Framework.Scenes
2595 if (regionCombinerModule != null) 2592 if (regionCombinerModule != null)
2596 regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); 2593 regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
2597 else 2594 else
2598 regionSize = new Vector2(Constants.RegionSize); 2595 regionSize = new Vector2(m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
2599 2596
2600 if (pos.X < 0 || pos.X >= regionSize.X 2597 if (pos.X < 0 || pos.X >= regionSize.X
2601 || pos.Y < 0 || pos.Y >= regionSize.Y 2598 || pos.Y < 0 || pos.Y >= regionSize.Y
@@ -2613,8 +2610,8 @@ namespace OpenSim.Region.Framework.Scenes
2613// } 2610// }
2614 2611
2615 // Get terrain height for sub-region in a megaregion if necessary 2612 // Get terrain height for sub-region in a megaregion if necessary
2616 int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); 2613 int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X);
2617 int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); 2614 int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y);
2618 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); 2615 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y);
2619 // If X and Y is NaN, target_region will be null 2616 // If X and Y is NaN, target_region will be null
2620 if (target_region == null) 2617 if (target_region == null)
@@ -2625,7 +2622,7 @@ namespace OpenSim.Region.Framework.Scenes
2625 if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) 2622 if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene))
2626 targetScene = m_scene; 2623 targetScene = m_scene;
2627 2624
2628 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)]; 2625 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)];
2629 // dont try to land underground 2626 // dont try to land underground
2630 terrainHeight += Appearance.AvatarHeight / 2; 2627 terrainHeight += Appearance.AvatarHeight / 2;
2631 pos.Z = Math.Max(terrainHeight, pos.Z); 2628 pos.Z = Math.Max(terrainHeight, pos.Z);
@@ -3941,7 +3938,7 @@ namespace OpenSim.Region.Framework.Scenes
3941 3938
3942 // Put the child agent back at the center 3939 // Put the child agent back at the center
3943 AbsolutePosition 3940 AbsolutePosition
3944 = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); 3941 = new Vector3(((float)m_scene.RegionInfo.RegionSizeX * 0.5f), ((float)m_scene.RegionInfo.RegionSizeY * 0.5f), 70);
3945 3942
3946 Animator.ResetAnimations(); 3943 Animator.ResetAnimations();
3947 } 3944 }
@@ -3968,9 +3965,7 @@ namespace OpenSim.Region.Framework.Scenes
3968 if (handle != Scene.RegionInfo.RegionHandle) 3965 if (handle != Scene.RegionInfo.RegionHandle)
3969 { 3966 {
3970 uint x, y; 3967 uint x, y;
3971 Utils.LongToUInts(handle, out x, out y); 3968 Util.RegionHandleToRegionLoc(handle, out x, out y);
3972 x = x / Constants.RegionSize;
3973 y = y / Constants.RegionSize;
3974 3969
3975// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); 3970// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
3976// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); 3971// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));