From 365c558f35f5baf996324d2e3574af9223d334ee Mon Sep 17 00:00:00 2001 From: zapashcanon Date: Thu, 8 Dec 2022 03:08:49 +0100 Subject: [PATCH] make sure there's an odd number of tiles --- src/island_client.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/island_client.ml b/src/island_client.ml index 75f0bf6..7f7a884 100644 --- a/src/island_client.ml +++ b/src/island_client.ml @@ -54,9 +54,13 @@ let init () = C2d.fill_rect context ~x:0. ~y:0. ~w:(float_of_int width) ~h:(float_of_int height) -let tiles_per_w = width / tile_size +let tiles_per_w = + let n = width / tile_size in + if n mod 2 = 0 then n - 1 else n -let tiles_per_h = height / tile_size +let tiles_per_h = + let n = height / tile_size in + if n mod 2 = 0 then n - 1 else n let orig_x = (width - (tiles_per_w * tile_size)) / 2