projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Upgrade to Squirrel 2.1.2 <http://squirrel-lang.org/>
[supertux.git]
/
src
/
collision.hpp
diff --git
a/src/collision.hpp
b/src/collision.hpp
index
cc5bcd0
..
ba6b6f8
100644
(file)
--- a/
src/collision.hpp
+++ b/
src/collision.hpp
@@
-22,6
+22,7
@@
#include <float.h>
#include "collision_hit.hpp"
#include <float.h>
#include "collision_hit.hpp"
+#include <limits>
class Vector;
class Rect;
class Vector;
class Rect;
@@
-34,15
+35,17
@@
class Constraints
{
public:
Constraints() {
{
public:
Constraints() {
- left = -INFINITY;
- right = INFINITY;
- top = -INFINITY;
- bottom = INFINITY;
+ float infinity = (std::numeric_limits<float>::has_infinity ? std::numeric_limits<float>::infinity() : std::numeric_limits<float>::max());
+ left = -infinity;
+ right = infinity;
+ top = -infinity;
+ bottom = infinity;
}
bool has_constraints() const {
}
bool has_constraints() const {
- return left > -INFINITY || right < INFINITY
- || top > -INFINITY || bottom < INFINITY;
+ float infinity = (std::numeric_limits<float>::has_infinity ? std::numeric_limits<float>::infinity() : std::numeric_limits<float>::max());
+ return left > -infinity || right < infinity
+ || top > -infinity || bottom < infinity;
}
float left;
}
float left;
@@
-55,10
+58,10
@@
public:
/** checks if 2 rectangle intersect each other */
bool intersects(const Rect& r1, const Rect& r2);
/** checks if 2 rectangle intersect each other */
bool intersects(const Rect& r1, const Rect& r2);
-
+
/** does collision detection between a rectangle and an axis aligned triangle
* Returns true in case of a collision and fills in the hit structure then.
/** does collision detection between a rectangle and an axis aligned triangle
* Returns true in case of a collision and fills in the hit structure then.
- */
+ */
bool rectangle_aatriangle(Constraints* constraints, const Rect& rect,
const AATriangle& triangle);
bool rectangle_aatriangle(Constraints* constraints, const Rect& rect,
const AATriangle& triangle);
@@
-68,4
+71,3
@@
void set_rectangle_rectangle_constraints(Constraints* constraints,
}
#endif
}
#endif
-