1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-20 21:19:10 +00:00

(svn r20162) -Fix [FS#3954]: integer comparison failed in case the difference was more than "MAX_UINT"/2

This commit is contained in:
rubidium
2010-07-16 17:42:58 +00:00
parent 50c7f60eca
commit 92da292fbc
3 changed files with 79 additions and 1 deletions

View File

@@ -186,7 +186,8 @@ bool SQVM::ObjCmp(const SQObjectPtr &o1,const SQObjectPtr &o2,SQInteger &result)
case OT_STRING:
_RET_SUCCEED(scstrcmp(_stringval(o1),_stringval(o2)));
case OT_INTEGER:
_RET_SUCCEED(_integer(o1)-_integer(o2));
/* FS#3954: wrong integer comparison */
_RET_SUCCEED((_integer(o1)<_integer(o2))?-1:(_integer(o1)==_integer(o2))?0:1);
case OT_FLOAT:
_RET_SUCCEED((_float(o1)<_float(o2))?-1:1);
case OT_TABLE: