Wire command zone menu, harden counter command handling, and expand tests

- Connect aMoveToCommandZone to cmMoveToCommandZone; the menu item was
    added, shown, and shortcut-bound but never wired, so it did nothing
  - Extract evaluateModifyCounter() and route cmdIncCounter/cmdSetCounter
    through it, replacing isCommandZoneCounterBlocked; reject inc/set on
    an inactive tax counter so a hidden counter cannot accumulate value
  - Reject reserved tax counter names in cmdCreateCounter to prevent a
    client from spoofing a system tax counter via a user-created counter
  - Route AbstractCounter::valueChanged through the virtual setValue() so
    CommanderTaxCounter clamps and refreshes its tooltip on value changes
  - Deduplicate actPlayAndIncreaseTax/actPlayAndIncreasePartnerTax into a
    single playAndIncreaseTax(counterId) helper
  - Move MINIMUM_STACKING_HEIGHT from CommandZone to the PlayerGraphicsItem
    layout code, its only consumer
  - Remove unused AbstractCounter forward declaration from player_logic.h
  - Add EvaluateModifyCounter tests and PartnerTax cases for
    evaluateSetCounterActive
  - Pin the FirstUserId floor in new_counter_id_test using ids 3 and 5 so
    a naive "highest id + 1" regression fails the test
This commit is contained in:
DawnFire42 2026-06-28 21:43:42 -04:00
parent 0bfb0f4131
commit bc09a19b50
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
11 changed files with 172 additions and 47 deletions

View file

@ -18,6 +18,10 @@
#include <QGraphicsView>
#include <libcockatrice/utility/counter_ids.h>
// Minimum height the stack zone keeps when the command zone shares its vertical space,
// so the stack remains usable. Owned by this layout code, the sole consumer.
static constexpr qreal MINIMUM_STACKING_HEIGHT = 50.0;
PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
{
connect(&SettingsCache::instance(), &SettingsCache::horizontalHandChanged, this,
@ -278,8 +282,8 @@ void PlayerGraphicsItem::rearrangeZones()
qreal stackHeight = tableHeight;
if (commandZoneVisible) {
stackHeight = tableHeight - totalCommandZoneHeight();
if (stackHeight < CommandZone::MINIMUM_STACKING_HEIGHT) {
stackHeight = CommandZone::MINIMUM_STACKING_HEIGHT;
if (stackHeight < MINIMUM_STACKING_HEIGHT) {
stackHeight = MINIMUM_STACKING_HEIGHT;
}
}
stackZoneGraphicsItem->setHeight(stackHeight);