Minor change in doc::Tileset asserts

This commit is contained in:
David Capello 2021-06-02 10:18:56 -03:00
parent 649f187fc9
commit 3ef3ee68e0

View File

@ -121,6 +121,10 @@ void Tileset::remap(const Remap& remap)
void Tileset::set(const tile_index ti,
const ImageRef& image)
{
ASSERT(image);
ASSERT(image->width() == m_grid.tileSize().w);
ASSERT(image->height() == m_grid.tileSize().h);
#if _DEBUG
if (ti == notile && !is_empty_image(image.get())) {
TRACEARGS("Warning: setting tile 0 with a non-empty image");
@ -154,16 +158,16 @@ tile_index Tileset::add(const ImageRef& image)
void Tileset::insert(const tile_index ti,
const ImageRef& image)
{
ASSERT(image);
ASSERT(image->width() == m_grid.tileSize().w);
ASSERT(image->height() == m_grid.tileSize().h);
#if _DEBUG
if (ti == notile && !is_empty_image(image.get())) {
TRACEARGS("Warning: inserting tile 0 with a non-empty image");
}
#endif
ASSERT(image);
ASSERT(image->width() == m_grid.tileSize().w);
ASSERT(image->height() == m_grid.tileSize().h);
ASSERT(ti >= 0 && ti <= m_tiles.size()+1);
preprocess_transparent_pixels(image.get());
m_tiles.insert(m_tiles.begin()+ti, image);