Fix issue where avatar and script chat could sometimes be heard from anywhere in neighbouring regions.

This was due to a silent uint overflow in ScenePresence.UpdateChildAgent() corrupting child agent positions
when the child agent was in a region with a greater x or y map co-ord than the root agent region
Probably introduced in beeec1c.
This still will not function properly with very high region map co-ords (in the millions) but other parts of the code don't handle this properly anyway.
Looks to address http://opensimulator.org/mantis/view.php?id=7163
bullet-2.82
Justin Clark-Casey (justincc) 2014-05-20 23:48:10 +01:00
parent 5ec3429843
commit 9479f64778
1 changed files with 8 additions and 3 deletions

View File

@ -3777,10 +3777,15 @@ namespace OpenSim.Region.Framework.Scenes
if (!IsChildAgent)
return;
//m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY);
// m_log.DebugFormat(
// "[SCENE PRESENCE]: ChildAgentPositionUpdate for {0} in {1}, tRegion {2},{3}, rRegion {4},{5}, pos {6}",
// Name, Scene.Name, tRegionX, tRegionY, rRegionX, rRegionY, cAgentData.Position);
// Find the distance (in meters) between the two regions
uint shiftx = Util.RegionToWorldLoc(rRegionX - tRegionX);
uint shifty = Util.RegionToWorldLoc(rRegionY - tRegionY);
// XXX: We cannot use Util.RegionLocToHandle() here because a negative value will silently overflow the
// uint
int shiftx = (int)(((int)rRegionX - (int)tRegionX) * Constants.RegionSize);
int shifty = (int)(((int)rRegionY - (int)tRegionY) * Constants.RegionSize);
Vector3 offset = new Vector3(shiftx, shifty, 0f);