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
ec602aef
Commit
ec602aef
authored
Nov 23, 2010
by
Max-Wilhelm Bruker
Browse files
server crash and inconsistency fix
parent
4387f05f
Changes
2
Hide whitespace changes
Inline
Side-by-side
common/server_card.cpp
View file @
ec602aef
...
...
@@ -37,15 +37,11 @@ Server_Card::~Server_Card()
void
Server_Card
::
resetState
()
{
setCoords
(
0
,
0
);
counters
.
clear
();
setTapped
(
false
);
setAttacking
(
false
);
setFaceDown
(
false
);
setColor
(
QString
());
setPT
(
QString
());
setAnnotation
(
QString
());
setDestroyOnZoneChange
(
false
);
setDoesntUntap
(
false
);
}
...
...
common/server_protocolhandler.cpp
View file @
ec602aef
...
...
@@ -623,6 +623,8 @@ ResponseCode Server_ProtocolHandler::moveCard(Server_Game *game, Server_Player *
y
=
0
;
if
(
x
==
-
1
)
x
=
targetzone
->
cards
.
size
();
card
->
resetState
();
}
else
if
(
x
==
-
1
)
x
=
targetzone
->
getFreeGridColumn
(
y
);
...
...
@@ -680,7 +682,7 @@ ResponseCode Server_ProtocolHandler::moveCard(Server_Game *game, Server_Player *
if
(
tapped
)
setCardAttrHelper
(
cont
,
game
,
player
,
targetzone
->
getName
(),
card
->
getId
(),
"tapped"
,
"1"
);
return
RespOk
;
}
...
...
@@ -1197,11 +1199,12 @@ ResponseCode Server_ProtocolHandler::cmdRevealCards(Command_RevealCards *cmd, Co
for
(
int
i
=
0
;
i
<
cardsToReveal
.
size
();
++
i
)
{
Server_Card
*
card
=
cardsToReveal
[
i
];
QList
<
ServerInfo_CardCounter
*>
cardCounterList
;
QList
<
ServerInfo_CardCounter
*>
cardCounterList
Private
,
cardCounterListOmniscient
;
QMapIterator
<
int
,
int
>
cardCounterIterator
(
card
->
getCounters
());
while
(
cardCounterIterator
.
hasNext
())
{
cardCounterIterator
.
next
();
cardCounterList
.
append
(
new
ServerInfo_CardCounter
(
cardCounterIterator
.
key
(),
cardCounterIterator
.
value
()));
cardCounterListPrivate
.
append
(
new
ServerInfo_CardCounter
(
cardCounterIterator
.
key
(),
cardCounterIterator
.
value
()));
cardCounterListOmniscient
.
append
(
new
ServerInfo_CardCounter
(
cardCounterIterator
.
key
(),
cardCounterIterator
.
value
()));
}
int
attachPlayerId
=
-
1
;
...
...
@@ -1214,8 +1217,8 @@ ResponseCode Server_ProtocolHandler::cmdRevealCards(Command_RevealCards *cmd, Co
}
if
(
cmd
->
getPlayerId
()
!=
-
1
)
respCardListPrivate
.
append
(
new
ServerInfo_Card
(
card
->
getId
(),
card
->
getName
(),
card
->
getX
(),
card
->
getY
(),
card
->
getTapped
(),
card
->
getAttacking
(),
card
->
getColor
(),
card
->
getPT
(),
card
->
getAnnotation
(),
card
->
getDestroyOnZoneChange
(),
cardCounterList
,
attachPlayerId
,
attachZone
,
attachCardId
));
respCardListOmniscient
.
append
(
new
ServerInfo_Card
(
card
->
getId
(),
card
->
getName
(),
card
->
getX
(),
card
->
getY
(),
card
->
getTapped
(),
card
->
getAttacking
(),
card
->
getColor
(),
card
->
getPT
(),
card
->
getAnnotation
(),
card
->
getDestroyOnZoneChange
(),
cardCounterList
,
attachPlayerId
,
attachZone
,
attachCardId
));
respCardListPrivate
.
append
(
new
ServerInfo_Card
(
card
->
getId
(),
card
->
getName
(),
card
->
getX
(),
card
->
getY
(),
card
->
getTapped
(),
card
->
getAttacking
(),
card
->
getColor
(),
card
->
getPT
(),
card
->
getAnnotation
(),
card
->
getDestroyOnZoneChange
(),
cardCounterList
Private
,
attachPlayerId
,
attachZone
,
attachCardId
));
respCardListOmniscient
.
append
(
new
ServerInfo_Card
(
card
->
getId
(),
card
->
getName
(),
card
->
getX
(),
card
->
getY
(),
card
->
getTapped
(),
card
->
getAttacking
(),
card
->
getColor
(),
card
->
getPT
(),
card
->
getAnnotation
(),
card
->
getDestroyOnZoneChange
(),
cardCounterList
Omniscient
,
attachPlayerId
,
attachZone
,
attachCardId
));
}
if
(
cmd
->
getPlayerId
()
==
-
1
)
...
...
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