budget: Use a loop to show build and maintenance
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
2eb08f40c7
commit
cfdf52740b
2 changed files with 46 additions and 91 deletions
|
@ -49,6 +49,19 @@ static char *dotsprintf(char *buf, char *format, int data);
|
||||||
int
|
int
|
||||||
budg(void)
|
budg(void)
|
||||||
{
|
{
|
||||||
|
static struct {
|
||||||
|
char *activity;
|
||||||
|
char *object;
|
||||||
|
} bm_name[] = {
|
||||||
|
{ "Ship building", "ship" },
|
||||||
|
{ "Ship maintenance", "ship" },
|
||||||
|
{ "Plane building", "plane" },
|
||||||
|
{ "Plane maintenance", "plane" },
|
||||||
|
{ "Unit building", "unit" },
|
||||||
|
{ "Unit maintenance", "unit" },
|
||||||
|
{ "Sector building", "sector" },
|
||||||
|
{ "Sector maintenance", "sector" }
|
||||||
|
};
|
||||||
int i;
|
int i;
|
||||||
int taxes, Ncivs, Nuws, bars, Nbars;
|
int taxes, Ncivs, Nuws, bars, Nbars;
|
||||||
struct budget *budget;
|
struct budget *budget;
|
||||||
|
@ -81,75 +94,17 @@ budg(void)
|
||||||
expenses -= budget->prod[i].money;
|
expenses -= budget->prod[i].money;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (budget->bm[BUDG_SHP_BUILD].money) {
|
for (i = 0; i <= BUDG_BLD_MAX; i++) {
|
||||||
snprintf(buf, sizeof(buf), "%d ship%s",
|
if (!budget->bm[i].money)
|
||||||
budget->bm[BUDG_SHP_BUILD].count,
|
continue;
|
||||||
splur(budget->bm[BUDG_SHP_BUILD].count));
|
snprintf(buf, sizeof(buf), "%d %s%s",
|
||||||
pr("Ship building\t\t\t%-16s\t\t%8d\n",
|
budget->bm[i].count, bm_name[i].object,
|
||||||
buf, -budget->bm[BUDG_SHP_BUILD].money);
|
splur(budget->bm[i].count));
|
||||||
expenses -= budget->bm[BUDG_SHP_BUILD].money;
|
pr("%-20s\t\t%-16s\t\t%8d\n",
|
||||||
|
bm_name[i].activity, buf, -budget->bm[i].money);
|
||||||
|
expenses -= budget->bm[i].money;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (budget->bm[BUDG_SHP_MAINT].money) {
|
|
||||||
snprintf(buf, sizeof(buf), "%d ship%s",
|
|
||||||
budget->bm[BUDG_SHP_MAINT].count,
|
|
||||||
splur(budget->bm[BUDG_SHP_MAINT].count));
|
|
||||||
pr("Ship maintenance\t\t%-16s\t\t%8d\n",
|
|
||||||
buf, -budget->bm[BUDG_SHP_MAINT].money);
|
|
||||||
expenses -= budget->bm[BUDG_SHP_MAINT].money;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (budget->bm[BUDG_PLN_BUILD].money) {
|
|
||||||
snprintf(buf, sizeof(buf), "%d plane%s",
|
|
||||||
budget->bm[BUDG_PLN_BUILD].count,
|
|
||||||
splur(budget->bm[BUDG_PLN_BUILD].count));
|
|
||||||
pr("Plane building\t\t\t%-16s\t\t%8d\n",
|
|
||||||
buf, -budget->bm[BUDG_PLN_BUILD].money);
|
|
||||||
expenses -= budget->bm[BUDG_PLN_BUILD].money;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (budget->bm[BUDG_PLN_MAINT].money) {
|
|
||||||
snprintf(buf, sizeof(buf), "%d plane%s",
|
|
||||||
budget->bm[BUDG_PLN_MAINT].count,
|
|
||||||
splur(budget->bm[BUDG_PLN_MAINT].count));
|
|
||||||
pr("Plane maintenance\t\t%-16s\t\t%8d\n",
|
|
||||||
buf, -budget->bm[BUDG_PLN_MAINT].money);
|
|
||||||
expenses -= budget->bm[BUDG_PLN_MAINT].money;
|
|
||||||
}
|
|
||||||
if (budget->bm[BUDG_LND_BUILD].money) {
|
|
||||||
snprintf(buf, sizeof(buf), "%d unit%s",
|
|
||||||
budget->bm[BUDG_LND_BUILD].count,
|
|
||||||
splur(budget->bm[BUDG_LND_BUILD].count));
|
|
||||||
pr("Unit building\t\t\t%-16s\t\t%8d\n",
|
|
||||||
buf, -budget->bm[BUDG_LND_BUILD].money);
|
|
||||||
expenses -= budget->bm[BUDG_LND_BUILD].money;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (budget->bm[BUDG_LND_MAINT].money) {
|
|
||||||
snprintf(buf, sizeof(buf), "%d unit%s",
|
|
||||||
budget->bm[BUDG_LND_MAINT].count,
|
|
||||||
splur(budget->bm[BUDG_LND_MAINT].count));
|
|
||||||
pr("Unit maintenance\t\t%-16s\t\t%8d\n",
|
|
||||||
buf, -budget->bm[BUDG_LND_MAINT].money);
|
|
||||||
expenses -= budget->bm[BUDG_LND_MAINT].money;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (budget->bm[BUDG_SCT_BUILD].money) {
|
|
||||||
snprintf(buf, sizeof(buf), "%d sector%s",
|
|
||||||
budget->bm[BUDG_SCT_BUILD].count,
|
|
||||||
splur(budget->bm[BUDG_SCT_BUILD].count));
|
|
||||||
pr("Sector building\t\t\t%-16s\t\t%8d\n",
|
|
||||||
buf, -budget->bm[BUDG_SCT_BUILD].money);
|
|
||||||
expenses -= budget->bm[BUDG_SCT_BUILD].money;
|
|
||||||
}
|
|
||||||
if (budget->bm[BUDG_SCT_MAINT].count) {
|
|
||||||
snprintf(buf, sizeof(buf), "%d sector%s",
|
|
||||||
budget->bm[BUDG_SCT_MAINT].count,
|
|
||||||
splur(budget->bm[BUDG_SCT_MAINT].count));
|
|
||||||
pr("Sector maintenance\t\t%-16s\t\t%8d\n",
|
|
||||||
buf, -budget->bm[BUDG_SCT_MAINT].money);
|
|
||||||
expenses -= budget->bm[BUDG_SCT_MAINT].money;
|
|
||||||
}
|
|
||||||
if (budget->mil.money) {
|
if (budget->mil.money) {
|
||||||
snprintf(buf, sizeof(buf), "%d mil, %d res",
|
snprintf(buf, sizeof(buf), "%d mil, %d res",
|
||||||
budget->mil.count, np->nat_reserve);
|
budget->mil.count, np->nat_reserve);
|
||||||
|
|
|
@ -33,14 +33,14 @@
|
||||||
Play#1 output Play#1 1 bank 41 bars 410
|
Play#1 output Play#1 1 bank 41 bars 410
|
||||||
Play#1 output Play#1 1 refinery 2581 petrol 290
|
Play#1 output Play#1 1 refinery 2581 petrol 290
|
||||||
Play#1 output Play#1 1 enlistment center 75 mil 225
|
Play#1 output Play#1 1 enlistment center 75 mil 225
|
||||||
Play#1 output Play#1 1 Ship building 10 ships 1519
|
Play#1 output Play#1 1 Ship building 10 ships 1519
|
||||||
Play#1 output Play#1 1 Ship maintenance 32 ships 2202
|
Play#1 output Play#1 1 Ship maintenance 32 ships 2202
|
||||||
Play#1 output Play#1 1 Plane building 13 planes 1924
|
Play#1 output Play#1 1 Plane building 13 planes 1924
|
||||||
Play#1 output Play#1 1 Plane maintenance 20 planes 984
|
Play#1 output Play#1 1 Plane maintenance 20 planes 984
|
||||||
Play#1 output Play#1 1 Unit building 6 units 2300
|
Play#1 output Play#1 1 Unit building 6 units 2300
|
||||||
Play#1 output Play#1 1 Unit maintenance 16 units 510
|
Play#1 output Play#1 1 Unit maintenance 16 units 510
|
||||||
Play#1 output Play#1 1 Sector building 40 sectors 774
|
Play#1 output Play#1 1 Sector building 40 sectors 774
|
||||||
Play#1 output Play#1 1 Sector maintenance 2 sectors 120
|
Play#1 output Play#1 1 Sector maintenance 2 sectors 120
|
||||||
Play#1 output Play#1 1 Military payroll 1164 mil, 0 res 5777
|
Play#1 output Play#1 1 Military payroll 1164 mil, 0 res 5777
|
||||||
Play#1 output Play#1 1 Total expenses.....................................................24627
|
Play#1 output Play#1 1 Total expenses.....................................................24627
|
||||||
Play#1 output Play#1 1 Income from taxes 26911 civs, 9007 uws +12625
|
Play#1 output Play#1 1 Income from taxes 26911 civs, 9007 uws +12625
|
||||||
|
@ -226,14 +226,14 @@
|
||||||
Play#2 command budget
|
Play#2 command budget
|
||||||
Play#2 output Play#2 1 Sector Type Production Cost
|
Play#2 output Play#2 1 Sector Type Production Cost
|
||||||
Play#2 output Play#2 1 technical center 1 tech 300
|
Play#2 output Play#2 1 technical center 1 tech 300
|
||||||
Play#2 output Play#2 1 Ship building 2 ships 450
|
Play#2 output Play#2 1 Ship building 2 ships 450
|
||||||
Play#2 output Play#2 1 Ship maintenance 3 ships 90
|
Play#2 output Play#2 1 Ship maintenance 3 ships 90
|
||||||
Play#2 output Play#2 1 Plane building 1 plane 360
|
Play#2 output Play#2 1 Plane building 1 plane 360
|
||||||
Play#2 output Play#2 1 Plane maintenance 3 planes 144
|
Play#2 output Play#2 1 Plane maintenance 3 planes 144
|
||||||
Play#2 output Play#2 1 Unit building 1 unit 450
|
Play#2 output Play#2 1 Unit building 1 unit 450
|
||||||
Play#2 output Play#2 1 Unit maintenance 3 units 90
|
Play#2 output Play#2 1 Unit maintenance 3 units 90
|
||||||
Play#2 output Play#2 1 Sector building 26 sectors 209
|
Play#2 output Play#2 1 Sector building 26 sectors 209
|
||||||
Play#2 output Play#2 1 Sector maintenance 5 sectors 300
|
Play#2 output Play#2 1 Sector maintenance 5 sectors 300
|
||||||
Play#2 output Play#2 1 Military payroll 1900 mil, 1000 res 9994
|
Play#2 output Play#2 1 Military payroll 1900 mil, 1000 res 9994
|
||||||
Play#2 output Play#2 1 Total expenses.....................................................12387
|
Play#2 output Play#2 1 Total expenses.....................................................12387
|
||||||
Play#2 output Play#2 1 Income from taxes 6800 civs, 4000 uws +1076
|
Play#2 output Play#2 1 Income from taxes 6800 civs, 4000 uws +1076
|
||||||
|
@ -318,8 +318,8 @@
|
||||||
Play#4 command budget
|
Play#4 command budget
|
||||||
Play#4 output Play#4 1 Sector Type Production Cost
|
Play#4 output Play#4 1 Sector Type Production Cost
|
||||||
Play#4 output Play#4 1 bank 4 bars 40
|
Play#4 output Play#4 1 bank 4 bars 40
|
||||||
Play#4 output Play#4 1 Ship maintenance 10 ships 300
|
Play#4 output Play#4 1 Ship maintenance 10 ships 300
|
||||||
Play#4 output Play#4 1 Unit maintenance 10 units 600
|
Play#4 output Play#4 1 Unit maintenance 10 units 600
|
||||||
Play#4 output Play#4 1 Military payroll 1111 mil, 0 res 5552
|
Play#4 output Play#4 1 Military payroll 1111 mil, 0 res 5552
|
||||||
Play#4 output Play#4 1 Total expenses......................................................6492
|
Play#4 output Play#4 1 Total expenses......................................................6492
|
||||||
Play#4 output Play#4 1 Income from taxes 23604 civs, 4100 uws +212
|
Play#4 output Play#4 1 Income from taxes 23604 civs, 4100 uws +212
|
||||||
|
@ -389,10 +389,10 @@
|
||||||
Play#6 input budget
|
Play#6 input budget
|
||||||
Play#6 command budget
|
Play#6 command budget
|
||||||
Play#6 output Play#6 1 Sector Type Production Cost
|
Play#6 output Play#6 1 Sector Type Production Cost
|
||||||
Play#6 output Play#6 1 Ship maintenance 1 ship 540
|
Play#6 output Play#6 1 Ship maintenance 1 ship 540
|
||||||
Play#6 output Play#6 1 Plane maintenance 3 planes 144
|
Play#6 output Play#6 1 Plane maintenance 3 planes 144
|
||||||
Play#6 output Play#6 1 Unit maintenance 3 units 90
|
Play#6 output Play#6 1 Unit maintenance 3 units 90
|
||||||
Play#6 output Play#6 1 Sector maintenance 1 sector 60
|
Play#6 output Play#6 1 Sector maintenance 1 sector 60
|
||||||
Play#6 output Play#6 1 Military payroll 168 mil, 0 res 831
|
Play#6 output Play#6 1 Military payroll 168 mil, 0 res 831
|
||||||
Play#6 output Play#6 1 Total expenses......................................................1665
|
Play#6 output Play#6 1 Total expenses......................................................1665
|
||||||
Play#6 output Play#6 1 Income from taxes 4000 civs, 0 uws +1750
|
Play#6 output Play#6 1 Income from taxes 4000 civs, 0 uws +1750
|
||||||
|
@ -422,8 +422,8 @@
|
||||||
Play#7 input budget
|
Play#7 input budget
|
||||||
Play#7 command budget
|
Play#7 command budget
|
||||||
Play#7 output Play#7 1 Sector Type Production Cost
|
Play#7 output Play#7 1 Sector Type Production Cost
|
||||||
Play#7 output Play#7 1 Ship maintenance 3 ships 70
|
Play#7 output Play#7 1 Ship maintenance 3 ships 70
|
||||||
Play#7 output Play#7 1 Sector maintenance 1 sector 60
|
Play#7 output Play#7 1 Sector maintenance 1 sector 60
|
||||||
Play#7 output Play#7 1 Military payroll 160 mil, 0 res 792
|
Play#7 output Play#7 1 Military payroll 160 mil, 0 res 792
|
||||||
Play#7 output Play#7 1 Total expenses.......................................................922
|
Play#7 output Play#7 1 Total expenses.......................................................922
|
||||||
Play#7 output Play#7 1 Income from taxes 4000 civs, 0 uws +1750
|
Play#7 output Play#7 1 Income from taxes 4000 civs, 0 uws +1750
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue