diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-04-04 17:42:58 -0400 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-04-04 17:42:58 -0400 |
| commit | 2296c83c1dca7a44c047d53c97e31872aaa22fac (patch) | |
| tree | a326c365d3ee3673a191ed00d7feeaf8399d4242 | |
| parent | df372d0269d11a80873b0120bd235698388752e7 (diff) | |
| download | sigen-2296c83c1dca7a44c047d53c97e31872aaa22fac.tar.gz sigen-2296c83c1dca7a44c047d53c97e31872aaa22fac.tar.xz sigen-2296c83c1dca7a44c047d53c97e31872aaa22fac.zip | |
Move last inside the loop
| -rw-r--r-- | sigmodr/widgets/mapeditor/WorldMapPlacement.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp index 70ebfd91..6cb4e41f 100644 --- a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp +++ b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp @@ -130,9 +130,9 @@ QPoint WorldMapPlacement::find(const QPoint& point) { if (!polygon.containsPoint(point, Qt::OddEvenFill)) continue; - QPoint last = polygon[0]; for (int i = 1; i < polygon.size(); ++i) { + const QPoint last = polygon[i - 1]; const QPoint cur = polygon[i]; const QPoint next = polygon[(i + 1) % polygon.size()]; if (((point.x() - last.x()) * (point.x() - cur.x())) < 0) @@ -156,7 +156,6 @@ QPoint WorldMapPlacement::find(const QPoint& point) { // TODO: Corner is concave } - last = cur; } } return best.topLeft().toPoint(); |
