Skip to content

Commit

Permalink
JANITORIAL: Replace (x ? false : true) by !(x).
Browse files Browse the repository at this point in the history
  • Loading branch information
chmallon authored and fuzzie committed Mar 13, 2012
1 parent 337d5da commit 75efdd2
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion audio/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
Expand Up @@ -1175,7 +1175,7 @@ void TownsPC98_AudioDriver::loadMusicData(uint8 *data, bool loadPaused) {
_patches = src_a + 4;
_finishedChannelsFlag = _finishedSSGFlag = _finishedRhythmFlag = 0;

_musicPlaying = (loadPaused ? false : true);
_musicPlaying = !loadPaused;
}

void TownsPC98_AudioDriver::loadSoundEffectData(uint8 *data, uint8 trackNum) {
Expand Down
4 changes: 2 additions & 2 deletions engines/kyra/eobcommon.cpp
Expand Up @@ -2066,7 +2066,7 @@ bool EoBCoreEngine::characterAttackHitTest(int charIndex, int monsterIndex, int

s = CLIP(s, 1, 20);

return s < m ? false : true;
return s >= m;
}

bool EoBCoreEngine::monsterAttackHitTest(EoBMonsterInPlay *m, int charIndex) {
Expand Down Expand Up @@ -2300,7 +2300,7 @@ bool EoBCoreEngine::trySavingThrow(void *target, int hpModifier, int level, int
s -= constMod[c->constitutionCur];
}

return rollDice(1, 20) < s ? false : true;
return rollDice(1, 20) >= s;
}

bool EoBCoreEngine::specialAttackSavingThrow(int charIndex, int type) {
Expand Down
6 changes: 3 additions & 3 deletions engines/kyra/gui_eob.cpp
Expand Up @@ -1876,7 +1876,7 @@ int GUI_EoB::processButtonList(Kyra::Button *buttonList, uint16 inputFlags, int8
processButton(buttonList);

if (v6 && buttonList->buttonCallback)
runLoop = ((*buttonList->buttonCallback.get())(buttonList)) ? false : true;
runLoop = !(*buttonList->buttonCallback.get())(buttonList);

if ((flgs2 & 2) && (flgs & 0x20))
runLoop = false;
Expand Down Expand Up @@ -2331,7 +2331,7 @@ bool GUI_EoB::confirmDialogue2(int dim, int id, int deflt) {
_screen->setFont(of);
_screen->setScreenDim(od);

return newHighlight ? false : true;
return newHighlight == 0;
}

void GUI_EoB::messageDialogue(int dim, int id, int buttonTextCol) {
Expand Down Expand Up @@ -3548,7 +3548,7 @@ bool GUI_EoB::confirmDialogue(int id) {
_vm->removeInputTop();

if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP5] || inputFlag == _vm->_keyMap[Common::KEYCODE_SPACE] || inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN]) {
result = lastHighlight ? false : true;
result = lastHighlight == 0;
inputFlag = 0x8021 + lastHighlight;
runLoop = false;
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_KP4] || inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_KP6] || inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT]) {
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/screen_v2.cpp
Expand Up @@ -365,7 +365,7 @@ bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, i
}
}

return (w1 == -1) ? false : true;
return w1 != -1;
}

