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
c5509db2
Commit
c5509db2
authored
Dec 19, 2011
by
Max-Wilhelm Bruker
Browse files
reasonable defaults
parent
f115342e
Changes
20
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/player.cpp
View file @
c5509db2
...
...
@@ -357,33 +357,26 @@ void Player::playerListActionTriggered()
{
QAction
*
action
=
static_cast
<
QAction
*>
(
sender
());
QMenu
*
menu
=
static_cast
<
QMenu
*>
(
action
->
parentWidget
());
int
otherPlayerId
=
action
->
data
().
toInt
();
if
(
menu
==
mRevealLibrary
)
{
Command_RevealCards
cmd
;
cmd
.
set_zone_name
(
"deck"
);
cmd
.
set_card_id
(
-
1
);
Command_RevealCards
cmd
;
const
int
otherPlayerId
=
action
->
data
().
toInt
();
if
(
otherPlayerId
!=
-
1
)
cmd
.
set_player_id
(
otherPlayerId
);
sendGameCommand
(
cmd
);
}
else
if
(
menu
==
mRevealTopCard
)
{
Command_RevealCards
cmd
;
if
(
menu
==
mRevealLibrary
)
cmd
.
set_zone_name
(
"deck"
);
else
if
(
menu
==
mRevealTopCard
)
{
cmd
.
set_zone_name
(
"deck"
);
cmd
.
set_card_id
(
0
);
cmd
.
set_player_id
(
otherPlayerId
);
sendGameCommand
(
cmd
);
}
else
if
(
menu
==
mRevealHand
)
{
Command_RevealCards
cmd
;
}
else
if
(
menu
==
mRevealHand
)
cmd
.
set_zone_name
(
"hand"
);
cmd
.
set_card_id
(
-
1
);
cmd
.
set_player_id
(
otherPlayerId
);
sendGameCommand
(
cmd
);
}
else
if
(
menu
==
mRevealRandomHandCard
)
{
Command_RevealCards
cmd
;
else
if
(
menu
==
mRevealRandomHandCard
)
{
cmd
.
set_zone_name
(
"hand"
);
cmd
.
set_card_id
(
-
2
);
cmd
.
set_player_id
(
otherPlayerId
);
sendGameCommand
(
cmd
);
}
}
else
return
;
sendGameCommand
(
cmd
);
}
void
Player
::
rearrangeZones
()
...
...
common/pb/proto/command_attach_card.proto
View file @
c5509db2
...
...
@@ -4,10 +4,10 @@ message Command_AttachCard {
optional
Command_AttachCard
ext
=
1009
;
}
optional
string
start_zone
=
1
;
optional
sint32
card_id
=
2
;
optional
sint32
target_player_id
=
3
;
optional
sint32
card_id
=
2
[
default
=
-
1
]
;
optional
sint32
target_player_id
=
3
[
default
=
-
1
]
;
optional
string
target_zone
=
4
;
optional
sint32
target_card_id
=
5
;
optional
sint32
target_card_id
=
5
[
default
=
-
1
]
;
}
common/pb/proto/command_create_arrow.proto
View file @
c5509db2
...
...
@@ -5,13 +5,11 @@ message Command_CreateArrow {
extend
GameCommand
{
optional
Command_CreateArrow
ext
=
1011
;
}
optional
sint32
start_player_id
=
1
;
optional
sint32
start_player_id
=
1
[
default
=
-
1
]
;
optional
string
start_zone
=
2
;
optional
sint32
start_card_id
=
3
;
optional
sint32
target_player_id
=
4
;
optional
sint32
start_card_id
=
3
[
default
=
-
1
]
;
optional
sint32
target_player_id
=
4
[
default
=
-
1
]
;
optional
string
target_zone
=
5
;
optional
sint32
target_card_id
=
6
;
optional
sint32
target_card_id
=
6
[
default
=
-
1
]
;
optional
color
arrow_color
=
7
;
}
common/pb/proto/command_deck_del.proto
View file @
c5509db2
...
...
@@ -4,5 +4,5 @@ message Command_DeckDel {
extend
SessionCommand
{
optional
Command_DeckDel
ext
=
1011
;
}
optional
u
int32
deck_id
=
1
;
optional
s
int32
deck_id
=
1
[
default
=
-
1
]
;
}
common/pb/proto/command_deck_download.proto
View file @
c5509db2
...
...
@@ -4,6 +4,6 @@ message Command_DeckDownload {
extend
SessionCommand
{
optional
Command_DeckDownload
ext
=
1012
;
}
optional
u
int32
deck_id
=
1
;
optional
s
int32
deck_id
=
1
[
default
=
-
1
]
;
}
common/pb/proto/command_deck_select.proto
View file @
c5509db2
...
...
@@ -4,5 +4,5 @@ message Command_DeckSelect {
optional
Command_DeckSelect
ext
=
1029
;
}
optional
string
deck
=
1
;
optional
sint32
deck_id
=
2
;
optional
sint32
deck_id
=
2
[
default
=
-
1
]
;
}
common/pb/proto/command_del_counter.proto
View file @
c5509db2
...
...
@@ -3,5 +3,5 @@ message Command_DelCounter {
extend
GameCommand
{
optional
Command_DelCounter
ext
=
1021
;
}
optional
sint32
counter_id
=
1
;
optional
sint32
counter_id
=
1
[
default
=
-
1
]
;
}
common/pb/proto/command_delete_arrow.proto
View file @
c5509db2
...
...
@@ -3,5 +3,5 @@ message Command_DeleteArrow {
extend
GameCommand
{
optional
Command_DeleteArrow
ext
=
1012
;
}
optional
sint32
arrow_id
=
1
;
optional
sint32
arrow_id
=
1
[
default
=
-
1
]
;
}
common/pb/proto/command_dump_zone.proto
View file @
c5509db2
...
...
@@ -3,7 +3,7 @@ message Command_DumpZone {
extend
GameCommand
{
optional
Command_DumpZone
ext
=
1024
;
}
optional
sint32
player_id
=
1
;
optional
sint32
player_id
=
1
[
default
=
-
1
]
;
optional
string
zone_name
=
2
;
optional
sint32
number_cards
=
3
;
}
common/pb/proto/command_flip_card.proto
View file @
c5509db2
...
...
@@ -4,7 +4,7 @@ message Command_FlipCard {
optional
Command_FlipCard
ext
=
1008
;
}
optional
string
zone
=
1
;
optional
sint32
card_id
=
2
;
optional
sint32
card_id
=
2
[
default
=
-
1
]
;
optional
bool
face_down
=
3
;
}
...
...
common/pb/proto/command_inc_card_counter.proto
View file @
c5509db2
...
...
@@ -4,7 +4,7 @@ message Command_IncCardCounter {
optional
Command_IncCardCounter
ext
=
1015
;
}
optional
string
zone
=
1
;
optional
sint32
card_id
=
2
;
optional
sint32
counter_id
=
3
;
optional
sint32
card_id
=
2
[
default
=
-
1
]
;
optional
sint32
counter_id
=
3
[
default
=
-
1
]
;
optional
sint32
counter_delta
=
4
;
}
common/pb/proto/command_inc_counter.proto
View file @
c5509db2
...
...
@@ -3,6 +3,6 @@ message Command_IncCounter {
extend
GameCommand
{
optional
Command_IncCounter
ext
=
1018
;
}
optional
sint32
counter_id
=
1
;
optional
sint32
counter_id
=
1
[
default
=
-
1
]
;
optional
sint32
delta
=
2
;
}
common/pb/proto/command_kick_from_game.proto
View file @
c5509db2
...
...
@@ -2,7 +2,7 @@ import "game_commands.proto";
message
Command_KickFromGame
{
extend
GameCommand
{
optional
Command_KickFromGame
ext
=
1000
;
}
optional
sint32
player_id
=
1
;
}
optional
sint32
player_id
=
1
[
default
=
-
1
]
;
}
common/pb/proto/command_move_card.proto
View file @
c5509db2
import
"game_commands.proto"
;
message
CardToMove
{
optional
sint32
card_id
=
1
;
optional
sint32
card_id
=
1
[
default
=
-
1
]
;
optional
bool
face_down
=
2
;
optional
string
pt
=
3
;
optional
bool
tapped
=
4
;
...
...
@@ -16,9 +16,9 @@ message Command_MoveCard {
}
optional
string
start_zone
=
1
;
optional
ListOfCardsToMove
cards_to_move
=
2
;
optional
sint32
target_player_id
=
3
;
optional
sint32
target_player_id
=
3
[
default
=
-
1
]
;
optional
string
target_zone
=
4
;
optional
sint32
x
=
5
;
optional
sint32
y
=
6
;
optional
sint32
x
=
5
[
default
=
-
1
]
;
optional
sint32
y
=
6
[
default
=
-
1
]
;
}
common/pb/proto/command_reveal_cards.proto
View file @
c5509db2
...
...
@@ -4,6 +4,6 @@ message Command_RevealCards {
optional
Command_RevealCards
ext
=
1026
;
}
optional
string
zone_name
=
1
;
optional
sint32
card_id
=
2
;
optional
sint32
player_id
=
3
;
optional
sint32
card_id
=
2
[
default
=
-
1
]
;
optional
sint32
player_id
=
3
[
default
=
-
1
]
;
}
common/pb/proto/command_set_card_attr.proto
View file @
c5509db2
...
...
@@ -4,7 +4,7 @@ message Command_SetCardAttr {
optional
Command_SetCardAttr
ext
=
1013
;
}
optional
string
zone
=
1
;
optional
sint32
card_id
=
2
;
optional
sint32
card_id
=
2
[
default
=
-
1
]
;
optional
string
attr_name
=
3
;
optional
string
attr_value
=
4
;
}
common/pb/proto/command_set_card_counter.proto
View file @
c5509db2
...
...
@@ -4,7 +4,7 @@ message Command_SetCardCounter {
optional
Command_SetCardCounter
ext
=
1014
;
}
optional
string
zone
=
1
;
optional
sint32
card_id
=
2
;
optional
sint32
counter_id
=
3
;
optional
sint32
card_id
=
2
[
default
=
-
1
]
;
optional
sint32
counter_id
=
3
[
default
=
-
1
]
;
optional
sint32
counter_value
=
4
;
}
common/pb/proto/command_set_counter.proto
View file @
c5509db2
...
...
@@ -3,6 +3,6 @@ message Command_SetCounter {
extend
GameCommand
{
optional
Command_SetCounter
ext
=
1020
;
}
optional
sint32
counter_id
=
1
;
optional
sint32
counter_id
=
1
[
default
=
-
1
]
;
optional
sint32
value
=
2
;
}
common/pb/proto/room_commands.proto
View file @
c5509db2
...
...
@@ -41,7 +41,7 @@ message Command_JoinGame {
extend
RoomCommand
{
optional
Command_JoinGame
ext
=
1003
;
}
optional
u
int32
game_id
=
1
;
optional
s
int32
game_id
=
1
[
default
=
-
1
]
;
optional
string
password
=
2
;
optional
bool
spectator
=
3
;
optional
bool
override_restrictions
=
4
;
...
...
common/server_protocolhandler.cpp
View file @
c5509db2
...
...
@@ -949,13 +949,11 @@ ResponseCode Server_ProtocolHandler::cmdAttachCard(const Command_AttachCard &cmd
if
(
!
card
)
return
RespNameNotFound
;
int
playerId
=
cmd
.
target_player_id
();
Server_Player
*
targetPlayer
=
0
;
Server_CardZone
*
targetzone
=
0
;
Server_Card
*
targetCard
=
0
;
qDebug
()
<<
"playerId="
<<
playerId
;
if
(
playerId
!=
-
1
)
{
if
(
cmd
.
has_target_player_id
())
{
targetPlayer
=
game
->
getPlayer
(
cmd
.
target_player_id
());
if
(
!
targetPlayer
)
return
RespNameNotFound
;
...
...
@@ -968,7 +966,8 @@ ResponseCode Server_ProtocolHandler::cmdAttachCard(const Command_AttachCard &cmd
// Possibly a flag will have to be introduced for this sometime.
if
(
!
targetzone
->
hasCoords
())
return
RespContextError
;
targetCard
=
targetzone
->
getCard
(
cmd
.
target_card_id
());
if
(
cmd
.
has_target_card_id
())
targetCard
=
targetzone
->
getCard
(
cmd
.
target_card_id
());
if
(
targetCard
)
if
(
targetCard
->
getParentCard
())
return
RespContextError
;
...
...
@@ -1391,7 +1390,7 @@ ResponseCode Server_ProtocolHandler::cmdRevealCards(const Command_RevealCards &c
return
RespContextError
;
Server_Player
*
otherPlayer
=
0
;
if
(
cmd
.
player_id
()
!=
-
1
)
{
if
(
cmd
.
has_
player_id
())
{
otherPlayer
=
game
->
getPlayer
(
cmd
.
player_id
());
if
(
!
otherPlayer
)
return
RespNameNotFound
;
...
...
@@ -1401,7 +1400,7 @@ ResponseCode Server_ProtocolHandler::cmdRevealCards(const Command_RevealCards &c
return
RespNameNotFound
;
QList
<
Server_Card
*>
cardsToReveal
;
if
(
cmd
.
card_id
()
==
-
1
)
if
(
!
cmd
.
has_
card_id
())
cardsToReveal
=
zone
->
cards
;
else
if
(
cmd
.
card_id
()
==
-
2
)
{
if
(
zone
->
cards
.
isEmpty
())
...
...
@@ -1435,12 +1434,12 @@ ResponseCode Server_ProtocolHandler::cmdRevealCards(const Command_RevealCards &c
attachCardId
=
card
->
getParentCard
()
->
getId
();
}
if
(
cmd
.
player_id
()
!=
-
1
)
if
(
cmd
.
has_
player_id
())
respCardListPrivate
.
append
(
new
ServerInfo_Card
(
card
->
getId
(),
card
->
getName
(),
card
->
getX
(),
card
->
getY
(),
card
->
getFaceDown
(),
card
->
getTapped
(),
card
->
getAttacking
(),
card
->
getColor
(),
card
->
getPT
(),
card
->
getAnnotation
(),
card
->
getDestroyOnZoneChange
(),
card
->
getDoesntUntap
(),
cardCounterListPrivate
,
attachPlayerId
,
attachZone
,
attachCardId
));
respCardListOmniscient
.
append
(
new
ServerInfo_Card
(
card
->
getId
(),
card
->
getName
(),
card
->
getX
(),
card
->
getY
(),
card
->
getFaceDown
(),
card
->
getTapped
(),
card
->
getAttacking
(),
card
->
getColor
(),
card
->
getPT
(),
card
->
getAnnotation
(),
card
->
getDestroyOnZoneChange
(),
card
->
getDoesntUntap
(),
cardCounterListOmniscient
,
attachPlayerId
,
attachZone
,
attachCardId
));
}
if
(
cmd
.
player_id
()
==
-
1
)
if
(
!
cmd
.
has_
player_id
())
bla
->
enqueueGameEventPublic
(
new
Event_RevealCards
(
player
->
getPlayerId
(),
zone
->
getName
(),
cmd
.
card_id
(),
-
1
,
respCardListOmniscient
),
game
->
getGameId
());
else
{
bla
->
enqueueGameEventPublic
(
new
Event_RevealCards
(
player
->
getPlayerId
(),
zone
->
getName
(),
cmd
.
card_id
(),
otherPlayer
->
getPlayerId
()),
game
->
getGameId
());
...
...
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