From 7359134fc549518bdc80cc6f532ececcf7be616e Mon Sep 17 00:00:00 2001 From: adrian17 Date: Thu, 4 Sep 2014 21:10:49 +0200 Subject: [PATCH] Fix off-by-one error in center_2d_coordinates --- src/viewport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/viewport.c b/src/viewport.c index 4266f27c8e..d39bf92a8d 100644 --- a/src/viewport.c +++ b/src/viewport.c @@ -113,19 +113,19 @@ void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_view switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)){ case 0: x = y - x; - y = y / 2 + start_x / 2 - z; + y = (y + start_x) / 2 - z; break; case 1: x = -y - x; - y = y / 2 - start_x / 2 - z; + y = (y - start_x) / 2 - z; break; case 2: x = -y + x; - y = -y / 2 - start_x / 2 - z; + y = (-y - start_x) / 2 - z; break; case 3: x = y + x; - y = -y / 2 + start_x / 2 - z; + y = (-y + start_x) / 2 - z; break; }