From 19630696c5a1cf5e81a61f6564c2858f3763369a Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 25 Feb 2016 10:55:15 +0000 Subject: [PATCH] Prevented AI craft for jittering when close to leader. --- src/battle/ai.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/battle/ai.c b/src/battle/ai.c index 209b38e..8aed1f8 100644 --- a/src/battle/ai.c +++ b/src/battle/ai.c @@ -594,7 +594,7 @@ static void moveToPlayer(void) if (dist <= 350) { - if (player->dx != 0 || player->dy != 0) + if (fabs(player->dx) >= 1 && fabs(player->dy) >= 1) { wantedAngle = getAngle(player->x, player->y, player->x + (player->dx * 10), player->y + (player->dy * 10)); @@ -790,7 +790,7 @@ static void moveToLeader(void) if (dist <= 350) { - if (self->leader->dx != 0 || self->leader->dy != 0) + if (fabs(self->leader->dx) >= 1 && fabs(self->leader->dy) >= 1) { wantedAngle = getAngle(self->leader->x, self->leader->y, self->leader->x + (self->leader->dx * 10), self->leader->y + (self->leader->dy * 10));