* Added some bounds checks to the sendLandUpdate packet to deal with agents coming in from foreign regions.
* Updated bounds-check of getLandObject to check for >= 256 rather than > 256.afrisby
parent
18e1e62f26
commit
39a3784b43
|
@ -209,7 +209,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
||||||
int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float)/Convert.ToDouble(4.0)));
|
int x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float)/Convert.ToDouble(4.0)));
|
||||||
int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float)/Convert.ToDouble(4.0)));
|
int y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float)/Convert.ToDouble(4.0)));
|
||||||
|
|
||||||
if (x > 63 || y > 63 || x < 0 || y < 0)
|
if (x >= 64 || y >= 64 || x < 0 || y < 0)
|
||||||
{
|
{
|
||||||
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ namespace OpenSim.Region.Environment.LandManagement
|
||||||
|
|
||||||
public Land getLandObject(int x, int y)
|
public Land getLandObject(int x, int y)
|
||||||
{
|
{
|
||||||
if (x > 256 || y > 256 || x < 0 || y < 0)
|
if (x >= 256 || y >= 256 || x < 0 || y < 0)
|
||||||
{
|
{
|
||||||
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
|
||||||
}
|
}
|
||||||
|
@ -535,8 +535,8 @@ namespace OpenSim.Region.Environment.LandManagement
|
||||||
|
|
||||||
public void sendLandUpdate(ScenePresence avatar)
|
public void sendLandUpdate(ScenePresence avatar)
|
||||||
{
|
{
|
||||||
Land over = getLandObject((int) Math.Round(avatar.AbsolutePosition.X),
|
Land over = getLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
|
||||||
(int) Math.Round(avatar.AbsolutePosition.Y));
|
(int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
|
||||||
|
|
||||||
if (over != null)
|
if (over != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue