mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 17:13:57 -07:00
Code cleanup
- Add missing isCommandZoneCounterBlocked check to cmdSetCounterActive
- Revert accidental deck view layout change from b4057a86
- Fix duplicate @param in playSelectedCardsImpl doc
- Add null check for PlayerLogic in CommandZoneMenu constructor
- Add index bounds check in CommandZone handleDropEvent
- Add index bounds check in StackZone handleDropEvent
- Add ownership comment for tax counter widget creation
- Add command zone to zoneGraphicsItems map
- Conditionally show command zone menu item based on server support
- Remove layer-violating includes from player_logic.cpp
- Fix tax counter increment (1 per cast, not 2)
- Add getTaxCounterIfActive() helper to PlayerGraphicsItem
This commit is contained in:
parent
928b0a1483
commit
db26191f2c
13 changed files with 45 additions and 29 deletions
|
|
@ -143,6 +143,7 @@ void PlayerGraphicsItem::initializeZones()
|
|||
zoneGraphicsItems.insert(player->getTableZone()->getName(), tableZoneGraphicsItem);
|
||||
zoneGraphicsItems.insert(player->getStackZone()->getName(), stackZoneGraphicsItem);
|
||||
zoneGraphicsItems.insert(player->getHandZone()->getName(), handZoneGraphicsItem);
|
||||
zoneGraphicsItems.insert(player->getCommandZone()->getName(), commandZoneGraphicsItem);
|
||||
}
|
||||
|
||||
void PlayerGraphicsItem::onCustomZoneAdded(QString customZoneName)
|
||||
|
|
@ -203,6 +204,8 @@ void PlayerGraphicsItem::onCounterAdded(CounterState *state)
|
|||
qWarning() << "Cannot create tax counter" << state->getName() << "- command zone not available";
|
||||
return;
|
||||
}
|
||||
// Qt parent (commandZoneGraphicsItem) owns widget; counterWidgets map holds reference
|
||||
// for lookup; CommandZone::registerTaxCounter connects QObject::destroyed for cleanup
|
||||
widget = new CommanderTaxCounter(state, player, commandZoneGraphicsItem);
|
||||
widget->setActive(state->isActive());
|
||||
commandZoneGraphicsItem->registerTaxCounter(widget);
|
||||
|
|
@ -267,6 +270,12 @@ QList<AbstractCounter *> PlayerGraphicsItem::getTaxCounterWidgets() const
|
|||
return result;
|
||||
}
|
||||
|
||||
AbstractCounter *PlayerGraphicsItem::getTaxCounterIfActive(int counterId) const
|
||||
{
|
||||
AbstractCounter *counter = getCounterWidget(counterId);
|
||||
return (counter && counter->isActive()) ? counter : nullptr;
|
||||
}
|
||||
|
||||
void PlayerGraphicsItem::rearrangeZones()
|
||||
{
|
||||
auto base = QPointF(CardDimensions::HEIGHT_F + counterAreaWidth + 15, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue