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, 1996
* Markus Armbruster, 2007
* Markus Armbruster, 2007-2016
*/
#include <config.h>
@ -41,14 +41,14 @@
/*
* Get build materials from sector @sp.
* @bp is the sector's build pointer.
* @mvec[] defines the materials needed to build 100%.
* Array @mvec[ITEM_MAX+1] defines the materials needed to build 100%.
* @pct is the percentage to build.
* Adjust build percentage downwards so that available materials
* suffice. Remove the materials.
* Return adjusted build percentage.
*/
int
get_materials(struct sctstr *sp, struct bp *bp, int *mvec, int pct)
get_materials(struct sctstr *sp, struct bp *bp, short mvec[], int pct)
{
int i, amt;