summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-11-15 09:47:25 +0000
committertron <tron@openttd.org>2005-11-15 09:47:25 +0000
commit24f857ed5edab0bf79b1f0f2c18b9a6280103ffb (patch)
treed754a4bbb7a3e5f12b31a28e64345ca8be3cdd20 /newgrf.c
parent9f8c5d8fd268cc6007047025650951a546133ce1 (diff)
downloadopenttd-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.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/newgrf.c b/newgrf.c
index aa4ddfc07..5396ef323 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -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);
}