From 5a0c02b81a23e9ca40ea4ca82bc2b848fccac8fc Mon Sep 17 00:00:00 2001 From: En Yi Date: Tue, 14 May 2024 23:22:26 +0800 Subject: [PATCH] Fix out-of-bound tile check due to uint --- scenes/scene_systems.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scenes/scene_systems.c b/scenes/scene_systems.c index b98b8e8..8f62bf4 100644 --- a/scenes/scene_systems.c +++ b/scenes/scene_systems.c @@ -294,7 +294,7 @@ void change_a_tile(TileGrid_t* tilemap, unsigned int tile_idx, TileType_t new_ty } } - if (tile_idx - tilemap->width >= 0) + if (tile_idx >= tilemap->width) { tilemap->tiles[tile_idx].connectivity |= (tilemap->tiles[tile_idx - tilemap->width].tile_type == SOLID_TILE) ? (1 << UP_BIT) : 0; if (new_type == SOLID_TILE)