]> git.pond.sub.org Git - empserver/blobdiff - include/update.h
Update copyright notice
[empserver] / include / update.h
index 77a2305d2d2706b7006a3ba6eddb3f9b2dafaeb7..5797b6c7d48185baa89dfa97755f536421d0289f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2016, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
@@ -28,7 +28,7 @@
  *
  *  Known contributors to this file:
  *     Ville Virrankoski, 1995
- *     Markus Armbruster, 2004-2016
+ *     Markus Armbruster, 2004-2020
  */
 
 #ifndef UPDATE_H
 #define IMPORT 0
 #define EXPORT 1
 
-#define SCT_EFFIC (SCT_TYPE_MAX + 1)
-#define SCT_MAINT (SCT_TYPE_MAX + 2)
-#define SCT_BUDG_MAX SCT_MAINT
+enum {
+    BUDG_SHP_BUILD,
+    BUDG_SHP_MAINT,
+    BUDG_PLN_BUILD,
+    BUDG_PLN_MAINT,
+    BUDG_LND_BUILD,
+    BUDG_LND_MAINT,
+    BUDG_SCT_BUILD,
+    BUDG_SCT_MAINT,
+    BUDG_BLD_MAX = BUDG_SCT_MAINT
+};
 
 struct budg_item {
-    int money;                 /* money delta */
+    double money;              /* money delta */
     int count;                 /* #things making/consuming the money */
 };
 
 /* A nation's budget for an update */
 struct budget {
-    /* military payroll */
-    struct budg_item mil;
+    /* production by sector type */
+    struct budg_item prod[ARRAY_SIZE(dchr) - 1];
+    /* level production output */
+    float level[4];
+    /* building and maintenance */
+    struct budg_item bm[BUDG_BLD_MAX + 1];
+    /* population, taxes, military payroll, bank interest */
+    struct budg_item civ, mil, uw, bars;
+    /* treasury */
+    int start_money;           /* at beginning of update */
+    double money;              /* current */
+    /* population before growth */
+    int oldowned_civs;
 };
 
 /* main.c */
+extern int update_running;
 extern struct budget nat_budget[MAXNOC];
-extern int money[MAXNOC];
-extern int pops[MAXNOC];
-extern int sea_money[MAXNOC];
-extern int lnd_money[MAXNOC];
-extern int air_money[MAXNOC];
-extern int tpops[MAXNOC];
-/* nat.c */
-extern float levels[MAXNOC][4];
 
 /* age.c */
 extern int age_people(int, int);
@@ -72,12 +84,17 @@ extern void age_levels(int);
 extern void delete_old_announcements(void);
 /* bp.c */
 extern struct bp *bp_alloc(void);
+extern int bp_skip_sect(struct bp *, struct sctstr *);
+extern int bp_skip_unit(struct bp *, struct empobj *);
+extern void bp_consider_unit(struct bp *, struct empobj *);
 extern void bp_set_from_sect(struct bp *, struct sctstr *);
 extern void bp_to_sect(struct bp *, struct sctstr *);
 /* deliver.c */
 extern void dodeliver(struct sctstr *);
 /* distribute.c */
 extern int dodistribute(struct sctstr *, int, double);
+/* fallout.c */
+extern void fallout(int);
 /* finish.c */
 extern void finish_sects(int);
 /* human.c */
@@ -86,20 +103,19 @@ extern int feed_people(short *, int);
 extern double food_needed(short *, int);
 extern int famine_victims(short *, int);
 /* land.c */
-extern int prod_land(int, int, struct bp *, int);
+extern void prep_lands(int, struct bp *);
+extern void prod_land(int, struct bp *, int);
 /* main.c */
 /* in server.h */
 /* material.c */
 extern int get_materials(struct sctstr *, short[], int);
 /* mobility.c */
-extern void mob_sect(void);
-extern void mob_ship(void);
-extern void mob_land(void);
-extern void mob_plane(void);
-extern void sct_do_upd_mob(struct sctstr *sp);
-extern void shp_do_upd_mob(struct shpstr *sp);
-extern void lnd_do_upd_mob(struct lndstr *lp);
-extern void pln_do_upd_mob(struct plnstr *pp);
+extern void mob_inc_all(int);
+extern void mob_inc_sect(struct sctstr *, int);
+extern void mob_inc_ship(struct shpstr *, int);
+extern void mob_inc_plane(struct plnstr *, int);
+extern void mob_inc_land(struct lndstr *, int);
+extern void mob_access_all(void);
 /* move_sat.c */
 extern void move_sat(struct plnstr *);
 /* nat.c */
@@ -109,21 +125,23 @@ extern void prod_nat(int);
 /* plague.c */
 extern void do_plague(struct sctstr *, int);
 extern int plague_people(struct natstr *, short *, int *, int *, int);
+extern void plague_report(natid, int, int, int, int, char *, char *);
 /* plane.c */
-extern int prod_plane(int, int, struct bp *, int);
+extern void prep_planes(int, struct bp *);
+extern void prod_plane(int, struct bp *, int);
 /* populace.c */
+extern void check_pop_loss(struct sctstr *);
 extern void populace(struct sctstr *, int);
 extern int total_work(int, int, int, int, int, int);
 /* prepare.c */
-extern void prepare_sects(int);
-extern void tax(struct sctstr *, int, int *, int *, int *);
-extern void upd_slmilcosts(int, natid);
-extern int bank_income(struct sctstr *, int);
+extern void prepare_sects(int, struct bp *);
+extern void prep_one_sect(struct sctstr *, int, struct bp *);
 extern void pay_reserve(struct natstr *, int);
 /* produce.c */
-extern int produce(struct natstr *, struct sctstr *, int *);
-extern int prod_materials_cost(struct pchrstr *, short[], int *);
-extern int prod_resource_limit(struct pchrstr *, unsigned char *);
+extern void produce(struct natstr *, struct sctstr *);
+extern double prod_output(struct sctstr *, double);
+extern double prod_materials_cost(struct pchrstr *, short[], int *);
+extern double prod_resource_limit(struct pchrstr *, unsigned char *);
 extern double prod_eff(int, float);
 /* removewants.c */
 extern int update_removewants(void);
@@ -132,11 +150,9 @@ extern void revolt(struct sctstr *);
 extern void guerrilla(struct sctstr *);
 /* sect.c */
 extern double buildeff(struct sctstr *);
-extern void do_fallout(struct sctstr *, int);
-extern void spread_fallout(struct sctstr *, int);
-extern void decay_fallout(struct sctstr *, int);
-extern void produce_sect(struct natstr *, int, struct bp *, int[][2]);
+extern void produce_sect(int, struct bp *);
 /* ship.c */
-extern int prod_ship(int, int, struct bp *, int);
+extern void prep_ships(int, struct bp *);
+extern void prod_ship(int, struct bp *, int);
 
 #endif