(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
|
@ -228,5 +228,6 @@ extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);
|
|||
extern int lnd_support(natid, natid, coord, coord);
|
||||
extern int lnd_can_attack(struct lndstr *);
|
||||
extern int lnd_fortify (struct lndstr *lp, int hard_amt);
|
||||
extern void lnd_set_tech(struct lndstr *, int);
|
||||
|
||||
#endif /* _LAND_H_ */
|
||||
|
|
|
@ -414,6 +414,7 @@ extern int put_plane_on_land(struct plnstr *, struct lndstr *);
|
|||
extern int pln_hitchance(struct plnstr *, int, int);
|
||||
extern int pln_damage(struct plnstr *, coord, coord, s_char, int *, int);
|
||||
extern int pln_identchance(struct plnstr *, int, int);
|
||||
extern void pln_set_tech(struct plnstr *, int);
|
||||
/* pr.c */
|
||||
extern void pr(s_char *, ...) ATTRIBUTE((format (printf, 1, 2)));
|
||||
extern void prnf(s_char *buf);
|
||||
|
@ -508,6 +509,7 @@ extern void shp_view(struct emp_qelem *);
|
|||
extern int shp_nav_one_sector(struct emp_qelem *, int, natid, int);
|
||||
extern int shp_missile_defense(coord, coord, natid, int);
|
||||
extern void shp_missdef(struct shpstr *, natid);
|
||||
extern void shp_set_tech(struct shpstr *, int);
|
||||
/* snxtitem.c */
|
||||
extern int snxtitem(register struct nstr_item *, int, s_char *);
|
||||
/* snxtsct.c */
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
* Steve McClure, 1998-2000
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "misc.h"
|
||||
#include "player.h"
|
||||
|
@ -350,7 +349,6 @@ build_ship(register struct sctstr *sp, register struct mchrstr *mp,
|
|||
float eff = SHIP_MINEFF / 100.0;
|
||||
int lcm, hcm;
|
||||
int freeship = 0;
|
||||
int techdiff;
|
||||
|
||||
hcm = roundavg((double)mp->m_hcm * eff);
|
||||
lcm = roundavg((double)mp->m_lcm * eff);
|
||||
|
@ -432,15 +430,6 @@ build_ship(register struct sctstr *sp, register struct mchrstr *mp,
|
|||
memset(ship.shp_item, 0, sizeof(ship.shp_item));
|
||||
ship.shp_pstage = PLG_HEALTHY;
|
||||
ship.shp_ptime = 0;
|
||||
ship.shp_tech = tlev;
|
||||
|
||||
techdiff = (int)(tlev - mp->m_tech);
|
||||
ship.shp_armor = (short)SHP_DEF(mp->m_armor, techdiff);
|
||||
ship.shp_speed = (short)SHP_SPD(mp->m_speed, techdiff);
|
||||
ship.shp_visib = (short)SHP_VIS(mp->m_visib, techdiff);
|
||||
ship.shp_frnge = (short)SHP_RNG(mp->m_frnge, techdiff);
|
||||
ship.shp_glim = (short)SHP_FIR(mp->m_glim, techdiff);
|
||||
|
||||
ship.shp_mobquota = 0;
|
||||
*ship.shp_path = 0;
|
||||
ship.shp_follow = nstr.cur;
|
||||
|
@ -451,6 +440,7 @@ build_ship(register struct sctstr *sp, register struct mchrstr *mp,
|
|||
ship.shp_fuel = mchr[(int)ship.shp_type].m_fuelc;
|
||||
ship.shp_rflags = 0;
|
||||
memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
|
||||
shp_set_tech(&ship, tlev);
|
||||
|
||||
vec[I_LCM] -= lcm;
|
||||
vec[I_HCM] -= hcm;
|
||||
|
@ -562,7 +552,6 @@ build_land(register struct sctstr *sp, register struct lchrstr *lp,
|
|||
} else {
|
||||
land.lnd_mobil = 0;
|
||||
}
|
||||
land.lnd_tech = tlev;
|
||||
land.lnd_uid = nstr.cur;
|
||||
land.lnd_army = ' ';
|
||||
land.lnd_flags = 0;
|
||||
|
@ -579,22 +568,7 @@ build_land(register struct sctstr *sp, register struct lchrstr *lp,
|
|||
memset(land.lnd_item, 0, sizeof(land.lnd_item));
|
||||
land.lnd_pstage = PLG_HEALTHY;
|
||||
land.lnd_ptime = 0;
|
||||
land.lnd_att = (float)LND_ATTDEF(lp->l_att, tlev - lp->l_tech);
|
||||
land.lnd_def = (float)LND_ATTDEF(lp->l_def, tlev - lp->l_tech);
|
||||
land.lnd_vul = (int)LND_VUL(lp->l_vul, tlev - lp->l_tech);
|
||||
land.lnd_spd = (int)LND_SPD(lp->l_spd, tlev - lp->l_tech);
|
||||
land.lnd_vis = (int)LND_VIS(lp->l_vis, tlev - lp->l_tech);
|
||||
land.lnd_spy = (int)LND_SPY(lp->l_spy, tlev - lp->l_tech);
|
||||
land.lnd_rad = (int)LND_RAD(lp->l_rad, tlev - lp->l_tech);
|
||||
land.lnd_frg = (int)LND_FRG(lp->l_frg, tlev - lp->l_tech);
|
||||
land.lnd_acc = (int)LND_ACC(lp->l_acc, tlev - lp->l_tech);
|
||||
land.lnd_dam = (int)LND_DAM(lp->l_dam, tlev - lp->l_tech);
|
||||
land.lnd_ammo = (int)LND_AMM(lp->l_ammo, lp->l_dam, tlev - lp->l_tech);
|
||||
land.lnd_aaf = (int)LND_AAF(lp->l_aaf, tlev - lp->l_tech);
|
||||
land.lnd_fuelc = (int)LND_FC(lp->l_fuelc, tlev - lp->l_tech);
|
||||
land.lnd_fuelu = (int)LND_FU(lp->l_fuelu, tlev - lp->l_tech);
|
||||
land.lnd_maxlight = (int)LND_XPL(lp->l_nxlight, tlev - lp->l_tech);
|
||||
land.lnd_maxland = (int)LND_MXL(lp->l_mxland, tlev - lp->l_tech);
|
||||
lnd_set_tech(&land, tlev);
|
||||
|
||||
vec[I_LCM] -= lcm;
|
||||
vec[I_HCM] -= hcm;
|
||||
|
@ -900,35 +874,27 @@ build_plane(register struct sctstr *sp, register struct plchrstr *pp,
|
|||
plane.pln_opx = 0;
|
||||
plane.pln_opy = 0;
|
||||
plane.pln_radius = 0;
|
||||
|
||||
/* Note that this next block of variables can be changed so that individual
|
||||
* planes may have their own stats (like based on tech maybe? :) ) Thus,
|
||||
* the code now checks the pln_acc, pln_load and pln_fuel instead of using
|
||||
* the static definitions of them. */
|
||||
plane.pln_att = PLN_ATTDEF(pp->pl_att, (int)(tlev - pp->pl_tech));
|
||||
plane.pln_def = PLN_ATTDEF(pp->pl_def, (int)(tlev - pp->pl_tech));
|
||||
plane.pln_acc = PLN_ACC(pp->pl_acc, (int)(tlev - pp->pl_tech));
|
||||
plane.pln_range = PLN_RAN(pp->pl_range, (int)(tlev - pp->pl_tech));
|
||||
plane.pln_range = UCHAR_MAX; /* will be adjusted by pln_set_tech() */
|
||||
plane.pln_range_max = plane.pln_range;
|
||||
plane.pln_load = PLN_LOAD(pp->pl_load, (int)(tlev - pp->pl_tech));
|
||||
plane.pln_fuel = pp->pl_fuel;
|
||||
|
||||
plane.pln_wing = ' ';
|
||||
plane.pln_tech = tlev;
|
||||
plane.pln_ship = -1;
|
||||
plane.pln_land = -1;
|
||||
plane.pln_uid = nstr.cur;
|
||||
plane.pln_nuketype = -1;
|
||||
plane.pln_harden = 0;
|
||||
plane.pln_flags = 0;
|
||||
pln_set_tech(&plane, tlev);
|
||||
|
||||
vec[I_LCM] -= lcm;
|
||||
vec[I_HCM] -= hcm;
|
||||
vec[I_MILIT] -= mil;
|
||||
|
||||
makenotlost(EF_PLANE, plane.pln_own, plane.pln_uid, plane.pln_x,
|
||||
plane.pln_y);
|
||||
putplane(plane.pln_uid, &plane);
|
||||
pr("%s built in sector %s\n", prplane(&plane),
|
||||
xyas(sp->sct_x, sp->sct_y, player->cnum));
|
||||
vec[I_LCM] -= lcm;
|
||||
vec[I_HCM] -= hcm;
|
||||
vec[I_MILIT] -= mil;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -371,8 +371,6 @@ pr_land(struct lndstr *land)
|
|||
pr("Mobility <M>: %d\n", (int)land->lnd_mobil);
|
||||
pr("Tech <t>: %d\t\t", land->lnd_tech);
|
||||
pr("Army <a>: %c\n", land->lnd_army);
|
||||
pr("Attack <A>: %1.2f\t", land->lnd_att);
|
||||
pr("Defense <D>: %1.2f\n", land->lnd_def);
|
||||
pr("Fortification <F>: %d\t", land->lnd_harden);
|
||||
pr("Fuel <B>: %d\n", land->lnd_fuel);
|
||||
count_land_planes(land);
|
||||
|
@ -425,7 +423,6 @@ pr_ship(struct shpstr *ship)
|
|||
/* could depend on opt_FUEL - but a deity might want to set this
|
||||
up before enabling the option */
|
||||
pr("Fuel <B>: %d\t\t\t", (int)ship->shp_fuel);
|
||||
pr("Defense <D>: %d\n", (int)ship->shp_armor);
|
||||
pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
|
||||
ship->shp_rpath, (int)ship->shp_rflags);
|
||||
pr("Plague Stage <a>: %d\t\t",ship->shp_pstage);
|
||||
|
@ -480,6 +477,11 @@ getin(s_char **what, s_char **p, int *arg, s_char *buf)
|
|||
return RET_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
warn_deprecated(char key)
|
||||
{
|
||||
pr("Key <%c> is deprecated and will go away in a future release\n", key);
|
||||
}
|
||||
|
||||
static int
|
||||
doland(s_char op, int arg, s_char *p, struct sctstr *sect)
|
||||
|
@ -845,7 +847,8 @@ doship(s_char op, int arg, s_char *p, struct shpstr *ship)
|
|||
ship->shp_y = newy;
|
||||
break;
|
||||
case 'T':
|
||||
ship->shp_tech = arg;
|
||||
shp_set_tech(ship,
|
||||
errcheck(arg, mchr[ship->shp_type].m_tech, SHRT_MAX));
|
||||
break;
|
||||
case 'E':
|
||||
ship->shp_effic = errcheck(arg, SHIP_MINEFF, 100);
|
||||
|
@ -912,7 +915,8 @@ doship(s_char op, int arg, s_char *p, struct shpstr *ship)
|
|||
ship->shp_item[I_RAD] = arg;
|
||||
break;
|
||||
case 'D':
|
||||
ship->shp_armor = errcheck(arg, 0, 127);
|
||||
warn_deprecated(op);
|
||||
ship->shp_armor = errcheck(arg, 0, SHRT_MAX);
|
||||
break;
|
||||
default:
|
||||
pr("huh? (%c)\n", op);
|
||||
|
@ -967,7 +971,8 @@ dounit(s_char op, int arg, s_char *p, float farg, struct lndstr *land)
|
|||
land->lnd_mobil = arg;
|
||||
break;
|
||||
case 't':
|
||||
land->lnd_tech = arg;
|
||||
lnd_set_tech(land,
|
||||
errcheck(arg, lchr[land->lnd_type].l_tech, SHRT_MAX));
|
||||
break;
|
||||
case 'a':
|
||||
if (p[0] == '~')
|
||||
|
@ -1043,11 +1048,13 @@ dounit(s_char op, int arg, s_char *p, float farg, struct lndstr *land)
|
|||
land->lnd_item[I_RAD] = arg;
|
||||
break;
|
||||
case 'A':
|
||||
warn_deprecated(op);
|
||||
pr("Attack changed from %1.2f to %1.2f.\n",
|
||||
land->lnd_att, farg);
|
||||
land->lnd_att = farg;
|
||||
break;
|
||||
case 'D':
|
||||
warn_deprecated(op);
|
||||
pr("Defense changed from %1.2f to %1.2f.\n",
|
||||
land->lnd_def, farg);
|
||||
land->lnd_def = farg;
|
||||
|
@ -1105,7 +1112,8 @@ doplane(s_char op, int arg, s_char *p, struct plnstr *plane)
|
|||
plane->pln_mobil = errcheck(arg, -127, 255);
|
||||
break;
|
||||
case 't':
|
||||
plane->pln_tech = arg;
|
||||
pln_set_tech(plane,
|
||||
errcheck(arg, plchr[plane->pln_type].pl_tech, SHRT_MAX));
|
||||
break;
|
||||
case 'w':
|
||||
if (p[0] == '~')
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
* Steve McClure, 1996-2000
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "misc.h"
|
||||
#include "player.h"
|
||||
#include "xy.h"
|
||||
|
@ -93,7 +91,6 @@ lupgr(void)
|
|||
int tlev;
|
||||
int avail, cost;
|
||||
int rel;
|
||||
int techdiff;
|
||||
long cash;
|
||||
|
||||
if (!snxtitem(&ni, EF_LAND, player->argp[2]))
|
||||
|
@ -143,30 +140,9 @@ lupgr(void)
|
|||
|
||||
sect.sct_avail -= avail;
|
||||
land.lnd_effic -= UPGR_EFF;
|
||||
|
||||
land.lnd_tech = tlev;
|
||||
techdiff = (int)(tlev - lp->l_tech);
|
||||
|
||||
lnd_set_tech(&land, tlev);
|
||||
land.lnd_harden = 0;
|
||||
land.lnd_mission = 0;
|
||||
|
||||
land.lnd_att = (float)LND_ATTDEF(lp->l_att, techdiff);
|
||||
land.lnd_def = (float)LND_ATTDEF(lp->l_def, techdiff);
|
||||
land.lnd_vul = (int)LND_VUL(lp->l_vul, techdiff);
|
||||
land.lnd_spd = (int)LND_SPD(lp->l_spd, techdiff);
|
||||
land.lnd_vis = (int)LND_VIS(lp->l_vis, techdiff);
|
||||
land.lnd_spy = (int)LND_SPY(lp->l_spy, techdiff);
|
||||
land.lnd_rad = (int)LND_RAD(lp->l_rad, techdiff);
|
||||
land.lnd_frg = (int)LND_FRG(lp->l_frg, techdiff);
|
||||
land.lnd_acc = (int)LND_ACC(lp->l_acc, techdiff);
|
||||
land.lnd_dam = (int)LND_DAM(lp->l_dam, techdiff);
|
||||
land.lnd_ammo = (int)LND_AMM(lp->l_ammo, lp->l_dam, techdiff);
|
||||
land.lnd_aaf = (int)LND_AAF(lp->l_aaf, techdiff);
|
||||
land.lnd_fuelc = (int)LND_FC(lp->l_fuelc, techdiff);
|
||||
land.lnd_fuelu = (int)LND_FU(lp->l_fuelu, techdiff);
|
||||
land.lnd_maxlight = (int)LND_XPL(lp->l_nxlight, techdiff);
|
||||
land.lnd_maxland = (int)LND_MXL(lp->l_mxland, techdiff);
|
||||
|
||||
time(&land.lnd_access);
|
||||
|
||||
putland(land.lnd_uid, &land);
|
||||
|
@ -199,7 +175,6 @@ supgr(void)
|
|||
int tlev;
|
||||
int avail, cost;
|
||||
int rel;
|
||||
int techdiff;
|
||||
long cash;
|
||||
|
||||
if (!snxtitem(&ni, EF_SHIP, player->argp[2]))
|
||||
|
@ -249,15 +224,7 @@ supgr(void)
|
|||
|
||||
sect.sct_avail -= avail;
|
||||
ship.shp_effic -= UPGR_EFF;
|
||||
ship.shp_tech = tlev;
|
||||
|
||||
techdiff = (int)(tlev - mp->m_tech);
|
||||
ship.shp_armor = (short)SHP_DEF(mp->m_armor, techdiff);
|
||||
ship.shp_speed = (short)SHP_SPD(mp->m_speed, techdiff);
|
||||
ship.shp_visib = (short)SHP_VIS(mp->m_visib, techdiff);
|
||||
ship.shp_frnge = (short)SHP_RNG(mp->m_frnge, techdiff);
|
||||
ship.shp_glim = (short)SHP_FIR(mp->m_glim, techdiff);
|
||||
|
||||
shp_set_tech(&ship, tlev);
|
||||
ship.shp_mission = 0;
|
||||
time(&ship.shp_access);
|
||||
|
||||
|
@ -291,7 +258,6 @@ pupgr(void)
|
|||
int tlev;
|
||||
int avail, cost;
|
||||
int rel;
|
||||
int techdiff;
|
||||
long cash;
|
||||
|
||||
if (!snxtitem(&ni, EF_PLANE, player->argp[2]))
|
||||
|
@ -345,24 +311,9 @@ pupgr(void)
|
|||
|
||||
sect.sct_avail -= avail;
|
||||
plane.pln_effic -= UPGR_EFF;
|
||||
|
||||
plane.pln_tech = tlev;
|
||||
techdiff = (int)(tlev - pp->pl_tech);
|
||||
|
||||
plane.pln_mission = 0;
|
||||
plane.pln_opx = 0;
|
||||
plane.pln_opy = 0;
|
||||
plane.pln_radius = 0;
|
||||
pln_set_tech(&plane, tlev);
|
||||
plane.pln_harden = 0;
|
||||
plane.pln_mission = 0;
|
||||
|
||||
plane.pln_att = PLN_ATTDEF(pp->pl_att, techdiff);
|
||||
plane.pln_def = PLN_ATTDEF(pp->pl_def, techdiff);
|
||||
plane.pln_acc = PLN_ACC(pp->pl_acc, techdiff);
|
||||
plane.pln_range = PLN_RAN(pp->pl_range, techdiff);
|
||||
plane.pln_range_max = plane.pln_range;
|
||||
plane.pln_load = PLN_LOAD(pp->pl_load, techdiff);
|
||||
|
||||
time(&plane.pln_access);
|
||||
|
||||
putplane(plane.pln_uid, &plane);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
* Steve McClure, 1998-2000
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "misc.h"
|
||||
#include "player.h"
|
||||
#include "var.h"
|
||||
|
@ -1165,3 +1166,29 @@ pln_mobcost(int dist, struct plnstr *pp, int flags)
|
|||
|
||||
return min(32 + pp->pln_mobil, cost + 5);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set PP's tech to TLEV along with everything else that depends on it.
|
||||
*/
|
||||
void
|
||||
pln_set_tech(struct plnstr *pp, int tlev)
|
||||
{
|
||||
struct plchrstr *pcp = plchr + pp->pln_type;
|
||||
int tech_diff = tlev - pcp->pl_tech;
|
||||
int limited_range = pp->pln_range < pp->pln_range_max;
|
||||
|
||||
if (CANT_HAPPEN(tech_diff < 0)) {
|
||||
tlev -= tech_diff;
|
||||
tech_diff = 0;
|
||||
}
|
||||
|
||||
pp->pln_tech = tlev;
|
||||
pp->pln_att = PLN_ATTDEF(pcp->pl_att, tech_diff);
|
||||
pp->pln_def = PLN_ATTDEF(pcp->pl_def, tech_diff);
|
||||
pp->pln_acc = PLN_ACC(pcp->pl_acc, tech_diff);
|
||||
pp->pln_range_max = PLN_RAN(pcp->pl_range, tech_diff);
|
||||
pp->pln_load = PLN_LOAD(pcp->pl_load, tech_diff);
|
||||
|
||||
if (!limited_range || pp->pln_range > pp->pln_range_max)
|
||||
pp->pln_range = pp->pln_range_max;
|
||||
}
|
||||
|
|
|
@ -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