From e81eab613374655022a592a055e7afe106765147 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Fri, 20 Aug 2010 16:35:20 +0000 Subject: Hugo : Style - Add parenthesis around condition when conditional operator is used, as mentioned in Code Formatting Conventions svn-id: r52230 --- engines/hugo/detection.cpp | 2 +- engines/hugo/engine.cpp | 6 +++--- engines/hugo/game.h | 2 +- engines/hugo/mouse.cpp | 4 ++-- engines/hugo/schedule.cpp | 2 +- engines/hugo/util.cpp | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index cf10bbbe0f..51a4ad324f 100644 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -199,7 +199,7 @@ void HugoEngine::initGame(const HugoGameDescription *gd) { void HugoEngine::initGamePart(const HugoGameDescription *gd) { char tmpStr[8]; - _gameVariant = _gameType - 1 + (_platform == Common::kPlatformWindows ? 0 : 3); + _gameVariant = _gameType - 1 + ((_platform == Common::kPlatformWindows) ? 0 : 3); //Generate filenames if (gd->desc.platform == Common::kPlatformWindows) diff --git a/engines/hugo/engine.cpp b/engines/hugo/engine.cpp index 59b2e0d9ee..967d75e663 100644 --- a/engines/hugo/engine.cpp +++ b/engines/hugo/engine.cpp @@ -262,11 +262,11 @@ void HugoEngine::moveObjects() { if (abs(dx) <= radius) obj->vx = 0; else - obj->vx = dx > 0 ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath); + obj->vx = (dx > 0) ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath); if (abs(dy) <= radius) obj->vy = 0; else - obj->vy = dy > 0 ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath); + obj->vy = (dy > 0) ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath); // Set first image in sequence (if multi-seq object) switch (obj->seqNumb) { @@ -467,7 +467,7 @@ int HugoEngine::deltaY(int x1, int x2, int vy, int y) { if (vy == 0) return(0); // Object stationary - inc = (vy > 0 ? 1 : -1); + inc = (vy > 0) ? 1 : -1; for (j = y + inc; j != (y + vy + inc); j += inc) //Search by byte for (i = x1 >> 3; i <= x2 >> 3; i++) if ((b = _boundary[j * XBYTES + i] | _objBound[j * XBYTES + i]) != 0) { // Any bit set diff --git a/engines/hugo/game.h b/engines/hugo/game.h index e8eeae75cb..ccac23d3c8 100644 --- a/engines/hugo/game.h +++ b/engines/hugo/game.h @@ -109,7 +109,7 @@ namespace Hugo { #define LOOK_S 8 // Description depends on state of object // Macros: -#define TPS (_config.turboFl ? TURBO_TPS : NORMAL_TPS) +#define TPS ((_config.turboFl) ? TURBO_TPS : NORMAL_TPS) enum TEXTCOLORS { diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp index 329b0b4fc7..dcc4b20730 100644 --- a/engines/hugo/mouse.cpp +++ b/engines/hugo/mouse.cpp @@ -167,7 +167,7 @@ void MouseHandler::processLeftClick(int16 objId, int16 cx, int16 cy) { case LEFT_ARROW: // A scroll arrow - scroll the iconbar case RIGHT_ARROW: // Scroll the iconbar and display results - _vm.inventory().processInventory(objId == LEFT_ARROW ? INV_LEFT : INV_RIGHT); + _vm.inventory().processInventory((objId == LEFT_ARROW) ? INV_LEFT : INV_RIGHT); _vm.screen().moveImage(_vm.screen().getIconBuffer(), 0, 0, XPIX, INV_DY, XPIX, _vm.screen().getFrontBuffer(), 0, DIBOFF_Y, XPIX); _vm.screen().moveImage(_vm.screen().getIconBuffer(), 0, 0, XPIX, INV_DY, XPIX, _vm.screen().getBackBuffer(), 0, DIBOFF_Y, XPIX); _vm.screen().displayList(D_ADD, 0, DIBOFF_Y, XPIX, INV_DY); @@ -281,7 +281,7 @@ void MouseHandler::mouseHandler() { if (objId >= 0) { // Got a match // Display object name next to cursor (unless CURSOR_NOCHAR) // Note test for swapped hero name - name = _vm._arrayNouns[_vm._objects[objId == HERO ? _vm._heroImage : objId].nounIndex][CURSOR_NAME]; + name = _vm._arrayNouns[(_vm._objects[objId == HERO) ? _vm._heroImage : objId].nounIndex][CURSOR_NAME]; if (name[0] != CURSOR_NOCHAR) cursorText(name, cx, cy, U_FONT8, _TBRIGHTWHITE); diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index 9757ace12a..e7ebdfa7a1 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -47,7 +47,7 @@ namespace Hugo { -#define SIGN(X) (X < 0 ? -1 : 1) +#define SIGN(X) ((X < 0) ? -1 : 1) Scheduler::Scheduler(HugoEngine &vm) : _vm(vm) { } diff --git a/engines/hugo/util.cpp b/engines/hugo/util.cpp index f623583fd1..ad7b9fe39e 100644 --- a/engines/hugo/util.cpp +++ b/engines/hugo/util.cpp @@ -200,7 +200,7 @@ void Utils::Debug_out(char *format, ...) { if (HugoEngine::get().getGameStatus().debugFl) { /* Create/truncate if first call, else append */ - if ((fp = fopen("debug.txt", fp == NULL ? "w" : "a")) == NULL) { + if ((fp = fopen("debug.txt", (fp == NULL) ? "w" : "a")) == NULL) { Error(WRITE_ERR, "debug.txt"); return; } -- cgit v1.2.3