diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-05-22 15:09:19 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-05-22 15:09:19 -0400 |
commit | feaa9785f7e98c8511388112d735d6465ad8eb9d (patch) | |
tree | 62eb6607c4fd6158af81978aa80bf8073b367d84 | |
parent | ccdf1bf8115908f64904fb8b5afd5a2816b7aa7c (diff) | |
download | sigen-feaa9785f7e98c8511388112d735d6465ad8eb9d.tar.gz sigen-feaa9785f7e98c8511388112d735d6465ad8eb9d.tar.xz sigen-feaa9785f7e98c8511388112d735d6465ad8eb9d.zip |
If the new rectangle collides with any, it isn't viable
-rw-r--r-- | sigmodr/widgets/mapeditor/WorldMapPlacement.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp index 33dfeac6..0b66a662 100644 --- a/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp +++ b/sigmodr/widgets/mapeditor/WorldMapPlacement.cpp @@ -287,7 +287,16 @@ void WorldMapPlacement::addRect(const QRectF& rect) while (queue.size()) { QRectF newRect = queue.dequeue(); - if (m_rects.contains(newRect.toRect())) + bool collides = false; + foreach (const QRectF& rect, m_rects) + { + if (rect.intersects(newRect)) + { + collides = true; + break; + } + } + if (collides) continue; foreach (const QRectF& rect, m_rects) { |