[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegames/kolf
From: Stefan Majewsky <majewsky () gmx ! net>
Date: 2010-10-31 23:23:00
Message-ID: 20101031232300.8397BAC8A0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1191704 by majewsky:
Simplify moveableItems() implementations and some unnecessarily complicated calculations.
M +4 -9 floater.cpp
M +1 -1 floater.h
M +4 -13 game.cpp
M +1 -3 slope.cpp
--- trunk/KDE/kdegames/kolf/floater.cpp #1191703:1191704
@@ -133,25 +133,20 @@
void Floater::reset()
{
- QPointF startf = wall->startPoint() + QPointF(wall->x(), wall->y());
- QPointF endf = wall->endPoint() + QPointF(wall->x(), wall->y());
- QPoint start = (QPoint((int)startf.x(), (int)startf.y()));
- QPoint end = (QPoint((int)endf.x(), (int)endf.y()));
+ QPointF start = wall->startPointF() + QPointF(wall->x(), wall->y());
+ QPointF end = wall->endPointF() + QPointF(wall->x(), wall->y());
vector = end - start;
origin = end;
- setPos(origin.x(), origin.y());
+ setPos(origin);
moveBy(0, 0);
setSpeed(speed);
}
QList<QGraphicsItem *> Floater::moveableItems() const
{
- QList<QGraphicsItem *> ret(wall->moveableItems());
- ret.append(wall);
- ret.append(point);
- return ret;
+ return wall->moveableItems() << wall << point;
}
void Floater::aboutToDie()
--- trunk/KDE/kdegames/kolf/floater.h #1191703:1191704
@@ -88,7 +88,7 @@
int speed;
FloaterGuide *wall;
- QPoint origin;
+ QPointF origin;
Vector vector;
bool noUpdateZ;
bool haventMoved;
--- trunk/KDE/kdegames/kolf/game.cpp #1191703:1191704
@@ -399,9 +399,7 @@
QList<QGraphicsItem *> Bridge::moveableItems() const
{
- QList<QGraphicsItem *> ret;
- ret.append(point);
- return ret;
+ return QList<QGraphicsItem*>() << point;
}
void Bridge::setSize(const QSizeF& size)
@@ -782,9 +780,7 @@
QList<QGraphicsItem *> KolfEllipse::moveableItems() const
{
- QList<QGraphicsItem *> ret;
- ret.append(point);
- return ret;
+ return QList<QGraphicsItem*>() << point;
}
void KolfEllipse::moveBy(double dx, double dy)
@@ -1224,9 +1220,7 @@
QList<QGraphicsItem *> BlackHole::moveableItems() const
{
- QList<QGraphicsItem *> ret;
- ret.append(exitItem);
- return ret;
+ return QList<QGraphicsItem*>() << exitItem;
}
bool BlackHole::collision(Ball *ball, long int /*id*/)
@@ -1780,10 +1774,7 @@
QList<QGraphicsItem *> Wall::moveableItems() const
{
- QList<QGraphicsItem *> ret;
- ret.append(startItem);
- ret.append(endItem);
- return ret;
+ return QList<QGraphicsItem*>() << startItem << endItem;
}
void Wall::moveBy(double dx, double dy)
--- trunk/KDE/kdegames/kolf/slope.cpp #1191703:1191704
@@ -115,9 +115,7 @@
QList<QGraphicsItem *> Slope::moveableItems() const
{
- QList<QGraphicsItem *> ret;
- ret.append(point);
- return ret;
+ return QList<QGraphicsItem*>() << point;
}
void Slope::setGrade(double newGrade)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic