diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 233d9e488..f99c91abb 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -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 diff --git a/cockatrice/src/game/player/menu/card_menu.cpp b/cockatrice/src/game/player/menu/card_menu.cpp index ef95f052e..cd77c2968 100644 --- a/cockatrice/src/game/player/menu/card_menu.cpp +++ b/cockatrice/src/game/player/menu/card_menu.cpp @@ -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. * diff --git a/cockatrice/src/game/player/menu/card_menu.h b/cockatrice/src/game/player/menu/card_menu.h index afe24da62..b7f2f8241 100644 --- a/cockatrice/src/game/player/menu/card_menu.h +++ b/cockatrice/src/game/player/menu/card_menu.h @@ -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;