shpsub: Make shp_check_nav() return more useful information

Some callers have to second-guess shp_check_nav() to figure out
whether CN_LANDLOCKED means "too big to fit into the canal" or "can't
go there at all".

Fix that by returning d_navigation.  CN_LANDLOCKED becomes either
NAV_CANAL or NAV_NONE, CN_CONSTRUCTION becomes either NAV_02 or
NAV_60, and CN_NAVIGABLE becomes NAVOK.

The CN_NAVIGABLE, ... codes are now unused.  Drop them.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-01-20 22:34:17 +01:00
parent 1fee5028a2
commit c03db4c5ef
6 changed files with 53 additions and 47 deletions

View file

@ -247,8 +247,7 @@ sail_nav_fleet(struct fltheadstr *fltp)
fe->num, cname(fe->own));
error = 1;
}
if ((shp_check_nav(sectp, sp) == CN_LANDLOCKED) &&
(dchr[sectp->sct_type].d_nav == NAV_CANAL)) {
if (shp_check_nav(sp, sectp) == NAV_CANAL) {
wu(0, fltp->own,
"Your ship #%d (%s) is too big to fit through the canal.\n",
fe->num, cname(fe->own));
@ -259,7 +258,7 @@ sail_nav_fleet(struct fltheadstr *fltp)
return 0;
sp = getshipp(fltp->leader);
sectp = getsectp(fltp->x, fltp->y);
if (shp_check_nav(sectp, sp) != CN_NAVIGABLE)
if (shp_check_nav(sp, sectp) != NAVOK)
wu(0, fltp->own, "Your fleet lead by %d is trapped by land.\n",
fltp->leader);
sp = getshipp(fltp->leader);