diff options
author | tron <tron@openttd.org> | 2005-11-15 09:47:25 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-11-15 09:47:25 +0000 |
commit | 3848d103c81dc68d804c550a4220b5f0d76b0415 (patch) | |
tree | d754a4bbb7a3e5f12b31a28e64345ca8be3cdd20 /command.c | |
parent | ca1dfe94d2cbfe9bc5e10d6598430ec2ec640b51 (diff) | |
download | openttd-3848d103c81dc68d804c550a4220b5f0d76b0415.tar.xz |
(svn r3187) Simplify overly complicated ifs, especially if (foo) return false; else return true; is confusing
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -309,12 +309,11 @@ static const Command _command_proc_table[] = { /* This function range-checks a cmd, and checks if the cmd is not NULL */ bool IsValidCommand(uint cmd) { - cmd = cmd & 0xFF; + cmd &= 0xFF; - if (cmd >= lengthof(_command_proc_table) || _command_proc_table[cmd].proc == NULL) - return false; - - return true; + return + cmd < lengthof(_command_proc_table) && + _command_proc_table[cmd].proc != NULL; } byte GetCommandFlags(uint cmd) {return _command_proc_table[cmd & 0xFF].flags;} |