diff --git a/src/lib/commands/tran.c b/src/lib/commands/tran.c index 5a71023f..843f7e2d 100644 --- a/src/lib/commands/tran.c +++ b/src/lib/commands/tran.c @@ -42,6 +42,7 @@ static int tran_pmap(coord, coord, char *, char *); 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) @@ -147,7 +148,7 @@ tran_plane(void) coord dstx, dsty; int mcost; int weight, count; - int type, dam; + int dam; struct nstr_item nstr; struct plnstr plane; struct sctstr sect; @@ -166,7 +167,6 @@ tran_plane(void) 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); @@ -193,7 +193,7 @@ tran_plane(void) 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) { @@ -241,6 +241,17 @@ tran_plane(void) 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 diff --git a/tests/smoke/journal.log b/tests/smoke/journal.log index cb3d0c07..1fa3330f 100644 --- a/tests/smoke/journal.log +++ b/tests/smoke/journal.log @@ -12879,7 +12879,7 @@ 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 @@ -13030,7 +13030,7 @@ 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 @@ -13575,7 +13575,7 @@ 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