mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-03-21 17:55:21 -05:00
Merge branch 'master' into card-selection-counter
This commit is contained in:
commit
0d358bd039
14
.github/workflows/desktop-build.yml
vendored
14
.github/workflows/desktop-build.yml
vendored
|
|
@ -202,6 +202,13 @@ jobs:
|
|||
--ccache "$CCACHE_SIZE" $NO_CLIENT
|
||||
.ci/name_build.sh
|
||||
|
||||
# Delete used cache to emulate a cache update. See https://github.com/actions/cache/issues/342.
|
||||
- name: Delete old compiler cache (ccache)
|
||||
if: github.ref == 'refs/heads/master' && steps.ccache_restore.outputs.cache-hit && steps.build.outcome == 'success'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: gh cache delete --repo ${{ github.repository }} ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Save compiler cache (ccache)
|
||||
if: github.ref == 'refs/heads/master'
|
||||
uses: actions/cache/save@v5
|
||||
|
|
@ -438,6 +445,13 @@ jobs:
|
|||
TARGET_MACOS_VERSION: ${{ matrix.override_target }}
|
||||
run: .ci/compile.sh --server --test --vcpkg
|
||||
|
||||
# Delete used cache to emulate a cache update. See https://github.com/actions/cache/issues/342.
|
||||
- name: Delete old compiler cache (ccache)
|
||||
if: github.ref == 'refs/heads/master' && matrix.use_ccache == 1 && steps.ccache_restore.outputs.cache-hit && steps.build.outcome == 'success'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: gh cache delete --repo ${{ github.repository }} ${{ steps.ccache_restore.outputs.cache-primary-key }}
|
||||
|
||||
- name: Save compiler cache (ccache)
|
||||
if: github.ref == 'refs/heads/master' && matrix.use_ccache == 1
|
||||
uses: actions/cache/save@v5
|
||||
|
|
|
|||
|
|
@ -113,32 +113,20 @@ CardMenu::CardMenu(Player *_player, const CardItem *_card, bool _shortcutsActive
|
|||
addAction(aSelectAll);
|
||||
addAction(aSelectColumn);
|
||||
addRelatedCardView();
|
||||
} else if (writeableCard) {
|
||||
|
||||
} else {
|
||||
if (card->getZone()) {
|
||||
if (card->getZone()->getName() == ZoneNames::TABLE) {
|
||||
createTableMenu();
|
||||
createTableMenu(writeableCard);
|
||||
} else if (card->getZone()->getName() == ZoneNames::STACK) {
|
||||
createStackMenu();
|
||||
createStackMenu(writeableCard);
|
||||
} else if (card->getZone()->getName() == ZoneNames::EXILE ||
|
||||
card->getZone()->getName() == ZoneNames::GRAVE) {
|
||||
createGraveyardOrExileMenu();
|
||||
createGraveyardOrExileMenu(writeableCard);
|
||||
} else {
|
||||
createHandOrCustomZoneMenu();
|
||||
createHandOrCustomZoneMenu(writeableCard);
|
||||
}
|
||||
} else {
|
||||
addMenu(new MoveMenu(player));
|
||||
}
|
||||
} else {
|
||||
if (card->getZone() && card->getZone()->getName() != ZoneNames::HAND) {
|
||||
addAction(aDrawArrow);
|
||||
addSeparator();
|
||||
addRelatedCardView();
|
||||
addRelatedCardActions();
|
||||
addSeparator();
|
||||
addAction(aClone);
|
||||
addSeparator();
|
||||
addAction(aSelectAll);
|
||||
createZonelessMenu(writeableCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -154,11 +142,9 @@ void CardMenu::removePlayer(Player *playerToRemove)
|
|||
}
|
||||
}
|
||||
|
||||
void CardMenu::createTableMenu()
|
||||
void CardMenu::createTableMenu(bool canModifyCard)
|
||||
{
|
||||
// Card is on the battlefield
|
||||
bool canModifyCard = player->getPlayerInfo()->judge || card->getOwner() == player;
|
||||
|
||||
if (!canModifyCard) {
|
||||
addRelatedCardView();
|
||||
addRelatedCardActions();
|
||||
|
|
@ -213,10 +199,8 @@ void CardMenu::createTableMenu()
|
|||
addMenu(mCardCounters);
|
||||
}
|
||||
|
||||
void CardMenu::createStackMenu()
|
||||
void CardMenu::createStackMenu(bool canModifyCard)
|
||||
{
|
||||
bool canModifyCard = player->getPlayerInfo()->judge || card->getOwner() == player;
|
||||
|
||||
// Card is on the stack
|
||||
if (canModifyCard) {
|
||||
addAction(aAttach);
|
||||
|
|
@ -238,10 +222,8 @@ void CardMenu::createStackMenu()
|
|||
addRelatedCardActions();
|
||||
}
|
||||
|
||||
void CardMenu::createGraveyardOrExileMenu()
|
||||
void CardMenu::createGraveyardOrExileMenu(bool canModifyCard)
|
||||
{
|
||||
bool canModifyCard = player->getPlayerInfo()->judge || card->getOwner() == player;
|
||||
|
||||
// Card is in the graveyard or exile
|
||||
if (canModifyCard) {
|
||||
addAction(aPlay);
|
||||
|
|
@ -270,8 +252,20 @@ void CardMenu::createGraveyardOrExileMenu()
|
|||
addRelatedCardActions();
|
||||
}
|
||||
|
||||
void CardMenu::createHandOrCustomZoneMenu()
|
||||
void CardMenu::createHandOrCustomZoneMenu(bool canModifyCard)
|
||||
{
|
||||
if (!canModifyCard) {
|
||||
addAction(aDrawArrow);
|
||||
addSeparator();
|
||||
addRelatedCardView();
|
||||
addRelatedCardActions();
|
||||
addSeparator();
|
||||
addAction(aClone);
|
||||
addSeparator();
|
||||
addAction(aSelectAll);
|
||||
return;
|
||||
}
|
||||
|
||||
// Card is in hand or a custom zone specified by server
|
||||
addAction(aPlay);
|
||||
addAction(aPlayFacedown);
|
||||
|
|
@ -305,6 +299,13 @@ void CardMenu::createHandOrCustomZoneMenu()
|
|||
}
|
||||
}
|
||||
|
||||
void CardMenu::createZonelessMenu(bool canModifyCard)
|
||||
{
|
||||
if (canModifyCard) {
|
||||
addMenu(new MoveMenu(player));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Populates the menu with an action for each active player.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@ class CardMenu : public QMenu
|
|||
public:
|
||||
explicit CardMenu(Player *player, const CardItem *card, bool shortcutsActive);
|
||||
void removePlayer(Player *playerToRemove);
|
||||
void createTableMenu();
|
||||
void createStackMenu();
|
||||
void createGraveyardOrExileMenu();
|
||||
void createHandOrCustomZoneMenu();
|
||||
void createTableMenu(bool canModifyCard);
|
||||
void createStackMenu(bool canModifyCard);
|
||||
void createGraveyardOrExileMenu(bool canModifyCard);
|
||||
void createHandOrCustomZoneMenu(bool canModifyCard);
|
||||
void createZonelessMenu(bool canModifyCard);
|
||||
|
||||
QMenu *mCardCounters;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user