Fix bug w/auto tileset mode adjusting tiles when we replace a unique instance of a tile+flag with a new tile

The assert() in remove_unused_tiles_from_tileset() checking for the
tiles histograms was failing because we weren't adjusting the
histogram correctly when a tile w/a flag is replaced w/another without
flags.
This commit is contained in:
David Capello 2023-10-06 17:39:00 -03:00
parent ed649e6bab
commit 25f61ff5f9

View File

@ -609,8 +609,9 @@ void modify_tilemap_cel_region(
// We add the new one tileIndex in the histogram count.
if (tilesetMode == TilesetMode::Auto &&
tileIndex != doc::notile &&
tileIndex >= 0 && tileIndex < tilesHistogram.size()) {
tile != doc::notile &&
tileIndex >= 0 && tileIndex < tilesHistogram.size() &&
ti != tileIndex) {
++tilesHistogram[tileIndex];
}
}