Browse Source

Clang-tidy: readability-simplify-boolean-expr

pull/2238/head
Anders Jenbo 5 years ago
parent
commit
bf221f4322
  1. 5
      Source/dvlnet/frame_queue.cpp
  2. 5
      Source/dvlnet/protocol_zt.cpp
  3. 6
      Source/items.cpp
  4. 4
      Source/monster.cpp
  5. 4
      Source/mpqapi.cpp
  6. 18
      Source/objects.cpp
  7. 5
      Source/pfile.cpp

5
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()

5
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;
}
}
}

6
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) {

4
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;

4
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<const char *>(&fhdr), sizeof(fhdr)))
return false;
return true;
return stream.write(reinterpret_cast<const char *>(&fhdr), sizeof(fhdr));
}
bool WriteBlockTable()

18
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;

5
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)

Loading…
Cancel
Save