3176: Fix float loops r=def- a=Jupeyy

Tested that one map from #bug channel

Co-authored-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
bors[bot] 2020-10-23 13:36:22 +00:00 committed by GitHub
commit f74c3e5776
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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