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
43d51667
Commit
43d51667
authored
Oct 19, 2009
by
Max-Wilhelm Bruker
Browse files
fix typo; don't point from an item to itself
parent
c86a1ed4
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/arrowitem.cpp
View file @
43d51667
...
...
@@ -32,14 +32,18 @@ void ArrowItem::updatePath(const QPointF &endPoint)
QLineF
line
(
startPoint
,
endPoint
);
qreal
lineLength
=
line
.
length
();
path
=
QPainterPath
(
QPointF
(
0
,
-
arrowWidth
/
2
));
path
.
lineTo
(
0
,
arrowWidth
/
2
);
path
.
lineTo
(
lineLength
-
headLength
,
arrowWidth
/
2
);
path
.
lineTo
(
lineLength
-
headLength
,
headWidth
/
2
);
path
.
lineTo
(
lineLength
,
0
);
path
.
lineTo
(
lineLength
-
headLength
,
-
headWidth
/
2
);
path
.
lineTo
(
lineLength
-
headLength
,
-
arrowWidth
/
2
);
path
.
lineTo
(
0
,
-
arrowWidth
/
2
);
if
(
lineLength
<
headLength
)
path
=
QPainterPath
();
else
{
path
=
QPainterPath
(
QPointF
(
0
,
-
arrowWidth
/
2
));
path
.
lineTo
(
0
,
arrowWidth
/
2
);
path
.
lineTo
(
lineLength
-
headLength
,
arrowWidth
/
2
);
path
.
lineTo
(
lineLength
-
headLength
,
headWidth
/
2
);
path
.
lineTo
(
lineLength
,
0
);
path
.
lineTo
(
lineLength
-
headLength
,
-
headWidth
/
2
);
path
.
lineTo
(
lineLength
-
headLength
,
-
arrowWidth
/
2
);
path
.
lineTo
(
0
,
-
arrowWidth
/
2
);
}
setPos
(
startPoint
);
setTransform
(
QTransform
().
rotate
(
-
line
.
angle
()));
...
...
@@ -79,7 +83,7 @@ void ArrowDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void
ArrowDragItem
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
/*event*/
)
{
if
(
targetItem
)
{
if
(
targetItem
&&
(
targetItem
!=
startItem
)
)
{
CardZone
*
startZone
=
static_cast
<
CardZone
*>
(
startItem
->
parentItem
());
CardZone
*
targetZone
=
static_cast
<
CardZone
*>
(
targetItem
->
parentItem
());
startZone
->
getPlayer
()
->
client
->
createArrow
(
...
...
cockatrice/src/player.h
View file @
43d51667
...
...
@@ -42,7 +42,7 @@ public slots:
void
actShuffle
();
void
actDrawCard
();
void
actDrawCards
();
void
actMuligan
();
void
actMul
l
igan
();
void
actViewLibrary
();
void
actViewTopCards
();
...
...
servatrice/src/serversocket.cpp
View file @
43d51667
...
...
@@ -581,7 +581,7 @@ ReturnMessage::ReturnCode ServerSocket::cmdCreateArrow(const QList<QVariant> &pa
return
ReturnMessage
::
ReturnContextError
;
Card
*
startCard
=
startZone
->
getCard
(
params
[
2
].
toInt
(),
false
);
Card
*
targetCard
=
targetZone
->
getCard
(
params
[
5
].
toInt
(),
false
);
if
(
!
startCard
||
!
targetCard
)
if
(
!
startCard
||
!
targetCard
||
(
startCard
==
targetCard
)
)
return
ReturnMessage
::
ReturnContextError
;
emit
broadcastEvent
(
QString
(
"create_arrow|%1|%2|%3|%4|%5|%6"
)
...
...
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