navigate march: Wipe mission and retreat orders less eagerly

navi() uses shp_sel() to collect ships, then shp_nav() to drop
ineligible ships.  shp_sel() wipes mission and retreat orders.  Stupid
when shp_nav() will drop them right away.

Avoid that by having shp_sel() check shp_nav()'s conditions, too.

navi()'s shp_nav() call won't find anything to drop now.  The call
will be removed shortly.

This drops "& stays in" from some failure reports, since shp_nav()'s
reject messages end with "& stays in X,Y", and shp_sel()'s don't.

Likewise for marc(), lnd_sel(), lnd_mar().

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-01-05 11:07:50 +01:00
parent 351bb852a3
commit 797abf4c8f
4 changed files with 61 additions and 30 deletions

View file

@ -461,7 +461,8 @@ lnd_may_mar(struct lndstr *lp, struct lndstr *ldr, char *suffix)
void
lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
{
struct lndstr land;
struct lndstr land, *ldr = NULL;
struct ulist *llp;
int this_mot;
int mobtype = MOB_MOVE; /* indeterminate */
@ -481,6 +482,8 @@ lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
continue;
}
}
if (!lnd_may_mar(&land, ldr, ""))
continue;
/*
* The marching code gets confused when trains and non-trains
* march together. Disallow for now.
@ -504,7 +507,9 @@ lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
land.lnd_rflags = 0;
memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));
putland(land.lnd_uid, &land);
lnd_insque(&land, list);
llp = lnd_insque(&land, list);
if (!ldr)
ldr = &llp->unit.land;
}
}