summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-05-22 15:09:19 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-05-22 15:09:19 -0400
commitfeaa9785f7e98c8511388112d735d6465ad8eb9d (patch)
tree62eb6607c4fd6158af81978aa80bf8073b367d84
parentccdf1bf8115908f64904fb8b5afd5a2816b7aa7c (diff)
downloadsigen-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.cpp11
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)
{