1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 05:30:00 +00:00

fixed bug in CPlaceable

This commit is contained in:
aap 2019-06-24 20:01:15 +02:00
parent db2e2575c8
commit 0b384356f9

View file

@ -20,56 +20,47 @@ CPlaceable::SetHeading(float angle)
bool bool
CPlaceable::IsWithinArea(float x1, float y1, float x2, float y2) CPlaceable::IsWithinArea(float x1, float y1, float x2, float y2)
{ {
float x, xmin, xmax; float tmp;
float y, ymin, ymax;
xmin = x1; if(x1 > x2){
xmax = x2; tmp = x1;
ymin = y1; x1 = x2;
ymax = y2; x2 = tmp;
if(x2 > x1){
xmin = x2;
xmax = x1;
} }
if(y2 > y1){ if(y1 > y2){
ymin = y2; tmp = y1;
ymax = y1; y1 = y2;
y2 = tmp;
} }
x = GetPosition().x;
y = GetPosition().y; return x1 <= GetPosition().x && GetPosition().x <= x2 &&
return xmin <= x && x <= xmax && y1 <= GetPosition().y && GetPosition().y <= y2;
ymin <= y && y <= ymax;
} }
bool bool
CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2) CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2)
{ {
float x, xmin, xmax; float tmp;
float y, ymin, ymax;
float z, zmin, zmax; if(x1 > x2){
xmin = x1; tmp = x1;
xmax = x2; x1 = x2;
ymin = y1; x2 = tmp;
ymax = y2;
zmin = z1;
zmax = z2;
if(x2 > x1){
xmin = x2;
xmax = x1;
} }
if(y2 > y1){ if(y1 > y2){
ymin = y2; tmp = y1;
ymax = y1; y1 = y2;
y2 = tmp;
} }
if(z2 > z1){ if(z1 > z2){
zmin = z2; tmp = z1;
zmax = z1; z1 = z2;
z2 = tmp;
} }
x = GetPosition().x;
y = GetPosition().y; return x1 <= GetPosition().x && GetPosition().x <= x2 &&
z = GetPosition().z; y1 <= GetPosition().y && GetPosition().y <= y2 &&
return xmin <= x && x <= xmax && z1 <= GetPosition().z && GetPosition().z <= z2;
ymin <= y && y <= ymax &&
zmin <= z && z <= zmax;
} }
STARTPATCHES STARTPATCHES