From 72d29bdb40c16ba4785b16e4025bf810baa96cb5 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Fri, 27 Jul 2012 10:49:47 +0100
Subject: LSL/OSSL lacks Math.Min & Math.Max implementations.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 28 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 16 +++++++++++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++++++
3 files changed, 54 insertions(+)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index faad75d..44de176 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3286,5 +3286,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID test;
return UUID.TryParse(thing, out test) ? 1 : 0;
}
+
+ ///
+ /// Wraps to Math.Min()
+ ///
+ ///
+ ///
+ ///
+ public LSL_Float osMin(double a, double b)
+ {
+ CheckThreatLevel(ThreatLevel.None, "osMin");
+ m_host.AddScriptLPS(1);
+
+ return Math.Min(a, b);
+ }
+
+ ///
+ /// Wraps to Math.max()
+ ///
+ ///
+ ///
+ ///
+ public LSL_Float osMax(double a, double b)
+ {
+ CheckThreatLevel(ThreatLevel.None, "osMax");
+ m_host.AddScriptLPS(1);
+
+ return Math.Max(a, b);
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index c9403eb..f73a85e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -283,5 +283,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
///
/// 1 if thing is a valid UUID, 0 otherwise
LSL_Integer osIsUUID(string thing);
+
+ ///
+ /// Wraps to Math.Min()
+ ///
+ ///
+ ///
+ ///
+ LSL_Float osMin(double a, double b);
+
+ ///
+ /// Wraps to Math.max()
+ ///
+ ///
+ ///
+ ///
+ LSL_Float osMax(double a, double b);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 99995a7..53daa13 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -935,5 +935,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osIsUUID(thing);
}
+
+ public LSL_Float osMin(double a, double b)
+ {
+ return m_OSSL_Functions.osMin(a, b);
+ }
+
+ public LSL_Float osMax(double a, double b)
+ {
+ return m_OSSL_Functions.osMax(a, b);
+ }
}
}
--
cgit v1.1