(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:
parent
65ff91877f
commit
c2debd73fc
8 changed files with 113 additions and 102 deletions
|
@ -32,6 +32,7 @@
|
|||
* Steve McClure, 1996-2000
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "misc.h"
|
||||
#include "queue.h"
|
||||
#include "player.h"
|
||||
|
@ -1059,3 +1060,25 @@ shp_missdef(struct shpstr *sp, natid victim)
|
|||
if (!QEMPTY(&list))
|
||||
free(mlp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set SP's tech to TLEV along with everything else that depends on it.
|
||||
*/
|
||||
void
|
||||
shp_set_tech(struct shpstr *sp, int tlev)
|
||||
{
|
||||
struct mchrstr *mcp = mchr + sp->shp_type;
|
||||
int tech_diff = tlev - mcp->m_tech;
|
||||
|
||||
if (CANT_HAPPEN(tech_diff < 0)) {
|
||||
tlev -= tech_diff;
|
||||
tech_diff = 0;
|
||||
}
|
||||
|
||||
sp->shp_tech = tlev;
|
||||
sp->shp_armor = (short)SHP_DEF(mcp->m_armor, tech_diff);
|
||||
sp->shp_speed = (short)SHP_SPD(mcp->m_speed, tech_diff);
|
||||
sp->shp_visib = (short)SHP_VIS(mcp->m_visib, tech_diff);
|
||||
sp->shp_frnge = (short)SHP_RNG(mcp->m_frnge, tech_diff);
|
||||
sp->shp_glim = (short)SHP_FIR(mcp->m_glim, tech_diff);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue