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
55e7feee
Commit
55e7feee
authored
Nov 09, 2010
by
Max-Wilhelm Bruker
Browse files
fix
parent
2cf57ad9
Changes
1
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/gamescene.cpp
View file @
55e7feee
...
@@ -153,21 +153,31 @@ bool GameScene::event(QEvent *event)
...
@@ -153,21 +153,31 @@ bool GameScene::event(QEvent *event)
}
}
QList
<
QGraphicsItem
*>
itemList
=
items
(
mouseEvent
->
scenePos
());
QList
<
QGraphicsItem
*>
itemList
=
items
(
mouseEvent
->
scenePos
());
qreal
maxZ
=
0
;
CardItem
*
maxZCard
=
0
;
// Search for the topmost zone and ignore all cards not belonging to that zone.
QList
<
CardItem
*>
cardList
;
CardZone
*
zone
=
0
;
for
(
int
i
=
0
;
i
<
itemList
.
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
itemList
.
size
();
++
i
)
CardItem
*
card
=
qgraphicsitem_cast
<
CardItem
*>
(
itemList
[
i
]);
if
((
zone
=
qgraphicsitem_cast
<
CardZone
*>
(
itemList
[
i
])))
if
(
!
card
)
break
;
continue
;
if
(
zone
)
{
cardList
.
append
(
card
);
qreal
maxZ
=
-
1
;
if
(
card
->
getRealZValue
()
>
maxZ
)
{
CardItem
*
maxZCard
=
0
;
maxZ
=
card
->
getRealZValue
();
QList
<
CardItem
*>
cardList
;
maxZCard
=
card
;
for
(
int
i
=
0
;
i
<
itemList
.
size
();
++
i
)
{
CardItem
*
card
=
qgraphicsitem_cast
<
CardItem
*>
(
itemList
[
i
]);
if
(
!
card
)
continue
;
if
(
card
->
getZone
()
!=
zone
)
continue
;
cardList
.
append
(
card
);
if
(
card
->
getRealZValue
()
>
maxZ
)
{
maxZ
=
card
->
getRealZValue
();
maxZCard
=
card
;
}
}
}
for
(
int
i
=
0
;
i
<
cardList
.
size
();
++
i
)
cardList
[
i
]
->
setZValue
(
cardList
[
i
]
==
maxZCard
?
2000000004
:
cardList
[
i
]
->
getRealZValue
());
}
}
for
(
int
i
=
0
;
i
<
cardList
.
size
();
++
i
)
cardList
[
i
]
->
setZValue
(
cardList
[
i
]
==
maxZCard
?
2000000004
:
cardList
[
i
]
->
getRealZValue
());
}
}
return
QGraphicsScene
::
event
(
event
);
return
QGraphicsScene
::
event
(
event
);
}
}
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