Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
94659837
Commit
94659837
authored
Jun 11, 2015
by
Fabio Bas
Browse files
Expose related cards in card menu
parent
da84bb33
Changes
2
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/player.cpp
View file @
94659837
...
...
@@ -676,7 +676,7 @@ void Player::retranslateUi()
for
(
int
i
=
0
;
i
<
allPlayersActions
.
size
();
++
i
)
allPlayersActions
[
i
]
->
setText
(
tr
(
"&All players"
));
}
aPlay
->
setText
(
tr
(
"&Play"
));
aHide
->
setText
(
tr
(
"&Hide"
));
aPlayFacedown
->
setText
(
tr
(
"Play &Face Down"
));
...
...
@@ -1076,6 +1076,25 @@ void Player::actCreatePredefinedToken()
actCreateAnotherToken
();
}
void
Player
::
actCreateRelatedCard
()
{
// get he target card name
QAction
*
action
=
static_cast
<
QAction
*>
(
sender
());
CardInfo
*
cardInfo
=
db
->
getCard
(
action
->
text
());
// create the token for the related card
Command_CreateToken
cmd
;
cmd
.
set_zone
(
"table"
);
cmd
.
set_card_name
(
cardInfo
->
getName
().
toStdString
());
cmd
.
set_color
(
cardInfo
->
getColors
().
isEmpty
()
?
QString
().
toStdString
()
:
cardInfo
->
getColors
().
first
().
toLower
().
toStdString
());
cmd
.
set_pt
(
cardInfo
->
getPowTough
().
toStdString
());
cmd
.
set_destroy_on_zone_change
(
true
);
cmd
.
set_x
(
-
1
);
cmd
.
set_y
(
0
);
sendGameCommand
(
cmd
);
}
void
Player
::
actSayMessage
()
{
QAction
*
a
=
qobject_cast
<
QAction
*>
(
sender
());
...
...
@@ -2247,6 +2266,17 @@ void Player::updateCardMenu(CardItem *card)
cardMenu
->
addAction
(
aFlip
);
if
(
card
->
getFaceDown
())
cardMenu
->
addAction
(
aPeek
);
QStringList
relatedCards
=
card
->
getInfo
()
->
getRelatedCards
();
if
(
relatedCards
.
size
())
{
QMenu
*
createRelatedCardMenu
=
cardMenu
->
addMenu
(
tr
(
"Cr&eate related card"
));
for
(
int
i
=
0
;
i
<
relatedCards
.
size
();
++
i
)
{
QAction
*
a
=
createRelatedCardMenu
->
addAction
(
relatedCards
.
at
(
i
));
connect
(
a
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
actCreateRelatedCard
()));
}
}
cardMenu
->
addSeparator
();
cardMenu
->
addAction
(
aAttach
);
if
(
card
->
getAttachedTo
())
...
...
cockatrice/src/player.h
View file @
94659837
...
...
@@ -141,6 +141,7 @@ private slots:
void
actOpenDeckInDeckEditor
();
void
actCreatePredefinedToken
();
void
actCreateRelatedCard
();
void
cardMenuAction
();
void
actCardCounterTrigger
();
void
actAttach
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment