]> git.pond.sub.org Git - empserver/commitdiff
(sect_has_dock): New.
authorRon Koenderink <rkoenderink@yahoo.ca>
Tue, 17 Jan 2006 23:38:51 +0000 (23:38 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Tue, 17 Jan 2006 23:38:51 +0000 (23:38 +0000)
(fuel, load, nav_loadship): Use it.

include/prototypes.h
src/lib/commands/fuel.c
src/lib/commands/load.c
src/lib/subs/shpsub.c
src/lib/update/nav_ship.c

index 5e9bbf9b698f675062525fb5a1c8b2fada5e16a7..6089b6daa9c9a895f7960a64f4b90f9e9997cba0 100644 (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 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);
 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);
index 9e64d66b5af9c6e6d6a931cf138b4bf94d7e617c..197c1632b1423c20b0bc927b431104303d7a7a4b 100644 (file)
@@ -134,8 +134,7 @@ fuel(void)
            mp = &mchr[(int)item.ship.shp_type];
 
            harbor = 0;
            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];
                harbor = 1;
                oil_amt = sect.sct_item[I_OIL];
                pet_amt = sect.sct_item[I_PETROL];
index c39a683077f5f01e969218689ad19fa061faa200..0ffdd8a73dd0ddea6745cd8d59e14da1d3b757fc 100644 (file)
@@ -139,8 +139,7 @@ load(void)
            (ship.shp_own != player->cnum))
            continue;
        if (!player->owner &&
            (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;
            continue;
        if (!sect.sct_own)
            continue;
@@ -150,8 +149,7 @@ load(void)
                   xyas(ship.shp_x, ship.shp_y, player->cnum));
            continue;
        }
                   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),
            if (noisy)
                pr("Sector %s is not a harbor%s%s.\n",
                   xyas(ship.shp_x, ship.shp_y, player->cnum),
index f853e3ba9e29ca7b356360da8890f5d514f74484..5a9a63e2b529e7b7c37e84902b528e3c9ec7b29f 100644 (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
 shp_count(struct emp_qelem *list, int wantflags, int nowantflags, int x,
          int y)
 static int
 shp_count(struct emp_qelem *list, int wantflags, int nowantflags, int x,
          int y)
index 1c9edfff92f9dc25a74684af6471250131fcecd8..bb5897ad50a03b6801e79beae82ae55d596fef3e 100644 (file)
@@ -193,8 +193,7 @@ nav_loadship(struct shpstr *sp, natid cnum)
            didsomething[i] = 1;
            continue;
        }
            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;
            /* we can only load in harbors */
            didsomething[i] = 1;
            continue;