diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-06 23:34:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-07 19:23:40 +0300 |
commit | 36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch) | |
tree | 190156cb88b13a38a6d13c69ee0742cc078065a1 /src/input/joystick.cpp | |
parent | f1518dd8476c968a43fa57cfb06198e290a4f77a (diff) | |
download | manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2 manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip |
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/input/joystick.cpp')
-rw-r--r-- | src/input/joystick.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp index 480d2b493..3ec317c8d 100644 --- a/src/input/joystick.cpp +++ b/src/input/joystick.cpp @@ -97,7 +97,7 @@ bool Joystick::open() mJoystick = SDL_JoystickOpen(mNumber); - if (!mJoystick) + if (mJoystick == nullptr) { logger->log("Couldn't open joystick: %s", SDL_GetError()); return false; @@ -129,7 +129,7 @@ bool Joystick::open() void Joystick::close() { logger->log("close joystick %d", mNumber); - if (mJoystick) + if (mJoystick != nullptr) { SDL_JoystickClose(mJoystick); mJoystick = nullptr; @@ -144,7 +144,7 @@ void Joystick::reload() void Joystick::setNumber(const int n) { - if (mJoystick) + if (mJoystick != nullptr) { SDL_JoystickClose(mJoystick); mNumber = n; @@ -200,17 +200,17 @@ void Joystick::logic() logger->log("axis 4 pos: %d", SDL_JoystickGetAxis(mJoystick, 4)); #endif // DEBUG_JOYSTICK - if (!mDirection && mHaveHats) + if ((mDirection == 0u) && mHaveHats) { // reading only hat 0 const uint8_t hat = SDL_JoystickGetHat(mJoystick, 0); - if (hat & SDL_HAT_RIGHT) + if ((hat & SDL_HAT_RIGHT) != 0) mDirection |= RIGHT; - else if (hat & SDL_HAT_LEFT) + else if ((hat & SDL_HAT_LEFT) != 0) mDirection |= LEFT; - if (hat & SDL_HAT_UP) + if ((hat & SDL_HAT_UP) != 0) mDirection |= UP; - else if (hat & SDL_HAT_DOWN) + else if ((hat & SDL_HAT_DOWN) != 0) mDirection |= DOWN; } |