Declare all configuration variables in optlist.h. Include that

instead of declaring them all over the place.  This uncovered type
errors:
(s_p_etu, adj_update): Defined long, sometimes declared int.  Kills
big endian machines where sizeof(long) != sizeof(int).  Change to
int.

(set_option, delete_option, optstrset, intset, floatset, doubleset,
longset, optionset, optiondel, worldxset): Change linkage to static.
This commit is contained in:
Markus Armbruster 2004-02-17 22:58:04 +00:00
parent 80aae5b8e6
commit 8cd0160176
62 changed files with 143 additions and 258 deletions

View file

@ -42,12 +42,6 @@ struct option_list {
extern struct option_list Options[];
extern void set_option(const char *key);
extern void delete_option(const char *key);
extern int WORLD_X;
extern int WORLD_Y;
extern int opt_NO_FORT_FIRE;
extern int opt_TREATIES;
extern int opt_BRIDGETOWERS;
@ -99,23 +93,119 @@ extern int opt_INTERDICT_ATT;
extern int opt_TECH_POP;
extern int opt_ROLLOVER_AVAIL;
struct keymatch; /* forward decl */
/* function prototype for variable setting routines */
typedef void KmFunc(struct keymatch * kp, s_char **av);
/* current known routines */
#if defined(__cplusplus) || (defined(__STDC__) &&__STDC__)
KmFunc optstrset, intset, floatset, doubleset, longset,
optionset, optiondel, worldxset;
#else
void optstrset(), intset(), floatset(), doubleset(), longset(),
optionset(), optiondel(), worldxset();
#endif
extern s_char *datadir;
extern s_char *infodir;
extern s_char *loginport;
extern s_char *privname;
extern s_char *privlog;
extern int WORLD_X;
extern int WORLD_Y;
extern int update_policy;
extern int etu_per_update;
extern int s_p_etu;
extern int adj_update;
extern int update_window;
extern s_char *update_times;
extern int hourslop;
extern int blitz_time;
extern int update_demandpolicy;
extern int update_wantmin;
extern int update_missed;
extern s_char *update_demandtimes;
extern s_char *game_days;
extern s_char *game_hours;
extern float btu_build_rate;
extern int m_m_p_d;
extern int max_btus;
extern int max_idle;
extern int players_at_00;
extern int at_least_one_100;
extern double powe_cost;
extern int War_Cost;
extern float easy_tech;
extern float hard_tech;
extern float start_technology;
extern float start_happiness;
extern float start_research;
extern float start_education;
extern float level_age_rate;
extern float tech_log_base;
extern float ally_factor;
extern float edu_avg;
extern float hap_avg;
extern double edu_cons;
extern double hap_cons;
extern int startmob;
extern float sect_mob_scale;
extern int sect_mob_max;
extern int buil_bh;
extern double buil_bc;
extern double buil_bt;
extern int buil_tower_bh;
extern double buil_tower_bc;
extern double buil_tower_bt;
extern float land_mob_scale;
extern int land_grow_scale;
extern int land_mob_max;
extern double money_land;
extern int morale_base;
extern float plane_mob_scale;
extern int plane_grow_scale;
extern int plane_mob_max;
extern double money_plane;
extern float ship_mob_scale;
extern int ship_grow_scale;
extern int ship_mob_max;
extern double money_ship;
extern int torpedo_damage;
extern int fort_max_interdiction_range;
extern int land_max_interdiction_range;
extern int ship_max_interdiction_range;
extern double flakscale;
extern double combat_mob;
extern double people_damage;
extern double unit_damage;
extern double collateral_dam;
extern double assault_penalty;
extern float fire_range_factor;
extern int sect_mob_neg_factor;
extern double mission_mob_cost;
extern double uwbrate;
extern double money_civ;
extern double money_mil;
extern double money_res;
extern double money_uw;
extern double babyeat;
extern double bankint;
extern double eatrate;
extern double fcrate;
extern double fgrate;
extern double obrate;
extern double decay_per_etu;
extern double fallout_spread;
extern float drnuke_const;
extern int MARK_DELAY;
extern int TRADE_DELAY;
extern double maxmult;
extern double minmult;
extern double buytax;
extern double tradetax;
extern int trade_1_dist;
extern int trade_2_dist;
extern int trade_3_dist;
extern float trade_1;
extern float trade_2;
extern float trade_3;
extern float trade_ally_bonus;
extern float trade_ally_cut;
extern int fuel_mult;
extern int lost_items_timeout;
extern long last_demand_update;
struct keymatch {
s_char *km_key; /* the key */
KmFunc *km_func; /* the function to call if matches */
void (*km_func)(struct keymatch * kp, s_char **av);
/* the function to call if matches */
caddr_t km_data; /* associated data */
int km_flags; /* useful flags */
#define KM_ALLOC 0x01 /* memory allocated */

View file

@ -80,8 +80,6 @@ extern int etu_per_update;
int
buil(void)
{
extern double buil_bt;
extern double buil_tower_bt;
struct sctstr sect;
struct nstr_sect nstr;
struct natstr *natp;
@ -100,7 +98,6 @@ buil(void)
int gotsect = 0;
int built;
int hold, found, number = 1, x;
extern float drnuke_const;
int asked = 0;
s_char buf[1024];
@ -652,8 +649,6 @@ build_land(register struct sctstr *sp, register struct lchrstr *lp,
static int
build_bridge(register struct sctstr *sp, register int *vec)
{
extern int buil_bh;
extern double buil_bc;
struct sctstr sect;
int val;
int newx, newy;
@ -1003,8 +998,6 @@ build_plane(register struct sctstr *sp, register struct plchrstr *pp,
static int
build_tower(register struct sctstr *sp, register int *vec)
{
extern int buil_tower_bh;
extern double buil_tower_bc;
struct sctstr sect;
int val;
int newx, newy;

View file

@ -78,8 +78,6 @@ buy(void)
time_t now;
double tally;
double canspend;
extern double buytax;
extern double tradetax;
s_char buf[1024];
if (!opt_MARKET) {
@ -224,7 +222,6 @@ buy(void)
int
check_market(void)
{
extern double buytax;
struct comstr comm;
struct sctstr *sect;
struct ichrstr *ip;

View file

@ -690,7 +690,6 @@ static int
docountry(s_char op, int arg, s_char *p, float farg, natid nat,
struct natstr *np)
{
extern int m_m_p_d;
coord newx, newy;
switch (op) {
case 'n':

View file

@ -43,6 +43,7 @@
#include "deity.h"
#include "file.h"
#include "commands.h"
#include "optlist.h"
int
fort(void)
@ -52,7 +53,6 @@ fort(void)
struct lndstr land;
int fort_amt, hard_amt;
s_char *p;
extern int land_mob_max;
s_char buf[1024];
if (!snxtitem(&ni, EF_LAND, player->argp[1]))

View file

@ -49,6 +49,7 @@
#include <unistd.h>
#endif
#include "commands.h"
#include "optlist.h"
#if 0
static int fileselect(struct dirent *dp);
@ -92,7 +93,6 @@ strnccmp(s_char *s1, s_char *s2, int n)
int
info(void)
{
extern s_char *infodir;
s_char buf[255];
FILE *fp;
s_char *bp;
@ -272,7 +272,6 @@ printdir(void)
int
apro(void)
{
extern s_char *infodir;
FILE *fp;
s_char *bp, *lbp;
s_char *fbuf;

View file

@ -118,7 +118,6 @@ look_ship(register struct shpstr *lookship)
register struct shpstr *sp;
register struct mchrstr *smcp;
register struct mchrstr *tmcp;
extern int ship_max_interdiction_range;
struct sctstr sect;
int range;
int vrange;

View file

@ -62,7 +62,6 @@ pr_mark(struct comstr *comm)
{
time_t now;
double tleft;
extern int MARK_DELAY;
(void)time(&now);
tleft = MARK_DELAY / 3600.0 - (now - comm->com_markettime) / 3600.0;

View file

@ -780,7 +780,6 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
struct sctstr firing;
struct nstr_sect ns;
struct flist *fp;
extern int torpedo_damage;
int gun;
if (own == 0)

View file

@ -50,6 +50,7 @@
#include "mission.h"
#include "genitem.h"
#include "commands.h"
#include "optlist.h"
/*
* mission <type> <planes/ships/units> <mission type> <op sector> [<radius>]
@ -67,10 +68,6 @@ mission(void)
struct genitem *gp;
int num = 0, mobmax, mobused, dist;
struct nstr_item ni;
extern int ship_mob_max;
extern int land_mob_max;
extern int plane_mob_max;
extern double mission_mob_cost;
s_char prompt[128];
s_char buf[1024];

View file

@ -47,9 +47,6 @@
int
mobq(void)
{
extern int ship_mob_max;
extern float ship_mob_scale;
extern int etu_per_update;
struct shpstr ship;
s_char *cp, *oldmq;
int good, mobquota, count = 0;

View file

@ -79,8 +79,6 @@ mult(void)
static void
multsingle(natid us, natid them, struct natstr *natp)
{
extern double minmult;
extern double maxmult;
double price;
s_char *p;
s_char prompt[128];

View file

@ -44,8 +44,6 @@
int
nati(void)
{
extern int etu_per_update;
extern double obrate, uwbrate;
struct natstr *natp;
struct sctstr sect;
float hap;

View file

@ -64,9 +64,6 @@ static struct range defrealm = { -8, -5, 10, 5, 0, 0 };
int
new(void)
{
extern int max_btus;
extern int players_at_00;
extern int at_least_one_100;
#ifdef START_UNITS
extern int start_unit_type[START_UNITS];
#endif /* START_UNITS */
@ -80,7 +77,6 @@ new(void)
int i;
s_char *p;
int n;
extern int startmob;
s_char buf[1024];
natp = getnatp(player->cnum);
@ -316,7 +312,6 @@ ok(s_char *map, int x, int y)
static int
deity_build_land(int type, coord x, coord y, natid own, int tlev)
{
extern int land_mob_max;
struct lndstr land;
struct lchrstr *lp;
struct nstr_item nstr;

View file

@ -47,8 +47,6 @@
int
newe(void)
{
extern double obrate, uwbrate;
extern int etu_per_update;
struct natstr *natp;
struct sctstr sect;
struct nstr_sect nstr;

View file

@ -333,8 +333,6 @@ orde(void)
static void
eta_calc(struct shpstr *sp, s_char *path, int *len, int *nupdates)
{
extern int etu_per_update;
extern float ship_mob_scale;
struct mchrstr *mcp;
double mobcost, mobil;
int i;

View file

@ -54,14 +54,6 @@ payo(void)
struct mchrstr *mp;
int dist;
float cash = 0.0;
extern int trade_1_dist; /* less than this gets no money */
extern int trade_2_dist; /* less than this gets trade_1 money */
extern int trade_3_dist; /* less than this gets trade_2 money */
extern float trade_1; /* return on trade_1 distance */
extern float trade_2; /* return on trade_2 distance */
extern float trade_3; /* return on trade_3 distance */
extern float trade_ally_bonus; /* 20% bonus for trading with allies */
if (!opt_TRADESHIPS) {
pr("Tradeships are not enabled.\n");

View file

@ -229,7 +229,6 @@ out5(double value, int round_val, int round_flag)
static void
gen_power(void)
{
extern double powe_cost;
float *f_ptr;
float *f_pt2;
register struct powstr *pow;

View file

@ -68,8 +68,6 @@ count_pop(register int n)
int
prod(void)
{
extern double obrate, uwbrate;
extern int etu_per_update;
struct natstr *natp;
struct sctstr sect;
struct nstr_sect nstr;

View file

@ -43,11 +43,11 @@
#include "file.h"
#include "nat.h"
#include "commands.h"
#include "optlist.h"
int
sate(void)
{
extern int plane_mob_max;
double tech;
int pln_uid;
struct plnstr plane;

View file

@ -58,14 +58,6 @@ union item_u {
int
scuttle_tradeship(struct shpstr *sp, int interactive)
{
extern int trade_1_dist; /* less than this gets no money */
extern int trade_2_dist; /* less than this gets trade_1 money */
extern int trade_3_dist; /* less than this gets trade_2 money */
extern float trade_1; /* return on trade_1 distance */
extern float trade_2; /* return on trade_2 distance */
extern float trade_3; /* return on trade_3 distance */
extern float trade_ally_bonus; /* 20% bonus for trading with allies */
extern float trade_ally_cut; /* 10% bonus for ally you trade with */
float cash = 0;
float ally_cash = 0;
int dist;

View file

@ -51,7 +51,6 @@ show(void)
struct natstr *natp;
int tlev;
s_char buf[1024];
extern float drnuke_const;
int rlev;
if (!(p = getstarg(player->argp[1],

View file

@ -47,6 +47,7 @@
#include "retreat.h"
#include "damage.h"
#include "commands.h"
#include "optlist.h"
static void anti_torp(int f, int ntorping, int vshipown);
static int candchrg(struct shpstr *, struct shpstr *);
@ -61,7 +62,6 @@ s_char *prsub(struct shpstr *sp);
int
torp(void)
{
extern int torpedo_damage;
natid vshipown;
int range;
int dam;
@ -404,7 +404,6 @@ fire_dchrg(struct shpstr *sp, struct shpstr *targ, int range, int ntargets)
static int
fire_torp(struct shpstr *sp, struct shpstr *targ, int range, int ntargets)
{
extern int torpedo_damage;
int dam;
int shells;
double hitchance;

View file

@ -78,8 +78,6 @@ trad(void)
struct trdstr tmpt;
union trdgenstr tg;
int plflags;
extern double tradetax;
extern double buytax;
double canspend;
time_t now;
int bid;
@ -308,7 +306,6 @@ check_trade(void)
{
int n;
int j;
extern double tradetax;
struct nstr_item ni;
struct plnstr plane;
struct lndstr land;

View file

@ -51,7 +51,6 @@ upda(void)
FILE *fp;
struct mob_acc_globals timestamps;
extern int updating_mob;
extern int update_window;
extern s_char *timestampfil;
if (opt_MOB_ACCESS) {
@ -77,14 +76,6 @@ upda(void)
if (opt_UPDATESCHED) {
time_t now, next, delta;
extern int update_time;
extern int update_policy;
extern int update_demandpolicy;
extern int update_wantmin;
extern int blitz_time;
extern s_char *update_times;
extern s_char *update_demandtimes;
extern s_char *game_days;
extern s_char *game_hours;
if (updates_disabled())
pr("UPDATES ARE DISABLED!\n");
@ -164,9 +155,6 @@ upda(void)
return (0);
} else {
extern int s_p_etu;
extern int etu_per_update;
extern int adj_update;
time_t now;
time_t upd_time;
time_t next_update;

View file

@ -52,44 +52,6 @@ extern float drnuke_const;
int
vers(void)
{
extern int s_p_etu;
extern int etu_per_update;
extern int m_m_p_d;
extern int players_at_00;
extern float btu_build_rate;
extern double fgrate, fcrate;
extern double eatrate, babyeat;
extern double obrate, uwbrate;
extern double bankint;
extern double hap_cons, edu_cons;
extern double money_civ, money_uw, money_mil, money_res;
extern float hap_avg, edu_avg, ally_factor;
extern float level_age_rate;
/* extern float easy_tech, hard_tech, tech_log_base; */
extern float easy_tech, tech_log_base;
extern int land_mob_max;
extern int land_grow_scale;
extern float land_mob_scale;
extern int sect_mob_max;
extern float sect_mob_scale;
extern int ship_mob_max;
extern float ship_mob_scale;
extern int ship_grow_scale;
extern int plane_mob_max;
extern float plane_mob_scale;
extern int plane_grow_scale;
extern int War_Cost;
extern float fire_range_factor;
extern int trade_1_dist; /* less than this gets no money */
extern int trade_2_dist; /* less than this gets trade_1 money */
extern int trade_3_dist; /* less than this gets trade_2 money */
extern float trade_1; /* return on trade_1 distance */
extern float trade_2; /* return on trade_2 distance */
extern float trade_3; /* return on trade_3 distance */
extern float trade_ally_bonus; /* 20% bonus for trading with allies */
extern float trade_ally_cut; /* 10% bonus for ally you trade with */
extern double tradetax;
extern double buytax;
struct option_list *op;
time_t now;

View file

@ -55,7 +55,6 @@ work(void)
struct lndstr land;
int work_amt, eff_amt, w;
s_char *p;
extern int land_mob_max;
coord donex = 0, doney = 1;
s_char buf[1024];

View file

@ -102,7 +102,6 @@ void
landdamage(struct lndstr *lp, int dam)
{
double damage_factor, m;
extern int land_mob_max;
m = (double)land_mob_max;
@ -183,7 +182,6 @@ effdamage(register int amt, int dam)
int
commdamage(register int amt, int dam, int vtype)
{
extern double people_damage;
int lost;
if (vtype == V_BAR && opt_SUPER_BARS)

View file

@ -44,6 +44,7 @@
#include "keyword.h"
#include "file.h"
#include "common.h"
#include "optlist.h"
#if defined(Rel4) || defined(_WIN32)
#include <time.h>
@ -59,7 +60,6 @@
int
gamehours(time_t now, int *hour)
{
extern s_char *game_days, *game_hours;
extern struct tm *localtime(const time_t *);
register s_char *bp;
register struct tm *tm;

View file

@ -47,6 +47,7 @@
#include "deity.h"
#include "player.h"
#include "common.h"
#include "optlist.h"
static s_char *logfile = 0;
@ -63,7 +64,6 @@ void
loginit(void)
{
extern s_char program[];
extern s_char *datadir;
s_char buf[1024];
#if !defined(_WIN32)

View file

@ -88,7 +88,6 @@ sect_damage(struct sctstr *sp, int dam, struct emp_qelem *list)
int
sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
{
extern double unit_damage;
struct nstr_item ni;
struct lndstr land;
struct plnstr plane;

View file

@ -126,7 +126,6 @@ vl_damage(register int pct, register u_char *typevec,
{
register int i;
register int lose;
extern double people_damage;
if (pct >= 100)
return 0;

View file

@ -54,9 +54,6 @@
void
update_policy_check(void)
{
extern int update_policy, update_demandpolicy;
extern int update_wantmin, blitz_time;
if (update_policy < 0)
update_policy = UDP_DEFAULT;
if (update_policy > UDP_MAX)
@ -80,7 +77,6 @@ demand_update_time(time_t * now)
s_char *p;
int curtime;
int hour[2];
extern s_char *update_demandtimes;
tm = localtime(now);
curtime = tm->tm_min + tm->tm_hour * 60;
@ -98,9 +94,6 @@ demand_update_time(time_t * now)
static void
regular_update_time(time_t * now, time_t * tim, time_t * delta)
{
extern int s_p_etu;
extern int etu_per_update;
extern int adj_update;
s_char *p;
time_t tw;
int secs_per_update;
@ -119,8 +112,6 @@ scheduled_update_time(time_t * now, int *which)
s_char *p, *p1;
int curtime;
int hour;
extern int hourslop;
extern s_char *update_times;
*which = -1;
p = update_times;
@ -146,7 +137,6 @@ next_scheduled_time(time_t * now, time_t * tim, time_t * delta)
int curtime;
int hour;
int mintime;
extern s_char *update_times;
p = update_times;
if (*p == 0)
@ -197,12 +187,10 @@ demand_update_want(int *want, int *pop, int which)
static int
demand_check(void)
{
extern int update_wantmin, update_missed;
struct natstr *natp;
int want, pop, cn, veto;
time_t now;
time_t cur;
extern long last_demand_update;
time(&cur);
@ -278,8 +266,6 @@ demand_check(void)
int
demandupdatecheck(void)
{
extern int update_demandpolicy;
if (UDDEM_COMSET != update_demandpolicy) {
logerror("no demand update, not policy.");
return (0);
@ -295,7 +281,6 @@ demandupdatecheck(void)
int
updatetime(time_t * now)
{
extern int update_policy;
int which;
if (opt_BLITZ && update_policy == UDP_BLITZ) {
@ -333,9 +318,7 @@ next_update_time(time_t * now, time_t * tim, time_t * delta)
/* Time of next update */
/* Seconds till next update */
{
extern int update_policy;
time_t stim, sdelta;
extern int blitz_time;
switch (update_policy) {
case UDP_NORMAL:
@ -369,9 +352,7 @@ next_update_check_time(time_t * now, time_t * tim, time_t * delta)
/* Time of next update */
/* Seconds till next update check */
{
extern int update_policy;
time_t stim, sdelta;
extern int blitz_time;
switch (update_policy) {
case UDP_NORMAL:

View file

@ -61,6 +61,7 @@
extern char *strdup();
#endif /* NOSTRDUP */
#if 0
/* All the configurable variables ... */
extern s_char *infodir, *datadir, *loginport, *privname,
*privlog;
@ -123,10 +124,20 @@ extern float start_technology, start_research;
extern int trade_1_dist, trade_2_dist, trade_3_dist;
extern float trade_1, trade_2, trade_3, trade_ally_bonus, trade_ally_cut;
#endif
/* Dummy one */
static int emp_config_dummy;
static void optstrset(struct keymatch *kp, s_char **av);
static void intset(struct keymatch *kp, s_char **av);
static void floatset(struct keymatch *kp, s_char **av);
static void doubleset(struct keymatch *kp, s_char **av);
static void longset(struct keymatch *kp, s_char **av);
static void optionset(struct keymatch *kp, s_char **av);
static void optiondel(struct keymatch *kp, s_char **av);
static void worldxset(struct keymatch *kp, s_char **av);
/* things that can be changed */
struct keymatch configkeys[] = {
{"", intset, (caddr_t)&emp_config_dummy, 0,
@ -502,7 +513,7 @@ keylookup(register s_char *command, struct keymatch *tbl)
}
/* worldx int setting function */
void
static void
worldxset(struct keymatch *kp, s_char **av)
{
int *intptr = (int *)kp->km_data;
@ -517,7 +528,7 @@ worldxset(struct keymatch *kp, s_char **av)
}
/* generic int setting function */
void
static void
intset(struct keymatch *kp, s_char **av)
{
int *intptr = (int *)kp->km_data;
@ -528,7 +539,7 @@ intset(struct keymatch *kp, s_char **av)
}
/* generic float set function */
void
static void
floatset(struct keymatch *kp, s_char **av)
{
float *floatptr = (float *)kp->km_data;
@ -541,7 +552,7 @@ floatset(struct keymatch *kp, s_char **av)
/* generic string set function */
void
static void
optstrset(struct keymatch *kp, s_char **av)
{
s_char **confstrp = (s_char **)kp->km_data;
@ -555,7 +566,7 @@ optstrset(struct keymatch *kp, s_char **av)
}
/* generic double set function */
void
static void
doubleset(struct keymatch *kp, s_char **av)
{
double *doublep = (double *)kp->km_data;
@ -566,7 +577,7 @@ doubleset(struct keymatch *kp, s_char **av)
}
/* generic long set function */
void
static void
longset(struct keymatch *kp, s_char **av)
{
long int *longp = (long int *)kp->km_data;
@ -636,7 +647,7 @@ print_config(FILE * fp)
/* add an option to the list */
void
static void
set_option(const char *s)
{
struct option_list *op;
@ -648,7 +659,7 @@ set_option(const char *s)
}
/* delete an option from the list */
void
static void
delete_option(const char *s)
{
struct option_list *op;
@ -660,7 +671,7 @@ delete_option(const char *s)
}
/* config interface */
void
static void
optionset(struct keymatch *kp, s_char **av)
/* unused - we have a well known global */
{
@ -671,7 +682,7 @@ optionset(struct keymatch *kp, s_char **av)
}
/* config interface */
void
static void
optiondel(struct keymatch *kp, s_char **av)
/* unused - we have a well known global */
{

View file

@ -48,9 +48,9 @@ int MARK_DELAY = 7200; /* Seconds to bid on commodities */
int TRADE_DELAY = 7200; /* Seconds to bid on units */
int m_m_p_d = 1440; /* max mins of play per day (per country) */
long s_p_etu = DEF_S_P_ETU; /* seconds per Empire time unit */
int s_p_etu = DEF_S_P_ETU; /* seconds per Empire time unit */
int etu_per_update = ETUS; /* # of etu's per update, from misc.h */
long adj_update = 0; /* update time adjustment */
int adj_update = 0; /* update time adjustment */
int update_window = 0; /* update window adjustment */
int hourslop = 5; /* amount of slop to match update times */
s_char *update_times = ""; /* times regular update is allowed */

View file

@ -193,7 +193,6 @@ player_wakeup(struct player *pl)
void
player_accept(void *argv)
{
extern s_char *loginport;
struct sockaddr_in sin;
struct servent *sp;
int s;

View file

@ -51,7 +51,6 @@ dispatch(s_char *buf, s_char *redir)
{
extern struct cmndstr player_coms[];
extern int update_pending;
extern int max_btus;
struct natstr *np;
struct cmndstr *command;
int cmd;

View file

@ -74,9 +74,6 @@ init_nats(void)
static int
nat_cap(int btu)
{
extern int s_p_etu;
extern int max_btus;
extern float btu_build_rate;
struct sctstr sect;
struct natstr *np;
double d;

View file

@ -2608,8 +2608,6 @@ static void
take_move_in_mob(int combat_mode, struct llist *llp, struct combat *off,
struct combat *def)
{
extern int etu_per_update;
extern float land_mob_scale;
int mobcost;
int new;

View file

@ -58,7 +58,6 @@ extern int etu_per_update;
int
attack_val(int combat_mode, struct lndstr *lp)
{
extern double assault_penalty;
int men;
int value;
struct lchrstr *lcp;
@ -102,7 +101,6 @@ attack_val(int combat_mode, struct lndstr *lp)
int
defense_val(struct lndstr *lp)
{
extern int land_mob_max;
int men;
double value;
struct lchrstr *lcp;
@ -1359,7 +1357,6 @@ lnd_can_attack(struct lndstr *lp)
int
lnd_fortify (struct lndstr *lp, int hard_amt)
{
extern int land_mob_max;
int mob_used;
int eng;

View file

@ -119,7 +119,6 @@ ground_interdict(coord x, coord y, natid victim, s_char *s)
int
collateral_damage(coord x, coord y, int dam, struct emp_qelem *list)
{
extern double collateral_dam;
int coll;
struct sctstr sect;
@ -439,8 +438,6 @@ static int
perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
int mission, s_char *s, int hardtarget)
{
extern int land_max_interdiction_range;
extern int ship_max_interdiction_range;
struct emp_qelem *qp, missiles, bombers, escorts, airp, b, e;
struct emp_qelem *newqp;
struct genlist *glp;
@ -456,7 +453,6 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
natid plane_owner = 0;
int gun, shell, md, air_dam = 0;
double range2, prb, range, mobcost, hitchance;
extern int torpedo_damage;
getsect(x, y, &sect);

View file

@ -55,7 +55,6 @@ setrel(natid us, natid them, int rel)
int n_down = 0;
s_char *addendum = 0;
int theirrel;
extern int War_Cost;
if (rel < AT_WAR)
rel = AT_WAR;

View file

@ -228,9 +228,6 @@ lookup(int key, struct lookup *table)
void
show_bridge(int tlev)
{
extern double buil_bt, buil_bc;
extern int buil_bh;
if (tlev < buil_bt)
return;
pr("Bridges require %g tech,", buil_bt);
@ -246,9 +243,6 @@ show_bridge(int tlev)
void
show_tower(int tlev)
{
extern double buil_tower_bt, buil_tower_bc;
extern int buil_tower_bh;
if (tlev < buil_tower_bt)
return;
pr("Bridge Towers require %g tech,", buil_tower_bt);
@ -273,7 +267,6 @@ show_nuke_build(int tlev)
register struct nchrstr *np;
register int n;
register int avail;
extern float drnuke_const;
if (opt_DRNUKE)
pr("%13s lcm hcm oil rad avail tech res $\n", "");
@ -309,7 +302,6 @@ show_nuke_capab(int tlev)
register struct nchrstr *np;
register int i, j, n;
s_char *p;
extern float drnuke_const;
if (opt_DRNUKE)
pr("%13s blst dam lbs tech res $%7s abilities\n", "", "");

View file

@ -630,7 +630,6 @@ static int
shp_fort_interdiction(struct emp_qelem *list, coord newx, coord newy,
natid victim)
{
extern int fort_max_interdiction_range;
struct nstr_sect ns;
struct sctstr fsect;
int trange;

View file

@ -123,8 +123,6 @@ resupply_commod(struct lndstr *lp, int type)
}
if (opt_FUEL && type == I_PETROL) {
extern float land_mob_scale;
extern int etu_per_update;
int fuel_needed = (lp->lnd_fuelu * (((float)etu_per_update
* land_mob_scale)) / 10.0);
@ -180,8 +178,6 @@ s_commod(int own, int x, int y, int type, int total_wanted,
int can_move;
double move_cost, weight, mobcost;
int packing;
extern double eatrate;
extern int etu_per_update;
struct dchrstr *dp;
struct ichrstr *ip;
s_char buf[1024];
@ -484,9 +480,6 @@ get_minimum(struct lndstr *lp, int type)
{
struct lchrstr *lcp;
int max, want = 0;
extern double eatrate;
extern int etu_per_update;
extern float land_mob_scale;
lcp = &lchr[(int)lp->lnd_type];
max = vl_find(V_ITEM(type), lcp->l_vtype, lcp->l_vamt, (int)lcp->l_nv);

View file

@ -64,8 +64,6 @@ takeover(register struct sctstr *sp, natid newown)
struct nstr_item ni;
struct plnstr p;
struct lndstr land;
extern int etu_per_update;
extern int sect_mob_neg_factor;
/* Wipe all the distribution info */
memset(vec, 0, sizeof(vec));

View file

@ -36,11 +36,11 @@
#include "file.h"
#include "update.h"
#include "gen.h"
#include "optlist.h"
void
age_levels(int etu)
{
extern float level_age_rate;
register float best_tech;
register float best_res;
register struct natstr *np;

View file

@ -65,7 +65,6 @@ int
do_feed(register struct sctstr *sp, register struct natstr *np, int *vec,
int *workp, int *bp, int etu)
{
extern double eatrate;
int people;
int work_avail;
int starved, sctwork;
@ -153,8 +152,6 @@ do_feed(register struct sctstr *sp, register struct natstr *np, int *vec,
static int
growfood(struct sctstr *sp, register int *vec, int work, int etu)
{
extern double fgrate;
extern double fcrate;
double food_fertil;
double food_workers;
double food;
@ -189,7 +186,6 @@ growfood(struct sctstr *sp, register int *vec, int work, int etu)
int
feed_people(register int *vec, int etu, int *needed)
{
extern double eatrate;
double food_eaten;
double people_left;
int can_eat;
@ -281,9 +277,6 @@ grow_people(struct sctstr *sp, register int etu,
register struct natstr *np, int *workp, int sctwork,
register int *vec)
{
extern double obrate;
extern double uwbrate;
extern double babyeat;
int newciv;
int newuw;
int new_birth;

View file

@ -116,14 +116,12 @@ upd_land(register struct lndstr *lp, int landno, register int etus,
struct natstr *np, int *bp, int build)
/* build = 1, maintain = 0 */
{
extern int morale_base;
struct lchrstr *lcp;
int vec[I_MAX + 1];
int cvec[I_MAX + 1];
int n;
int min = morale_base - (int)np->nat_level[NAT_HLEV];
int mult;
extern double money_land;
int needed;
int cost;
int eff;
@ -244,7 +242,6 @@ static int
landrepair(register struct lndstr *land, int *vec, struct natstr *np,
int *bp, int etus)
{
extern int land_grow_scale;
register int delta;
struct sctstr *sp;
struct lchrstr *lp;
@ -369,7 +366,6 @@ int
feed_land(struct lndstr *lp, register int *vec, int etus, int *needed,
int doit)
{
extern double eatrate;
double food_eaten, ship_eaten;
double people_left;
int can_eat, need, svec[I_MAX + 1];

View file

@ -68,8 +68,6 @@ static void do_prod(int, int, int, int *, long int (*)[2], int *, int *,
void
update_main(void *argv)
{
extern int etu_per_update;
extern double money_res;
int etu = etu_per_update;
int n;
int x;
@ -220,7 +218,6 @@ do_prod(int sector_type, int etu, int n, int *bp, long int (*p_sect)[2],
int *ship_build, int *ship_maint, int *plane_build,
int *plane_maint, int *land_build, int *land_maint)
{
extern double money_mil;
struct natstr *np;
np = getnatp(n);

View file

@ -62,7 +62,6 @@ increase_mob(time_t * counter, float mult)
time_t secs;
time_t now;
time_t left;
extern long s_p_etu;
extern int updating_mob;
int newetus;
float newmob;
@ -156,7 +155,6 @@ update_all_mob(void)
void
sct_do_upd_mob(register struct sctstr *sp)
{
extern float sect_mob_scale;
int etus;
if (do_upd_checking || timestamp_fixing || update_pending)
@ -176,7 +174,6 @@ sct_do_upd_mob(register struct sctstr *sp)
void
shp_do_upd_mob(register struct shpstr *sp)
{
extern float ship_mob_scale;
int etus;
if (do_upd_checking || timestamp_fixing || update_pending)
@ -193,7 +190,6 @@ shp_do_upd_mob(register struct shpstr *sp)
void
lnd_do_upd_mob(register struct lndstr *lp)
{
extern float land_mob_scale;
int etus;
if (do_upd_checking || timestamp_fixing || update_pending)
@ -211,7 +207,6 @@ lnd_do_upd_mob(register struct lndstr *lp)
void
pln_do_upd_mob(register struct plnstr *pp)
{
extern float plane_mob_scale;
int etus;
if (do_upd_checking || timestamp_fixing || update_pending)
@ -246,8 +241,6 @@ mob_sect(register int etus)
static void
do_mob_sect(register struct sctstr *sp, register int etus)
{
extern float sect_mob_scale;
extern int sect_mob_max;
register int value;
if (sp->sct_own == 0)
@ -286,13 +279,10 @@ mob_ship(register int etus)
static void
do_mob_ship(register struct shpstr *sp, register int etus)
{
extern int ship_mob_max;
extern float ship_mob_scale;
int newfuel = 0;
register int value;
int can_add, have_fuel_for, total_add;
double d;
extern int fuel_mult;
if (sp->shp_own == 0)
return;
@ -399,13 +389,10 @@ mob_land(register int etus)
static void
do_mob_land(register struct lndstr *lp, register int etus)
{
extern int land_mob_max;
extern float land_mob_scale;
int newfuel = 0;
register int value;
int can_add, have_fuel_for, total_add;
double d;
extern int fuel_mult;
if (lp->lnd_own == 0)
return;
@ -519,8 +506,6 @@ mob_plane(register int etus)
static void
do_mob_plane(register struct plnstr *pp, register int etus)
{
extern int plane_mob_max;
extern float plane_mob_scale;
register int value;
if (pp->pln_own == 0)

View file

@ -104,8 +104,6 @@ limit_level(double level, int type, int flag)
/*
* Begin ugly hack.
*/
extern float easy_tech, tech_log_base;
level_easy[0] = easy_tech;
level_log[0] = tech_log_base;
/*
@ -132,7 +130,6 @@ prod_nat(int etu)
{
extern long money[MAXNOC];
extern long pops[MAXNOC];
extern double hap_cons, edu_cons;
extern long sea_money[MAXNOC];
extern long lnd_money[MAXNOC];
extern long air_money[MAXNOC];

View file

@ -59,9 +59,6 @@ prod_plane(int etus, int natnum, int *bp, int buildem)
/* Build = 1, maintain =0 */
{
extern double money_mil;
extern double money_plane;
extern int plane_grow_scale;
extern long air_money[MAXNOC];
register struct plnstr *pp;
register struct plchrstr *plp;

View file

@ -121,7 +121,6 @@ tax(struct sctstr *sp, struct natstr *np, int etu, long *pop, int *civ_tax,
int *uw_tax, int *mil_pay)
{
int vec[I_MAX + 1];
extern double money_civ, money_mil, money_uw;
*civ_tax = 0;
*uw_tax = 0;
@ -152,7 +151,6 @@ tax(struct sctstr *sp, struct natstr *np, int etu, long *pop, int *civ_tax,
int
upd_slmilcosts(natid n, int etu)
{
extern double money_mil;
struct shpstr *sp;
struct lndstr *lp;
int mil = 0;
@ -179,7 +177,6 @@ upd_slmilcosts(natid n, int etu)
int
bank_income(struct sctstr *sp, int etu)
{
extern double bankint;
int vec[I_MAX + 1];
if (getvec(VT_ITEM, vec, (s_char *)sp, EF_SECTOR) <= 0)

View file

@ -295,7 +295,6 @@ do_fallout(register struct sctstr *sp, register int etus)
void
spread_fallout(struct sctstr *sp, int etus)
{
extern double fallout_spread;
struct sctstr *ap;
int tvec[I_MAX + 1];
int cvec[I_MAX + 1];
@ -329,8 +328,6 @@ spread_fallout(struct sctstr *sp, int etus)
void
decay_fallout(struct sctstr *sp, int etus)
{
extern double decay_per_etu;
extern double fallout_spread;
int cvec[I_MAX + 1];
int decay;

View file

@ -126,7 +126,6 @@ upd_ship(register struct shpstr *sp, int shipno, register int etus,
s_char *resource;
int n;
int mult;
extern double money_ship;
int needed;
int cost;
int eff;
@ -267,7 +266,6 @@ static int
shiprepair(register struct shpstr *ship, int *vec, struct natstr *np,
int *bp, int etus)
{
extern int ship_grow_scale;
register int delta;
struct sctstr *sp;
struct mchrstr *mp;
@ -435,7 +433,6 @@ int
feed_ship(struct shpstr *sp, register int *vec, int etus, int *needed,
int doit)
{
extern double eatrate;
double food_eaten, land_eaten;
double people_left;
int ifood_eaten;

View file

@ -37,12 +37,12 @@
#include "empthread.h"
#include "proto.h"
#include "prototypes.h"
#include "optlist.h"
/*ARGSUSED*/
void
player_kill_idle(void *argv)
{
extern int max_idle;
struct player *p;
time_t now;

View file

@ -40,12 +40,12 @@
#include "lost.h"
#include <stdio.h>
#include "prototypes.h"
#include "optlist.h"
/*ARGSUSED*/
void
delete_lostitems(void *argv)
{
extern int lost_items_timeout;
time_t now;
struct loststr lost;
int n;

View file

@ -98,7 +98,6 @@ main(int argc, char **argv)
int debug = 0;
int op;
char *config_file = NULL;
extern s_char *datadir;
extern char *optarg;
s_char tbuf[256];
#ifdef POSIXSIGNALS

View file

@ -49,10 +49,6 @@ time_t update_time;
void
update_sched(void *argv)
{
extern int s_p_etu;
extern int etu_per_update;
extern int adj_update;
extern int update_window;
s_char *kw;
int hour[2];
int wind;

View file

@ -185,7 +185,6 @@ main(int argc, char *argv[])
int opt;
extern int optind;
extern char *optarg;
extern s_char *datadir;
char *config_file = NULL;
char tbuf[512];
int i = 0;

View file

@ -75,7 +75,6 @@ main(int argc, char *argv[])
extern s_char *timestampfil;
extern s_char *infodir;
extern s_char *commfil;
extern s_char *datadir;
s_char buf[255];
s_char tbuf[512];
s_char *filename;