mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed that Collision::IntersectLine gets stuck in a loop forever. Closes #6
This commit is contained in:
parent
abc84ac0b0
commit
e966cdb334
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue