summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-01-20 23:27:07 +0200
committerSergeanur <s.anureev@yandex.ua>2020-01-20 23:27:57 +0200
commit06904755d9b2b1e56f1e53070a66101a12dddff9 (patch)
tree6a3ecea30757fb5966c1417a89740d568f718683 /src/core
parent7857590990c32e05a83bbf1e70e10d6d9a8341b8 (diff)
Refactor CCullZone::CalcDistToCullZoneSquared
Diffstat (limited to 'src/core')
-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;
}