diff --git a/include/budg.h b/include/budg.h index c58ea913..389c024c 100644 --- a/include/budg.h +++ b/include/budg.h @@ -28,7 +28,7 @@ * * Known contributors to this file: * Ville Virrankoski, 1995 - * Markus Armbruster, 2004-2013 + * Markus Armbruster, 2004-2016 */ #ifndef BUDG_H @@ -49,7 +49,7 @@ void bp_put_items(struct bp *, struct sctstr *, short *); int bp_get_avail(struct bp *, struct sctstr *); void bp_put_avail(struct bp *, struct sctstr *, int); -int get_materials(struct sctstr *, struct bp *, int *, int); +int get_materials(struct sctstr *, struct bp *, short[], int); extern int money[MAXNOC]; extern int pops[MAXNOC]; diff --git a/include/land.h b/include/land.h index 2f9d3e95..42d98147 100644 --- a/include/land.h +++ b/include/land.h @@ -81,11 +81,8 @@ struct lndstr { struct lchrstr { short l_item[I_MAX+1]; /* load limit */ char *l_name; /* full name of type of land unit */ - int l_lcm; /* units of lcm to build */ - int l_hcm; /* units of hcm to build */ - int l_mil; /* how many mil it takes to build (unused) */ - int l_gun; /* how many guns it takes to build (unused) */ - int l_shell; /* #shells it takes to build (unused) */ + short l_mat[I_MAX+1]; /* materials to build 100% */ + /* only I_LCM and I_HCM non-zero */ int l_bwork; /* work to build 100% */ int l_tech; /* tech required to build */ int l_cost; /* how much it costs to build */ diff --git a/include/nuke.h b/include/nuke.h index 51c1a050..2ef7bf01 100644 --- a/include/nuke.h +++ b/include/nuke.h @@ -35,6 +35,7 @@ #define NUKE_H #include +#include "item.h" #include "types.h" #define N_MAXNUKE 20 @@ -64,12 +65,10 @@ struct nukstr { struct nchrstr { char *n_name; /* warhead unit name */ - int n_lcm; /* costs to build */ - int n_hcm; - int n_oil; - int n_rad; int n_blast; /* blast radius */ int n_dam; /* damage at center */ + short n_mat[I_MAX+1]; /* materials to build 100% */ + /* only I_LCM, I_HCM, I_OIL, I_RAD non-zero */ int n_bwork; /* work to build 100% */ int n_tech; /* tech needed to build */ int n_cost; /* how much it costs to build */ diff --git a/include/plane.h b/include/plane.h index 2a66decb..a434b78d 100644 --- a/include/plane.h +++ b/include/plane.h @@ -37,6 +37,7 @@ #define PLANE_H #include +#include "item.h" #include "queue.h" #include "types.h" @@ -79,8 +80,8 @@ struct plnstr { struct plchrstr { char *pl_name; /* full name of type of plane */ - int pl_lcm; /* costs to build */ - int pl_hcm; + short pl_mat[I_MAX+1]; /* materials to build 100% */ + /* only I_LCM, I_HCM, I_MILIT non-zero */ int pl_bwork; /* work to build 100% */ int pl_tech; /* tech needed to build */ int pl_cost; /* how much it costs to build */ @@ -89,7 +90,6 @@ struct plchrstr { int pl_att; /* air-air attack/defense strengths */ int pl_def; int pl_range; /* how many sectors it can fly */ - int pl_crew; /* number of mil to crew it */ int pl_fuel; /* fuel consumption */ int pl_stealth; /* how stealthy is it? */ int pl_flags; /* description of capability */ diff --git a/include/ship.h b/include/ship.h index f6c9d392..36a01ca6 100644 --- a/include/ship.h +++ b/include/ship.h @@ -82,8 +82,6 @@ struct shpstr { struct mchrstr { short m_item[I_MAX+1]; /* load limit */ - int m_lcm; /* units of lcm to build */ - int m_hcm; /* units of hcm to build */ int m_armor; /* how well armored it is */ int m_speed; /* how fast it can go */ int m_visib; /* how well it can be seen */ @@ -93,6 +91,8 @@ struct mchrstr { unsigned char m_nxlight; /* maximum number of xlight planes */ unsigned char m_nchoppers; /* maximum number of choppers */ char *m_name; /* full name of type of ship */ + short m_mat[I_MAX+1]; /* materials to build 100% */ + /* only I_LCM and I_HCM non-zero */ int m_bwork; /* work to build 100% */ int m_tech; /* tech required to build */ int m_cost; /* how much it costs to build */ diff --git a/src/lib/commands/buil.c b/src/lib/commands/buil.c index d6fa4d4f..b893f313 100644 --- a/src/lib/commands/buil.c +++ b/src/lib/commands/buil.c @@ -213,9 +213,7 @@ build_ship(struct sctstr *sp, int type, int tlev) short mat[I_MAX+1]; struct shpstr ship; - memset(mat, 0, sizeof(mat)); - mat[I_LCM] = mp->m_lcm; - mat[I_HCM] = mp->m_hcm; + memcpy(mat, mp->m_mat, sizeof(mat)); if (sp->sct_type != SCT_HARBR && !player->god) { pr("Ships must be built in harbours.\n"); @@ -264,9 +262,7 @@ build_land(struct sctstr *sp, int type, int tlev) short mat[I_MAX+1]; struct lndstr land; - memset(mat, 0, sizeof(mat)); - mat[I_LCM] = lp->l_lcm; - mat[I_HCM] = lp->l_hcm; + memcpy(mat, lp->l_mat, sizeof(mat)); if (sp->sct_type != SCT_HEADQ && !player->god) { pr("Land units must be built in headquarters.\n"); @@ -323,11 +319,7 @@ build_nuke(struct sctstr *sp, int type, int tlev) * make them start at 20%. Since they don't have efficiency * now, we charge all the work right away. */ - memset(mat, 0, sizeof(mat)); - mat[I_LCM] = np->n_lcm; - mat[I_HCM] = np->n_hcm; - mat[I_OIL] = np->n_oil; - mat[I_RAD] = np->n_rad; + memcpy(mat, np->n_mat, sizeof(mat)); if (!sector_can_build(sp, mat, np->n_bwork, 100, np->n_name)) return 0; @@ -358,10 +350,7 @@ build_plane(struct sctstr *sp, int type, int tlev) short mat[I_MAX+1]; struct plnstr plane; - memset(mat, 0, sizeof(mat)); - mat[I_MILIT] = pp->pl_crew; - mat[I_LCM] = pp->pl_lcm; - mat[I_HCM] = pp->pl_hcm; + memcpy(mat, pp->pl_mat, sizeof(mat)); if (sp->sct_type != SCT_AIRPT && !player->god) { pr("Planes must be built in airports.\n"); diff --git a/src/lib/commands/powe.c b/src/lib/commands/powe.c index 6c778e30..113c3c48 100644 --- a/src/lib/commands/powe.c +++ b/src/lib/commands/powe.c @@ -30,7 +30,7 @@ * Dave Pare * Ken Stevens, 1995 * Steve McClure, 1998-2000 - * Markus Armbruster, 2004-2013 + * Markus Armbruster, 2004-2016 * Ron Koenderink, 2005-2008 */ @@ -244,8 +244,10 @@ gen_power(struct powstr *powbuf, int save) continue; pow = &powbuf[land.lnd_own]; addtopow(land.lnd_item, pow); - f = (lchr[(int)land.lnd_type].l_lcm / 10.0) * (land.lnd_effic / 100.0); - f += (lchr[(int)land.lnd_type].l_hcm / 10.0) * (land.lnd_effic / 100.0); + f = (lchr[land.lnd_type].l_mat[I_LCM] / 10.0) + * (land.lnd_effic / 100.0); + f += (lchr[land.lnd_type].l_mat[I_HCM] / 10.0) + * (land.lnd_effic / 100.0); pow->p_power += f * 2; if (!(lchr[(int)land.lnd_type].l_flags & L_SPY)) pow->p_units += 1.0; @@ -256,8 +258,10 @@ gen_power(struct powstr *powbuf, int save) continue; pow = &powbuf[ship.shp_own]; addtopow(ship.shp_item, pow); - f = (mchr[(int)ship.shp_type].m_lcm / 10.0) * (ship.shp_effic / 100.0); - f += (mchr[(int)ship.shp_type].m_hcm / 10.0) * (ship.shp_effic / 100.0); + f = (mchr[ship.shp_type].m_mat[I_LCM] / 10.0) + * (ship.shp_effic / 100.0); + f += (mchr[ship.shp_type].m_mat[I_HCM] / 10.0) + * (ship.shp_effic / 100.0); pow->p_power += f * 2; pow->p_ships += 1.0; } diff --git a/src/lib/commands/scra.c b/src/lib/commands/scra.c index a338991d..dab777d6 100644 --- a/src/lib/commands/scra.c +++ b/src/lib/commands/scra.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Steve McClure, 2000 - * Markus Armbruster, 2004-2014 + * Markus Armbruster, 2004-2016 */ #include @@ -55,6 +55,8 @@ scra(void) char prompt[128]; char buf[1024]; float eff; + short *mvec; + int amt; if (!(p = getstarg(player->argp[1], "Ship, land, or plane? ", buf))) return RET_SYN; @@ -148,8 +150,7 @@ scra(void) -item.ship.shp_item[i])) sect.sct_item[i] += item.ship.shp_item[i]; } - sect.sct_item[I_LCM] += mp->m_lcm * 2 / 3 * eff; - sect.sct_item[I_HCM] += mp->m_hcm * 2 / 3 * eff; + mvec = mp->m_mat; if (item.ship.shp_pstage == PLG_INFECT && sect.sct_pstage == PLG_HEALTHY) sect.sct_pstage = PLG_EXPOSED; @@ -161,23 +162,25 @@ scra(void) -item.land.lnd_item[i])) sect.sct_item[i] += item.land.lnd_item[i]; } - sect.sct_item[I_LCM] += lp->l_lcm * 2 / 3 * eff; - sect.sct_item[I_HCM] += lp->l_hcm * 2 / 3 * eff; + mvec = lp->l_mat; if (item.land.lnd_pstage == PLG_INFECT && sect.sct_pstage == PLG_HEALTHY) sect.sct_pstage = PLG_EXPOSED; } else { eff = item.land.lnd_effic / 100.0; pp = &plchr[(int)item.plane.pln_type]; - sect.sct_item[I_LCM] += pp->pl_lcm * 2 / 3 * eff; - sect.sct_item[I_HCM] += pp->pl_hcm * 2 / 3 * eff; - sect.sct_item[I_MILIT] += roundavg(pp->pl_crew * eff); + mvec = pp->pl_mat; } item.gen.effic = 0; put_empobj(type, item.gen.uid, &item.gen); for (i = I_NONE + 1; i <= I_MAX; i++) { - if (sect.sct_item[i] > ITEM_MAX) - sect.sct_item[i] = ITEM_MAX; + if (i == I_CIVIL || i == I_MILIT || i == I_UW) + amt = sect.sct_item[i] + mvec[i] * eff; + else + amt = sect.sct_item[i] + mvec[i] * 2 / 3 * eff; + if (amt > ITEM_MAX) + amt = ITEM_MAX; + sect.sct_item[i] = amt; } putsect(§); } diff --git a/src/lib/commands/tran.c b/src/lib/commands/tran.c index 0fd9f245..5a71023f 100644 --- a/src/lib/commands/tran.c +++ b/src/lib/commands/tran.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Steve McClure, 2000 - * Markus Armbruster, 2006-2011 + * Markus Armbruster, 2006-2016 */ #include @@ -193,7 +193,7 @@ tran_plane(void) return RET_FAIL; } } - weight += plchr[type].pl_lcm + (plchr[type].pl_hcm * 2); + weight += plchr[type].pl_mat[I_LCM] + (plchr[type].pl_mat[I_HCM] * 2); ++count; } if (count == 0) { diff --git a/src/lib/common/nsc.c b/src/lib/common/nsc.c index 3758b110..6c5102a5 100644 --- a/src/lib/common/nsc.c +++ b/src/lib/common/nsc.c @@ -261,8 +261,8 @@ struct castr mchr_ca[] = { {"type", fldoff(m_type), NSC_CHAR, 0, NULL, EF_SHIP_CHR, 0}, {"name", fldoff(m_name), NSC_STRING, 0, NULL, EF_BAD, 0}, NSC_IVEC(fldoff(m_item), ""), - {"l_build", fldoff(m_lcm), NSC_INT, 0, NULL, EF_BAD, 0}, - {"h_build", fldoff(m_hcm), NSC_INT, 0, NULL, EF_BAD, 0}, + {"l_build", fldoff(m_mat[I_LCM]), NSC_SHORT, 0, NULL, EF_BAD, 0}, + {"h_build", fldoff(m_mat[I_HCM]), NSC_SHORT, 0, NULL, EF_BAD, 0}, {"armor", fldoff(m_armor), NSC_INT, 0, NULL, EF_BAD, 0}, {"speed", fldoff(m_speed), NSC_INT, 0, NULL, EF_BAD, 0}, {"visib", fldoff(m_visib), NSC_INT, 0, NULL, EF_BAD, 0}, @@ -305,8 +305,8 @@ struct castr plchr_ca[] = { #define CURSTR struct plchrstr {"type", fldoff(pl_type), NSC_CHAR, 0, NULL, EF_PLANE_CHR, 0}, {"name", fldoff(pl_name), NSC_STRING, 0, NULL, EF_BAD, 0}, - {"l_build", fldoff(pl_lcm), NSC_INT, 0, NULL, EF_BAD, 0}, - {"h_build", fldoff(pl_hcm), NSC_INT, 0, NULL, EF_BAD, 0}, + {"l_build", fldoff(pl_mat[I_LCM]), NSC_SHORT, 0, NULL, EF_BAD, 0}, + {"h_build", fldoff(pl_mat[I_HCM]), NSC_SHORT, 0, NULL, EF_BAD, 0}, {"bwork", fldoff(pl_bwork), NSC_INT, 0, NULL, EF_BAD, 0}, {"tech", fldoff(pl_tech), NSC_INT, 0, NULL, EF_BAD, 0}, {"cost", fldoff(pl_cost), NSC_INT, 0, NULL, EF_BAD, 0}, @@ -315,7 +315,7 @@ struct castr plchr_ca[] = { {"att", fldoff(pl_att), NSC_INT, 0, NULL, EF_BAD, 0}, {"def", fldoff(pl_def), NSC_INT, 0, NULL, EF_BAD, 0}, {"range", fldoff(pl_range), NSC_INT, 0, NULL, EF_BAD, 0}, - {"crew", fldoff(pl_crew), NSC_INT, 0, NULL, EF_BAD, 0}, + {"crew", fldoff(pl_mat[I_MILIT]), NSC_SHORT, 0, NULL, EF_BAD, 0}, {"fuel", fldoff(pl_fuel), NSC_INT, 0, NULL, EF_BAD, 0}, {"stealth", fldoff(pl_stealth), NSC_INT, 0, NULL, EF_BAD, 0}, {"flags", fldoff(pl_flags), NSC_INT, 0, NULL, @@ -367,8 +367,8 @@ struct castr lchr_ca[] = { {"type", fldoff(l_type), NSC_CHAR, 0, NULL, EF_LAND_CHR, 0}, {"name", fldoff(l_name), NSC_STRING, 0, NULL, EF_BAD, 0}, NSC_IVEC(fldoff(l_item), ""), - {"l_build", fldoff(l_lcm), NSC_INT, 0, NULL, EF_BAD, 0}, - {"h_build", fldoff(l_hcm), NSC_INT, 0, NULL, EF_BAD, 0}, + {"l_build", fldoff(l_mat[I_LCM]), NSC_SHORT, 0, NULL, EF_BAD, 0}, + {"h_build", fldoff(l_mat[I_HCM]), NSC_SHORT, 0, NULL, EF_BAD, 0}, {"bwork", fldoff(l_bwork), NSC_INT, 0, NULL, EF_BAD, 0}, {"tech", fldoff(l_tech), NSC_INT, 0, NULL, EF_BAD, 0}, {"cost", fldoff(l_cost), NSC_INT, 0, NULL, EF_BAD, 0}, @@ -405,10 +405,10 @@ struct castr nchr_ca[] = { #define CURSTR struct nchrstr {"type", fldoff(n_type), NSC_CHAR, 0, NULL, EF_NUKE_CHR, 0}, {"name", fldoff(n_name), NSC_STRING, 0, NULL, EF_BAD, 0}, - {"l_build", fldoff(n_lcm), NSC_INT, 0, NULL, EF_BAD, 0}, - {"h_build", fldoff(n_hcm), NSC_INT, 0, NULL, EF_BAD, 0}, - {"o_build", fldoff(n_oil), NSC_INT, 0, NULL, EF_BAD, 0}, - {"r_build", fldoff(n_rad), NSC_INT, 0, NULL, EF_BAD, 0}, + {"l_build", fldoff(n_mat[I_LCM]), NSC_SHORT, 0, NULL, EF_BAD, 0}, + {"h_build", fldoff(n_mat[I_HCM]), NSC_SHORT, 0, NULL, EF_BAD, 0}, + {"o_build", fldoff(n_mat[I_OIL]), NSC_SHORT, 0, NULL, EF_BAD, 0}, + {"r_build", fldoff(n_mat[I_RAD]), NSC_SHORT, 0, NULL, EF_BAD, 0}, {"blast", fldoff(n_blast), NSC_INT, 0, NULL, EF_BAD, 0}, {"dam", fldoff(n_dam), NSC_INT, 0, NULL, EF_BAD, 0}, {"bwork", fldoff(n_bwork), NSC_INT, 0, NULL, EF_BAD, 0}, diff --git a/src/lib/subs/plnsub.c b/src/lib/subs/plnsub.c index cb6eee76..f8eeaa61 100644 --- a/src/lib/subs/plnsub.c +++ b/src/lib/subs/plnsub.c @@ -239,7 +239,7 @@ pln_newlanding(struct emp_qelem *list, coord tx, coord ty, int cno) cname(player->cnum), prplane(&plp->plane), prship(&ship)); } - if (plp->pcp->pl_crew && plp->pstage == PLG_INFECT + if (plp->pcp->pl_mat[I_MILIT] && plp->pstage == PLG_INFECT && ship.shp_pstage == PLG_HEALTHY) ship.shp_pstage = PLG_EXPOSED; } @@ -253,7 +253,7 @@ pln_newlanding(struct emp_qelem *list, coord tx, coord ty, int cno) cname(player->cnum), prplane(&plp->plane), xyas(tx, ty, sect.sct_own)); } - if (plp->pcp->pl_crew && plp->pstage == PLG_INFECT + if (plp->pcp->pl_mat[I_MILIT] && plp->pstage == PLG_INFECT && sect.sct_pstage == PLG_HEALTHY) sect.sct_pstage = PLG_EXPOSED; plp->plane.pln_ship = cno; diff --git a/src/lib/subs/show.c b/src/lib/subs/show.c index 29acdfa2..52409e6d 100644 --- a/src/lib/subs/show.c +++ b/src/lib/subs/show.c @@ -198,8 +198,8 @@ show_nuke_build(int tlev) for (i = 0; i < n; i++) { np = &nchr[chridx[i].type]; pr("%-13.13s %3d %3d %4d %4d %5d %4d %3.0f $%6d\n", - np->n_name, np->n_lcm, np->n_hcm, np->n_oil, - np->n_rad, np->n_bwork, np->n_tech, + np->n_name, np->n_mat[I_LCM], np->n_mat[I_HCM], + np->n_mat[I_OIL], np->n_mat[I_RAD], np->n_bwork, np->n_tech, drnuke_const > MIN_DRNUKE_CONST ? ceil(np->n_tech * drnuke_const) : 0.0, np->n_cost); @@ -240,7 +240,7 @@ show_ship_build(int tlev) for (i = 0; i < n; i++) { mp = &mchr[chridx[i].type]; pr("%-25.25s %3d %3d %5d %4d $%d\n", - mp->m_name, mp->m_lcm, mp->m_hcm, + mp->m_name, mp->m_mat[I_LCM], mp->m_mat[I_HCM], mp->m_bwork, mp->m_tech, mp->m_cost); } } @@ -331,8 +331,8 @@ show_plane_build(int tlev) for (i = 0; i < n; i++) { pp = &plchr[chridx[i].type]; pr("%-25.25s %3d %3d %4d %5d %4d $%d\n", - pp->pl_name, pp->pl_lcm, - pp->pl_hcm, pp->pl_crew, + pp->pl_name, pp->pl_mat[I_LCM], + pp->pl_mat[I_HCM], pp->pl_mat[I_MILIT], pp->pl_bwork, pp->pl_tech, pp->pl_cost); } } @@ -349,9 +349,9 @@ show_land_build(int tlev) for (i = 0; i < n; i++) { lp = &lchr[chridx[i].type]; pr("%-25.25s %3d %3d %4d %5d %4d $%d\n", - lp->l_name, lp->l_lcm, - lp->l_hcm, - lp->l_gun, + lp->l_name, lp->l_mat[I_LCM], + lp->l_mat[I_HCM], + lp->l_mat[I_GUN], lp->l_bwork, lp->l_tech, lp->l_cost); } } diff --git a/src/lib/update/land.c b/src/lib/update/land.c index 63ccf5fe..9c25137f 100644 --- a/src/lib/update/land.c +++ b/src/lib/update/land.c @@ -200,7 +200,6 @@ landrepair(struct lndstr *land, struct natstr *np, struct bp *bp, int etus) int build; int avail; int mult; - int mvec[I_MAX + 1]; lp = &lchr[(int)land->lnd_type]; sp = getsectp(land->lnd_x, land->lnd_y); @@ -230,10 +229,7 @@ landrepair(struct lndstr *land, struct natstr *np, struct bp *bp, int etus) if (delta > 100 - land->lnd_effic) delta = 100 - land->lnd_effic; - memset(mvec, 0, sizeof(mvec)); - mvec[I_LCM] = lp->l_lcm; - mvec[I_HCM] = lp->l_hcm; - build = get_materials(sp, bp, mvec, delta); + build = get_materials(sp, bp, lp->l_mat, delta); if ((sp->sct_type != SCT_HEADQ) && (sp->sct_type != SCT_FORTR)) build /= 3; diff --git a/src/lib/update/material.c b/src/lib/update/material.c index 091aa15b..4fa3f185 100644 --- a/src/lib/update/material.c +++ b/src/lib/update/material.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Ville Virrankoski, 1996 - * Markus Armbruster, 2007 + * Markus Armbruster, 2007-2016 */ #include @@ -41,14 +41,14 @@ /* * Get build materials from sector @sp. * @bp is the sector's build pointer. - * @mvec[] defines the materials needed to build 100%. + * Array @mvec[ITEM_MAX+1] defines the materials needed to build 100%. * @pct is the percentage to build. * Adjust build percentage downwards so that available materials * suffice. Remove the materials. * Return adjusted build percentage. */ int -get_materials(struct sctstr *sp, struct bp *bp, int *mvec, int pct) +get_materials(struct sctstr *sp, struct bp *bp, short mvec[], int pct) { int i, amt; diff --git a/src/lib/update/plane.c b/src/lib/update/plane.c index 059a9610..74ad33e2 100644 --- a/src/lib/update/plane.c +++ b/src/lib/update/plane.c @@ -116,7 +116,7 @@ upd_plane(struct plnstr *pp, int etus, np->nat_money -= cost; } /* flight pay is 5x the pay received by other military */ - np->nat_money += etus * pcp->pl_crew * money_mil * 5; + np->nat_money += etus * pcp->pl_mat[I_MILIT] * money_mil * 5; } } @@ -124,7 +124,6 @@ static void planerepair(struct plnstr *pp, struct natstr *np, struct bp *bp, int etus) { int build; - int mvec[I_MAX + 1]; struct shpstr *carrier; struct plchrstr *pcp = &plchr[(int)pp->pln_type]; struct sctstr *sp = getsectp(pp->pln_x, pp->pln_y); @@ -173,11 +172,7 @@ planerepair(struct plnstr *pp, struct natstr *np, struct bp *bp, int etus) if (delta > 100 - pp->pln_effic) delta = 100 - pp->pln_effic; - memset(mvec, 0, sizeof(mvec)); - mvec[I_MILIT] = pcp->pl_crew; - mvec[I_LCM] = pcp->pl_lcm; - mvec[I_HCM] = pcp->pl_hcm; - build = get_materials(sp, bp, mvec, delta); + build = get_materials(sp, bp, pcp->pl_mat, delta); if (carrier) build = delta; diff --git a/src/lib/update/ship.c b/src/lib/update/ship.c index 598a2e72..0768decc 100644 --- a/src/lib/update/ship.c +++ b/src/lib/update/ship.c @@ -248,7 +248,6 @@ shiprepair(struct shpstr *ship, struct natstr *np, struct bp *bp, int etus) int wf; int avail; int mult; - int mvec[I_MAX + 1]; mp = &mchr[(int)ship->shp_type]; sp = getsectp(ship->shp_x, ship->shp_y); @@ -293,10 +292,7 @@ shiprepair(struct shpstr *ship, struct natstr *np, struct bp *bp, int etus) if (delta > 100 - ship->shp_effic) delta = 100 - ship->shp_effic; - memset(mvec, 0, sizeof(mvec)); - mvec[I_LCM] = mp->m_lcm; - mvec[I_HCM] = mp->m_hcm; - build = get_materials(sp, bp, mvec, delta); + build = get_materials(sp, bp, mp->m_mat, delta); if (sp->sct_type != SCT_HARBR) build = delta; diff --git a/tests/version/journal.log b/tests/version/journal.log index 027781be..f580c261 100644 --- a/tests/version/journal.log +++ b/tests/version/journal.log @@ -1020,8 +1020,8 @@ Play#0 output Play#0 1 "hcm" 6 0 0 -1 Play#0 output Play#0 1 "uw" 6 0 0 -1 Play#0 output Play#0 1 "rad" 6 0 0 -1 - Play#0 output Play#0 1 "l_build" 8 0 0 -1 - Play#0 output Play#0 1 "h_build" 8 0 0 -1 + Play#0 output Play#0 1 "l_build" 6 0 0 -1 + Play#0 output Play#0 1 "h_build" 6 0 0 -1 Play#0 output Play#0 1 "armor" 8 0 0 -1 Play#0 output Play#0 1 "speed" 8 0 0 -1 Play#0 output Play#0 1 "visib" 8 0 0 -1 @@ -1043,8 +1043,8 @@ Play#0 output Play#0 1 XDUMP meta plane-chr 0 Play#0 output Play#0 1 "type" 4 0 0 20 Play#0 output Play#0 1 "name" 3 0 0 -1 - Play#0 output Play#0 1 "l_build" 8 0 0 -1 - Play#0 output Play#0 1 "h_build" 8 0 0 -1 + Play#0 output Play#0 1 "l_build" 6 0 0 -1 + Play#0 output Play#0 1 "h_build" 6 0 0 -1 Play#0 output Play#0 1 "bwork" 8 0 0 -1 Play#0 output Play#0 1 "tech" 8 0 0 -1 Play#0 output Play#0 1 "cost" 8 0 0 -1 @@ -1053,7 +1053,7 @@ Play#0 output Play#0 1 "att" 8 0 0 -1 Play#0 output Play#0 1 "def" 8 0 0 -1 Play#0 output Play#0 1 "range" 8 0 0 -1 - Play#0 output Play#0 1 "crew" 8 0 0 -1 + Play#0 output Play#0 1 "crew" 6 0 0 -1 Play#0 output Play#0 1 "fuel" 8 0 0 -1 Play#0 output Play#0 1 "stealth" 8 0 0 -1 Play#0 output Play#0 1 "flags" 8 8 0 43 @@ -1078,8 +1078,8 @@ Play#0 output Play#0 1 "hcm" 6 0 0 -1 Play#0 output Play#0 1 "uw" 6 0 0 -1 Play#0 output Play#0 1 "rad" 6 0 0 -1 - Play#0 output Play#0 1 "l_build" 8 0 0 -1 - Play#0 output Play#0 1 "h_build" 8 0 0 -1 + Play#0 output Play#0 1 "l_build" 6 0 0 -1 + Play#0 output Play#0 1 "h_build" 6 0 0 -1 Play#0 output Play#0 1 "bwork" 8 0 0 -1 Play#0 output Play#0 1 "tech" 8 0 0 -1 Play#0 output Play#0 1 "cost" 8 0 0 -1 @@ -1105,10 +1105,10 @@ Play#0 output Play#0 1 XDUMP meta nuke-chr 0 Play#0 output Play#0 1 "type" 4 0 0 22 Play#0 output Play#0 1 "name" 3 0 0 -1 - Play#0 output Play#0 1 "l_build" 8 0 0 -1 - Play#0 output Play#0 1 "h_build" 8 0 0 -1 - Play#0 output Play#0 1 "o_build" 8 0 0 -1 - Play#0 output Play#0 1 "r_build" 8 0 0 -1 + Play#0 output Play#0 1 "l_build" 6 0 0 -1 + Play#0 output Play#0 1 "h_build" 6 0 0 -1 + Play#0 output Play#0 1 "o_build" 6 0 0 -1 + Play#0 output Play#0 1 "r_build" 6 0 0 -1 Play#0 output Play#0 1 "blast" 8 0 0 -1 Play#0 output Play#0 1 "dam" 8 0 0 -1 Play#0 output Play#0 1 "bwork" 8 0 0 -1