Fix out-of-bound tile check due to uint

scene_man
En Yi 2024-05-14 23:22:26 +08:00
parent 394825173d
commit 5a0c02b81a
1 changed files with 1 additions and 1 deletions

View File

@ -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; tilemap->tiles[tile_idx].connectivity |= (tilemap->tiles[tile_idx - tilemap->width].tile_type == SOLID_TILE) ? (1 << UP_BIT) : 0;
if (new_type == SOLID_TILE) if (new_type == SOLID_TILE)