mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 18:25:33 +08:00
varregion: many more updates removing the constant RegionSize and replacing
with a passed region size. This time in the map code and grid services code.
This commit is contained in:
@@ -1099,8 +1099,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns>True after all operations complete, throws exceptions otherwise.</returns>
|
||||
public override void OtherRegionUp(GridRegion otherRegion)
|
||||
{
|
||||
// uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize);
|
||||
// uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize);
|
||||
uint xcell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocX);
|
||||
uint ycell = Util.WorldToRegionLoc((uint)otherRegion.RegionLocY);
|
||||
|
||||
@@ -2450,9 +2448,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
int xx = (int)Math.Floor(pos.X);
|
||||
int yy = (int)Math.Floor(pos.Y);
|
||||
if (xx < 0
|
||||
|| xx > RegionInfo.RegionSizeX
|
||||
|| xx >= RegionInfo.RegionSizeX
|
||||
|| yy < 0
|
||||
|| yy > RegionInfo.RegionSizeY)
|
||||
|| yy >= RegionInfo.RegionSizeY)
|
||||
ret = false;
|
||||
return ret;
|
||||
|
||||
@@ -4581,53 +4579,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ScenePresence sp = GetScenePresence(remoteClient.AgentId);
|
||||
if (sp != null)
|
||||
{
|
||||
/*
|
||||
uint regionX = RegionInfo.LegacyRegionLocX;
|
||||
uint regionY = RegionInfo.LegacyRegionLocY;
|
||||
|
||||
Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY);
|
||||
Utils.LongToUInts(regionHandle, out regionX, out regionY);
|
||||
|
||||
int shiftx = (int) regionX - (int) RegionInfo.LegacyRegionLocX * (int)Constants.RegionSize;
|
||||
int shifty = (int) regionY - (int) RegionInfo.LegacyRegionLocY * (int)Constants.RegionSize;
|
||||
*/
|
||||
|
||||
uint regionX, regionY;
|
||||
Util.RegionHandleToWorldLoc(regionHandle, out regionX, out regionY);
|
||||
|
||||
int shiftx = (int) regionX - (int)RegionInfo.WorldLocX;
|
||||
int shifty = (int) regionY - (int)RegionInfo.WorldLocY;
|
||||
|
||||
position.X += shiftx;
|
||||
position.Y += shifty;
|
||||
|
||||
bool result = false;
|
||||
|
||||
if (TestBorderCross(position,Cardinals.N))
|
||||
result = true;
|
||||
|
||||
if (TestBorderCross(position, Cardinals.S))
|
||||
result = true;
|
||||
|
||||
if (TestBorderCross(position, Cardinals.E))
|
||||
result = true;
|
||||
|
||||
if (TestBorderCross(position, Cardinals.W))
|
||||
result = true;
|
||||
|
||||
// bordercross if position is outside of region
|
||||
|
||||
if (!result)
|
||||
{
|
||||
regionHandle = RegionInfo.RegionHandle;
|
||||
}
|
||||
else
|
||||
{
|
||||
// not in this region, undo the shift!
|
||||
position.X -= shiftx;
|
||||
position.Y -= shifty;
|
||||
}
|
||||
|
||||
if (EntityTransferModule != null)
|
||||
{
|
||||
EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
public abstract class SceneBase : IScene
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly string LogHeader = "[SCENE]";
|
||||
|
||||
#region Events
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
|
||||
Vector3 minScale = new Vector3(Constants.MaximumRegionSize, Constants.MaximumRegionSize, Constants.MaximumRegionSize);
|
||||
Vector3 maxScale = Vector3.Zero;
|
||||
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||
|
||||
@@ -517,14 +517,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
|
||||
|
||||
// Normalize
|
||||
if (val.X >= Constants.RegionSize)
|
||||
val.X -= Constants.RegionSize;
|
||||
if (val.Y >= Constants.RegionSize)
|
||||
val.Y -= Constants.RegionSize;
|
||||
if (val.X >= m_scene.RegionInfo.RegionSizeX)
|
||||
val.X -= m_scene.RegionInfo.RegionSizeX;
|
||||
if (val.Y >= m_scene.RegionInfo.RegionSizeY)
|
||||
val.Y -= m_scene.RegionInfo.RegionSizeY;
|
||||
if (val.X < 0)
|
||||
val.X += Constants.RegionSize;
|
||||
val.X += m_scene.RegionInfo.RegionSizeX;
|
||||
if (val.Y < 0)
|
||||
val.Y += Constants.RegionSize;
|
||||
val.Y += m_scene.RegionInfo.RegionSizeY;
|
||||
|
||||
// If it's deleted, crossing was successful
|
||||
if (IsDeleted)
|
||||
@@ -572,9 +572,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
Vector3 oldp = AbsolutePosition;
|
||||
val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f);
|
||||
val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f);
|
||||
val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f);
|
||||
val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f);
|
||||
val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f);
|
||||
val.Z = Util.Clamp<float>(oldp.Z, 0.5f, Constants.RegionHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user