mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 13:21:34 +00:00
Rehash the Tileset hash tablet when we remap/move tiles
This commit is contained in:
parent
21fa63da76
commit
75f7346ef6
@ -100,6 +100,8 @@ void Tileset::remap(const Remap& remap)
|
||||
m_tiles[remap[ti]] = tmp[ti];
|
||||
}
|
||||
}
|
||||
|
||||
rehash();
|
||||
}
|
||||
|
||||
void Tileset::set(const tile_index ti,
|
||||
@ -202,11 +204,7 @@ void Tileset::notifyTileContentChange(const tile_index ti)
|
||||
// only way to make it work correctly)
|
||||
|
||||
(void)ti; // unused
|
||||
|
||||
tile_index tj = 0;
|
||||
m_hash.clear();
|
||||
for (auto tile : m_tiles)
|
||||
m_hash[tile] = tj++;
|
||||
rehash();
|
||||
|
||||
#endif
|
||||
}
|
||||
@ -259,4 +257,12 @@ void Tileset::assertValidHashTable()
|
||||
}
|
||||
#endif
|
||||
|
||||
void Tileset::rehash()
|
||||
{
|
||||
tile_index tj = 0;
|
||||
m_hash.clear();
|
||||
for (auto tile : m_tiles)
|
||||
m_hash[tile] = tj++;
|
||||
}
|
||||
|
||||
} // namespace doc
|
||||
|
@ -102,6 +102,7 @@ namespace doc {
|
||||
private:
|
||||
void removeFromHash(const tile_index ti,
|
||||
const bool adjustIndexes);
|
||||
void rehash();
|
||||
|
||||
Sprite* m_sprite;
|
||||
Grid m_grid;
|
||||
|
Loading…
x
Reference in New Issue
Block a user