From 8f0db68424af54ca42928216224d1172b266250e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 20 Nov 2009 18:39:39 +0000 Subject: Fix http://opensimulator.org/mantis/view.php?id=3874 - parenthesis in for statements cause script compile failures This fixes a problem in OpenSim where statements of the form for ((i = 0); (i < 10); (++i)) { ... } do not compile even though they are valid lsl. --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- .../ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2e15b86..a430b1e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1266,7 +1266,7 @@ namespace OpenSim.Region.Framework.Scenes // allocations, and there is no more work to be done until someone logs in GC.Collect(); - m_log.DebugFormat("[REGION]: Enabling Logins for {0}", RegionInfo.RegionName); + m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); loginsdisabled = false; } } diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index 41ecfd3..e427f50 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs @@ -722,8 +722,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools if (fls.kids.Top is IdentExpression && 1 == fls.kids.Count) return retstr; - foreach (SYMBOL s in fls.kids) + for (int i = 0; i < fls.kids.Count; i++) { + SYMBOL s = (SYMBOL)fls.kids[i]; + + // Statements surrounded by parentheses in for loops + // + // e.g. for ((i = 0), (j = 7); (i < 10); (++i)) + // + // are legal in LSL but not in C# so we need to discard the parentheses + // + // The following, however, does not appear to be legal in LLS + // + // for ((i = 0, j = 7); (i < 10); (++i)) + // + // As of Friday 20th November 2009, the Linden Lab simulators appear simply never to compile or run this + // script but with no debug or warnings at all! Therefore, we won't deal with this yet (which looks + // like it would be considerably more complicated to handle). + while (s is ParenthesisExpression) + s = (SYMBOL)s.kids.Pop(); + retstr += GenerateNode(s); if (0 < comma--) retstr += Generate(", "); -- cgit v1.1 From 0ffda7128e67a217bb494355d454ff0bd62e6bb5 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 21 Nov 2009 04:33:34 -0500 Subject: * Fixes one of two terse update issues. There's still one left, but this one fixes the situation where the object on the server is moving but no updates are being sent. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 73d0984..7c236e8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2083,6 +2083,7 @@ namespace OpenSim.Region.Framework.Scenes { if (PhysActor != null) { + Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) @@ -2090,6 +2091,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.AbsolutePosition = newpos; return; } + //m_parentGroup.RootPart.m_groupPosition = newpos; } ScheduleTerseUpdate(); @@ -2428,6 +2430,7 @@ namespace OpenSim.Region.Framework.Scenes ClearUpdateSchedule(); } } + ClearUpdateSchedule(); } /// diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index fa42023..16f2d5d 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -2643,7 +2643,7 @@ Console.WriteLine(" JointCreateFixed"); //outofBounds = true; } -// float Adiff = 1.0f - Math.Abs(Quaternion.Dot(m_lastorientation, l_orientation)); + //float Adiff = 1.0f - Math.Abs(Quaternion.Dot(m_lastorientation, l_orientation)); //Console.WriteLine("Adiff " + m_primName + " = " + Adiff); if ((Math.Abs(m_lastposition.X - l_position.X) < 0.02) && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) @@ -2659,6 +2659,8 @@ Console.WriteLine(" JointCreateFixed"); { //m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString()); _zeroFlag = false; + m_lastUpdateSent = false; + //m_throttleUpdates = false; } if (_zeroFlag) @@ -2685,7 +2687,9 @@ Console.WriteLine(" JointCreateFixed"); m_rotationalVelocity = pv; if (_parent == null) + { base.RequestPhysicsterseUpdate(); + } m_lastUpdateSent = true; } @@ -2695,7 +2699,9 @@ Console.WriteLine(" JointCreateFixed"); if (lastZeroFlag != _zeroFlag) { if (_parent == null) + { base.RequestPhysicsterseUpdate(); + } } m_lastVelocity = _velocity; @@ -2728,7 +2734,9 @@ Console.WriteLine(" JointCreateFixed"); if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate) { if (_parent == null) + { base.RequestPhysicsterseUpdate(); + } } else { -- cgit v1.1 From 7760da1a4cb5bbccd218c90e311b41b8897f3e05 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 21 Nov 2009 04:39:41 -0500 Subject: * Fixes the second of two terse update issues. Physical objects should react normally again. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 + OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 3 +++ 2 files changed, 4 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7c236e8..6f1b458 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2398,6 +2398,7 @@ namespace OpenSim.Region.Framework.Scenes if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || !Acceleration.Equals(m_lastAcceleration) || !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || + Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) || !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 16f2d5d..6f14f7b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -2357,6 +2357,9 @@ Console.WriteLine(" JointCreateFixed"); { // Averate previous velocity with the new one so // client object interpolation works a 'little' better + if (_zeroFlag) + return Vector3.Zero; + Vector3 returnVelocity = Vector3.Zero; returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2; -- cgit v1.1 From 247fc00ce7ea99db12334a281cb5fc7802bc024a Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 21 Nov 2009 06:39:28 -0500 Subject: * Hack to get avatar to land on prim. This is a big nasty hack that tricks the client into thinking you're landing on the terrain. There are some visual artifacts when you land. It's only temporary until we figure out how this broke. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1dedcf1..424c25b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -995,6 +995,8 @@ namespace OpenSim.Region.Framework.Scenes Animator.TrySetMovementAnimation("LAND"); SendFullUpdateToAllClients(); + ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, + AbsolutePosition, Velocity, -Vector3.UnitZ, m_bodyRot, Vector4.UnitW, m_uuid, null, GetUpdatePriority(ControllingClient))); } public void AddNeighbourRegion(ulong regionHandle, string cap) -- cgit v1.1