LAB: Verify the appropriate use of parenthesis in if statements

This commit is contained in:
Strangerke 2015-12-16 17:03:42 +01:00 committed by Willem Jan Palenstijn
parent 83126e84ee
commit 5ed11d721c
8 changed files with 13 additions and 13 deletions

View File

@ -118,7 +118,7 @@ void Anim::diffNextFrame(bool onlyDiffData) {
_frameNum++;
if ((_frameNum == 1) && (_continuous || (!_playOnce)))
if ((_frameNum == 1) && (_continuous || !_playOnce))
_diffFileStart = _diffFile;
_isAnim = (_frameNum >= 3) && (!_playOnce);

View File

@ -180,7 +180,7 @@ SaveStateList LabMetaEngine::listSaves(const char *target) const {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
if (slotNum >= 0 && slotNum <= 999) {
if ((slotNum >= 0) && (slotNum <= 999)) {
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
if (in) {
if (Lab::readSaveGameHeader(in, header))

View File

@ -638,7 +638,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo
if (g_engine->shouldQuit())
return false;
if ((msgClass == RAWKEY) && (!_graphics->_longWinInFront)) {
if ((msgClass == RAWKEY) && !_graphics->_longWinInFront) {
if (!processKey(curMsg, msgClass, qualifier, curPos, curInv, forceDraw, code))
return false;
}
@ -990,9 +990,9 @@ void LabEngine::processMainButton(CloseDataPtr wrkClosePtr, uint16 &curInv, uint
} else if (_roomNum == oldRoomNum) { // didn't get there?
_followingCrumbs = false;
}
} else if (_droppingCrumbs && oldRoomNum != _roomNum) {
} else if (_droppingCrumbs && (oldRoomNum != _roomNum)) {
// If in surreal maze, turn off DroppingCrumbs.
if (_roomNum >= 245 && _roomNum <= 280) {
if ((_roomNum >= 245) && (_roomNum <= 280)) {
_followingCrumbs = false;
_droppingCrumbs = false;
_numCrumbs = 0;
@ -1091,7 +1091,7 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI
if ((curInv == 0) || (curInv > _numInv)) {
curInv = 1;
while ((curInv <= _numInv) && (!_conditions->in(curInv)))
while ((curInv <= _numInv) && !_conditions->in(curInv))
curInv++;
}

View File

@ -70,7 +70,7 @@ void Image::blitBitmap(uint16 xs, uint16 ys, Image *imDest,
if (yd + h > destHeight)
h = destHeight - yd;
if (w > 0 && h > 0) {
if ((w > 0) && (h > 0)) {
byte *s = _imageData + ys * _width + xs;
byte *d = destBuffer + yd * destWidth + xd;

View File

@ -117,8 +117,8 @@ Button *EventManager::checkNumButtonHit(ButtonList *buttonList, uint16 key) {
for (ButtonList::iterator buttonItr = buttonList->begin(); buttonItr != buttonList->end(); ++buttonItr) {
Button *button = *buttonItr;
if ((gkey - 1 == button->_buttonID || (gkey == 0 && button->_buttonID == 9) ||
(button->_keyEquiv != 0 && makeButtonKeyEquiv(key) == button->_keyEquiv))
if (((gkey - 1 == button->_buttonID) || ((gkey == 0) && (button->_buttonID == 9))
|| ((button->_keyEquiv != 0) && (makeButtonKeyEquiv(key) == button->_keyEquiv)))
&& button->_isEnabled) {
mouseHide();
button->_altImage->drawImage(button->_x, button->_y);

View File

@ -324,7 +324,7 @@ bool LabEngine::floorVisited(uint16 floorNum) {
* Note: The original did not show all the visited floors, but we do
*/
uint16 LabEngine::getUpperFloor(uint16 floorNum) {
if (floorNum == kFloorCarnival || floorNum == kFloorNone)
if ((floorNum == kFloorCarnival) || (floorNum == kFloorNone))
return kFloorNone;
for (uint16 i = floorNum; i < kFloorCarnival; i++)
@ -339,7 +339,7 @@ uint16 LabEngine::getUpperFloor(uint16 floorNum) {
* Note: The original did not show all the visited floors, but we do
*/
uint16 LabEngine::getLowerFloor(uint16 floorNum) {
if (floorNum == kFloorLower || floorNum == kFloorNone)
if ((floorNum == kFloorLower) || (floorNum == kFloorNone))
return kFloorNone;
for (uint16 i = floorNum; i > kFloorLower; i--)

View File

@ -71,7 +71,7 @@ void Music::updateMusic() {
_vm->_event->processInput();
_vm->_event->updateMouse();
if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) {
if (_musicOn && (getPlayingBufferCount() < MAXBUFFERS)) {
// NOTE: We need to use malloc(), cause this will be freed with free()
// by the music code
byte *musicBuffer = (byte *)malloc(MUSICBUFSIZE);

View File

@ -82,7 +82,7 @@ char *Resource::getText(const char *fileName) {
byte *text = buffer;
dataFile->read(buffer, count);
while (text && *text != '\0')
while (text && (*text != '\0'))
*text++ -= (byte)95;
delete dataFile;