static int tran_nmap(coord, coord, char *, char *);
static int tran_nuke(void);
static int tran_plane(void);
+static int pln_weight(struct plnstr *);
int
tran(void)
coord dstx, dsty;
int mcost;
int weight, count;
- int type, dam;
+ int dam;
struct nstr_item nstr;
struct plnstr plane;
struct sctstr sect;
while (nxtitem(&nstr, &plane)) {
if (!player->owner)
continue;
- type = plane.pln_type;
if (plane.pln_ship >= 0) {
pr("%s is stowed on ship #%d, and can't be transported\n",
prplane(&plane), plane.pln_ship);
return RET_FAIL;
}
}
- weight += plchr[type].pl_mat[I_LCM] + (plchr[type].pl_mat[I_HCM] * 2);
+ weight += pln_weight(&plane);
++count;
}
if (count == 0) {
return RET_OK;
}
+static int
+pln_weight(struct plnstr *pp)
+{
+ int w, i;
+
+ w = 0;
+ for (i = I_NONE + 1; i <= I_MAX; i++)
+ w += plchr[pp->pln_type].pl_mat[i] * ichr[i].i_lbs;
+ return w;
+}
+
/*
* Pretty tacky, but it works.
* If more commands start doing this, then
Play#1 command transport
Play#1 output Play#1 1 Looking for best path to 11,-1
Play#1 output Play#1 1 Using best path 'uuujjjh', movement cost 0.802
- Play#1 output Play#1 1 Total movement cost = 29
+ Play#1 output Play#1 1 Total movement cost = 26
Play#1 output Play#1 6 0 625
Play#1 input reco 0 . 11,-1 ujbgh
Play#1 command recon
Play#1 output Play#1 1 7,1 d 100% 127 .. .. 1000 0 0 0 100% 489 0 1
Play#1 output Play#1 1 -2,2 i 100% 127 .. .. 1000 0 0 0 100% 2 0 1
Play#1 output Play#1 1 0,2 m 100% 127 .. .. 1000 0 0 0 100% 0 0
- Play#1 output Play#1 1 2,2 * 100% 98 .. .. 1000 30 0 0 100% 569 0 1
+ Play#1 output Play#1 1 2,2 * 100% 101 .. .. 1000 30 0 0 100% 569 0 1
Play#1 output Play#1 1 4,2 r 100% 127 .. .. 1000 0 0 0 100% 489 0 1
Play#1 output Play#1 1 6,2 w 100% 127 .. .. 1000 75 0 0 100% 660 0 1
Play#1 output Play#1 1 8,2 e 100% 127 .. .. 966 1 0 0 100% 649 0 1
Play#0 output Play#0 1 10 -11,-11 g 100% 127 .. .. 1000 0 0 0 100% 650 0 1
Play#0 output Play#0 1 1 3,-11 i 100% 127 .. .. 1000 0 0 0 100% 2 0 1
Play#0 output Play#0 1 1 5,-11 m 100% 127 .. .. 1000 0 0 0 100% 0 0
- Play#0 output Play#0 1 1 7,-11 * 100% 98 .. .. 1000 30 0 0 100% 569 0 1
+ Play#0 output Play#0 1 1 7,-11 * 100% 101 .. .. 1000 30 0 0 100% 569 0 1
Play#0 output Play#0 1 1 9,-11 r 100% 127 .. .. 1000 0 0 0 100% 489 0 1
Play#0 output Play#0 1 1 11,-11 w 100% 127 .. .. 1000 75 0 0 100% 660 0 1
Play#0 output Play#0 1 1 13,-11 e 100% 127 .. .. 966 1 0 0 100% 649 0 1