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

@ -28,6 +28,7 @@
*
* Known contributors to this file:
* Dave Pare, 1986
* Markus Armbruster, 2004-2016
*/
#ifndef NUKE_H
@ -69,8 +70,9 @@ struct nchrstr {
int n_rad;
int n_blast; /* blast radius */
int n_dam; /* damage at center */
int n_cost;
int n_bwork; /* work to build 100% */
int n_tech; /* tech needed to build */
int n_cost; /* how much it costs to build */
int n_weight;
int n_flags; /* description of capability */
signed char n_type; /* index in nchr[] */
@ -82,10 +84,6 @@ struct nchrstr {
#define putnuke(n, p) ef_write(EF_NUKE, (n), (p))
#define getnukep(n) ((struct nukstr *)ef_ptr(EF_NUKE, (n)))
/* Work required for building */
#define NUK_BLD_WORK(lcm, hcm, oil, rad) \
(((lcm) + 2 * (hcm) + (oil) + (rad) + 4) / 5)
extern struct nchrstr nchr[N_MAXNUKE + 1];
/* src/lib/common/cargo.c */