Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim

remotes/origin/0.6.7-post-fixes
Justin Clark-Casey (justincc) 2009-09-08 17:50:45 +01:00
commit 2bb2a0ec44
3 changed files with 68 additions and 12 deletions

View File

@ -1620,8 +1620,24 @@ namespace OpenSim.Region.Framework.Scenes
{ {
UUID assetID = UUID.Zero; UUID assetID = UUID.Zero;
Vector3 inventoryStoredPosition = new Vector3
(((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
? 250
: objectGroup.AbsolutePosition.X)
,
(objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
? 250
: objectGroup.AbsolutePosition.X,
objectGroup.AbsolutePosition.Z);
Vector3 originalPosition = objectGroup.AbsolutePosition;
objectGroup.AbsolutePosition = inventoryStoredPosition;
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
objectGroup.AbsolutePosition = originalPosition;
// Get the user info of the item destination // Get the user info of the item destination
// //
UUID userID = UUID.Zero; UUID userID = UUID.Zero;
@ -1683,6 +1699,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// Deleting someone else's item // Deleting someone else's item
// //
if (remoteClient == null || if (remoteClient == null ||
objectGroup.OwnerID != remoteClient.AgentId) objectGroup.OwnerID != remoteClient.AgentId)
{ {
@ -1857,8 +1875,24 @@ namespace OpenSim.Region.Framework.Scenes
itemID = UUID.Zero; itemID = UUID.Zero;
if (grp != null) if (grp != null)
{ {
Vector3 inventoryStoredPosition = new Vector3
(((grp.AbsolutePosition.X > (int)Constants.RegionSize)
? 250
: grp.AbsolutePosition.X)
,
(grp.AbsolutePosition.X > (int)Constants.RegionSize)
? 250
: grp.AbsolutePosition.X,
grp.AbsolutePosition.Z);
Vector3 originalPosition = grp.AbsolutePosition;
grp.AbsolutePosition = inventoryStoredPosition;
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
grp.AbsolutePosition = originalPosition;
AssetBase asset = CreateAsset( AssetBase asset = CreateAsset(
grp.GetPartName(grp.LocalId), grp.GetPartName(grp.LocalId),
grp.GetPartDescription(grp.LocalId), grp.GetPartDescription(grp.LocalId),

View File

@ -4256,7 +4256,24 @@ namespace OpenSim.Region.Framework.Scenes
break; break;
case 2: // Sell a copy case 2: // Sell a copy
Vector3 inventoryStoredPosition = new Vector3
(((group.AbsolutePosition.X > (int)Constants.RegionSize)
? 250
: group.AbsolutePosition.X)
,
(group.AbsolutePosition.X > (int)Constants.RegionSize)
? 250
: group.AbsolutePosition.X,
group.AbsolutePosition.Z);
Vector3 originalPosition = group.AbsolutePosition;
group.AbsolutePosition = inventoryStoredPosition;
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
group.AbsolutePosition = originalPosition;
uint perms=group.GetEffectivePermissions(); uint perms=group.GetEffectivePermissions();

View File

@ -476,9 +476,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// normalize an angle between -PI and PI (-180 to +180 degrees) // normalize an angle between -PI and PI (-180 to +180 degrees)
protected double NormalizeAngle(double angle) protected double NormalizeAngle(double angle)
{ {
angle = angle % (Math.PI * 2); if (angle > -Math.PI && angle < Math.PI)
// if (angle < 0) angle = angle + Math.PI * 2; return angle;
return angle;
int numPis = (int)(Math.PI / angle);
double remainder = angle - Math.PI * numPis;
if (numPis % 2 == 1)
return Math.PI - angle;
return remainder;
} }
// Old implementation of llRot2Euler, now normalized // Old implementation of llRot2Euler, now normalized
@ -497,9 +502,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))), NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))),
NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)))); NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s))));
else if (n > 0) else if (n > 0)
return new LSL_Vector(0.0, Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
else else
return new LSL_Vector(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
} }
/* From wiki: /* From wiki:
@ -553,12 +558,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
double x,y,z,s; double x,y,z,s;
double c1 = Math.Cos(v.x/2.0); double c1 = Math.Cos(v.x * 0.5);
double c2 = Math.Cos(v.y/2.0); double c2 = Math.Cos(v.y * 0.5);
double c3 = Math.Cos(v.z/2.0); double c3 = Math.Cos(v.z * 0.5);
double s1 = Math.Sin(v.x/2.0); double s1 = Math.Sin(v.x * 0.5);
double s2 = Math.Sin(v.y/2.0); double s2 = Math.Sin(v.y * 0.5);
double s3 = Math.Sin(v.z/2.0); double s3 = Math.Sin(v.z * 0.5);
x = s1*c2*c3+c1*s2*s3; x = s1*c2*c3+c1*s2*s3;
y = c1*s2*c3-s1*c2*s3; y = c1*s2*c3-s1*c2*s3;