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 | 24f857ed5edab0bf79b1f0f2c18b9a6280103ffb (patch) | |
tree | d754a4bbb7a3e5f12b31a28e64345ca8be3cdd20 /newgrf.c | |
parent | 9f8c5d8fd268cc6007047025650951a546133ce1 (diff) | |
download | openttd-24f857ed5edab0bf79b1f0f2c18b9a6280103ffb.tar.xz |
(svn r3187) Simplify overly complicated ifs, especially if (foo) return false; else return true; is confusing
Diffstat (limited to 'newgrf.c')
-rw-r--r-- | newgrf.c | 20 |
1 files changed, 5 insertions, 15 deletions
@@ -2572,24 +2572,14 @@ static void DecodeSpecialSprite(const char* filename, uint num, uint stage) if (action >= lengthof(handlers)) { DEBUG(grf, 7) ("Skipping unknown action 0x%02X", action); - free(buf); - return; - } - - if (!HASBIT(action_mask, action)) { + } else if (!HASBIT(action_mask, action)) { DEBUG(grf, 7) ("Skipping action 0x%02X in stage %d", action, stage); - free(buf); - return; - } - - if (handlers[action] == NULL) { + } else if (handlers[action] == NULL) { DEBUG(grf, 7) ("Skipping unsupported Action 0x%02X", action); - free(buf); - return; + } else { + DEBUG(grf, 7) ("Handling action 0x%02X in stage %d", action, stage); + handlers[action](buf, num); } - - DEBUG(grf, 7) ("Handling action 0x%02X in stage %d", action, stage); - handlers[action](buf, num); free(buf); } |