diff options
author | Rubidium <rubidium@openttd.org> | 2021-06-16 23:21:21 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-06-17 16:18:30 +0200 |
commit | 281a65b3e17310d07458652a3f6cba55aff59dc0 (patch) | |
tree | e3f06df00a9f8fc074f863b230980f2a11b066e4 /src/3rdparty/squirrel | |
parent | 357af686dc5e0a0085da5c42639abe83caebe6c3 (diff) | |
download | openttd-281a65b3e17310d07458652a3f6cba55aff59dc0.tar.xz |
Cleanup: simplify some boolean expressions
Diffstat (limited to 'src/3rdparty/squirrel')
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqapi.cpp | 12 | ||||
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqvm.cpp | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqapi.cpp b/src/3rdparty/squirrel/squirrel/sqapi.cpp index aeef3779b..80c5d816e 100644 --- a/src/3rdparty/squirrel/squirrel/sqapi.cpp +++ b/src/3rdparty/squirrel/squirrel/sqapi.cpp @@ -135,7 +135,7 @@ void sq_close(HSQUIRRELVM v) SQRESULT sq_compile(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,const SQChar *sourcename,SQBool raiseerror) { SQObjectPtr o; - if(Compile(v, read, p, sourcename, o, raiseerror?true:false, _ss(v)->_debuginfo)) { + if(Compile(v, read, p, sourcename, o, raiseerror != 0, _ss(v)->_debuginfo)) { v->Push(SQClosure::Create(_ss(v), _funcproto(o))); return SQ_OK; } @@ -144,12 +144,12 @@ SQRESULT sq_compile(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,const SQCha void sq_enabledebuginfo(HSQUIRRELVM v, SQBool enable) { - _ss(v)->_debuginfo = enable?true:false; + _ss(v)->_debuginfo = enable != 0; } void sq_notifyallexceptions(HSQUIRRELVM v, SQBool enable) { - _ss(v)->_notifyallexceptions = enable?true:false; + _ss(v)->_notifyallexceptions = enable != 0; } void sq_addref(HSQUIRRELVM v,HSQOBJECT *po) @@ -224,7 +224,7 @@ void sq_pushinteger(HSQUIRRELVM v,SQInteger n) void sq_pushbool(HSQUIRRELVM v,SQBool b) { - v->Push(b?true:false); + v->Push(b != 0); } void sq_pushfloat(HSQUIRRELVM v,SQFloat n) @@ -724,7 +724,7 @@ SQRESULT sq_newslot(HSQUIRRELVM v, SQInteger idx, SQBool bstatic) if(type(self) == OT_TABLE || type(self) == OT_CLASS) { SQObjectPtr &key = v->GetUp(-2); if(type(key) == OT_NULL) return sq_throwerror(v, "null is not a valid key"); - v->NewSlot(self, key, v->GetUp(-1),bstatic?true:false); + v->NewSlot(self, key, v->GetUp(-1),bstatic != 0); v->Pop(2); } return SQ_OK; @@ -975,7 +975,7 @@ SQRESULT sq_call(HSQUIRRELVM v,SQInteger params,SQBool retval,SQBool raiseerror, v->_can_suspend = suspend >= 0; if (v->_can_suspend) v->_ops_till_suspend = suspend; - if(v->Call(v->GetUp(-(params+1)),params,v->_top-params,res,raiseerror?true:false,v->_can_suspend)){ + if(v->Call(v->GetUp(-(params+1)),params,v->_top-params,res,raiseerror != 0,v->_can_suspend)){ if(!v->_suspended) { v->Pop(params);//pop closure and args } diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp index b6f2c526d..1f81a2e9a 100644 --- a/src/3rdparty/squirrel/squirrel/sqvm.cpp +++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp @@ -437,7 +437,7 @@ bool SQVM::Return(SQInteger _arg0, SQInteger _arg1, SQObjectPtr &retval) while (last_top > oldstackbase) _stack._vals[last_top--].Null(); assert(oldstackbase >= _stackbase); - return broot?true:false; + return broot != 0; } #define _RET_ON_FAIL(exp) { if(!exp) return false; } @@ -653,7 +653,7 @@ bool SQVM::CLASS_OP(SQObjectPtr &target,SQInteger baseclass,SQInteger attributes bool SQVM::IsEqual(SQObjectPtr &o1,SQObjectPtr &o2,bool &res) { if(type(o1) == type(o2)) { - res = ((_rawval(o1) == _rawval(o2)?true:false)); + res = ((_rawval(o1) == _rawval(o2))); } else { if(sq_isnumeric(o1) && sq_isnumeric(o2)) { @@ -1028,7 +1028,7 @@ common_call: case _OP_THROW: Raise_Error(TARGET); SQ_THROW(); case _OP_CLASS: _GUARD(CLASS_OP(TARGET,arg1,arg2)); continue; case _OP_NEWSLOTA: - bool bstatic = (arg0&NEW_SLOT_STATIC_FLAG)?true:false; + bool bstatic = (arg0&NEW_SLOT_STATIC_FLAG) != 0; if(type(STK(arg1)) == OT_CLASS) { if(type(_class(STK(arg1))->_metamethods[MT_NEWMEMBER]) != OT_NULL ) { Push(STK(arg1)); Push(STK(arg2)); Push(STK(arg3)); |