transport: Don't hardcode material weights
tran_plane() computes a plane's weight from its materials. It hardcodes lcm weight 1, hcm weight 2, and military weight 0. Use ichr[].i_lbs instead, which is 1 in the stock game for all three materials. While there, support arbitrary materials, even though they aren't yet possible, just to avoid unnecessary assumptions on possible build materials. Since the stock game's planes use fewer military than hcms, they become up to 15% lighter, except for zep, which becomes 10% heavier. Missiles use no military and become 20-33% lighter. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
5635fc212f
commit
3145e7d8a7
2 changed files with 17 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue