mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
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.
This commit is contained in:
@@ -269,9 +269,7 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||
foreach (KeyValuePair<ulong, string> kvp in m_childrenSeeds[agentID])
|
||||
{
|
||||
uint x, y;
|
||||
Utils.LongToUInts(kvp.Key, out x, out y);
|
||||
x = x / Constants.RegionSize;
|
||||
y = y / Constants.RegionSize;
|
||||
Util.RegionHandleToRegionLoc(kvp.Key, out x, out y);
|
||||
m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key);
|
||||
List<GridRegion> regions = kvp.Value.GetNeighbours();
|
||||
foreach (GridRegion r in regions)
|
||||
caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
|
||||
caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
return;
|
||||
|
||||
m_log.DebugFormat("[REGION CACHE]: (on region {0}) Region {1} is up @ {2}-{3}",
|
||||
m_scene.RegionInfo.RegionName, otherRegion.RegionName, otherRegion.RegionLocX / Constants.RegionSize, otherRegion.RegionLocY / Constants.RegionSize);
|
||||
m_scene.RegionInfo.RegionName, otherRegion.RegionName, Util.WorldToRegionLoc((uint)otherRegion.RegionLocX), Util.WorldToRegionLoc((uint)otherRegion.RegionLocY));
|
||||
|
||||
m_neighbours[otherRegion.RegionHandle] = otherRegion;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
{
|
||||
uint xsnap = (uint)(x / Constants.RegionSize) * Constants.RegionSize;
|
||||
uint ysnap = (uint)(y / Constants.RegionSize) * Constants.RegionSize;
|
||||
ulong handle = Utils.UIntsToLong(xsnap, ysnap);
|
||||
ulong handle = Util.RegionWorldLocToHandle(xsnap, ysnap);
|
||||
|
||||
if (m_neighbours.ContainsKey(handle))
|
||||
return m_neighbours[handle];
|
||||
|
||||
@@ -1571,10 +1571,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
float X = position.X;
|
||||
float Y = position.Y;
|
||||
|
||||
if (X > ((int)Constants.RegionSize - 1))
|
||||
X = ((int)Constants.RegionSize - 1);
|
||||
if (Y > ((int)Constants.RegionSize - 1))
|
||||
Y = ((int)Constants.RegionSize - 1);
|
||||
if (X > ((int)m_scene.RegionInfo.RegionSizeX - 1))
|
||||
X = ((int)m_scene.RegionInfo.RegionSizeX - 1);
|
||||
if (Y > ((int)m_scene.RegionInfo.RegionSizeY - 1))
|
||||
Y = ((int)m_scene.RegionInfo.RegionSizeY - 1);
|
||||
if (X < 0)
|
||||
X = 0;
|
||||
if (Y < 0)
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects
|
||||
for (y = 0; y < map.Height; y++)
|
||||
{
|
||||
map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 3, 0.25) * 10;
|
||||
double spherFac = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2, Constants.RegionSize / 2, 50) * 0.01;
|
||||
double spherFac = TerrainUtil.SphericalFactor(x, y, map.Width / 2, map.Height / 2, 50) * 0.01;
|
||||
if (map[x, y] < spherFac)
|
||||
{
|
||||
map[x, y] = spherFac;
|
||||
|
||||
Reference in New Issue
Block a user