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
9f13254d
Commit
9f13254d
authored
Feb 03, 2013
by
Max-Wilhelm Bruker
Browse files
don't allow players to move cards that are attached to something
parent
1f6fbfdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
common/server_player.cpp
View file @
9f13254d
...
...
@@ -353,15 +353,21 @@ Response::ResponseCode Server_Player::moveCard(GameEventStorage &ges, Server_Car
continue
;
cardIdsToMove
.
insert
(
_cards
[
i
]
->
card_id
());
// Consistency checks. In case the command contains illegal moves, try to resolve the legal ones still.
int
position
;
Server_Card
*
card
=
startzone
->
getCard
(
_cards
[
i
]
->
card_id
(),
&
position
);
if
(
!
card
)
return
Response
::
RespNameNotFound
;
if
(
card
->
getParentCard
())
continue
;
if
(
!
card
->
getAttachedCards
().
isEmpty
()
&&
!
targetzone
->
isColumnEmpty
(
x
,
y
))
return
Response
::
RespContextError
;
continue
;
cardsToMove
.
append
(
QPair
<
Server_Card
*
,
int
>
(
card
,
position
));
cardProperties
.
insert
(
card
,
_cards
[
i
]);
}
// In case all moves were filtered out, abort.
if
(
cardsToMove
.
isEmpty
())
return
Response
::
RespContextError
;
MoveCardCompareFunctor
cmp
(
startzone
==
targetzone
?
-
1
:
x
);
qSort
(
cardsToMove
.
begin
(),
cardsToMove
.
end
(),
cmp
);
...
...
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