summaryrefslogtreecommitdiffstats
path: root/src/core/ZoneCull.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ZoneCull.cpp')
-rw-r--r--src/core/ZoneCull.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp
index ab7fc9ac..b6929e86 100644
--- a/src/core/ZoneCull.cpp
+++ b/src/core/ZoneCull.cpp
@@ -507,27 +507,14 @@ float
CCullZone::CalcDistToCullZoneSquared(float x, float y)
{
float rx, ry;
- float temp;
-
- temp = minx;
- if (temp <= x) {
- temp = maxx;
- if (x <= temp)
- rx = 0.0f;
- else
- rx = sq(x - temp);
- } else
- rx = sq(x - temp);
-
- temp = miny;
- if (temp <= y) {
- temp = maxy;
- if (y <= temp)
- ry = 0.0f;
- else
- ry = sq(y - temp);
- } else
- ry = sq(y - temp);
+
+ if (x < minx) rx = sq(x - minx);
+ else if (x > maxx) rx = sq(x - maxx);
+ else rx = 0.0f;
+
+ if (y < miny) ry = sq(y - miny);
+ else if (y > maxy) ry = sq(y - maxy);
+ else ry = 0.0f;
return rx + ry;
}