budget: Track sector expenses in nat_budget[]
The update summarizes sector production, building and maintenance for budget in a two-dimensional array int p_sect[SCT_BUDG_MAX+1][2]. All references into this array use literals as second subscript. Bzzzt, wrong data type. Add two one-dimensional arrays to nat_budget[], one for production, and one for building and maintenance. p_sect[i] becomes nat_budget[cnum].prod[i] for production, and .bm[j] for building and maintenance. p_sect[i][0] becomes .count, and -p_sect[i][1] becomes .money. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
bb495cac60
commit
16f9a393c4
4 changed files with 44 additions and 40 deletions
|
|
@ -105,9 +105,6 @@ update_main(void)
|
|||
logerror("done preparing sectors.");
|
||||
logerror("producing for countries...");
|
||||
for (i = 0; i < MAXNOC; i++) {
|
||||
int p_sect[SCT_BUDG_MAX+1][2];
|
||||
|
||||
memset(p_sect, 0, sizeof(p_sect));
|
||||
if (!(np = getnatp(i)))
|
||||
continue;
|
||||
if (np->nat_stat == STAT_SANCT) {
|
||||
|
|
@ -120,7 +117,7 @@ update_main(void)
|
|||
prod_land(etu, i, NULL, 0);
|
||||
|
||||
/* produce all sects */
|
||||
produce_sect(np, etu, NULL, p_sect);
|
||||
produce_sect(np, etu, NULL);
|
||||
|
||||
/* build units */
|
||||
prod_ship(etu, i, NULL, 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue