Changeset - r25709:feac296d221b
[Not reviewed]
master
0 9 0
Rubidium - 3 years ago 2021-06-16 21:21:21
rubidium@openttd.org
Cleanup: simplify some boolean expressions
9 files changed with 17 insertions and 25 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/squirrel/squirrel/sqapi.cpp
Show inline comments
 
@@ -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,SQLEXR
 

	
 
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,SQInte
 

	
 
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, SQInt
 
	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
 
	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
 
		}
src/3rdparty/squirrel/squirrel/sqvm.cpp
Show inline comments
 
@@ -437,7 +437,7 @@ bool SQVM::Return(SQInteger _arg0, SQInt
 

	
 
	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,
 
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));
src/fios_gui.cpp
Show inline comments
 
@@ -868,7 +868,7 @@ public:
 
						this->fios_items_shown[i] = this->string_filter.GetState();
 
						if (this->fios_items_shown[i]) items_shown_count++;
 

	
 
						if (&(this->fios_items[i]) == this->selected && this->fios_items_shown[i] == false) {
 
						if (&(this->fios_items[i]) == this->selected && !this->fios_items_shown[i]) {
 
							/* The selected element has been filtered out */
 
							this->selected = nullptr;
 
							this->OnInvalidateData(SLIWD_SELECTION_CHANGES);
src/news_gui.cpp
Show inline comments
 
@@ -639,8 +639,7 @@ static bool ReadyForNextTickerItem()
 

	
 
	/* Ticker message
 
	 * Check if the status bar message is still being displayed? */
 
	if (IsNewsTickerShown()) return false;
 
	return true;
 
	return !IsNewsTickerShown();
 
}
 

	
 
/**
src/pathfinder/npf/npf.cpp
Show inline comments
 
@@ -826,9 +826,7 @@ static bool CanEnterTile(TileIndex tile,
 

	
 
	/* Depots, standard roadstops and single tram bits can only be entered from one direction */
 
	DiagDirection single_entry = GetTileSingleEntry(tile, user->type, user->subtype);
 
	if (single_entry != INVALID_DIAGDIR && single_entry != ReverseDiagDir(dir)) return false;
 

	
 
	return true;
 
	return single_entry == INVALID_DIAGDIR || single_entry == ReverseDiagDir(dir);
 
}
 

	
 
/**
src/saveload/saveload.h
Show inline comments
 
@@ -956,9 +956,7 @@ static inline bool IsSavegameVersionUnti
 
static inline bool SlIsObjectCurrentlyValid(SaveLoadVersion version_from, SaveLoadVersion version_to)
 
{
 
	extern const SaveLoadVersion SAVEGAME_VERSION;
 
	if (SAVEGAME_VERSION < version_from || SAVEGAME_VERSION >= version_to) return false;
 

	
 
	return true;
 
	return version_from <= SAVEGAME_VERSION && SAVEGAME_VERSION < version_to;
 
}
 

	
 
/**
src/script/api/script_list.cpp
Show inline comments
 
@@ -468,7 +468,7 @@ int64 ScriptList::Begin()
 

	
 
int64 ScriptList::Next()
 
{
 
	if (this->initialized == false) {
 
	if (!this->initialized) {
 
		Debug(script, 0, "Next() is invalid as Begin() is never called");
 
		return 0;
 
	}
 
@@ -482,7 +482,7 @@ bool ScriptList::IsEmpty()
 

	
 
bool ScriptList::IsEnd()
 
{
 
	if (this->initialized == false) {
 
	if (!this->initialized) {
 
		Debug(script, 0, "IsEnd() is invalid as Begin() is never called");
 
		return true;
 
	}
src/settings_gui.cpp
Show inline comments
 
@@ -930,8 +930,7 @@ void BaseSettingEntry::Init(byte level)
 
bool BaseSettingEntry::IsVisible(const BaseSettingEntry *item) const
 
{
 
	if (this->IsFiltered()) return false;
 
	if (this == item) return true;
 
	return false;
 
	return this == item;
 
}
 

	
 
/**
src/signal.cpp
Show inline comments
 
@@ -216,9 +216,7 @@ static inline bool CheckAddToTodoSet(Til
 

	
 
	assert(!_tbdset.IsIn(t1, d1)); // it really shouldn't be there already
 

	
 
	if (_tbdset.Remove(t2, d2)) return false;
 

	
 
	return true;
 
	return !_tbdset.Remove(t2, d2);
 
}
 

	
 

	
0 comments (0 inline, 0 general)