Bug 2616: FOLGE schiesst über das Ziel hinaus.

This commit is contained in:
Enno Rehling 2019-10-22 21:30:14 +02:00
parent 1c358b9982
commit c82b3b27dd
1 changed files with 3 additions and 2 deletions

View File

@ -2227,6 +2227,7 @@ int follow_ship(unit * u, order * ord)
int moves, id, speed; int moves, id, speed;
char command[256]; char command[256];
direction_t dir; direction_t dir;
ship *sh;
if (fval(u, UFL_NOTMOVING)) { if (fval(u, UFL_NOTMOVING)) {
return 0; return 0;
@ -2251,10 +2252,10 @@ int follow_ship(unit * u, order * ord)
return 0; return 0;
} }
sh = findship(id);
dir = hunted_dir(rc->attribs, id); dir = hunted_dir(rc->attribs, id);
if (dir == NODIRECTION) { if (dir == NODIRECTION) {
ship *sh = findship(id);
if (sh == NULL || sh->region != rc) { if (sh == NULL || sh->region != rc) {
cmistake(u, ord, 20, MSG_MOVE); cmistake(u, ord, 20, MSG_MOVE);
} }
@ -2278,7 +2279,7 @@ int follow_ship(unit * u, order * ord)
speed = maxspeed; speed = maxspeed;
} }
rc = rconnect(rc, dir); rc = rconnect(rc, dir);
while (rc && moves < speed && (dir = hunted_dir(rc->attribs, id)) != NODIRECTION) { while (rc && rc != sh->region && moves < speed && (dir = hunted_dir(rc->attribs, id)) != NODIRECTION) {
const char *loc = LOC(u->faction->locale, directions[dir]); const char *loc = LOC(u->faction->locale, directions[dir]);
sbs_strcat(&sbcmd, " "); sbs_strcat(&sbcmd, " ");
sbs_strcat(&sbcmd, loc); sbs_strcat(&sbcmd, loc);