From 87b8f327aab6d14f8682051d7867750d72bea085 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sat, 1 Nov 2008 23:15:16 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=2440 * The attached patch changes the LSLInteger operator overrides for == and != to return LSLIntegers 1 or 0 instead of a bool and adds similar operator overrides for >, <, >= and <= * Thanks idb! --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 31 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index f3adb22..6c78ef8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -1553,16 +1553,39 @@ namespace OpenSim.Region.ScriptEngine.Shared return new LSLInteger(0); } - static public bool operator ==(LSLInteger i1, LSLInteger i2) + static public LSLInteger operator ==(LSLInteger i1, LSLInteger i2) { bool ret = i1.value == i2.value; - return ret; + return new LSLInteger((ret ? 1 : 0)); } - static public bool operator !=(LSLInteger i1, LSLInteger i2) + static public LSLInteger operator !=(LSLInteger i1, LSLInteger i2) { bool ret = i1.value != i2.value; - return ret; + return new LSLInteger((ret ? 1 : 0)); + } + + static public LSLInteger operator <(LSLInteger i1, LSLInteger i2) + { + bool ret = i1.value < i2.value; + return new LSLInteger((ret ? 1 : 0)); + } + static public LSLInteger operator <=(LSLInteger i1, LSLInteger i2) + { + bool ret = i1.value <= i2.value; + return new LSLInteger((ret ? 1 : 0)); + } + + static public LSLInteger operator >(LSLInteger i1, LSLInteger i2) + { + bool ret = i1.value > i2.value; + return new LSLInteger((ret ? 1 : 0)); + } + + static public LSLInteger operator >=(LSLInteger i1, LSLInteger i2) + { + bool ret = i1.value >= i2.value; + return new LSLInteger((ret ? 1 : 0)); } static public LSLInteger operator +(LSLInteger i1, int i2) -- cgit v1.1