Skip to content

Commit

Permalink
KeyInputProc: Simplify expressions (clang tidy)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Aug 28, 2021
1 parent 3506e96 commit 6229cea
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2911,10 +2911,10 @@ bool Game_Interpreter::CommandKeyInputProc(lcf::rpg::EventCommand const& com) {
} else {
// For Rpg2k >=1.50
_keyinput.keys[Keys::eShift] = com.parameters[5] != 0;
_keyinput.keys[Keys::eDown] = param_size > 6 ? com.parameters[6] != 0 : false;
_keyinput.keys[Keys::eLeft] = param_size > 7 ? com.parameters[7] != 0 : false;
_keyinput.keys[Keys::eRight] = param_size > 8 ? com.parameters[8] != 0 : false;
_keyinput.keys[Keys::eUp] = param_size > 9 ? com.parameters[9] != 0 : false;
_keyinput.keys[Keys::eDown] = param_size > 6 && com.parameters[6] != 0;
_keyinput.keys[Keys::eLeft] = param_size > 7 && com.parameters[7] != 0;
_keyinput.keys[Keys::eRight] = param_size > 8 && com.parameters[8] != 0;
_keyinput.keys[Keys::eUp] = param_size > 9 && com.parameters[9] != 0;
}
} else {
if (param_size != 10 || Player::IsRPG2k3Legacy()) {
Expand All @@ -2925,17 +2925,17 @@ bool Game_Interpreter::CommandKeyInputProc(lcf::rpg::EventCommand const& com) {
_keyinput.keys[Keys::eRight] = true;
_keyinput.keys[Keys::eUp] = true;
}
_keyinput.keys[Keys::eNumbers] = param_size > 5 ? com.parameters[5] != 0 : false;
_keyinput.keys[Keys::eOperators] = param_size > 6 ? com.parameters[6] != 0 : false;
_keyinput.time_variable = param_size > 7 ? com.parameters[7] : false;
_keyinput.timed = param_size > 8 ? com.parameters[8] != 0 : false;
_keyinput.keys[Keys::eNumbers] = param_size > 5 && com.parameters[5] != 0;
_keyinput.keys[Keys::eOperators] = param_size > 6 && com.parameters[6] != 0;
_keyinput.time_variable = param_size > 7 && com.parameters[7];
_keyinput.timed = param_size > 8 && com.parameters[8] != 0;
if (param_size > 10 && Player::IsMajorUpdatedVersion()) {
// For Rpg2k3 >=1.05
_keyinput.keys[Keys::eShift] = com.parameters[9] != 0;
_keyinput.keys[Keys::eDown] = com.parameters[10] != 0;
_keyinput.keys[Keys::eLeft] = param_size > 11 ? com.parameters[11] != 0 : false;
_keyinput.keys[Keys::eRight] = param_size > 12 ? com.parameters[12] != 0 : false;
_keyinput.keys[Keys::eUp] = param_size > 13 ? com.parameters[13] != 0 : false;
_keyinput.keys[Keys::eLeft] = param_size > 11 && com.parameters[11] != 0;
_keyinput.keys[Keys::eRight] = param_size > 12 && com.parameters[12] != 0;
_keyinput.keys[Keys::eUp] = param_size > 13 && com.parameters[13] != 0;
}
} else {
// Since RPG2k3 1.05
Expand Down

0 comments on commit 6229cea

Please sign in to comment.