LSL/OSSL lacks Math.Min & Math.Max implementations.

0.7.4.1
SignpostMarv 2012-07-27 10:49:47 +01:00 committed by Justin Clark-Casey (justincc)
parent 7e89b99e6a
commit 72d29bdb40
3 changed files with 54 additions and 0 deletions

View File

@ -3286,5 +3286,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID test; UUID test;
return UUID.TryParse(thing, out test) ? 1 : 0; return UUID.TryParse(thing, out test) ? 1 : 0;
} }
/// <summary>
/// Wraps to Math.Min()
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public LSL_Float osMin(double a, double b)
{
CheckThreatLevel(ThreatLevel.None, "osMin");
m_host.AddScriptLPS(1);
return Math.Min(a, b);
}
/// <summary>
/// Wraps to Math.max()
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public LSL_Float osMax(double a, double b)
{
CheckThreatLevel(ThreatLevel.None, "osMax");
m_host.AddScriptLPS(1);
return Math.Max(a, b);
}
} }
} }

View File

@ -283,5 +283,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
/// <param name="thing"></param> /// <param name="thing"></param>
/// <returns>1 if thing is a valid UUID, 0 otherwise</returns> /// <returns>1 if thing is a valid UUID, 0 otherwise</returns>
LSL_Integer osIsUUID(string thing); LSL_Integer osIsUUID(string thing);
/// <summary>
/// Wraps to Math.Min()
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
LSL_Float osMin(double a, double b);
/// <summary>
/// Wraps to Math.max()
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
LSL_Float osMax(double a, double b);
} }
} }

View File

@ -935,5 +935,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
return m_OSSL_Functions.osIsUUID(thing); 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);
}
} }
} }