mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-03-21 17:55:21 -05:00
[Game] Fix not using zone-specific card menu for opponent's cards (#6695)
Some checks are pending
Build Desktop / Configure (push) Waiting to run
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 11) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 13) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, skip, 12) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, 43) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, skip, 42) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Servatrice_Debian, DEB, yes, skip, 11) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, 22.04) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, 24.04) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (yes, Arch, skip) (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Ninja, 1, macOS, -macOS14, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, macos-14, Apple, 14, Release, 1, 15.4) (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Ninja, 1, macOS, -macOS15, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, macos-15, Apple, 15, Release, 1, 16.4) (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Ninja, 1, macOS, 13, -macOS13_Intel, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, macos-15-intel, Intel, 13, … (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Ninja, macOS, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, macos-15, Apple, 15, Debug, 1, 16.4) (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Visual Studio 17 2022, x64, 1, Windows, -Win10, win64_msvc2022_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, windows… (push) Blocked by required conditions
Build Docker Image / amd64 & arm64 (push) Waiting to run
Some checks are pending
Build Desktop / Configure (push) Waiting to run
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 11) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 13) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, skip, 12) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, 43) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, skip, 42) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Servatrice_Debian, DEB, yes, skip, 11) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, 22.04) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, 24.04) (push) Blocked by required conditions
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (yes, Arch, skip) (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Ninja, 1, macOS, -macOS14, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, macos-14, Apple, 14, Release, 1, 15.4) (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Ninja, 1, macOS, -macOS15, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, macos-15, Apple, 15, Release, 1, 16.4) (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Ninja, 1, macOS, 13, -macOS13_Intel, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, macos-15-intel, Intel, 13, … (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Ninja, macOS, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, macos-15, Apple, 15, Debug, 1, 16.4) (push) Blocked by required conditions
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Visual Studio 17 2022, x64, 1, Windows, -Win10, win64_msvc2022_64, qtimageformats qtmultimedia qtwebsockets, 6.10.*, windows… (push) Blocked by required conditions
Build Docker Image / amd64 & arm64 (push) Waiting to run
This commit is contained in:
parent
2b2a6db081
commit
33d5721490
|
|
@ -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