config: Generalize unit build materials storage

Use a single array member instead of multiple scalar members.  Only
the array elements that replace scalar members are can be non-zero for
now.

This is a first step to permitting more build materials.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-05-27 14:17:08 +02:00
parent 68c7c08a58
commit da05484d8b
17 changed files with 79 additions and 100 deletions

View file

@ -28,7 +28,7 @@
*
* Known contributors to this file:
* Ville Virrankoski, 1995
* Markus Armbruster, 2004-2013
* Markus Armbruster, 2004-2016
*/
#ifndef BUDG_H
@ -49,7 +49,7 @@ void bp_put_items(struct bp *, struct sctstr *, short *);
int bp_get_avail(struct bp *, struct sctstr *);
void bp_put_avail(struct bp *, struct sctstr *, int);
int get_materials(struct sctstr *, struct bp *, int *, int);
int get_materials(struct sctstr *, struct bp *, short[], int);
extern int money[MAXNOC];
extern int pops[MAXNOC];

View file

@ -81,11 +81,8 @@ struct lndstr {
struct lchrstr {
short l_item[I_MAX+1]; /* load limit */
char *l_name; /* full name of type of land unit */
int l_lcm; /* units of lcm to build */
int l_hcm; /* units of hcm to build */
int l_mil; /* how many mil it takes to build (unused) */
int l_gun; /* how many guns it takes to build (unused) */
int l_shell; /* #shells it takes to build (unused) */
short l_mat[I_MAX+1]; /* materials to build 100% */
/* only I_LCM and I_HCM non-zero */
int l_bwork; /* work to build 100% */
int l_tech; /* tech required to build */
int l_cost; /* how much it costs to build */

View file

@ -35,6 +35,7 @@
#define NUKE_H
#include <time.h>
#include "item.h"
#include "types.h"
#define N_MAXNUKE 20
@ -64,12 +65,10 @@ struct nukstr {
struct nchrstr {
char *n_name; /* warhead unit name */
int n_lcm; /* costs to build */
int n_hcm;
int n_oil;
int n_rad;
int n_blast; /* blast radius */
int n_dam; /* damage at center */
short n_mat[I_MAX+1]; /* materials to build 100% */
/* only I_LCM, I_HCM, I_OIL, I_RAD non-zero */
int n_bwork; /* work to build 100% */
int n_tech; /* tech needed to build */
int n_cost; /* how much it costs to build */

View file

@ -37,6 +37,7 @@
#define PLANE_H
#include <time.h>
#include "item.h"
#include "queue.h"
#include "types.h"
@ -79,8 +80,8 @@ struct plnstr {
struct plchrstr {
char *pl_name; /* full name of type of plane */
int pl_lcm; /* costs to build */
int pl_hcm;
short pl_mat[I_MAX+1]; /* materials to build 100% */
/* only I_LCM, I_HCM, I_MILIT non-zero */
int pl_bwork; /* work to build 100% */
int pl_tech; /* tech needed to build */
int pl_cost; /* how much it costs to build */
@ -89,7 +90,6 @@ struct plchrstr {
int pl_att; /* air-air attack/defense strengths */
int pl_def;
int pl_range; /* how many sectors it can fly */
int pl_crew; /* number of mil to crew it */
int pl_fuel; /* fuel consumption */
int pl_stealth; /* how stealthy is it? */
int pl_flags; /* description of capability */

View file

@ -82,8 +82,6 @@ struct shpstr {
struct mchrstr {
short m_item[I_MAX+1]; /* load limit */
int m_lcm; /* units of lcm to build */
int m_hcm; /* units of hcm to build */
int m_armor; /* how well armored it is */
int m_speed; /* how fast it can go */
int m_visib; /* how well it can be seen */
@ -93,6 +91,8 @@ struct mchrstr {
unsigned char m_nxlight; /* maximum number of xlight planes */
unsigned char m_nchoppers; /* maximum number of choppers */
char *m_name; /* full name of type of ship */
short m_mat[I_MAX+1]; /* materials to build 100% */
/* only I_LCM and I_HCM non-zero */
int m_bwork; /* work to build 100% */
int m_tech; /* tech required to build */
int m_cost; /* how much it costs to build */