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
25f444a5
Commit
25f444a5
authored
May 16, 2015
by
ctrlaltca
Browse files
Merge pull request #1051 from poixen/reveal_top_x
Reveal top x cards
parents
262ebe3b
02453d35
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/player.cpp
View file @
25f444a5
...
...
@@ -515,8 +515,22 @@ void Player::playerListActionTriggered()
if
(
menu
==
mRevealLibrary
)
{
cmd
.
set_zone_name
(
"deck"
);
}
else
if
(
menu
==
mRevealTopCard
)
{
cmd
.
set_zone_name
(
"deck"
);
cmd
.
set_card_id
(
0
);
int
decksize
=
zones
.
value
(
"deck"
)
->
getCards
().
size
();
bool
ok
;
int
number
=
#if QT_VERSION < 0x050000
QInputDialog
::
getInteger
(
#else
QInputDialog
::
getInt
(
#endif
0
,
tr
(
"Reveal top cards of library"
),
tr
(
"Number of cards: (max. %1)"
).
arg
(
decksize
),
defaultNumberTopCards
,
1
,
decksize
,
1
,
&
ok
);
if
(
ok
)
{
cmd
.
set_zone_name
(
"deck"
);
cmd
.
set_top_cards
(
number
);
// backward compatibility: servers before #1051 only permits to reveal the first card
cmd
.
set_card_id
(
0
);
}
}
else
if
(
menu
==
mRevealHand
)
cmd
.
set_zone_name
(
"hand"
);
else
if
(
menu
==
mRevealRandomHandCard
)
{
...
...
@@ -624,7 +638,7 @@ void Player::retranslateUi()
aViewLibrary
->
setText
(
tr
(
"&View library"
));
aViewTopCards
->
setText
(
tr
(
"View &top cards of library..."
));
mRevealLibrary
->
setTitle
(
tr
(
"Reveal &library to..."
));
mRevealTopCard
->
setTitle
(
tr
(
"Reveal t&op card to..."
));
mRevealTopCard
->
setTitle
(
tr
(
"Reveal t&op card
s
to..."
));
aAlwaysRevealTopCard
->
setText
(
tr
(
"&Always reveal top card"
));
aOpenDeckInDeckEditor
->
setText
(
tr
(
"O&pen deck in deck editor"
));
aViewSideboard
->
setText
(
tr
(
"&View sideboard"
));
...
...
common/pb/command_reveal_cards.proto
View file @
25f444a5
...
...
@@ -7,4 +7,5 @@ message Command_RevealCards {
optional
sint32
card_id
=
2
[
default
=
-
1
];
optional
sint32
player_id
=
3
[
default
=
-
1
];
optional
bool
grant_write_access
=
4
;
optional
sint32
top_cards
=
5
[
default
=
-
1
];
}
common/server_player.cpp
View file @
25f444a5
...
...
@@ -1525,7 +1525,14 @@ Response::ResponseCode Server_Player::cmdRevealCards(const Command_RevealCards &
return
Response
::
RespNameNotFound
;
QList
<
Server_Card
*>
cardsToReveal
;
if
(
!
cmd
.
has_card_id
())
if
(
cmd
.
top_cards
()
!=
-
1
)
{
for
(
int
i
=
0
;
i
<
cmd
.
top_cards
();
i
++
)
{
Server_Card
*
card
=
zone
->
getCard
(
i
);
if
(
!
card
)
return
Response
::
RespNameNotFound
;
cardsToReveal
.
append
(
card
);
}
}
else
if
(
!
cmd
.
has_card_id
())
cardsToReveal
=
zone
->
getCards
();
else
if
(
cmd
.
card_id
()
==
-
2
)
{
if
(
zone
->
getCards
().
isEmpty
())
...
...
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