edit: Fix edit s key 'U' to preserve "does not follow"

Copying the ship copies the ship to follow.  When the source ship
doesn't follow a ship, the target ship is made to follow the source.
Screwed up since Chainsaw added the means to copy a ship.  Fix it.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-01-18 12:24:29 +01:00
parent e604c6e737
commit ae595ec430
3 changed files with 25 additions and 18 deletions

View file

@ -885,6 +885,7 @@ edit_ship(struct shpstr *ship, char *key, char *p)
{
struct mchrstr *mcp = &mchr[ship->shp_type];
int arg = atoi(p);
int old_uid, ret;
switch (*key) {
case 'U':
@ -893,8 +894,14 @@ edit_ship(struct shpstr *ship, char *key, char *p)
case 'E':
case 'M':
case 'F':
return edit_unit((struct empobj *)ship, key, p,
SHIP_MINEFF, "fleet", 0);
old_uid = ship->shp_uid;
ret = edit_unit((struct empobj *)ship, key, p,
SHIP_MINEFF, "fleet", 0);
if (ret == RET_OK && ship->shp_uid != old_uid) {
if (ship->shp_follow == old_uid)
ship->shp_follow = ship->shp_uid;
}
return ret;
case 't':
arg = ef_elt_byname(EF_SHIP_CHR, p);
if (arg < 0) {