(sect_has_dock): New.

(fuel, load, nav_loadship): Use it.
This commit is contained in:
Ron Koenderink 2006-01-17 23:38:51 +00:00
parent 80be15204b
commit 14d94c2509
5 changed files with 16 additions and 8 deletions

View file

@ -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);

View file

@ -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(&sect)) {
harbor = 1;
oil_amt = sect.sct_item[I_OIL];
pet_amt = sect.sct_item[I_PETROL];

View file

@ -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(&sect))
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(&sect)) {
if (noisy)
pr("Sector %s is not a harbor%s%s.\n",
xyas(ship.shp_x, ship.shp_y, player->cnum),

View file

@ -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)

View file

@ -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;