mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 03:23:24 -08:00
[Refactor] Retype PlayerActions onto CardState (#7435)
* [Refactor] Retype card containers and zone logic onto CardState * [Refactor] Retype PlayerActions onto CardState --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
65e9f1b370
commit
7ca23430cd
18 changed files with 138 additions and 136 deletions
|
|
@ -86,7 +86,7 @@ CardMenu::CardMenu(PlayerGraphicsItem *_player, CardItem *_card, bool _shortcuts
|
|||
auto *gameScene = player->getGameScene();
|
||||
|
||||
// Single selection resolver used by all lambdas — called at trigger time
|
||||
auto sel = [gameScene]() { return gameScene->selectedCards(); };
|
||||
auto sel = [gameScene]() { return gameScene->selectedCardStates(); };
|
||||
|
||||
// Unified dispatcher for card menu actions
|
||||
auto invoke = [actions, sel](CardMenuActionType type) {
|
||||
|
|
@ -337,7 +337,7 @@ void CardMenu::createHandOrCustomZoneMenu(bool canModifyCard)
|
|||
initContextualPlayersMenu(revealMenu, aRevealToAll);
|
||||
|
||||
connect(revealMenu, &QMenu::triggered, this, [this](QAction *action) {
|
||||
player->getLogic()->getPlayerActions()->actReveal(player->getGameScene()->selectedCards(), action);
|
||||
player->getLogic()->getPlayerActions()->actReveal(player->getGameScene()->selectedCardStates(), action);
|
||||
});
|
||||
|
||||
addSeparator();
|
||||
|
|
@ -486,8 +486,9 @@ void CardMenu::addRelatedCardActions()
|
|||
|
||||
auto *createRelated = new QAction(text, this);
|
||||
const int relatedIndex = index++;
|
||||
connect(createRelated, &QAction::triggered, this,
|
||||
[this, playerActions, relatedIndex] { playerActions->actCreateRelatedCard(card, relatedIndex); });
|
||||
connect(createRelated, &QAction::triggered, this, [this, playerActions, relatedIndex] {
|
||||
playerActions->actCreateRelatedCard(card->getState(), relatedIndex);
|
||||
});
|
||||
addAction(createRelated);
|
||||
}
|
||||
|
||||
|
|
@ -497,7 +498,7 @@ void CardMenu::addRelatedCardActions()
|
|||
SettingsCache::instance().shortcuts().getShortcut("Player/aCreateRelatedTokens"));
|
||||
}
|
||||
connect(createRelatedCards, &QAction::triggered, this,
|
||||
[this, playerActions] { playerActions->actCreateAllRelatedCards(card); });
|
||||
[this, playerActions] { playerActions->actCreateAllRelatedCards(card->getState()); });
|
||||
addAction(createRelatedCards);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue