From 38910aeead73dc32dff7dee6736fba832aec3e20 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:41:02 +1100 Subject: [PATCH] Skip generating tile pieces if a color variant is invalid --- source/rendering/StarTilePainter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/rendering/StarTilePainter.cpp b/source/rendering/StarTilePainter.cpp index de49910..5655930 100644 --- a/source/rendering/StarTilePainter.cpp +++ b/source/rendering/StarTilePainter.cpp @@ -292,7 +292,9 @@ bool TilePainter::produceTerrainPrimitives(HashMapvariants.get(materialColorVariant).wrap(variance); + auto variant = piecePair.first->variants.ptr(materialColorVariant); + if (!variant) continue; + RectF textureCoords = variant->wrap(variance); RectF worldCoords = RectF::withSize(piecePair.second / TilePixels + Vec2F(pos), textureCoords.size() / TilePixels); quadList.emplace_back(std::in_place_type_t(), move(texture), worldCoords .min(), @@ -317,7 +319,9 @@ bool TilePainter::produceTerrainPrimitives(HashMapvariants.get(modColorVariant).wrap(variance); + auto variant = piecePair.first->variants.ptr(modColorVariant); + if (!variant) continue; + auto& textureCoords = variant->wrap(variance); RectF worldCoords = RectF::withSize(piecePair.second / TilePixels + Vec2F(pos), textureCoords.size() / TilePixels); quadList.emplace_back(std::in_place_type_t(), move(texture), worldCoords.min(), textureCoords.min(),