diff --git a/src/game/collision.cpp b/src/game/collision.cpp index b91f99aaf..4b6885b66 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -1027,7 +1027,7 @@ int CCollision::GetIndex(vec2 PrevPos, vec2 Pos) int Nx = 0; int Ny = 0; - for(int i = 0, id = (int)Distance; i <= id; i++) + for(int i = 0, id = (int)ceilf(Distance); i < id; i++) { a = (float)i / Distance; Tmp = mix(PrevPos, Pos, a); @@ -1193,7 +1193,7 @@ int CCollision::IntersectNoLaser(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 float d = distance(Pos0, Pos1); vec2 Last = Pos0; - for(int i = 0, id = (int)d; i <= id; i++) + for(int i = 0, id = (int)ceilf(d); i < id; i++) { float a = (int)i / d; vec2 Pos = mix(Pos0, Pos1, a); @@ -1224,7 +1224,7 @@ int CCollision::IntersectNoLaserNW(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, ve float d = distance(Pos0, Pos1); vec2 Last = Pos0; - for(int i = 0, id = (int)d; i <= id; i++) + for(int i = 0, id = (int)ceilf(d); i < id; i++) { float a = (float)i / d; vec2 Pos = mix(Pos0, Pos1, a); @@ -1253,7 +1253,7 @@ int CCollision::IntersectAir(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pO float d = distance(Pos0, Pos1); vec2 Last = Pos0; - for(int i = 0, id = (int)d; i <= id; i++) + for(int i = 0, id = (int)ceilf(d); i < id; i++) { float a = (float)i / d; vec2 Pos = mix(Pos0, Pos1, a);