From 25dcfa8b4e7b18891baad49c583d23383d1a9035 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 12 Apr 2024 22:14:54 +0100 Subject: [PATCH] change llAtan2 arguments order to (y,x) to match standard documentation --- .../Servers/HttpServer/OSHttpServer/HttpInputItem.cs | 9 +++++---- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- .../Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 6 +++++- .../Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpInputItem.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpInputItem.cs index 2a3fb37dfb..8ca7cde52b 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpInputItem.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpInputItem.cs @@ -71,8 +71,9 @@ namespace OSHttpServer /// if no item was found. public HttpInputItem this[string name] { - get { - return _items.ContainsKey(name) ? _items[name] : Empty; + get + { + return _items.TryGetValue(name, out HttpInputItem hii) ? hii : Empty; } } @@ -144,7 +145,7 @@ namespace OSHttpServer /// true if the sub-item exists and has a value; otherwise false. public bool Contains(string name) { - return _items.ContainsKey(name) && _items[name].Value != null; + return _items.TryGetValue(name, out HttpInputItem hii) && hii.Value != null; } /// Returns a formatted representation of the instance with the values of all contained parameters @@ -216,7 +217,7 @@ namespace OSHttpServer { get { - return _items.ContainsKey(name) ? _items[name] : Empty; + return _items.TryGetValue(name, out HttpInputItem hii) ? hii : Empty; } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0b3134a7f6..d53bb8d653 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -833,9 +833,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return Math.Tan(f); } - public LSL_Float llAtan2(LSL_Float x, LSL_Float y) + public LSL_Float llAtan2(LSL_Float y, LSL_Float x) { - return Math.Atan2(x, y); + return Math.Atan2(y, x); } public LSL_Float llSqrt(double f) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index fb6f2c58ff..325f342e0e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -43,7 +43,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces { void state(string newState); + //ApiDesc Returns absolute version as val (ie as postive value) LSL_Integer llAbs(LSL_Integer val); + //ApiDesc Returns cosine of val (val in radians) LSL_Float llAcos(LSL_Float val); //ApiDesc Sleep 0.1 void llAddToLandBanList(LSL_Key avatarId, LSL_Float hours); @@ -55,8 +57,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b); void llApplyImpulse(LSL_Vector force, LSL_Integer local); void llApplyRotationalImpulse(LSL_Vector force, int local); + //ApiDesc Returns sine of val (val in radians) LSL_Float llAsin(LSL_Float val); - LSL_Float llAtan2(LSL_Float x, LSL_Float y); + //ApiDesc Returns the angle whose tangent is the y/x + LSL_Float llAtan2(LSL_Float y, LSL_Float x); void llAttachToAvatar(LSL_Integer attachment); void llAttachToAvatarTemp(LSL_Integer attachmentPoint); LSL_Key llAvatarOnSitTarget(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index ccda2911f4..41effdfec5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -123,9 +123,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public LSL_Float llAtan2(LSL_Float x, LSL_Float y) + public LSL_Float llAtan2(LSL_Float y, LSL_Float x) { - return m_LSL_Functions.llAtan2(x, y); + return m_LSL_Functions.llAtan2(y, x); } [MethodImpl(MethodImplOptions.AggressiveInlining)]