From 0cc75879ce6edc4dc198ce88791b45cd4e4397f0 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Sun, 2 Feb 2025 18:38:41 -0800 Subject: [PATCH] do it in a way that doesn't cause warnings to be logged --- cockatrice/src/client/ui/pixel_map_generator.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cockatrice/src/client/ui/pixel_map_generator.cpp b/cockatrice/src/client/ui/pixel_map_generator.cpp index 1d2af989f..350bdb5d1 100644 --- a/cockatrice/src/client/ui/pixel_map_generator.cpp +++ b/cockatrice/src/client/ui/pixel_map_generator.cpp @@ -61,6 +61,11 @@ QMap CounterPixmapGenerator::pmCache; QPixmap CounterPixmapGenerator::generatePixmap(int height, QString name, bool highlight) { + // The colorless counter is named "x" by the server but the file is named "general.svg" + if (name == "x") { + name = "general"; + } + if (highlight) name.append("_highlight"); QString key = name + QString::number(height); @@ -68,6 +73,8 @@ QPixmap CounterPixmapGenerator::generatePixmap(int height, QString name, bool hi return pmCache.value(key); QPixmap pixmap = loadSvg("theme:counters/" + name, QSize(height, height)); + + // fall back to colorless counter if the name can't be found if (pixmap.isNull()) { name = "general"; if (highlight)