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
c835a827
Commit
c835a827
authored
Apr 01, 2012
by
Max-Wilhelm Bruker
Browse files
AlwaysRevealTopCard done, issue #31 fixed
parent
840b577f
Changes
6
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/abstractcarditem.cpp
View file @
c835a827
...
@@ -37,6 +37,7 @@ QRectF AbstractCardItem::boundingRect() const
...
@@ -37,6 +37,7 @@ QRectF AbstractCardItem::boundingRect() const
void
AbstractCardItem
::
pixmapUpdated
()
void
AbstractCardItem
::
pixmapUpdated
()
{
{
update
();
update
();
emit
sigPixmapUpdated
();
}
}
void
AbstractCardItem
::
cardInfoUpdated
()
void
AbstractCardItem
::
cardInfoUpdated
()
...
...
cockatrice/src/abstractcarditem.h
View file @
c835a827
...
@@ -34,6 +34,7 @@ signals:
...
@@ -34,6 +34,7 @@ signals:
void
showCardInfoPopup
(
QPoint
pos
,
QString
cardName
);
void
showCardInfoPopup
(
QPoint
pos
,
QString
cardName
);
void
deleteCardInfoPopup
(
QString
cardName
);
void
deleteCardInfoPopup
(
QString
cardName
);
void
updateCardMenu
(
AbstractCardItem
*
card
);
void
updateCardMenu
(
AbstractCardItem
*
card
);
void
sigPixmapUpdated
();
public:
public:
enum
{
Type
=
typeCard
};
enum
{
Type
=
typeCard
};
int
type
()
const
{
return
Type
;
}
int
type
()
const
{
return
Type
;
}
...
...
cockatrice/src/pilezone.cpp
View file @
c835a827
...
@@ -39,11 +39,15 @@ void PileZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*optio
...
@@ -39,11 +39,15 @@ void PileZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*optio
void
PileZone
::
addCardImpl
(
CardItem
*
card
,
int
x
,
int
/*y*/
)
void
PileZone
::
addCardImpl
(
CardItem
*
card
,
int
x
,
int
/*y*/
)
{
{
connect
(
card
,
SIGNAL
(
sigPixmapUpdated
()),
this
,
SLOT
(
callUpdate
()));
cards
.
insert
(
x
,
card
);
cards
.
insert
(
x
,
card
);
card
->
setPos
(
0
,
0
);
card
->
setPos
(
0
,
0
);
if
(
!
contentsKnown
())
{
if
(
!
contentsKnown
())
{
card
->
setName
(
QString
());
card
->
setName
(
QString
());
card
->
setId
(
-
1
);
card
->
setId
(
-
1
);
// If we obscure a previously revealed card, its name has to be forgotten
if
(
cards
.
size
()
>
x
+
1
)
cards
.
at
(
x
+
1
)
->
setName
(
QString
());
}
}
card
->
setVisible
(
false
);
card
->
setVisible
(
false
);
card
->
resetState
();
card
->
resetState
();
...
...
cockatrice/src/pilezone.h
View file @
c835a827
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
class
PileZone
:
public
CardZone
{
class
PileZone
:
public
CardZone
{
Q_OBJECT
Q_OBJECT
private
slots
:
void
callUpdate
()
{
update
();
}
public:
public:
PileZone
(
Player
*
_p
,
const
QString
&
_name
,
bool
_isShufflable
,
bool
_contentsKnown
,
QGraphicsItem
*
parent
=
0
);
PileZone
(
Player
*
_p
,
const
QString
&
_name
,
bool
_isShufflable
,
bool
_contentsKnown
,
QGraphicsItem
*
parent
=
0
);
QRectF
boundingRect
()
const
;
QRectF
boundingRect
()
const
;
...
...
cockatrice/src/player.cpp
View file @
c835a827
...
@@ -1297,12 +1297,19 @@ void Player::eventRevealCards(const Event_RevealCards &event)
...
@@ -1297,12 +1297,19 @@ void Player::eventRevealCards(const Event_RevealCards &event)
emit
logRevealCards
(
this
,
zone
,
cardList
.
at
(
i
)
->
id
(),
cardName
,
this
,
true
);
emit
logRevealCards
(
this
,
zone
,
cardList
.
at
(
i
)
->
id
(),
cardName
,
this
,
true
);
}
}
}
else
{
}
else
{
if
(
!
cardList
.
isEmpty
())
bool
showZoneView
=
true
;
static_cast
<
GameScene
*>
(
scene
())
->
addRevealedZoneView
(
this
,
zone
,
cardList
,
event
.
grant_write_access
());
QString
cardName
;
QString
cardName
;
if
(
cardList
.
size
()
==
1
)
if
(
cardList
.
size
()
==
1
)
{
cardName
=
QString
::
fromStdString
(
cardList
.
first
()
->
name
());
cardName
=
QString
::
fromStdString
(
cardList
.
first
()
->
name
());
if
((
event
.
card_id
()
==
0
)
&&
dynamic_cast
<
PileZone
*>
(
zone
))
{
zone
->
getCards
().
first
()
->
setName
(
cardName
);
zone
->
update
();
showZoneView
=
false
;
}
}
if
(
showZoneView
&&
!
cardList
.
isEmpty
())
static_cast
<
GameScene
*>
(
scene
())
->
addRevealedZoneView
(
this
,
zone
,
cardList
,
event
.
grant_write_access
());
emit
logRevealCards
(
this
,
zone
,
event
.
card_id
(),
cardName
,
otherPlayer
,
false
);
emit
logRevealCards
(
this
,
zone
,
event
.
card_id
(),
cardName
,
otherPlayer
,
false
);
}
}
}
}
...
...
common/server_player.cpp
View file @
c835a827
...
@@ -1582,7 +1582,7 @@ Response::ResponseCode Server_Player::cmdChangeZoneProperties(const Command_Chan
...
@@ -1582,7 +1582,7 @@ Response::ResponseCode Server_Player::cmdChangeZoneProperties(const Command_Chan
ges
.
enqueueGameEvent
(
event
,
playerId
);
ges
.
enqueueGameEvent
(
event
,
playerId
);
if
(
!
zone
->
cards
.
isEmpty
())
{
if
(
!
zone
->
cards
.
isEmpty
()
&&
cmd
.
always_reveal_top_card
()
)
{
Event_RevealCards
revealEvent
;
Event_RevealCards
revealEvent
;
revealEvent
.
set_zone_name
(
zone
->
getName
().
toStdString
());
revealEvent
.
set_zone_name
(
zone
->
getName
().
toStdString
());
revealEvent
.
set_card_id
(
0
);
revealEvent
.
set_card_id
(
0
);
...
...
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