From 5f8d1a9ae9a2976261834bdd3d48f3fe53915c28 Mon Sep 17 00:00:00 2001 From: Benjamin Trotter Date: Tue, 15 Aug 2017 14:00:54 -0700 Subject: [PATCH] some minor changes --- src/libtiled/wangset.cpp | 14 ++------------ src/tiled/stampbrush.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/libtiled/wangset.cpp b/src/libtiled/wangset.cpp index 63184daabf..4743500641 100644 --- a/src/libtiled/wangset.cpp +++ b/src/libtiled/wangset.cpp @@ -320,22 +320,12 @@ WangSet::WangSet(Tileset *tileset, int WangSet::edgeColorCount() const { - int size = mEdgeColors.size(); - - if (size > 1) - return size; - else - return 1; + return qMax(1, mEdgeColors.size()); } int WangSet::cornerColorCount() const { - int size = mCornerColors.size(); - - if (size > 1) - return size; - else - return 1; + return qMax(1, mCornerColors.size()); } void WangSet::setEdgeColorCount(int n) diff --git a/src/tiled/stampbrush.cpp b/src/tiled/stampbrush.cpp index ed200ea64d..aba60dc5f5 100644 --- a/src/tiled/stampbrush.cpp +++ b/src/tiled/stampbrush.cpp @@ -441,15 +441,15 @@ void StampBrush::drawPreviewLayer(const QVector &list) bounds.x(), bounds.y(), bounds.width(), bounds.height())); - for (const QPoint p : list) { - WangFiller wangFiller(mWangSet, - dynamic_cast(mapDocument()->renderer()), - mapDocument()->map()->staggerAxis()); + WangFiller wangFiller(mWangSet, + dynamic_cast(mapDocument()->renderer()), + mapDocument()->map()->staggerAxis()); + for (const QPoint p : list) { Cell cell = wangFiller.findFittingCell(*tileLayer, - *preview.data(), - paintedRegion, - p); + *preview.data(), + paintedRegion, + p); preview->setCell(p.x() - bounds.left(), p.y() - bounds.top(),