]> git.pond.sub.org Git - empserver/blob - include/update.h
update: Push budget update into produce(), enlist()
[empserver] / include / update.h
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2016, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                Ken Stevens, Steve McClure, Markus Armbruster
5  *
6  *  Empire is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  *  ---
20  *
21  *  See files README, COPYING and CREDITS in the root of the source
22  *  tree for related information and legal notices.  It is expected
23  *  that future projects/authors will amend these files as needed.
24  *
25  *  ---
26  *
27  *  update.h: Definitions related to the update
28  *
29  *  Known contributors to this file:
30  *     Ville Virrankoski, 1995
31  *     Markus Armbruster, 2004-2016
32  */
33
34 #ifndef UPDATE_H
35 #define UPDATE_H
36
37 #include "sect.h"
38
39 #define IMPORT  0
40 #define EXPORT  1
41
42 enum {
43     BUDG_SHP_BUILD,
44     BUDG_SHP_MAINT,
45     BUDG_PLN_BUILD,
46     BUDG_PLN_MAINT,
47     BUDG_LND_BUILD,
48     BUDG_LND_MAINT,
49     BUDG_SCT_BUILD,
50     BUDG_SCT_MAINT,
51     BUDG_BLD_MAX = BUDG_SCT_MAINT
52 };
53
54 struct budg_item {
55     int money;                  /* money delta */
56     int count;                  /* #things making/consuming the money */
57 };
58
59 /* A nation's budget for an update */
60 struct budget {
61     /* production by sector type */
62     struct budg_item prod[SCT_TYPE_MAX + 1];
63     /* building and maintenance */
64     struct budg_item bm[BUDG_BLD_MAX + 1];
65     /* population, taxes, military payroll, bank interest */
66     struct budg_item civ, mil, uw, bars;
67 };
68
69 /* main.c */
70 extern struct budget nat_budget[MAXNOC];
71 extern int money[MAXNOC];
72 extern int pops[MAXNOC];
73 extern int tpops[MAXNOC];
74 /* nat.c */
75 extern float levels[MAXNOC][4];
76
77 /* age.c */
78 extern int age_people(int, int);
79 extern void age_levels(int);
80 /* anno.c */
81 extern void delete_old_announcements(void);
82 /* bp.c */
83 extern struct bp *bp_alloc(void);
84 extern void bp_set_from_sect(struct bp *, struct sctstr *);
85 extern void bp_to_sect(struct bp *, struct sctstr *);
86 /* deliver.c */
87 extern void dodeliver(struct sctstr *);
88 /* distribute.c */
89 extern int dodistribute(struct sctstr *, int, double);
90 /* finish.c */
91 extern void finish_sects(int);
92 /* human.c */
93 extern void do_feed(struct sctstr *, struct natstr *, int, int);
94 extern int feed_people(short *, int);
95 extern double food_needed(short *, int);
96 extern int famine_victims(short *, int);
97 /* land.c */
98 extern void prod_land(int, int, struct bp *, int);
99 /* main.c */
100 /* in server.h */
101 /* material.c */
102 extern int get_materials(struct sctstr *, short[], int);
103 /* mobility.c */
104 extern void mob_sect(void);
105 extern void mob_ship(void);
106 extern void mob_land(void);
107 extern void mob_plane(void);
108 extern void sct_do_upd_mob(struct sctstr *sp);
109 extern void shp_do_upd_mob(struct shpstr *sp);
110 extern void lnd_do_upd_mob(struct lndstr *lp);
111 extern void pln_do_upd_mob(struct plnstr *pp);
112 /* move_sat.c */
113 extern void move_sat(struct plnstr *);
114 /* nat.c */
115 extern void prod_nat(int);
116 /* nxtitemp.c */
117 /* in nsc.h */
118 /* plague.c */
119 extern void do_plague(struct sctstr *, int);
120 extern int plague_people(struct natstr *, short *, int *, int *, int);
121 /* plane.c */
122 extern void prod_plane(int, int, struct bp *, int);
123 /* populace.c */
124 extern void populace(struct sctstr *, int);
125 extern int total_work(int, int, int, int, int, int);
126 /* prepare.c */
127 extern void prepare_sects(int);
128 extern void tax(struct sctstr *, int, int *);
129 extern void upd_slmilcosts(int, natid);
130 extern void bank_income(struct sctstr *, int);
131 extern void pay_reserve(struct natstr *, int);
132 /* produce.c */
133 extern void produce(struct natstr *, struct sctstr *);
134 extern int prod_materials_cost(struct pchrstr *, short[], int *);
135 extern int prod_resource_limit(struct pchrstr *, unsigned char *);
136 extern double prod_eff(int, float);
137 /* removewants.c */
138 extern int update_removewants(void);
139 /* revolt.c */
140 extern void revolt(struct sctstr *);
141 extern void guerrilla(struct sctstr *);
142 /* sect.c */
143 extern double buildeff(struct sctstr *);
144 extern void do_fallout(struct sctstr *, int);
145 extern void spread_fallout(struct sctstr *, int);
146 extern void decay_fallout(struct sctstr *, int);
147 extern void produce_sect(struct natstr *, int, struct bp *);
148 /* ship.c */
149 extern void prod_ship(int, int, struct bp *, int);
150
151 #endif