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
8abbf4cf
Commit
8abbf4cf
authored
Oct 14, 2010
by
Max-Wilhelm Bruker
Browse files
Merge branch 'master' of
ssh://cockatrice.git.sourceforge.net/gitroot/cockatrice/cockatrice
parents
c2d1f151
b0b58ca7
Changes
4
Hide whitespace changes
Inline
Side-by-side
common/protocol.cpp
View file @
8abbf4cf
...
...
@@ -206,6 +206,7 @@ ProtocolResponse::ProtocolResponse(int _cmdId, ResponseCode _responseCode, const
void
ProtocolResponse
::
initializeHash
()
{
responseHash
.
insert
(
QString
(),
RespNothing
);
responseHash
.
insert
(
"ok"
,
RespOk
);
responseHash
.
insert
(
"invalid_command"
,
RespInvalidCommand
);
responseHash
.
insert
(
"name_not_found"
,
RespNameNotFound
);
...
...
common/protocol.h
View file @
8abbf4cf
...
...
@@ -194,7 +194,7 @@ class ProtocolResponse : public ProtocolItem {
private:
static
QHash
<
QString
,
ResponseCode
>
responseHash
;
public:
ProtocolResponse
(
int
_cmdId
=
-
1
,
ResponseCode
_responseCode
=
Resp
Ok
,
const
QString
&
_itemName
=
QString
());
ProtocolResponse
(
int
_cmdId
=
-
1
,
ResponseCode
_responseCode
=
Resp
Nothing
,
const
QString
&
_itemName
=
QString
());
int
getItemId
()
const
{
return
ItemId_Other
;
}
static
void
initializeHash
();
static
SerializableItem
*
newItem
()
{
return
new
ProtocolResponse
;
}
...
...
common/server_protocolhandler.cpp
View file @
8abbf4cf
...
...
@@ -583,12 +583,27 @@ ResponseCode Server_ProtocolHandler::moveCard(Server_Game *game, Server_Player *
return
RespNameNotFound
;
if
(
startzone
!=
targetzone
)
{
// Delete all attachment relationships
if
(
card
->
getParentCard
())
card
->
setParentCard
(
0
);
const
QList
<
Server_Card
*>
&
attachedCards
=
card
->
getAttachedCards
();
for
(
int
i
=
0
;
i
<
attachedCards
.
size
();
++
i
)
unattachCard
(
game
,
attachedCards
[
i
]
->
getZone
()
->
getPlayer
(),
cont
,
attachedCards
[
i
]);
// Delete all arrows from and to the card
const
QList
<
Server_Player
*>
&
players
=
game
->
getPlayers
().
values
();
for
(
int
i
=
0
;
i
<
players
.
size
();
++
i
)
{
QList
<
int
>
arrowsToDelete
;
QMapIterator
<
int
,
Server_Arrow
*>
arrowIterator
(
players
[
i
]
->
getArrows
());
while
(
arrowIterator
.
hasNext
())
{
Server_Arrow
*
arrow
=
arrowIterator
.
next
().
value
();
if
((
arrow
->
getStartCard
()
==
card
)
||
(
arrow
->
getTargetItem
()
==
card
))
arrowsToDelete
.
append
(
arrow
->
getId
());
}
for
(
int
j
=
0
;
j
<
arrowsToDelete
.
size
();
++
j
)
players
[
i
]
->
deleteArrow
(
arrowsToDelete
[
j
]);
}
}
if
(
card
->
getDestroyOnZoneChange
()
&&
(
startzone
!=
targetzone
))
{
...
...
@@ -659,22 +674,6 @@ ResponseCode Server_ProtocolHandler::moveCard(Server_Game *game, Server_Player *
if
(
tapped
)
setCardAttrHelper
(
cont
,
game
,
player
,
targetzone
->
getName
(),
card
->
getId
(),
"tapped"
,
"1"
);
// If the card was moved to another zone, delete all arrows from and to the card
if
(
startzone
!=
targetzone
)
{
const
QList
<
Server_Player
*>
&
players
=
game
->
getPlayers
().
values
();
for
(
int
i
=
0
;
i
<
players
.
size
();
++
i
)
{
QList
<
int
>
arrowsToDelete
;
QMapIterator
<
int
,
Server_Arrow
*>
arrowIterator
(
players
[
i
]
->
getArrows
());
while
(
arrowIterator
.
hasNext
())
{
Server_Arrow
*
arrow
=
arrowIterator
.
next
().
value
();
if
((
arrow
->
getStartCard
()
==
card
)
||
(
arrow
->
getTargetItem
()
==
card
))
arrowsToDelete
.
append
(
arrow
->
getId
());
}
for
(
int
j
=
0
;
j
<
arrowsToDelete
.
size
();
++
j
)
players
[
i
]
->
deleteArrow
(
arrowsToDelete
[
j
]);
}
}
return
RespOk
;
}
...
...
servatrice/servatrice.ini.example
View file @
8abbf4cf
...
...
@@ -6,6 +6,7 @@ method=none
[database]
type=none
prefix=cockatrice
hostname=localhost
database=servatrice
user=servatrice
...
...
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