diff --git a/Source/dvlnet/frame_queue.cpp b/Source/dvlnet/frame_queue.cpp index a7c67f3b3..dfe358415 100644 --- a/Source/dvlnet/frame_queue.cpp +++ b/Source/dvlnet/frame_queue.cpp @@ -52,10 +52,7 @@ bool frame_queue::packet_ready() if (nextsize == 0) throw frame_queue_exception(); } - if (size() >= nextsize) - return true; - - return false; + return size() >= nextsize; } buffer_t frame_queue::read_packet() diff --git a/Source/dvlnet/protocol_zt.cpp b/Source/dvlnet/protocol_zt.cpp index da09f189d..75f430bb3 100644 --- a/Source/dvlnet/protocol_zt.cpp +++ b/Source/dvlnet/protocol_zt.cpp @@ -152,10 +152,7 @@ bool protocol_zt::recv_peer(const endpoint &peer) if (len >= 0) { peer_list[peer].recv_queue.write(buffer_t(buf, buf + len)); } else { - if (errno == EAGAIN || errno == EWOULDBLOCK) { - return true; - } - return false; + return errno == EAGAIN || errno == EWOULDBLOCK; } } } diff --git a/Source/items.cpp b/Source/items.cpp index dbd2e1353..b29f68105 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -810,11 +810,7 @@ void CalcPlrItemVals(int playerId, bool Loadgfx) player._pILMinDam = lmin; player._pILMaxDam = lmax; - if ((iflgs & ISPL_INFRAVISION) != 0) { - player._pInfraFlag = true; - } else { - player._pInfraFlag = false; - } + player._pInfraFlag = (iflgs & ISPL_INFRAVISION) != 0; player._pBlockFlag = false; if (player._pClass == HeroClass::Monk) { diff --git a/Source/monster.cpp b/Source/monster.cpp index 686c07cbd..031c10d8b 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -4663,9 +4663,7 @@ bool DirOK(int i, Direction mdir) if (SolidLoc(position + DIR_SW) || SolidLoc(position + DIR_SE)) return false; if (monster[i].leaderflag == 1) { - if (futurePosition.WalkingDistance(monster[monster[i].leader].position.future) >= 4) - return false; - return true; + return futurePosition.WalkingDistance(monster[monster[i].leader].position.future) < 4; } if (monster[i]._uniqtype == 0 || (UniqMonst[monster[i]._uniqtype - 1].mUnqAttr & 2) == 0) return true; diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index b6b7aeaf3..ccfccbcad 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -277,9 +277,7 @@ private: fhdr.hashcount = SDL_SwapLE32(INDEX_ENTRIES); fhdr.blockcount = SDL_SwapLE32(INDEX_ENTRIES); - if (!stream.write(reinterpret_cast(&fhdr), sizeof(fhdr))) - return false; - return true; + return stream.write(reinterpret_cast(&fhdr), sizeof(fhdr)); } bool WriteBlockTable() diff --git a/Source/objects.cpp b/Source/objects.cpp index 5720e1088..95dbba2c8 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -347,9 +347,7 @@ bool RndLocOk(int xp, int yp) return false; if (nSolidTable[dPiece[xp][yp]]) return false; - if (leveltype != DTYPE_CATHEDRAL || dPiece[xp][yp] <= 126 || dPiece[xp][yp] >= 144) - return true; - return false; + return leveltype != DTYPE_CATHEDRAL || dPiece[xp][yp] <= 126 || dPiece[xp][yp] >= 144; } static bool WallTrapLocOkK(int xp, int yp) @@ -357,10 +355,7 @@ static bool WallTrapLocOkK(int xp, int yp) if ((dFlags[xp][yp] & BFLAG_POPULATED) != 0) return false; - if (nTrapTable[dPiece[xp][yp]]) - return true; - - return false; + return nTrapTable[dPiece[xp][yp]]; } void InitRndLocObj(int min, int max, _object_id objtype) @@ -647,9 +642,7 @@ void AddL3Objs(int x1, int y1, int x2, int y2) bool TorchLocOK(int xp, int yp) { - if ((dFlags[xp][yp] & BFLAG_POPULATED) != 0) - return false; - return true; + return (dFlags[xp][yp] & BFLAG_POPULATED) == 0; } void AddL2Torches() @@ -5317,10 +5310,7 @@ void SyncL2Doors(int i) { int x, y; - if (object[i]._oVar4 == 0) - object[i]._oMissFlag = false; - else - object[i]._oMissFlag = true; + object[i]._oMissFlag = object[i]._oVar4 != 0; x = object[i].position.x; y = object[i].position.y; object[i]._oSelFlag = 2; diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 22c891919..20aa35ad8 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -188,10 +188,7 @@ static void pfile_encode_hero(const PkPlayerStruct *pack) static bool pfile_open_archive(uint32_t save_num) { - if (OpenMPQ(GetSavePath(save_num).c_str())) - return true; - - return false; + return OpenMPQ(GetSavePath(save_num).c_str()); } static HANDLE pfile_open_save_archive(uint32_t save_num)