From dcc23ef7c24065517b281fef9d5133dcdd8a49bc Mon Sep 17 00:00:00 2001 From: SirLynix Date: Mon, 1 May 2023 10:37:14 +0200 Subject: [PATCH] Graphics/Tilemap: Fix layer update when enabling tiles Thanks to @jube for noticing! --- include/Nazara/Graphics/Tilemap.inl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/Nazara/Graphics/Tilemap.inl b/include/Nazara/Graphics/Tilemap.inl index 4bf62290f..e07cecea9 100644 --- a/include/Nazara/Graphics/Tilemap.inl +++ b/include/Nazara/Graphics/Tilemap.inl @@ -15,7 +15,7 @@ namespace Nz */ inline void Tilemap::DisableTile(const Vector2ui& tilePos) { - NazaraAssert(tilePos.x < m_mapSize.x&& tilePos.y < m_mapSize.y, "Tile position is out of bounds"); + NazaraAssert(tilePos.x < m_mapSize.x && tilePos.y < m_mapSize.y, "Tile position is out of bounds"); std::size_t tileIndex = tilePos.y * m_mapSize.x + tilePos.x; Tile& tile = m_tiles[tileIndex]; @@ -134,7 +134,7 @@ namespace Nz else if (materialIndex != tile.layerIndex) { Layer& oldLayer = m_layers[tile.layerIndex]; - Layer& newLayer = m_layers[tile.layerIndex]; + Layer& newLayer = m_layers[materialIndex]; oldLayer.enabledTiles.Reset(tileIndex); oldLayer.enabledTileCount = oldLayer.enabledTiles.Count(); @@ -275,7 +275,7 @@ namespace Nz else if (materialIndex != tile.layerIndex) { Layer& oldLayer = m_layers[tile.layerIndex]; - Layer& newLayer = m_layers[tile.layerIndex]; + Layer& newLayer = m_layers[materialIndex]; oldLayer.enabledTiles.Reset(tileIndex); oldLayer.enabledTileCount = oldLayer.enabledTiles.Count();