diff --git a/cockatrice/src/game_graphics/board/abstract_counter.h b/cockatrice/src/game_graphics/board/abstract_counter.h index d65ec9825..b43d942fd 100644 --- a/cockatrice/src/game_graphics/board/abstract_counter.h +++ b/cockatrice/src/game_graphics/board/abstract_counter.h @@ -113,7 +113,13 @@ public: /** * @brief Sets the active state of this counter. - * When inactive, the counter is hidden via setVisible(false). + * + * This is the sole owner of the counter's own visibility flag: active maps directly to + * setVisible(_active). For counters nested in another item (e.g. tax counters parented to + * the command zone), Qt AND-s this flag with the parent's visibility, so an active counter + * inside a hidden zone still does not render. Container layout code must therefore not set + * visibility itself; it only positions counters and may read isActive(). + * * @param _active True to show and enable the counter, false to hide it */ virtual void setActive(bool _active); diff --git a/cockatrice/src/game_graphics/log/message_log_widget.cpp b/cockatrice/src/game_graphics/log/message_log_widget.cpp index 423a66e92..b6f6fa9d8 100644 --- a/cockatrice/src/game_graphics/log/message_log_widget.cpp +++ b/cockatrice/src/game_graphics/log/message_log_widget.cpp @@ -680,12 +680,15 @@ void MessageLogWidget::logSetCounter(PlayerLogic *player, QString counterName, i QString playerName = sanitizeHtml(player->getPlayerInfo()->getName()); QString valueStr = QString("%1").arg(value); int delta = value - oldValue; + QString deltaStr = QString::number(delta); QString counterDisplayName = TranslateCounterName::getDisplayName(counterName); QString taxLabel = QString("%1").arg(sanitizeHtml(counterDisplayName)); if (value > oldValue) { - appendHtmlServerMessage(tr("%1 increases %2 to %3 (+%4).").arg(playerName, taxLabel, valueStr).arg(delta)); + // delta > 0 here; the format string supplies the leading '+' + appendHtmlServerMessage(tr("%1 increases %2 to %3 (+%4).").arg(playerName, taxLabel, valueStr, deltaStr)); } else { - appendHtmlServerMessage(tr("%1 decreases %2 to %3 (%4).").arg(playerName, taxLabel, valueStr).arg(delta)); + // delta < 0 here; deltaStr already carries the '-' sign + appendHtmlServerMessage(tr("%1 decreases %2 to %3 (%4).").arg(playerName, taxLabel, valueStr, deltaStr)); } return; } diff --git a/cockatrice/src/game_graphics/zones/command_zone.cpp b/cockatrice/src/game_graphics/zones/command_zone.cpp index 72451e5c3..d703f1c29 100644 --- a/cockatrice/src/game_graphics/zones/command_zone.cpp +++ b/cockatrice/src/game_graphics/zones/command_zone.cpp @@ -150,7 +150,6 @@ void CommandZone::registerTaxCounter(AbstractCounter *counter) void CommandZone::rearrangeTaxCounters() { - bool commandZoneVisible = isVisible(); int activeTaxCounterCount = 0; for (AbstractCounter *ctr : taxCounters) { @@ -158,9 +157,11 @@ void CommandZone::rearrangeTaxCounters() activeTaxCounterCount * (TaxCounterSizes::TAX_COUNTER_SIZE + TaxCounterSizes::TAX_COUNTER_MARGIN); ctr->setPos(TaxCounterSizes::TAX_COUNTER_MARGIN, y); ctr->setZValue(ZValues::TAX_COUNTERS); - bool visible = commandZoneVisible && ctr->isActive(); - ctr->setVisible(visible); - if (visible) { + // Visibility is owned solely by AbstractCounter::setActive() (the counter's own flag), + // which Qt AND-s with this CommandZone's visibility via child-visibility propagation + // (tax counters are graphics children of the zone). This function only handles layout, + // so it stacks and measures by isActive() alone. + if (ctr->isActive()) { ++activeTaxCounterCount; } }