summaryrefslogtreecommitdiffstats
path: root/sigmod/MapWarp.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-12-25 07:53:09 -0500
committerBen Boeckel <MathStuf@gmail.com>2008-12-25 07:53:09 -0500
commitf3b3f21d3ba0fd48bc265684817cb38a70adf84b (patch)
treeccffe66f71e3ee15166080cda2aca7d842f547a2 /sigmod/MapWarp.cpp
parente88f1843d61fd0d4c02fa85c3444c786f8c8fd8d (diff)
Bounds errors are verbose now and some unchecked conditions fixed as well
Diffstat (limited to 'sigmod/MapWarp.cpp')
-rw-r--r--sigmod/MapWarp.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/sigmod/MapWarp.cpp b/sigmod/MapWarp.cpp
index e0482f14..137c5f98 100644
--- a/sigmod/MapWarp.cpp
+++ b/sigmod/MapWarp.cpp
@@ -98,9 +98,9 @@ void Sigmod::MapWarp::setArea(const QRect& area)
{
const Map* map = qobject_cast<const Map*>(parent());
if ((map->width() <= area.x()) || (map->height() <= area.y()))
- emit(error(bounds("area")));
- else if ((area.width() <= 0) || (area.height() <= 0))
- emit(error(bounds("area")));
+ emit(error(bounds("area", QPoint(0, 0), QPoint(map->width(), map->height()), area.topLeft())));
+ else if ((area.width() <= 0) || (area.height() <= 0) || ((map->width() - area.x()) < area.width()) || ((map->height() - area.y()) < area.height()))
+ emit(error(bounds("area size", QPoint(0, 0), QPoint(map->width() - area.x(), map->height() - area.y()), area.translated(-area.topLeft()).bottomRight())));
else
CHECK(area);
}
@@ -113,7 +113,7 @@ void Sigmod::MapWarp::setType(const Type type)
void Sigmod::MapWarp::setToMap(const int toMap)
{
if (!sigmod()->mapById(toMap))
- emit(error(bounds("toMap")));
+ emit(error(bounds("toMap", toMap)));
else
CHECK(toMap);
}
@@ -122,9 +122,9 @@ void Sigmod::MapWarp::setToWarp(const int toWarp)
{
const Map* map = sigmod()->mapById(m_toMap);
if (!map)
- emit(error(bounds("toMap")));
+ emit(error(bounds("toMap", m_toMap)));
else if (!map->warpById(toWarp))
- emit(error(bounds("toWarp")));
+ emit(error(bounds("toWarp", toWarp)));
else
CHECK(toWarp);
}