mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
From: Chris Yeoh (yeohc@au1.ibm.com)
Here's the patch that clamps llGround to using sane values avoiding runtime errors.
This commit is contained in:
@@ -937,6 +937,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
Vector3 pos = m_host.GetWorldPosition();
|
||||
int x = (int)(pos.X + offset.x);
|
||||
int y = (int)(pos.Y + offset.y);
|
||||
|
||||
// Clamp to valid position
|
||||
if (x<0)
|
||||
x = 0;
|
||||
else if (x>=World.Heightmap.Width)
|
||||
x = World.Heightmap.Width-1;
|
||||
if (y<0)
|
||||
y = 0;
|
||||
else if (y>=World.Heightmap.Height)
|
||||
y = World.Heightmap.Height-1;
|
||||
|
||||
|
||||
return World.GetLandHeight(x, y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user