diff --git a/src/game/collision.cpp b/src/game/collision.cpp index 40d79d00a..320b55d08 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -249,6 +249,7 @@ void ThroughOffset(vec2 Pos0, vec2 Pos1, int *Ox, int *Oy) int CCollision::IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision, bool AllowThrough) { float d = distance(Pos0, Pos1); + int End(d+1); vec2 Last = Pos0; int ix, iy; // Temporary position for checking collision int dx, dy; // Offset for checking the "through" tile @@ -256,9 +257,9 @@ int CCollision::IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *p { ThroughOffset(Pos0, Pos1, &dx, &dy); } - 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); ix = round(Pos.x); iy = round(Pos.y);