Implement server-side protocol and game logic for networked command
zone play.
Protocol changes:
- room_commands.proto: command zone messages and responses
Server components:
- ServerCounter: counter synchronization for commander tax
- ServerGame: command zone game state management
- ServerPlayer: player-level command zone handling
- Server/ServerProtocolHandler: command zone message routing
- Servatrice: command zone support in the main server
Design decisions:
- setCount() returns bool for event suppression (avoid duplicate events)
- Zone state synchronized across all connected clients
- Commander tax persists across zone transitions
Test coverage verifies setCount() return value behavior for proper
event suppression in networked scenarios.
Integrate command zones with the client settings and theming system.
Settings integration:
- CacheSettings: persist command zone preferences
- ShortcutsSettings: keyboard shortcuts for zone actions
Theme support:
- ThemeManager: command zone background loading
- Theme assets for Fabric, Leather, Plasma, VelvetMarble themes
Visual integration:
- MessageLogWidget: command zone action logging
Theme assets provide consistent visual styling across all bundled themes.
Implement UI components for configuring command zones when creating
new games.
New components:
- GameZoneOptionsWidget: reusable widget for zone configuration
- DlgLocalGameOptions: local game setup with command zone options
Integration points:
- DlgCreateGame: add command zone options to game creation dialog
- WindowMain: wire up command zone configuration in game flow
This allows players to:
- Enable/disable command zones for a game
- Select zone type (Commander, Companion, etc.)
- Configure zone-specific options
Wire command zones into the player object hierarchy, making them
functional game elements.
Player class modifications:
- player.h/cpp: command zone ownership and lifecycle
- player_actions.h/cpp: command zone action handlers
- player_graphics_item.h/cpp: command zone visual positioning
This commit connects all previous command zone components to the
player, enabling:
- Zone creation during game setup
- Zone positioning relative to other player zones
- Action routing for command zone interactions
- Proper cleanup on player destruction
Implement CommandZoneMenu - context menu for interacting with cards
in the command zone.
Menu actions include:
- Cast commander (move to stack)
- Return to command zone
- View/reveal zone contents
- Commander-specific actions (tax reset, etc.)
Integration with existing menu system:
- CardMenuActionType: new action types for command zone
- CardMenu: command zone action routing
- MoveMenu: command zone as move destination
- PlayerMenu: command zone menu integration
- Zone menus: inherit from AbstractZoneMenu
This provides the right-click interaction layer for command zones.
Introduce AbstractZoneMenu - a base class for zone-specific context
menus that provides common functionality.
This abstraction:
- Reduces code duplication across zone menu implementations
- Establishes consistent menu behavior patterns
- Provides foundation for CommandZoneMenu implementation
Small foundational commit to keep the menu hierarchy clean.
Implement CommandZone - the main Qt graphics class for rendering and
interacting with command zones.
This commit brings together all previous components:
- Uses CommandZoneState for visibility management
- Uses CommandZoneLogic for card data handling
- Uses ZoneToggleButton for visibility controls
- Uses CommanderTaxCounter for tax display
- Uses z_values.h for proper visual layering
Zone modifications for command zone support:
- SelectZone: add command zone to zone selection
- StackZone: support command zone in stack operations
- TableZone: command zone positioning integration
- ViewZoneWidget: command zone viewing support
Integration tests verify:
- Counter parenting behavior
- Zone state coordination
- Full graphics stack interaction
Implement ZoneToggleButton - a reusable UI component for toggling
zone visibility states.
Features:
- Click to toggle between hidden/revealed states
- Visual feedback showing current state
- Hover effects for discoverability
- Proper event handling for mouse interactions
This self-contained graphics component will be used by CommandZone
to provide users with intuitive visibility controls.
Implement CommanderTaxCounter - tracks casting cost increases for
commanders that have been cast multiple times.
Key components:
- CommanderTaxCounter: specialized counter with value clamping
- AbstractCounter modifications: support for counter ID system
- CounterGeneral/TranslateCounterName: UI integration for display
Design decisions:
- Counter values clamped to valid range (0 to max)
- Builds on counter_ids.h constants from commit 1
- Uses z_values.h from commit 4 for proper visual layering
- Counter visibility tied to zone state (hidden when zone hidden)
Test coverage:
- commander_tax_counter_test: verifies setValue clamping behavior
- counter_visibility_test: verifies visibility state transitions
Note: Tests include <climits> for INT_MIN usage (required on some compilers
like GCC on Debian 11 where INT_MIN is not transitively included).
Implement CommandZoneLogic - the card data management layer for zones.
This layer handles card insertion, removal, and ordering independently
of Qt graphics rendering.
Key components:
- CommandZoneLogic: manages card data within a zone
- AddCardAlgorithm: generic insertion algorithm for ordered zones
- CardZoneLogic modifications: integrate with existing zone hierarchy
Design decisions:
- Separation of data logic from graphics enables unit testing
- addCardImpl uses a stable insertion algorithm for consistent ordering
- Mock card items enable testing without Qt graphics dependencies
Test coverage verifies card insertion behavior across edge cases.
Implement CommandZoneState - a pure C++ state machine managing zone
visibility transitions (Hidden, Revealed, Peeking states).
The state machine is intentionally decoupled from Qt graphics:
- Pure logic with no Qt dependencies in the state class
- Testable in isolation without a GUI
- Clear state transition table with StateChangeResult outcomes
Test coverage verifies:
- Initial state is Hidden
- Valid transitions: Hidden->Revealed, Hidden->Peeking, etc.
- Invalid transitions return NoChange
- Peek timeout triggers return to previous state
This establishes the foundation for command zone visibility management
while keeping graphics concerns separate.
Add core type definitions and constants for the command zone feature:
- zone_names.h: Add command zone name constants (command, partner,
companion, background) for protocol and lookup operations
- command_zone_types.h: Define CommandZoneType enum, ZoneVisibility enum,
and StateChangeResult struct for state machine logic
- counter_ids.h: Define shared counter IDs and names for commander tax
tracking (IDs 8-9 reserved to avoid conflicts with user counters)
These headers are intentionally minimal and dependency-free to enable
inclusion in both production code and isolated unit tests.
Replace hardcoded Z-value numbers with ZValues::* constants:
- 2000000007 -> ZValues::DRAG_ITEM
- 2000000007 + offset -> ZValues::DRAG_ITEM_CHILD
- 2000000004 -> ZValues::HOVERED_CARD
- 2000000005 -> ZValues::ARROWS
This improves code readability by making the intent of these layer
values explicit and centralizes Z-ordering logic for easier maintenance.
Add centralized Z-value management for Qt's stacking order system. This
replaces scattered magic numbers with semantic constants, making the rendering
hierarchy explicit and maintainable.
The architecture defines three layers:
- Zone layer (0-999): Zone backgrounds and containers
- Card layer (1-40M): Cards on the table zone using position-based formula
- Overlay layer (200M+): UI elements that always render above cards
ZValueLayerManager provides validation utilities and the overlayZValue()
function for computing overlay Z-values. ZValues namespace provides the
semantic constants used throughout the codebase.
The 5x gap between card max (40M) and overlay base (200M) provides safety
margin for future table zone expansions.
Replace hardcoded zone name strings with ZoneNames::* constants
for existing zones. This improves maintainability and type safety.
Zones converted:
- "hand" -> ZoneNames::HAND
- "deck" -> ZoneNames::DECK
- "grave" -> ZoneNames::GRAVE
- "rfg" -> ZoneNames::EXILE
- "sb" -> ZoneNames::SIDEBOARD
Add a centralized header for zone name string constants used in protocol
messages and zone lookups. This replaces scattered hardcoded string literals
with type-safe constants, improving maintainability and reducing typo risks.
The ZoneNames namespace provides constants for core game zones: table, grave,
exile (rfg), hand, deck, sideboard, and stack.
Adds a new default theme that causes the QT Fusion theme to be
selected. This theme looks a bit nicer than 'Windows' and supports
both light and dark mode out of the box.
* add doxygen-theme-css submodule
* enable theme and disable not needed code references
* hide nav sync button
* css and cleanup
* Move comments to dedicated README to not fail config check