Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/rendering/StarTilePainter.cpp8
1 files 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(HashMap<QuadZLevel, List<RenderPrimit
terrainLayer == TerrainLayer::Background ? TileLayer::Background : TileLayer::Foreground, false);
for (auto const& piecePair : pieces) {
TexturePtr texture = getPieceTexture(material, piecePair.first, materialHue, false);
- RectF textureCoords = piecePair.first->variants.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<RenderQuad>(), move(texture),
worldCoords .min(),
@@ -317,7 +319,9 @@ bool TilePainter::produceTerrainPrimitives(HashMap<QuadZLevel, List<RenderPrimit
terrainLayer == TerrainLayer::Background ? TileLayer::Background : TileLayer::Foreground, true);
for (auto const& piecePair : pieces) {
auto texture = getPieceTexture(mod, piecePair.first, modHue, true);
- auto& textureCoords = piecePair.first->variants.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<RenderQuad>(), move(texture),
worldCoords.min(), textureCoords.min(),