From 4f8b5e2f5fcbd158afc3ccfe453dcc0c0b334be4 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 9 Apr 2021 11:08:56 +0200 Subject: [PATCH] :art: Correct style of true comparisons --- Source/control.cpp | 2 +- Source/drlg_l1.cpp | 40 +++++++++++----------- Source/drlg_l2.cpp | 24 +++++++------- Source/drlg_l3.cpp | 81 ++++++++++++++++++++++----------------------- Source/drlg_l4.cpp | 22 ++++++------ Source/inv.cpp | 4 +-- Source/missiles.cpp | 31 +++++++++-------- Source/monster.cpp | 2 +- Source/multi.cpp | 2 +- Source/objects.cpp | 2 +- 10 files changed, 104 insertions(+), 106 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index 0d5734d52..b9c9a9c74 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1220,7 +1220,7 @@ static void CPrintString(CelOutputBuffer out, int y, const char *str, bool cente lineOffset = 0; sx = 177 + PANEL_X; sy = lineOffsets[lines][y] + PANEL_Y; - if (center == true) { + if (center) { strWidth = 0; tmp = str; while (*tmp) { diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index 5a091162c..82d587b81 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -868,7 +868,7 @@ static void DRLG_L1Shadows() patflag = false; if (SPATS[i].s3 && SPATS[i].s3 != sd[1][0]) patflag = false; - if (patflag == true) { + if (patflag) { if (SPATS[i].nv1 && !L5dflags[x - 1][y - 1]) dungeon[x - 1][y - 1] = SPATS[i].nv1; if (SPATS[i].nv2 && !L5dflags[x][y - 1]) @@ -986,8 +986,8 @@ static int DRLG_PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, in ii = 2; - for (yy = 0; yy < sh && abort == true; yy++) { - for (xx = 0; xx < sw && abort == true; xx++) { + for (yy = 0; yy < sh && abort; yy++) { + for (xx = 0; xx < sw && abort; xx++) { if (miniset[ii] && dungeon[xx + sx][sy + yy] != miniset[ii]) abort = false; if (L5dflags[xx + sx][sy + yy]) @@ -1028,7 +1028,7 @@ static int DRLG_PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, in quests[Q_PWATER]._qty = 2 * sy + 22; } - if (setview == true) { + if (setview) { ViewX = 2 * sx + 19; ViewY = 2 * sy + 20; } @@ -1369,15 +1369,15 @@ static void L5roomGen(int x, int y, int w, int h, int dir) num++; } while (!ran && num < 20); - if (ran == true) + if (ran) L5drawRoom(cx1, cy1, cw, ch); cx2 = x + w; ran2 = L5checkRoom(cx2, cy1 - 1, cw + 1, ch + 2); - if (ran2 == true) + if (ran2) L5drawRoom(cx2, cy1, cw, ch); - if (ran == true) + if (ran) L5roomGen(cx1, cy1, cw, ch, 1); - if (ran2 == true) + if (ran2) L5roomGen(cx2, cy1, cw, ch, 1); return; } @@ -1391,15 +1391,15 @@ static void L5roomGen(int x, int y, int w, int h, int dir) num++; } while (!ran && num < 20); - if (ran == true) + if (ran) L5drawRoom(rx, ry, width, height); ry2 = y + h; ran2 = L5checkRoom(rx - 1, ry2, width + 2, height + 1); - if (ran2 == true) + if (ran2) L5drawRoom(rx, ry2, width, height); - if (ran == true) + if (ran) L5roomGen(rx, ry, width, height, 0); - if (ran2 == true) + if (ran2) L5roomGen(rx, ry2, width, height, 0); } @@ -1745,7 +1745,7 @@ static void DRLG_L5GChamber(int sx, int sy, bool topflag, bool bottomflag, bool { int i, j; - if (topflag == true) { + if (topflag) { dungeon[sx + 2][sy] = 12; dungeon[sx + 3][sy] = 12; dungeon[sx + 4][sy] = 3; @@ -1753,7 +1753,7 @@ static void DRLG_L5GChamber(int sx, int sy, bool topflag, bool bottomflag, bool dungeon[sx + 8][sy] = 12; dungeon[sx + 9][sy] = 2; } - if (bottomflag == true) { + if (bottomflag) { sy += 11; dungeon[sx + 2][sy] = 10; dungeon[sx + 3][sy] = 12; @@ -1765,7 +1765,7 @@ static void DRLG_L5GChamber(int sx, int sy, bool topflag, bool bottomflag, bool } sy -= 11; } - if (leftflag == true) { + if (leftflag) { dungeon[sx][sy + 2] = 11; dungeon[sx][sy + 3] = 11; dungeon[sx][sy + 4] = 3; @@ -1773,7 +1773,7 @@ static void DRLG_L5GChamber(int sx, int sy, bool topflag, bool bottomflag, bool dungeon[sx][sy + 8] = 11; dungeon[sx][sy + 9] = 1; } - if (rightflag == true) { + if (rightflag) { sx += 11; dungeon[sx][sy + 2] = 14; dungeon[sx][sy + 3] = 11; @@ -1951,8 +1951,8 @@ void drlg_l1_crypt_rndset(const BYTE *miniset, int rndper) for (sx = 0; sx < DMAXX - sw; sx++) { found = true; ii = 2; - for (yy = 0; yy < sh && found == true; yy++) { - for (xx = 0; xx < sw && found == true; xx++) { + for (yy = 0; yy < sh && found; yy++) { + for (xx = 0; xx < sw && found; xx++) { if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = false; } @@ -1963,7 +1963,7 @@ void drlg_l1_crypt_rndset(const BYTE *miniset, int rndper) } } kk = sw * sh + 2; - if (miniset[kk] >= 84 && miniset[kk] <= 100 && found == true) { + if (miniset[kk] >= 84 && miniset[kk] <= 100 && found) { // BUGFIX: accesses to dungeon can go out of bounds (fixed) // BUGFIX: Comparisons vs 100 should use same tile as comparisons vs 84 (fixed) if (sx > 0 && dungeon[sx - 1][sy] >= 84 && dungeon[sx - 1][sy] <= 100) { @@ -1979,7 +1979,7 @@ void drlg_l1_crypt_rndset(const BYTE *miniset, int rndper) found = false; } } - if (found == true && random_(0, 100) < rndper) { + if (found && random_(0, 100) < rndper) { for (yy = 0; yy < sh; yy++) { for (xx = 0; xx < sw; xx++) { if (miniset[kk] != 0) { diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 38629b34a..038343b17 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -1637,8 +1637,8 @@ static bool DRLG_L2PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, found = false; } ii = 2; - for (yy = 0; yy < sh && found == true; yy++) { - for (xx = 0; xx < sw && found == true; xx++) { + for (yy = 0; yy < sh && found; yy++) { + for (xx = 0; xx < sw && found; xx++) { if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = false; } @@ -1673,7 +1673,7 @@ static bool DRLG_L2PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, } } - if (setview == true) { + if (setview) { ViewX = 2 * sx + 21; ViewY = 2 * sy + 22; } @@ -1704,8 +1704,8 @@ static void DRLG_L2PlaceRndSet(const BYTE *miniset, int rndper) if (sx >= nSx1 && sx <= nSx2 && sy >= nSy1 && sy <= nSy2) { found = false; } - for (yy = 0; yy < sh && found == true; yy++) { - for (xx = 0; xx < sw && found == true; xx++) { + for (yy = 0; yy < sh && found; yy++) { + for (xx = 0; xx < sw && found; xx++) { if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = false; } @@ -1716,8 +1716,8 @@ static void DRLG_L2PlaceRndSet(const BYTE *miniset, int rndper) } } kk = sw * sh + 2; - if (found == true) { - for (yy = std::max(sy - sh, 0); yy < std::min(sy + 2 * sh, DMAXY) && found == true; yy++) { + if (found) { + for (yy = std::max(sy - sh, 0); yy < std::min(sy + 2 * sh, DMAXY) && found; yy++) { for (xx = std::max(sx - sw, 0); xx < std::min(sx + 2 * sw, DMAXX); xx++) { // BUGFIX: yy and xx can go out of bounds (fixed) if (dungeon[xx][yy] == miniset[kk]) { @@ -1726,7 +1726,7 @@ static void DRLG_L2PlaceRndSet(const BYTE *miniset, int rndper) } } } - if (found == true && random_(0, 100) < rndper) { + if (found && random_(0, 100) < rndper) { for (yy = 0; yy < sh; yy++) { for (xx = 0; xx < sw; xx++) { if (miniset[kk] != 0) { @@ -1802,7 +1802,7 @@ static void DRLG_L2Shadows() if (SPATSL2[i].s3 != 0 && SPATSL2[i].s3 != sd[1][0]) { patflag = false; } - if (patflag == true) { + if (patflag) { if (SPATSL2[i].nv1 != 0) { dungeon[x - 1][y - 1] = SPATSL2[i].nv1; } @@ -1897,7 +1897,7 @@ static void DefineRoom(int nX1, int nY1, int nX2, int nY2, bool ForceHW) RoomList[nRoomCnt].nRoomy1 = nY1; RoomList[nRoomCnt].nRoomy2 = nY2; - if (ForceHW == true) { + if (ForceHW) { for (i = nX1; i < nX2; i++) { /// BUGFIX: Should loop j between nY1 and nY2 instead of always using nY1. while (i < nY2) { @@ -2023,7 +2023,7 @@ static void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir nRh = nAh; } - if (ForceHW == true) { + if (ForceHW) { nRw = nW; nRh = nH; } @@ -2067,7 +2067,7 @@ static void CreateRoom(int nX1, int nY1, int nX2, int nY2, int nRDest, int nHDir } DefineRoom(nRx1, nRy1, nRx2, nRy2, ForceHW); - if (ForceHW == true) { + if (ForceHW) { nSx1 = nRx1 + 2; nSy1 = nRy1 + 2; nSx2 = nRx2; diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 8d6adc87e..1bfc4d170 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -959,7 +959,7 @@ static void DRLG_L3CreateBlock(int x, int y, int obs, int dir) y2 = y1 + blksizey; } - if (DRLG_L3FillRoom(x1, y1, x2, y2) == true) { + if (DRLG_L3FillRoom(x1, y1, x2, y2)) { contflag = random_(0, 4); if (contflag != 0 && dir != 2) { DRLG_L3CreateBlock(x1, y1, blksizey, 0); @@ -1171,17 +1171,16 @@ static void DRLG_L3MakeMegas() static void DRLG_L3River() { - int rx, ry, px, py, dir, pdir, nodir, nodir2, dircheck; + int rx, ry, px, py, dir, nodir, nodir2, dircheck; int river[3][100]; - int rivercnt, riveramt; - int i, trys, found, bridge, lpcnt; - bool bail; + int riveramt; + int i, found, bridge, lpcnt; - rivercnt = 0; - bail = false; - trys = 0; + int rivercnt = 0; + bool bail = false; + int trys = 0; /// BUGFIX: pdir is uninitialized, add code `pdir = -1;`(fixed) - pdir = -1; + int pdir = -1; while (trys < 200 && rivercnt < 4) { bail = false; @@ -1372,10 +1371,10 @@ static void DRLG_L3River() bail = true; } } - if (bail == true && riveramt < 7) { + if (bail && riveramt < 7) { bail = false; } - if (bail == true) { + if (bail) { found = 0; lpcnt = 0; while (found == 0 && lpcnt < 30) { @@ -1445,28 +1444,28 @@ static bool DRLG_L3SpawnEdge(int x, int y, int *totarea) dungeon[x][y] |= 0x80; *totarea += 1; - if (spawntable[i] & 8 && DRLG_L3SpawnEdge(x, y - 1, totarea) == true) { + if (spawntable[i] & 8 && DRLG_L3SpawnEdge(x, y - 1, totarea)) { return true; } - if (spawntable[i] & 4 && DRLG_L3SpawnEdge(x, y + 1, totarea) == true) { + if (spawntable[i] & 4 && DRLG_L3SpawnEdge(x, y + 1, totarea)) { return true; } - if (spawntable[i] & 2 && DRLG_L3SpawnEdge(x + 1, y, totarea) == true) { + if (spawntable[i] & 2 && DRLG_L3SpawnEdge(x + 1, y, totarea)) { return true; } - if (spawntable[i] & 1 && DRLG_L3SpawnEdge(x - 1, y, totarea) == true) { + if (spawntable[i] & 1 && DRLG_L3SpawnEdge(x - 1, y, totarea)) { return true; } - if (spawntable[i] & 0x80 && DRLG_L3Spawn(x, y - 1, totarea) == true) { + if (spawntable[i] & 0x80 && DRLG_L3Spawn(x, y - 1, totarea)) { return true; } - if (spawntable[i] & 0x40 && DRLG_L3Spawn(x, y + 1, totarea) == true) { + if (spawntable[i] & 0x40 && DRLG_L3Spawn(x, y + 1, totarea)) { return true; } - if (spawntable[i] & 0x20 && DRLG_L3Spawn(x + 1, y, totarea) == true) { + if (spawntable[i] & 0x20 && DRLG_L3Spawn(x + 1, y, totarea)) { return true; } - if (spawntable[i] & 0x10 && DRLG_L3Spawn(x - 1, y, totarea) == true) { + if (spawntable[i] & 0x10 && DRLG_L3Spawn(x - 1, y, totarea)) { return true; } @@ -1496,29 +1495,29 @@ static bool DRLG_L3Spawn(int x, int y, int *totarea) *totarea += 1; if (i != 8) { - if (spawntable[i] & 8 && DRLG_L3SpawnEdge(x, y - 1, totarea) == true) { + if (spawntable[i] & 8 && DRLG_L3SpawnEdge(x, y - 1, totarea)) { return true; } - if (spawntable[i] & 4 && DRLG_L3SpawnEdge(x, y + 1, totarea) == true) { + if (spawntable[i] & 4 && DRLG_L3SpawnEdge(x, y + 1, totarea)) { return true; } - if (spawntable[i] & 2 && DRLG_L3SpawnEdge(x + 1, y, totarea) == true) { + if (spawntable[i] & 2 && DRLG_L3SpawnEdge(x + 1, y, totarea)) { return true; } - if (spawntable[i] & 1 && DRLG_L3SpawnEdge(x - 1, y, totarea) == true) { + if (spawntable[i] & 1 && DRLG_L3SpawnEdge(x - 1, y, totarea)) { return true; } } else { - if (DRLG_L3Spawn(x + 1, y, totarea) == true) { + if (DRLG_L3Spawn(x + 1, y, totarea)) { return true; } - if (DRLG_L3Spawn(x - 1, y, totarea) == true) { + if (DRLG_L3Spawn(x - 1, y, totarea)) { return true; } - if (DRLG_L3Spawn(x, y + 1, totarea) == true) { + if (DRLG_L3Spawn(x, y + 1, totarea)) { return true; } - if (DRLG_L3Spawn(x, y - 1, totarea) == true) { + if (DRLG_L3Spawn(x, y - 1, totarea)) { return true; } } @@ -1643,8 +1642,8 @@ static bool DRLG_L3PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, found = false; } ii = 2; - for (yy = 0; yy < sh && found == true; yy++) { - for (xx = 0; xx < sw && found == true; xx++) { + for (yy = 0; yy < sh && found; yy++) { + for (xx = 0; xx < sw && found; xx++) { if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = false; } @@ -1679,7 +1678,7 @@ static bool DRLG_L3PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, } } - if (setview == true) { + if (setview) { ViewX = 2 * sx + 17; ViewY = 2 * sy + 19; } @@ -1703,8 +1702,8 @@ static void DRLG_L3PlaceRndSet(const BYTE *miniset, int rndper) for (sx = 0; sx < DMAXY - sw; sx++) { found = true; ii = 2; - for (yy = 0; yy < sh && found == true; yy++) { - for (xx = 0; xx < sw && found == true; xx++) { + for (yy = 0; yy < sh && found; yy++) { + for (xx = 0; xx < sw && found; xx++) { if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = false; } @@ -1715,7 +1714,7 @@ static void DRLG_L3PlaceRndSet(const BYTE *miniset, int rndper) } } kk = sw * sh + 2; - if (miniset[kk] >= 84 && miniset[kk] <= 100 && found == true) { + if (miniset[kk] >= 84 && miniset[kk] <= 100 && found) { // BUGFIX: accesses to dungeon can go out of bounds (fixed) // BUGFIX: Comparisons vs 100 should use same tile as comparisons vs 84. if (sx - 1 >= 0 && dungeon[sx - 1][sy] >= 84 && dungeon[sx - 1][sy] <= 100) { @@ -1731,7 +1730,7 @@ static void DRLG_L3PlaceRndSet(const BYTE *miniset, int rndper) found = false; } } - if (found == true && random_(0, 100) < rndper) { + if (found && random_(0, 100) < rndper) { for (yy = 0; yy < sh; yy++) { for (xx = 0; xx < sw; xx++) { if (miniset[kk] != 0) { @@ -1759,8 +1758,8 @@ bool drlg_l3_hive_rnd_piece(const BYTE *miniset, int rndper) for (sx = 0; sx < DMAXY - sw; sx++) { found = true; ii = 2; - for (yy = 0; yy < sh && found == true; yy++) { - for (xx = 0; xx < sw && found == true; xx++) { + for (yy = 0; yy < sh && found; yy++) { + for (xx = 0; xx < sw && found; xx++) { if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = false; } @@ -1771,7 +1770,7 @@ bool drlg_l3_hive_rnd_piece(const BYTE *miniset, int rndper) } } kk = sw * sh + 2; - if (miniset[kk] >= 84 && miniset[kk] <= 100 && found == true) { + if (miniset[kk] >= 84 && miniset[kk] <= 100 && found) { // BUGFIX: accesses to dungeon can go out of bounds // BUGFIX: Comparisons vs 100 should use same tile as comparisons vs 84. if (dungeon[sx - 1][sy] >= 84 && dungeon[sx - 1][sy] <= 100) { @@ -1787,7 +1786,7 @@ bool drlg_l3_hive_rnd_piece(const BYTE *miniset, int rndper) found = false; } } - if (found == true && random_(0, 100) < rndper) { + if (found && random_(0, 100) < rndper) { placed = true; for (yy = 0; yy < sh; yy++) { for (xx = 0; xx < sw; xx++) { @@ -2187,8 +2186,8 @@ static bool DRLG_L3Anvil() trys++; found = true; ii = 2; - for (yy = 0; yy < sh && found == true; yy++) { - for (xx = 0; xx < sw && found == true; xx++) { + for (yy = 0; yy < sh && found; yy++) { + for (xx = 0; xx < sw && found; xx++) { if (L3ANVIL[ii] != 0 && dungeon[xx + sx][yy + sy] != L3ANVIL[ii]) { found = false; } @@ -2425,7 +2424,7 @@ static void DRLG_L3(int entry) if (!genok && QuestStatus(Q_ANVIL)) { genok = DRLG_L3Anvil(); } - } while (genok == true); + } while (genok); if (currlevel < 17) { DRLG_L3Pool(); } else { diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index da64b5aba..5ee5224b3 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1139,15 +1139,15 @@ static void L4roomGen(int x, int y, int w, int h, int dir) num++; } while (!ran && num < 20); - if (ran == true) + if (ran) L4drawRoom(cx1, cy1, cw, ch); cx2 = x + w; ran2 = L4checkRoom(cx2, cy1 - 1, cw + 1, ch + 2); - if (ran2 == true) + if (ran2) L4drawRoom(cx2, cy1, cw, ch); - if (ran == true) + if (ran) L4roomGen(cx1, cy1, cw, ch, 1); - if (ran2 == true) + if (ran2) L4roomGen(cx2, cy1, cw, ch, 1); return; } @@ -1161,15 +1161,15 @@ static void L4roomGen(int x, int y, int w, int h, int dir) num++; } while (!ran && num < 20); - if (ran == true) + if (ran) L4drawRoom(rx, ry, width, height); ry2 = y + h; ran2 = L4checkRoom(rx - 1, ry2, width + 2, height + 1); - if (ran2 == true) + if (ran2) L4drawRoom(rx, ry2, width, height); - if (ran == true) + if (ran) L4roomGen(rx, ry, width, height, 0); - if (ran2 == true) + if (ran2) L4roomGen(rx, ry2, width, height, 0); } @@ -1347,8 +1347,8 @@ static bool DRLG_L4PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, found = false; } ii = 2; - for (yy = 0; yy < sh && found == true; yy++) { - for (xx = 0; xx < sw && found == true; xx++) { + for (yy = 0; yy < sh && found; yy++) { + for (xx = 0; xx < sw && found; xx++) { if (miniset[ii] != 0 && dungeon[xx + sx][yy + sy] != miniset[ii]) { found = false; } @@ -1388,7 +1388,7 @@ static bool DRLG_L4PlaceMiniSet(const BYTE *miniset, int tmin, int tmax, int cx, quests[Q_BETRAYER]._qtx = sx + 1; quests[Q_BETRAYER]._qty = sy + 1; } - if (setview == true) { + if (setview) { ViewX = 2 * sx + 21; ViewY = 2 * sy + 22; } diff --git a/Source/inv.cpp b/Source/inv.cpp index 7dd311df8..545614ecf 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1919,7 +1919,7 @@ void CheckQuestItem(int pnum) quests[Q_ANVIL]._qactive = QUEST_ACTIVE; quests[Q_ANVIL]._qvar1 = 1; } - if (quests[Q_ANVIL]._qlog == true) { + if (quests[Q_ANVIL]._qlog) { sfxdelay = 10; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR89; @@ -1957,7 +1957,7 @@ void CheckQuestItem(int pnum) quests[Q_ROCK]._qactive = QUEST_ACTIVE; quests[Q_ROCK]._qvar1 = 1; } - if (quests[Q_ROCK]._qlog == true) { + if (quests[Q_ROCK]._qlog) { sfxdelay = 10; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR87; diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 67bbe1088..a7c73a635 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -793,7 +793,7 @@ bool PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, bool s blk = 100; } - if (shift == true) + if (shift) blk = 100; if (mtype == MIS_ACIDPUD) blk = 100; @@ -972,7 +972,7 @@ bool Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, b } else { blkper = 100; } - if (shift == true) + if (shift) blkper = 100; blk = plr[p]._pDexterity + plr[p]._pBaseToBlk + (plr[p]._pLevel << 1) - (plr[pnum]._pLevel << 1); @@ -1305,7 +1305,7 @@ void InitMissiles() AutoMapShowItems = false; plr[myplr]._pSpellFlags &= ~0x1; - if (plr[myplr]._pInfraFlag == true) { + if (plr[myplr]._pInfraFlag) { for (i = 0; i < nummissiles; ++i) { mi = missileactive[i]; if (missile[mi]._mitype == MIS_INFRA) { @@ -3369,7 +3369,7 @@ int AddMissile(int sx, int sy, int dx, int dy, int midir, int mitype, int8_t mic if (nummissiles >= MAXMISSILES - 1) return -1; - if (mitype == MIS_MANASHIELD && plr[id].pManaShield == true) { + if (mitype == MIS_MANASHIELD && plr[id].pManaShield) { if (currlevel != plr[id].plrlevel) return -1; @@ -3710,7 +3710,7 @@ void MI_Lightball(Sint32 i) GetMissilePos(i); j = missile[i]._mirange; CheckMissileCol(i, missile[i]._midam, missile[i]._midam, false, missile[i]._mix, missile[i]._miy, false); - if (missile[i]._miHitFlag == true) + if (missile[i]._miHitFlag) missile[i]._mirange = j; obj = dObject[tx][ty]; if (obj && tx == missile[i]._mix && ty == missile[i]._miy) { @@ -3933,7 +3933,7 @@ void MI_LightningWall(Sint32 i) missile[i]._mirange--; range = missile[i]._mirange; CheckMissileCol(i, missile[i]._midam, missile[i]._midam, 1, missile[i]._mix, missile[i]._miy, 0); - if (missile[i]._miHitFlag == true) + if (missile[i]._miHitFlag) missile[i]._mirange = range; if (missile[i]._mirange == 0) missile[i]._miDelFlag = true; @@ -4493,7 +4493,7 @@ void MI_Lightning(Sint32 i) j = missile[i]._mirange; if (missile[i]._mix != missile[i]._misx || missile[i]._miy != missile[i]._misy) CheckMissileCol(i, missile[i]._midam, missile[i]._midam, true, missile[i]._mix, missile[i]._miy, false); - if (missile[i]._miHitFlag == true) + if (missile[i]._miHitFlag) missile[i]._mirange = j; if (missile[i]._mirange == 0) { missile[i]._miDelFlag = true; @@ -4704,7 +4704,7 @@ void MI_Firemove(Sint32 i) GetMissilePos(i); j = missile[i]._mirange; CheckMissileCol(i, missile[i]._midam, missile[i]._midam, false, missile[i]._mix, missile[i]._miy, false); - if (missile[i]._miHitFlag == true) + if (missile[i]._miHitFlag) missile[i]._mirange = j; if (missile[i]._mirange == 0) { missile[i]._miDelFlag = true; @@ -4978,7 +4978,7 @@ void MI_Boom(Sint32 i) missile[i]._mirange--; if (missile[i]._miVar1 == 0) CheckMissileCol(i, missile[i]._midam, missile[i]._midam, false, missile[i]._mix, missile[i]._miy, true); - if (missile[i]._miHitFlag == true) + if (missile[i]._miHitFlag) missile[i]._miVar1 = 1; if (missile[i]._mirange == 0) missile[i]._miDelFlag = true; @@ -5117,11 +5117,10 @@ void MI_Infra(Sint32 i) void MI_Apoca(Sint32 i) { - int j, k, id; - bool exit; + int j, k; - id = missile[i]._misource; - exit = false; + int id = missile[i]._misource; + bool exit = false; for (j = missile[i]._miVar2; j < missile[i]._miVar3 && !exit; j++) { for (k = missile[i]._miVar4; k < missile[i]._miVar5 && !exit; k++) { if (dMonster[k][j] > MAX_PLRS - 1 && !nSolidTable[dPiece[k][j]]) { @@ -5136,7 +5135,7 @@ void MI_Apoca(Sint32 i) } } - if (exit == true) { + if (exit) { missile[i]._miVar2 = j - 1; missile[i]._miVar4 = k; } else { @@ -5287,7 +5286,7 @@ void MI_Flame(Sint32 i) missile[i]._miVar2--; k = missile[i]._mirange; CheckMissileCol(i, missile[i]._midam, missile[i]._midam, true, missile[i]._mix, missile[i]._miy, false); - if (missile[i]._mirange == 0 && missile[i]._miHitFlag == true) + if (missile[i]._mirange == 0 && missile[i]._miHitFlag) missile[i]._mirange = k; if (missile[i]._miVar2 == 0) missile[i]._miAnimFrame = 20; @@ -5358,7 +5357,7 @@ void MI_Cbolt(Sint32 i) missile[i]._mityoff += missile[i]._miyvel; GetMissilePos(i); CheckMissileCol(i, missile[i]._midam, missile[i]._midam, false, missile[i]._mix, missile[i]._miy, false); - if (missile[i]._miHitFlag == true) { + if (missile[i]._miHitFlag) { missile[i]._miVar1 = 8; missile[i]._mimfnum = 0; missile[i]._mixoff = 0; diff --git a/Source/monster.cpp b/Source/monster.cpp index 755731428..3fb2c0d85 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -714,7 +714,7 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int bosspacksize) if (uniqindex == UMT_ZHAR) { zharflag = true; for (i = 0; i < themeCount; i++) { - if (i == zharlib && zharflag == true) { + if (i == zharlib && zharflag) { zharflag = false; xp = 2 * themeLoc[i].x + 20; yp = 2 * themeLoc[i].y + 20; diff --git a/Source/multi.cpp b/Source/multi.cpp index 33499e0c6..446f68e89 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -898,7 +898,7 @@ void recv_plrinfo(int pnum, TCmdPlrInfoHdr *p, bool recv) plr[pnum].plractive = true; gbActivePlayers++; - if (sgbPlayerTurnBitTbl[pnum] != false) { + if (sgbPlayerTurnBitTbl[pnum]) { szEvent = "Player '%s' (level %d) just joined the game"; } else { szEvent = "Player '%s' (level %d) is already in the game"; diff --git a/Source/objects.cpp b/Source/objects.cpp index 005c049f0..5a49ac1d7 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -331,7 +331,7 @@ static bool WallTrapLocOkK(int xp, int yp) if (dFlags[xp][yp] & BFLAG_POPULATED) return false; - if (nTrapTable[dPiece[xp][yp]] != false) + if (nTrapTable[dPiece[xp][yp]]) return true; else return false;