mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 11:03:54 -07:00
[Game] Fix not using zone-specific card menu for opponent's cards (#6695)
This commit is contained in:
parent
2b2a6db081
commit
33d5721490
2 changed files with 34 additions and 32 deletions
|
|
@ -113,32 +113,20 @@ CardMenu::CardMenu(Player *_player, const CardItem *_card, bool _shortcutsActive
|
||||||
addAction(aSelectAll);
|
addAction(aSelectAll);
|
||||||
addAction(aSelectColumn);
|
addAction(aSelectColumn);
|
||||||
addRelatedCardView();
|
addRelatedCardView();
|
||||||
} else if (writeableCard) {
|
} else {
|
||||||
|
|
||||||
if (card->getZone()) {
|
if (card->getZone()) {
|
||||||
if (card->getZone()->getName() == ZoneNames::TABLE) {
|
if (card->getZone()->getName() == ZoneNames::TABLE) {
|
||||||
createTableMenu();
|
createTableMenu(writeableCard);
|
||||||
} else if (card->getZone()->getName() == ZoneNames::STACK) {
|
} else if (card->getZone()->getName() == ZoneNames::STACK) {
|
||||||
createStackMenu();
|
createStackMenu(writeableCard);
|
||||||
} else if (card->getZone()->getName() == ZoneNames::EXILE ||
|
} else if (card->getZone()->getName() == ZoneNames::EXILE ||
|
||||||
card->getZone()->getName() == ZoneNames::GRAVE) {
|
card->getZone()->getName() == ZoneNames::GRAVE) {
|
||||||
createGraveyardOrExileMenu();
|
createGraveyardOrExileMenu(writeableCard);
|
||||||
} else {
|
} else {
|
||||||
createHandOrCustomZoneMenu();
|
createHandOrCustomZoneMenu(writeableCard);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addMenu(new MoveMenu(player));
|
createZonelessMenu(writeableCard);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (card->getZone() && card->getZone()->getName() != ZoneNames::HAND) {
|
|
||||||
addAction(aDrawArrow);
|
|
||||||
addSeparator();
|
|
||||||
addRelatedCardView();
|
|
||||||
addRelatedCardActions();
|
|
||||||
addSeparator();
|
|
||||||
addAction(aClone);
|
|
||||||
addSeparator();
|
|
||||||
addAction(aSelectAll);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -154,11 +142,9 @@ void CardMenu::removePlayer(Player *playerToRemove)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardMenu::createTableMenu()
|
void CardMenu::createTableMenu(bool canModifyCard)
|
||||||
{
|
{
|
||||||
// Card is on the battlefield
|
// Card is on the battlefield
|
||||||
bool canModifyCard = player->getPlayerInfo()->judge || card->getOwner() == player;
|
|
||||||
|
|
||||||
if (!canModifyCard) {
|
if (!canModifyCard) {
|
||||||
addRelatedCardView();
|
addRelatedCardView();
|
||||||
addRelatedCardActions();
|
addRelatedCardActions();
|
||||||
|
|
@ -213,10 +199,8 @@ void CardMenu::createTableMenu()
|
||||||
addMenu(mCardCounters);
|
addMenu(mCardCounters);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardMenu::createStackMenu()
|
void CardMenu::createStackMenu(bool canModifyCard)
|
||||||
{
|
{
|
||||||
bool canModifyCard = player->getPlayerInfo()->judge || card->getOwner() == player;
|
|
||||||
|
|
||||||
// Card is on the stack
|
// Card is on the stack
|
||||||
if (canModifyCard) {
|
if (canModifyCard) {
|
||||||
addAction(aAttach);
|
addAction(aAttach);
|
||||||
|
|
@ -238,10 +222,8 @@ void CardMenu::createStackMenu()
|
||||||
addRelatedCardActions();
|
addRelatedCardActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardMenu::createGraveyardOrExileMenu()
|
void CardMenu::createGraveyardOrExileMenu(bool canModifyCard)
|
||||||
{
|
{
|
||||||
bool canModifyCard = player->getPlayerInfo()->judge || card->getOwner() == player;
|
|
||||||
|
|
||||||
// Card is in the graveyard or exile
|
// Card is in the graveyard or exile
|
||||||
if (canModifyCard) {
|
if (canModifyCard) {
|
||||||
addAction(aPlay);
|
addAction(aPlay);
|
||||||
|
|
@ -270,8 +252,20 @@ void CardMenu::createGraveyardOrExileMenu()
|
||||||
addRelatedCardActions();
|
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
|
// Card is in hand or a custom zone specified by server
|
||||||
addAction(aPlay);
|
addAction(aPlay);
|
||||||
addAction(aPlayFacedown);
|
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.
|
* @brief Populates the menu with an action for each active player.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,11 @@ class CardMenu : public QMenu
|
||||||
public:
|
public:
|
||||||
explicit CardMenu(Player *player, const CardItem *card, bool shortcutsActive);
|
explicit CardMenu(Player *player, const CardItem *card, bool shortcutsActive);
|
||||||
void removePlayer(Player *playerToRemove);
|
void removePlayer(Player *playerToRemove);
|
||||||
void createTableMenu();
|
void createTableMenu(bool canModifyCard);
|
||||||
void createStackMenu();
|
void createStackMenu(bool canModifyCard);
|
||||||
void createGraveyardOrExileMenu();
|
void createGraveyardOrExileMenu(bool canModifyCard);
|
||||||
void createHandOrCustomZoneMenu();
|
void createHandOrCustomZoneMenu(bool canModifyCard);
|
||||||
|
void createZonelessMenu(bool canModifyCard);
|
||||||
|
|
||||||
QMenu *mCardCounters;
|
QMenu *mCardCounters;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue