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/keyboardconfig.cpp | |
parent | f1518dd8476c968a43fa57cfb06198e290a4f77a (diff) | |
download | plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2 plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip |
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/input/keyboardconfig.cpp')
-rw-r--r-- | src/input/keyboardconfig.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp index 9ed3d2a58..794d4d377 100644 --- a/src/input/keyboardconfig.cpp +++ b/src/input/keyboardconfig.cpp @@ -163,7 +163,7 @@ InputActionT KeyboardConfig::getActionId(const SDL_Event &event) bool KeyboardConfig::isActionActive(const InputActionT index) const { - if (!mActiveKeys || !mActiveKeys2) + if ((mActiveKeys == nullptr) || (mActiveKeys2 == nullptr)) return false; const InputFunction &key = inputManager.getKey(index); @@ -176,12 +176,12 @@ bool KeyboardConfig::isActionActive(const InputActionT index) const const int value = val.value; if (value >= 0) { - if (mActiveKeys[value]) + if (mActiveKeys[value] != 0u) return true; } else if (value < -1 && value > -500) { - if (mActiveKeys2[-value]) + if (mActiveKeys2[-value] != 0u) return true; } } @@ -196,7 +196,7 @@ void KeyboardConfig::update() void KeyboardConfig::handleActivateKey(const SDL_Event &event) { - if (!mActiveKeys2) + if (mActiveKeys2 == nullptr) return; const int key = getKeyValueFromEvent(event); if (key < -1 && key > -500) @@ -206,7 +206,7 @@ void KeyboardConfig::handleActivateKey(const SDL_Event &event) void KeyboardConfig::handleActivateKey(const int key) { - if (!mActiveKeys2) + if (mActiveKeys2 == nullptr) return; if (key < -1 && key > -500) mActiveKeys2[-key] = 1; @@ -215,7 +215,7 @@ void KeyboardConfig::handleActivateKey(const int key) void KeyboardConfig::handleDeActicateKey(const SDL_Event &event) { - if (!mActiveKeys2) + if (mActiveKeys2 == nullptr) return; const int key = getKeyValueFromEvent(event); if (key < -1 && key > -500) @@ -225,7 +225,7 @@ void KeyboardConfig::handleDeActicateKey(const SDL_Event &event) void KeyboardConfig::handleDeActicateKey(const int key) { - if (!mActiveKeys2) + if (mActiveKeys2 == nullptr) return; if (key < -1 && key > -500) mActiveKeys2[-key] = 0; @@ -241,12 +241,12 @@ void KeyboardConfig::handleRepeat(const int time) const int key = (*it).first; if (key >= 0) { - if (mActiveKeys && mActiveKeys[key]) + if ((mActiveKeys != nullptr) && (mActiveKeys[key] != 0u)) repeat = true; } else if (key < -1 && key > -500) { - if (mActiveKeys2 && mActiveKeys2[-key]) + if ((mActiveKeys2 != nullptr) && (mActiveKeys2[-key] != 0u)) repeat = true; } if (repeat) |