summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-24 20:01:15 +0200
committeraap <aap@papnet.eu>2019-06-24 20:01:15 +0200
commit0b384356f9a8ed560dc5e59ec4a7735545099093 (patch)
tree349fd65f124ec039ddc3b1c6aa35484910cb01c0
parentmore CStreaming (diff)
downloadre3-0b384356f9a8ed560dc5e59ec4a7735545099093.tar
re3-0b384356f9a8ed560dc5e59ec4a7735545099093.tar.gz
re3-0b384356f9a8ed560dc5e59ec4a7735545099093.tar.bz2
re3-0b384356f9a8ed560dc5e59ec4a7735545099093.tar.lz
re3-0b384356f9a8ed560dc5e59ec4a7735545099093.tar.xz
re3-0b384356f9a8ed560dc5e59ec4a7735545099093.tar.zst
re3-0b384356f9a8ed560dc5e59ec4a7735545099093.zip
-rw-r--r--src/Placeable.cpp71
1 files changed, 31 insertions, 40 deletions
diff --git a/src/Placeable.cpp b/src/Placeable.cpp
index 43708d3e..b4b2a37b 100644
--- a/src/Placeable.cpp
+++ b/src/Placeable.cpp
@@ -20,56 +20,47 @@ CPlaceable::SetHeading(float angle)
bool
CPlaceable::IsWithinArea(float x1, float y1, float x2, float y2)
{
- float x, xmin, xmax;
- float y, ymin, ymax;
- xmin = x1;
- xmax = x2;
- ymin = y1;
- ymax = y2;
- if(x2 > x1){
- xmin = x2;
- xmax = x1;
+ float tmp;
+
+ if(x1 > x2){
+ tmp = x1;
+ x1 = x2;
+ x2 = tmp;
}
- if(y2 > y1){
- ymin = y2;
- ymax = y1;
+ if(y1 > y2){
+ tmp = y1;
+ y1 = y2;
+ y2 = tmp;
}
- x = GetPosition().x;
- y = GetPosition().y;
- return xmin <= x && x <= xmax &&
- ymin <= y && y <= ymax;
+
+ return x1 <= GetPosition().x && GetPosition().x <= x2 &&
+ y1 <= GetPosition().y && GetPosition().y <= y2;
}
bool
CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2)
{
- float x, xmin, xmax;
- float y, ymin, ymax;
- float z, zmin, zmax;
- xmin = x1;
- xmax = x2;
- ymin = y1;
- ymax = y2;
- zmin = z1;
- zmax = z2;
- if(x2 > x1){
- xmin = x2;
- xmax = x1;
+ float tmp;
+
+ if(x1 > x2){
+ tmp = x1;
+ x1 = x2;
+ x2 = tmp;
}
- if(y2 > y1){
- ymin = y2;
- ymax = y1;
+ if(y1 > y2){
+ tmp = y1;
+ y1 = y2;
+ y2 = tmp;
}
- if(z2 > z1){
- zmin = z2;
- zmax = z1;
+ if(z1 > z2){
+ tmp = z1;
+ z1 = z2;
+ z2 = tmp;
}
- x = GetPosition().x;
- y = GetPosition().y;
- z = GetPosition().z;
- return xmin <= x && x <= xmax &&
- ymin <= y && y <= ymax &&
- zmin <= z && z <= zmax;
+
+ return x1 <= GetPosition().x && GetPosition().x <= x2 &&
+ y1 <= GetPosition().y && GetPosition().y <= y2 &&
+ z1 <= GetPosition().z && GetPosition().z <= z2;
}
STARTPATCHES