void Screen_v2::checkedPageUpdate(int srcPage, int dstPage) {
Expand Down
4 changes: 2 additions & 2 deletions engines/kyra/sequences_hof.cpp
Expand Up @@ -32,7 +32,7 @@ namespace Kyra {
void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
seq_init();

bool allowSkip = (!(_flags.isDemo && !_flags.isTalkie) && (startSeq == kSequenceTitle)) ? false : true;
bool allowSkip = (_flags.isDemo && !_flags.isTalkie) || startSeq != kSequenceTitle;

if (endSeq == -1)
endSeq = startSeq;
Expand Down Expand Up @@ -74,7 +74,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
_seqFrameCounter = 0;
_seqStartTime = _system->getMillis();

allowSkip = (!(_flags.isDemo && !_flags.isTalkie) && (seqNum == kSequenceTitle)) ? false : true;
allowSkip = (_flags.isDemo && !_flags.isTalkie) || seqNum != kSequenceTitle;

Sequence cseq = _sequences->seq[seqNum];
SeqProc cb = _callbackS[seqNum];
Expand Down
4 changes: 2 additions & 2 deletions engines/kyra/sprites_lol.cpp
Expand Up @@ -248,7 +248,7 @@ bool LoLEngine::updateMonsterAdjustBlocks(LoLMonster *monster) {
int16 fx2 = 0;
setLevelShapesDim(x2 + dims[y2], fx1, fx2, 13);

return (fx1 >= fx2) ? false : true;
return fx1 < fx2;
}

void LoLEngine::placeMonster(LoLMonster *monster, uint16 x, uint16 y) {
Expand Down Expand Up @@ -1447,7 +1447,7 @@ void LoLEngine::rearrangeAttackingMonster(LoLMonster *monster) {
uint16 mx = monster->x;
uint16 my = monster->y;
uint16 *c = (t & 1) ? &my : &mx;
bool centered = (*c & 0x7f) ? false : true;
bool centered = (*c & 0x7f) == 0;

bool posFlag = true;
if (monster->properties->maxWidth <= 63) {
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/timer_eob.cpp
Expand Up @@ -186,7 +186,7 @@ void EoBCoreEngine::timerProcessFlyingObjects(int timerNum) {
if (!fo->enable)
continue;

bool endFlight = fo->distance ? false : true;
bool endFlight = fo->distance == 0;

uint8 pos = dirPosIndex[(fo->direction << 2) + (fo->curPos & 3)];
uint16 bl = fo->curBlock;
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/vqa.cpp
Expand Up @@ -395,7 +395,7 @@ void VQAMovie::displayFrame(uint frameNum) {
if (frameNum >= _header.numFrames || !_opened)
return;

bool foundSound = _stream ? false : true;
bool foundSound = !_stream;
bool foundFrame = false;
uint i;

Expand Down
2 changes: 1 addition & 1 deletion engines/lastexpress/entities/chapters.cpp
Expand Up @@ -1805,7 +1805,7 @@ void Chapters::enterExitHelper(bool isEnteringStation) {
getObjects()->update(kObjectHandleOutsideLeft, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);
getObjects()->update(kObjectHandleOutsideRight, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);

getProgress().isTrainRunning = isEnteringStation ? false : true;
getProgress().isTrainRunning = !isEnteringStation;

if (isEnteringStation) {
ENTITY_PARAM(0, 2) = 1;
Expand Down
2 changes: 1 addition & 1 deletion engines/sci/engine/kmenu.cpp
Expand Up @@ -94,7 +94,7 @@ reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv) {

reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) {
reg_t eventObject = argv[0];
bool pauseSound = argc > 1 ? (argv[1].isNull() ? false : true) : true;
bool pauseSound = argc <= 1 || !argv[1].isNull();

return g_sci->_gfxMenu->kernelSelect(eventObject, pauseSound);
}
Expand Down
2 changes: 1 addition & 1 deletion engines/sci/graphics/controls16.cpp
Expand Up @@ -297,7 +297,7 @@ void GfxControls16::kernelDrawButton(Common::Rect rect, reg_t obj, const char *t
_paint16->eraseRect(rect);
_paint16->frameRect(rect);
rect.grow(-2);
_ports->textGreyedOutput(style & 1 ? false : true);
_ports->textGreyedOutput(!(style & SCI_CONTROLS_STYLE_ENABLED));
_text16->Box(text, false, rect, SCI_TEXT16_ALIGNMENT_CENTER, fontId);
_ports->textGreyedOutput(false);
rect.grow(1);
Expand Down
4 changes: 2 additions & 2 deletions engines/sci/graphics/menu.cpp
Expand Up @@ -286,7 +286,7 @@ void GfxMenu::kernelSetAttribute(uint16 menuId, uint16 itemId, uint16 attributeI

switch (attributeId) {
case SCI_MENU_ATTRIBUTE_ENABLED:
itemEntry->enabled = value.isNull() ? false : true;
itemEntry->enabled = !value.isNull();
break;
case SCI_MENU_ATTRIBUTE_SAID:
itemEntry->saidVmPtr = value;
Expand Down Expand Up @@ -606,7 +606,7 @@ void GfxMenu::drawMenu(uint16 oldMenuId, uint16 newMenuId) {
listItemEntry = *listItemIterator;
if (listItemEntry->menuId == newMenuId) {
if (!listItemEntry->separatorLine) {
_ports->textGreyedOutput(listItemEntry->enabled ? false : true);
_ports->textGreyedOutput(!listItemEntry->enabled);
_ports->moveTo(_menuRect.left, topPos);
_text16->DrawString(listItemEntry->textSplit.c_str());
_ports->moveTo(_menuRect.right - listItemEntry->textRightAlignedWidth - 5, topPos);
Expand Down
2 changes: 1 addition & 1 deletion engines/sci/graphics/paint16.cpp
Expand Up @@ -513,7 +513,7 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
argc--; argv++;
break;
case SCI_DISPLAY_SETGREYEDOUTPUT:
_ports->textGreyedOutput(argv[0].isNull() ? false : true);
_ports->textGreyedOutput(!argv[0].isNull());
argc--; argv++;
break;
case SCI_DISPLAY_SETFONT:
Expand Down
4 changes: 2 additions & 2 deletions engines/scumm/gfx_towns.cpp
Expand Up @@ -271,7 +271,7 @@ void TownsScreen::setupLayer(int layer, int width, int height, int numCol, void

l->enabled = true;
_layers[0].onBottom = true;
_layers[1].onBottom = _layers[0].enabled ? false : true;
_layers[1].onBottom = !_layers[0].enabled;
l->ready = true;
}

Expand Down Expand Up @@ -424,7 +424,7 @@ void TownsScreen::toggleLayers(int flag) {
_layers[0].enabled = (flag & 1) ? true : false;
_layers[0].onBottom = true;
_layers[1].enabled = (flag & 2) ? true : false;
_layers[1].onBottom = _layers[0].enabled ? false : true;
_layers[1].onBottom = !_layers[0].enabled;

_dirtyRects.clear();
_dirtyRects.push_back(Common::Rect(_width - 1, _height - 1));
Expand Down
2 changes: 1 addition & 1 deletion engines/sword25/kernel/inputpersistenceblock.cpp
Expand Up @@ -86,7 +86,7 @@ void InputPersistenceBlock::read(bool &value) {
if (checkMarker(BOOL_MARKER)) {
uint uintBool = READ_LE_UINT32(_iter);
_iter += 4;
value = uintBool == 0 ? false : true;
value = uintBool != 0;
} else {
value = false;
}
Expand Down
2 changes: 1 addition & 1 deletion engines/sword25/script/luabindhelper.h
Expand Up @@ -40,7 +40,7 @@
namespace Sword25 {

#define lua_pushbooleancpp(L, b) (lua_pushboolean(L, b ? 1 : 0))
#define lua_tobooleancpp(L, i) (lua_toboolean(L, i) == 0 ? false : true)
#define lua_tobooleancpp(L, i) (lua_toboolean(L, i) != 0)

struct lua_constant_reg {
const char *Name;
Expand Down
2 changes: 1 addition & 1 deletion gui/options.cpp
Expand Up @@ -1010,7 +1010,7 @@ bool OptionsDialog::loadMusicDeviceSetting(PopUpWidget *popup, Common::String se
for (MusicDevices::iterator d = i.begin(); d != i.end(); ++d) {
if (setting.empty() ? (preferredType == d->getMusicType()) : (drv == d->getCompleteId())) {
popup->setSelectedTag(d->getHandle());
return popup->getSelected() == -1 ? false : true;
return popup->getSelected() != -1;
}
}
}
Expand Down

0 comments on commit 75efdd2

Please sign in to comment.