diff options
| author | oy <Tom_Adams@web.de> | 2010-08-16 04:09:21 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-08-16 04:09:21 +0200 |
| commit | e966cdb334356ad96aeccb19481a85f46f6a4b55 (patch) | |
| tree | 3d725ad75d4f1fb14538383650cd1059bc0faca9 | |
| parent | abc84ac0b0ff77b3b30a20252f86332c699e4466 (diff) | |
| download | zcatch-e966cdb334356ad96aeccb19481a85f46f6a4b55.tar.gz zcatch-e966cdb334356ad96aeccb19481a85f46f6a4b55.zip | |
fixed that Collision::IntersectLine gets stuck in a loop forever. Closes #6
| -rw-r--r-- | src/game/collision.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/game/collision.cpp b/src/game/collision.cpp index 0dee57c8..f114fd06 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -67,11 +67,12 @@ bool CCollision::IsTileSolid(int x, int y) int CCollision::IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision) { float d = distance(Pos0, Pos1); + int End(d+1); vec2 Last = Pos0; - for(float f = 0; f < d; f++) + for(int i = 0; i < End; i++) { - float a = f/d; + float a = i/d; vec2 Pos = mix(Pos0, Pos1, a); if(CheckPoint(Pos.x, Pos.y)) { |