fixed that Collision::IntersectLine gets stuck in a loop forever. Closes #6

This commit is contained in:
oy 2010-08-16 04:09:21 +02:00
parent abc84ac0b0
commit e966cdb334

View file

@ -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))
{