From 7dd7895cb455a954210c580156b3c480049e527c Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Thu, 19 Nov 2020 18:54:49 -0500 Subject: [PATCH] fixing control flow in get_nearest_home_index --- src/code_197F40.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/code_197F40.c b/src/code_197F40.c index 156a76bdd7..6c10f62b35 100644 --- a/src/code_197F40.c +++ b/src/code_197F40.c @@ -13,26 +13,24 @@ s32 get_nearest_home_index(f32 x, f32 y, f32 z) { s32 xVal; s32 yVal; - xVal = 0; - if (!(y < 40.0f)) { + if (y < 40.0f) { + xVal = 0; + } else if (y < 85.0f) { xVal = 1; - if (!(y < 85.0f)) { - xVal = 3; - if (y < 100.0f) { - xVal = 2; - } - } + } else if (y < 100.0f) { + xVal = 2; + } else { + xVal = 3; } - yVal = 0; - if (!(x < 25.0f)) { + if (x < 25.0f) { + yVal = 0; + } else if (x < 65.0f) { yVal = 1; - if (!(x < 65.0f)) { - yVal = 3; - if (x < 105.0f) { - yVal = 2; - } - } + } else if (x < 105.0f) { + yVal = 2; + } else { + yVal = 3; } return yVal | (xVal << 2);