mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
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:
parent
3fb3a329ef
commit
25e2633ee7
3 changed files with 17 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue