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
a0299944
Commit
a0299944
authored
Oct 27, 2010
by
Max-Wilhelm Bruker
Browse files
removed unnecessary repaint when destroying token
parent
51f9f34e
Changes
5
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/cardzone.cpp
View file @
a0299944
...
@@ -129,7 +129,7 @@ CardItem *CardZone::getCard(int cardId, const QString &cardName)
...
@@ -129,7 +129,7 @@ CardItem *CardZone::getCard(int cardId, const QString &cardName)
return
c
;
return
c
;
}
}
CardItem
*
CardZone
::
takeCard
(
int
position
,
int
cardId
,
const
QString
&
cardName
,
bool
/*canResize*/
)
CardItem
*
CardZone
::
takeCard
(
int
position
,
int
cardId
,
bool
/*canResize*/
)
{
{
if
(
position
==
-
1
)
{
if
(
position
==
-
1
)
{
// position == -1 means either that the zone is indexed by card id
// position == -1 means either that the zone is indexed by card id
...
@@ -151,7 +151,6 @@ CardItem *CardZone::takeCard(int position, int cardId, const QString &cardName,
...
@@ -151,7 +151,6 @@ CardItem *CardZone::takeCard(int position, int cardId, const QString &cardName,
view
->
removeCard
(
position
);
view
->
removeCard
(
position
);
c
->
setId
(
cardId
);
c
->
setId
(
cardId
);
c
->
setName
(
cardName
);
reorganizeCards
();
reorganizeCards
();
emit
cardCountChanged
();
emit
cardCountChanged
();
...
...
cockatrice/src/cardzone.h
View file @
a0299944
...
@@ -52,7 +52,7 @@ public:
...
@@ -52,7 +52,7 @@ public:
// getCard() finds a card by id.
// getCard() finds a card by id.
CardItem
*
getCard
(
int
cardId
,
const
QString
&
cardName
);
CardItem
*
getCard
(
int
cardId
,
const
QString
&
cardName
);
// takeCard() finds a card by position and removes it from the zone and from all of its views.
// takeCard() finds a card by position and removes it from the zone and from all of its views.
virtual
CardItem
*
takeCard
(
int
position
,
int
cardId
,
const
QString
&
cardName
,
bool
canResize
=
true
);
virtual
CardItem
*
takeCard
(
int
position
,
int
cardId
,
bool
canResize
=
true
);
ZoneViewZone
*
getView
()
const
{
return
view
;
}
ZoneViewZone
*
getView
()
const
{
return
view
;
}
void
setView
(
ZoneViewZone
*
_view
)
{
view
=
_view
;
}
void
setView
(
ZoneViewZone
*
_view
)
{
view
=
_view
;
}
virtual
void
reorganizeCards
()
=
0
;
virtual
void
reorganizeCards
()
=
0
;
...
...
cockatrice/src/player.cpp
View file @
a0299944
...
@@ -696,9 +696,10 @@ void Player::eventMoveCard(Event_MoveCard *event)
...
@@ -696,9 +696,10 @@ void Player::eventMoveCard(Event_MoveCard *event)
int
logX
=
x
;
int
logX
=
x
;
if
(
x
==
-
1
)
if
(
x
==
-
1
)
x
=
0
;
x
=
0
;
CardItem
*
card
=
startZone
->
takeCard
(
position
,
event
->
getCardId
(),
event
->
getCardName
(),
startZone
!=
targetZone
);
CardItem
*
card
=
startZone
->
takeCard
(
position
,
event
->
getCardId
(),
startZone
!=
targetZone
);
if
(
!
card
)
if
(
!
card
)
return
;
return
;
card
->
setName
(
event
->
getCardName
());
if
(
card
->
getAttachedTo
()
&&
(
startZone
!=
targetZone
))
if
(
card
->
getAttachedTo
()
&&
(
startZone
!=
targetZone
))
card
->
setAttachedTo
(
0
);
card
->
setAttachedTo
(
0
);
...
@@ -761,7 +762,7 @@ void Player::eventDestroyCard(Event_DestroyCard *event)
...
@@ -761,7 +762,7 @@ void Player::eventDestroyCard(Event_DestroyCard *event)
return
;
return
;
emit
logDestroyCard
(
this
,
card
->
getName
());
emit
logDestroyCard
(
this
,
card
->
getName
());
zone
->
takeCard
(
-
1
,
event
->
getCardId
(),
QString
(),
true
);
zone
->
takeCard
(
-
1
,
event
->
getCardId
(),
true
);
card
->
deleteLater
();
card
->
deleteLater
();
}
}
...
@@ -813,11 +814,15 @@ void Player::eventDrawCards(Event_DrawCards *event)
...
@@ -813,11 +814,15 @@ void Player::eventDrawCards(Event_DrawCards *event)
CardZone
*
hand
=
zones
.
value
(
"hand"
);
CardZone
*
hand
=
zones
.
value
(
"hand"
);
const
QList
<
ServerInfo_Card
*>
&
cardList
=
event
->
getCardList
();
const
QList
<
ServerInfo_Card
*>
&
cardList
=
event
->
getCardList
();
if
(
!
cardList
.
isEmpty
())
if
(
!
cardList
.
isEmpty
())
for
(
int
i
=
0
;
i
<
cardList
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
cardList
.
size
();
++
i
)
{
hand
->
addCard
(
deck
->
takeCard
(
0
,
cardList
[
i
]
->
getId
(),
cardList
[
i
]
->
getName
()),
false
,
-
1
);
CardItem
*
card
=
deck
->
takeCard
(
0
,
cardList
[
i
]
->
getId
());
card
->
setName
(
cardList
[
i
]
->
getName
());
hand
->
addCard
(
card
,
false
,
-
1
);
}
else
else
for
(
int
i
=
0
;
i
<
event
->
getNumberCards
();
++
i
)
for
(
int
i
=
0
;
i
<
event
->
getNumberCards
();
++
i
)
hand
->
addCard
(
deck
->
takeCard
(
0
,
-
1
,
QString
()),
false
,
-
1
);
hand
->
addCard
(
deck
->
takeCard
(
0
,
-
1
),
false
,
-
1
);
hand
->
reorganizeCards
();
hand
->
reorganizeCards
();
deck
->
reorganizeCards
();
deck
->
reorganizeCards
();
...
...
cockatrice/src/tablezone.cpp
View file @
a0299944
...
@@ -174,9 +174,9 @@ void TableZone::toggleTapped()
...
@@ -174,9 +174,9 @@ void TableZone::toggleTapped()
player
->
sendCommandContainer
(
new
CommandContainer
(
cmdList
));
player
->
sendCommandContainer
(
new
CommandContainer
(
cmdList
));
}
}
CardItem
*
TableZone
::
takeCard
(
int
position
,
int
cardId
,
const
QString
&
cardName
,
bool
canResize
)
CardItem
*
TableZone
::
takeCard
(
int
position
,
int
cardId
,
bool
canResize
)
{
{
CardItem
*
result
=
CardZone
::
takeCard
(
position
,
cardId
,
cardName
);
CardItem
*
result
=
CardZone
::
takeCard
(
position
,
cardId
);
if
(
canResize
)
if
(
canResize
)
resizeToContents
();
resizeToContents
();
return
result
;
return
result
;
...
...
cockatrice/src/tablezone.h
View file @
a0299944
...
@@ -35,7 +35,7 @@ public:
...
@@ -35,7 +35,7 @@ public:
QPointF
mapFromGrid
(
const
QPoint
&
gridPoint
)
const
;
QPointF
mapFromGrid
(
const
QPoint
&
gridPoint
)
const
;
QPoint
mapToGrid
(
const
QPointF
&
mapPoint
)
const
;
QPoint
mapToGrid
(
const
QPointF
&
mapPoint
)
const
;
QPointF
closestGridPoint
(
const
QPointF
&
point
);
QPointF
closestGridPoint
(
const
QPointF
&
point
);
CardItem
*
takeCard
(
int
position
,
int
cardId
,
const
QString
&
cardName
,
bool
canResize
=
true
);
CardItem
*
takeCard
(
int
position
,
int
cardId
,
bool
canResize
=
true
);
void
resizeToContents
();
void
resizeToContents
();
int
getMinimumWidth
()
const
{
return
currentMinimumWidth
;
}
int
getMinimumWidth
()
const
{
return
currentMinimumWidth
;
}
void
setWidth
(
qreal
_width
);
void
setWidth
(
qreal
_width
);
...
...
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