(shp_set_tech, pln_set_tech, lnd_set_tech): New, factored out of build

and upgrade code.
(build_ship, build_plane, build_land, supgr, pupgr, lupgr): Use them.
Upgrading planes no longer sets plane range to maximum.

(pupgr): Just clear the mission, don't bother to clear op area.

(doship, doplane, dounit): Editing tech now updates stats, like an
upgrade command.  Proper range checking.
(warn_deprecated): New.
(pr_ship, doship): Deprecate key 'D'.
(pr_land, dounit): Deprecate key 'A' and 'D'.
This commit is contained in:
Markus Armbruster 2004-05-16 14:19:38 +00:00
parent 65ff91877f
commit c2debd73fc
8 changed files with 113 additions and 102 deletions

View file

@ -1383,3 +1383,36 @@ lnd_fortify (struct lndstr *lp, int hard_amt)
return hard_amt;
}
/*
* Set LP's tech to TLEV along with everything else that depends on it.
*/
void
lnd_set_tech(struct lndstr *lp, int tlev)
{
struct lchrstr *lcp = lchr + lp->lnd_type;
int tech_diff = tlev - lcp->l_tech;
if (CANT_HAPPEN(tech_diff < 0)) {
tlev -= tech_diff;
tech_diff = 0;
}
lp->lnd_tech = tlev;
lp->lnd_att = (float)LND_ATTDEF(lcp->l_att, tech_diff);
lp->lnd_def = (float)LND_ATTDEF(lcp->l_def, tech_diff);
lp->lnd_vul = (int)LND_VUL(lcp->l_vul, tech_diff);
lp->lnd_spd = (int)LND_SPD(lcp->l_spd, tech_diff);
lp->lnd_vis = (int)LND_VIS(lcp->l_vis, tech_diff);
lp->lnd_spy = (int)LND_SPY(lcp->l_spy, tech_diff);
lp->lnd_rad = (int)LND_RAD(lcp->l_rad, tech_diff);
lp->lnd_frg = (int)LND_FRG(lcp->l_frg, tech_diff);
lp->lnd_acc = (int)LND_ACC(lcp->l_acc, tech_diff);
lp->lnd_dam = (int)LND_DAM(lcp->l_dam, tech_diff);
lp->lnd_ammo = (int)LND_AMM(lcp->l_ammo, lcp->l_dam, tech_diff);
lp->lnd_aaf = (int)LND_AAF(lcp->l_aaf, tech_diff);
lp->lnd_fuelc = (int)LND_FC(lcp->l_fuelc, tech_diff);
lp->lnd_fuelu = (int)LND_FU(lcp->l_fuelu, tech_diff);
lp->lnd_maxlight = (int)LND_XPL(lcp->l_nxlight, tech_diff);
lp->lnd_maxland = (int)LND_MXL(lcp->l_mxland, tech_diff);
}