* 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!
0.6.0-stable
Justin Clarke Casey 2008-11-01 23:15:16 +00:00
parent 4c24b1bc9b
commit 87b8f327aa
1 changed files with 27 additions and 4 deletions

View File

@ -1553,16 +1553,39 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new LSLInteger(0); 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; 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; 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) static public LSLInteger operator +(LSLInteger i1, int i2)