varregion: remove uses of region size constant. In particular, update scene

to check for border crossings based on the size of the region.
varregion
Robert Adams 2013-11-04 22:09:52 -08:00
parent ac94dc8a14
commit cd1a23fc14
3 changed files with 15 additions and 14 deletions

View File

@ -1033,7 +1033,7 @@ namespace OpenSim.Region.Framework.Scenes
BordersLocked = true; BordersLocked = true;
Border northBorder = new Border(); Border northBorder = new Border();
northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (float)RegionInfo.RegionSizeY); //<---
northBorder.CrossDirection = Cardinals.N; northBorder.CrossDirection = Cardinals.N;
NorthBorders.Add(northBorder); NorthBorders.Add(northBorder);
@ -1043,7 +1043,7 @@ namespace OpenSim.Region.Framework.Scenes
SouthBorders.Add(southBorder); SouthBorders.Add(southBorder);
Border eastBorder = new Border(); Border eastBorder = new Border();
eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- eastBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (float)RegionInfo.RegionSizeY); //<---
eastBorder.CrossDirection = Cardinals.E; eastBorder.CrossDirection = Cardinals.E;
EastBorders.Add(eastBorder); EastBorders.Add(eastBorder);
@ -3994,12 +3994,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (posX < 0) if (posX < 0)
posX = 0; posX = 0;
else if (posX >= 256) else if (posX >= (float)RegionInfo.RegionSizeX)
posX = 255.999f; posX = (float)RegionInfo.RegionSizeX - 0.001f;
if (posY < 0) if (posY < 0)
posY = 0; posY = 0;
else if (posY >= 256) else if (posY >= (float)RegionInfo.RegionSizeY)
posY = 255.999f; posY = (float)RegionInfo.RegionSizeY - 0.001f;
reason = String.Empty; reason = String.Empty;
if (Permissions.IsGod(agentID)) if (Permissions.IsGod(agentID))

View File

@ -842,9 +842,9 @@ namespace OpenSim.Region.Framework.Scenes
maxX = -256f; maxX = -256f;
maxY = -256f; maxY = -256f;
maxZ = -256f; maxZ = -256f;
minX = 256f; minX = 10000f;
minY = 256f; minY = 10000f;
minZ = 8192f; minZ = 10000f;
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)

View File

@ -376,18 +376,19 @@ public class BSPrim : BSPhysObject
{ {
bool ret = false; bool ret = false;
uint wayOutThere = Constants.RegionSize * Constants.RegionSize; int wayOverThere = -1000;
int wayOutThere = 10000;
// There have been instances of objects getting thrown way out of bounds and crashing // There have been instances of objects getting thrown way out of bounds and crashing
// the border crossing code. // the border crossing code.
if ( RawPosition.X < -Constants.RegionSize || RawPosition.X > wayOutThere if ( RawPosition.X < wayOverThere || RawPosition.X > wayOutThere
|| RawPosition.Y < -Constants.RegionSize || RawPosition.Y > wayOutThere || RawPosition.Y < wayOverThere || RawPosition.X > wayOutThere
|| RawPosition.Z < -Constants.RegionSize || RawPosition.Z > wayOutThere) || RawPosition.Z < wayOverThere || RawPosition.X > wayOutThere)
{ {
RawPosition = new OMV.Vector3(10, 10, 50); RawPosition = new OMV.Vector3(10, 10, 50);
ZeroMotion(inTaintTime); ZeroMotion(inTaintTime);
ret = true; ret = true;
} }
if (RawVelocity.LengthSquared() > BSParam.MaxLinearVelocity) if (RawVelocity.LengthSquared() > BSParam.MaxLinearVelocitySquared)
{ {
RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity); RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity);
ret = true; ret = true;