diff --git a/include/prototypes.h b/include/prototypes.h index 5e9bbf9b..6089b6da 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -685,6 +685,7 @@ extern s_char *shp_path(int, struct shpstr *, s_char *); extern void shp_put(struct emp_qelem *, natid); extern void shp_list(struct emp_qelem *); extern int shp_check_nav(struct sctstr *); +extern int sect_has_dock(struct sctstr *); extern int shp_hardtarget(struct shpstr *); extern void shp_view(struct emp_qelem *); extern int shp_nav_one_sector(struct emp_qelem *, int, natid, int); diff --git a/src/lib/commands/fuel.c b/src/lib/commands/fuel.c index 9e64d66b..197c1632 100644 --- a/src/lib/commands/fuel.c +++ b/src/lib/commands/fuel.c @@ -134,8 +134,7 @@ fuel(void) mp = &mchr[(int)item.ship.shp_type]; harbor = 0; - if (sect.sct_type == SCT_HARBR - || IS_BIG_CITY(sect.sct_type)) { + if (sect_has_dock(§)) { harbor = 1; oil_amt = sect.sct_item[I_OIL]; pet_amt = sect.sct_item[I_PETROL]; diff --git a/src/lib/commands/load.c b/src/lib/commands/load.c index c39a6830..0ffdd8a7 100644 --- a/src/lib/commands/load.c +++ b/src/lib/commands/load.c @@ -139,8 +139,7 @@ load(void) (ship.shp_own != player->cnum)) continue; if (!player->owner && - sect.sct_type != SCT_HARBR && - !IS_BIG_CITY(sect.sct_type)) + !sect_has_dock(§)) continue; if (!sect.sct_own) continue; @@ -150,8 +149,7 @@ load(void) xyas(ship.shp_x, ship.shp_y, player->cnum)); continue; } - if (sect.sct_type != SCT_HARBR && - !IS_BIG_CITY(sect.sct_type)) { + if (!sect_has_dock(§)) { if (noisy) pr("Sector %s is not a harbor%s%s.\n", xyas(ship.shp_x, ship.shp_y, player->cnum), diff --git a/src/lib/subs/shpsub.c b/src/lib/subs/shpsub.c index f853e3ba..5a9a63e2 100644 --- a/src/lib/subs/shpsub.c +++ b/src/lib/subs/shpsub.c @@ -388,6 +388,17 @@ shp_check_nav(struct sctstr *sect) return CN_NAVIGABLE; } +int +sect_has_dock(struct sctstr *sect) +{ + switch (dchr[sect->sct_type].d_nav) { + case NAV_02: + return 1; + default: + return 0; + } +} + static int shp_count(struct emp_qelem *list, int wantflags, int nowantflags, int x, int y) diff --git a/src/lib/update/nav_ship.c b/src/lib/update/nav_ship.c index 1c9edfff..bb5897ad 100644 --- a/src/lib/update/nav_ship.c +++ b/src/lib/update/nav_ship.c @@ -193,8 +193,7 @@ nav_loadship(struct shpstr *sp, natid cnum) didsomething[i] = 1; continue; } - if (sectp->sct_type != SCT_HARBR && - !IS_BIG_CITY(sectp->sct_type)) { + if (!sect_has_dock(sectp)) { /* we can only load in harbors */ didsomething[i] = 1; continue;