From 3848d103c81dc68d804c550a4220b5f0d76b0415 Mon Sep 17 00:00:00 2001 From: tron Date: Tue, 15 Nov 2005 09:47:25 +0000 Subject: (svn r3187) Simplify overly complicated ifs, especially if (foo) return false; else return true; is confusing --- command.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'command.c') diff --git a/command.c b/command.c index 3a929c941..02569d01d 100644 --- a/command.c +++ b/command.c @@ -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;} -- cgit v1.2.3-54-g00ecf