Mission target bug fix.

This commit is contained in:
Steve 2015-11-22 11:42:04 +00:00
parent ccaf3d08fc
commit de3cd3bb5a
1 changed files with 3 additions and 1 deletions

View File

@ -330,9 +330,12 @@ static void selectMissionTarget(void)
{ {
if (e->active && e->flags & EF_MISSION_TARGET && e->alive == ALIVE_ALIVE) if (e->active && e->flags & EF_MISSION_TARGET && e->alive == ALIVE_ALIVE)
{ {
dist = getDistance(self->x, self->y, e->x, e->y);
if (battle.missionTarget == NULL) if (battle.missionTarget == NULL)
{ {
battle.missionTarget = e; battle.missionTarget = e;
closest = dist;
} }
else if (battle.missionTarget->type == ET_WAYPOINT && e->type != ET_WAYPOINT) else if (battle.missionTarget->type == ET_WAYPOINT && e->type != ET_WAYPOINT)
{ {
@ -340,7 +343,6 @@ static void selectMissionTarget(void)
} }
else if (battle.missionTarget->type != ET_WAYPOINT) else if (battle.missionTarget->type != ET_WAYPOINT)
{ {
dist = getDistance(self->x, self->y, e->x, e->y);
if (dist < closest) if (dist < closest)
{ {
battle.missionTarget = e; battle.missionTarget = e;