config: Make work to build units independently configurable

The work required for build and repairs is traditionally a function of
build materials: 20 + lcm + 2*hcm for ships, planes and land units,
and (lcm + 2*hcm + oil + rad)/5 for nukes.  Make it independently
configurable instead, via new ship-chr, plane-chr, land-chr, nuke-chr
selector bwork, backed by new struct mchrstr member m_bwork, struct
plchrstr member pl_bwork, struct lchrstr member l_bwork, struct
nchrstr member n_bwork.  Keep the required work exactly the same for
now.

Clients that compute work from materials need to be updated.  Easy,
since build work is now exposed in xdump.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-05-27 13:39:11 +02:00
parent 14af586b57
commit 68c7c08a58
19 changed files with 319 additions and 351 deletions

View file

@ -29,7 +29,7 @@
* Known contributors to this file:
* Dave Pare, 1986
* Steve McClure, 1998
* Markus Armbruster, 2006-2011
* Markus Armbruster, 2006-2016
*/
#include <config.h>
@ -131,7 +131,6 @@ planerepair(struct plnstr *pp, struct natstr *np, struct bp *bp, int etus)
int delta;
int mult;
int avail;
int w_p_eff;
int used;
carrier = NULL;
@ -166,8 +165,7 @@ planerepair(struct plnstr *pp, struct natstr *np, struct bp *bp, int etus)
if (carrier)
avail += etus * carrier->shp_item[I_MILIT] / 2;
w_p_eff = PLN_BLD_WORK(pcp->pl_lcm, pcp->pl_hcm);
delta = roundavg((double)avail / w_p_eff);
delta = roundavg((double)avail / pcp->pl_bwork);
if (delta <= 0)
return;
if (delta > (int)((float)etus * plane_grow_scale))
@ -184,7 +182,7 @@ planerepair(struct plnstr *pp, struct natstr *np, struct bp *bp, int etus)
if (carrier)
build = delta;
used = build * w_p_eff;
used = build * pcp->pl_bwork;
/*
* I didn't use roundavg here, because I want to
* penalize the player with a large number of planes.