Reconcile tax counter visibility ownership and harden tax log formatting

- Make AbstractCounter::setActive() the sole owner of counter visibility; document the contract.
  - Drop the redundant setVisible() from CommandZone::rearrangeTaxCounters(); it now only lays out by isActive().
  - Format tax log lines with a single atomic 4-arg arg() instead of mixing string and int overloads.
This commit is contained in:
DawnFire42 2026-06-16 16:36:12 -04:00
parent 3fb3a329ef
commit 25e2633ee7
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
3 changed files with 17 additions and 7 deletions

View file

@ -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;
}
}