aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorSean Dague2009-02-10 13:36:42 +0000
committerSean Dague2009-02-10 13:36:42 +0000
commitac6657d0f1522d3f23c8b3cb3a652e467aee7275 (patch)
tree490d572ec3fe20aedece8f3ba2b4ad41bf1eddc3 /OpenSim/Region/ScriptEngine/Shared/Api
parentthis is step 2 of 2 of the OpenSim.Region.Environment refactor. (diff)
downloadopensim-SC_OLD-ac6657d0f1522d3f23c8b3cb3a652e467aee7275.zip
opensim-SC_OLD-ac6657d0f1522d3f23c8b3cb3a652e467aee7275.tar.gz
opensim-SC_OLD-ac6657d0f1522d3f23c8b3cb3a652e467aee7275.tar.bz2
opensim-SC_OLD-ac6657d0f1522d3f23c8b3cb3a652e467aee7275.tar.xz
From Rob Smart <SMARTROB@uk.ibm.com>
In SL if llAbs() is called with the minimum integer value of -2147483648 it will return that value untouched without error. this patch replicates the SL functionality. OpenSim currently throws an overflow exception: number too small under mono or a "System.OverflowException: Negating the minimum value of a twos complement number is invalid. " under .NET
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d1006e3..c2449a2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -361,8 +361,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
361 361
362 public LSL_Integer llAbs(int i) 362 public LSL_Integer llAbs(int i)
363 { 363 {
364 // changed to replicate LSL behaviour whereby minimum int value is returned untouched.
364 m_host.AddScriptLPS(1); 365 m_host.AddScriptLPS(1);
365 return (int)Math.Abs(i); 366 if(i == Int32.MinValue)
367 return i;
368 else
369 return (int)Math.Abs(i);
366 } 370 }
367 371
368 public LSL_Float llFabs(double f) 372 public LSL_Float llFabs(double f)