(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_put(struct emp_qelem *, natid);
extern void shp_list(struct emp_qelem *); extern void shp_list(struct emp_qelem *);
extern int shp_check_nav(struct sctstr *); extern int shp_check_nav(struct sctstr *);
extern int sect_has_dock(struct sctstr *);
extern int shp_hardtarget(struct shpstr *); extern int shp_hardtarget(struct shpstr *);
extern void shp_view(struct emp_qelem *); extern void shp_view(struct emp_qelem *);
extern int shp_nav_one_sector(struct emp_qelem *, int, natid, int); 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]; mp = &mchr[(int)item.ship.shp_type];
harbor = 0; harbor = 0;
if (sect.sct_type == SCT_HARBR if (sect_has_dock(&sect)) {
|| IS_BIG_CITY(sect.sct_type)) {
harbor = 1; harbor = 1;
oil_amt = sect.sct_item[I_OIL]; oil_amt = sect.sct_item[I_OIL];
pet_amt = sect.sct_item[I_PETROL]; pet_amt = sect.sct_item[I_PETROL];

View file

@ -139,8 +139,7 @@ load(void)
(ship.shp_own != player->cnum)) (ship.shp_own != player->cnum))
continue; continue;
if (!player->owner && if (!player->owner &&
sect.sct_type != SCT_HARBR && !sect_has_dock(&sect))
!IS_BIG_CITY(sect.sct_type))
continue; continue;
if (!sect.sct_own) if (!sect.sct_own)
continue; continue;
@ -150,8 +149,7 @@ load(void)
xyas(ship.shp_x, ship.shp_y, player->cnum)); xyas(ship.shp_x, ship.shp_y, player->cnum));
continue; continue;
} }
if (sect.sct_type != SCT_HARBR && if (!sect_has_dock(&sect)) {
!IS_BIG_CITY(sect.sct_type)) {
if (noisy) if (noisy)
pr("Sector %s is not a harbor%s%s.\n", pr("Sector %s is not a harbor%s%s.\n",
xyas(ship.shp_x, ship.shp_y, player->cnum), xyas(ship.shp_x, ship.shp_y, player->cnum),

View file

@ -388,6 +388,17 @@ shp_check_nav(struct sctstr *sect)
return CN_NAVIGABLE; 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 static int
shp_count(struct emp_qelem *list, int wantflags, int nowantflags, int x, shp_count(struct emp_qelem *list, int wantflags, int nowantflags, int x,
int y) int y)

View file

@ -193,8 +193,7 @@ nav_loadship(struct shpstr *sp, natid cnum)
didsomething[i] = 1; didsomething[i] = 1;
continue; continue;
} }
if (sectp->sct_type != SCT_HARBR && if (!sect_has_dock(sectp)) {
!IS_BIG_CITY(sectp->sct_type)) {
/* we can only load in harbors */ /* we can only load in harbors */
didsomething[i] = 1; didsomething[i] = 1;
continue; continue;