/* src/lib/empthread/pthread.c */
#ifdef _EMPTH_POSIX
-extern void *empth_start(void *ctx);
extern int empth_init(char **ctx_ptr, int flags);
extern empth_t *empth_create(int prio, void (*entry) (),
int size, int flags,
extern int bdes(void);
extern int best(void);
extern int boar(void);
-extern int pinflak_planedamage(struct plnstr *, struct plchrstr *, natid,
- int);
extern int bomb(void);
extern int brea(void);
-extern s_char *dotsprintf(s_char *, s_char *, int);
-extern int goodsect(char);
-extern void prexpense(long, int *, s_char, int);
extern int budg(void);
extern int buil(void);
extern int buy(void);
extern int capi(void);
extern int carg(void);
extern int lcarg(void);
-extern int cede_sect(struct nstr_sect *, natid);
-extern void grab_sect(register struct sctstr *, natid);
-extern int cede_ship(struct nstr_item *, natid);
-extern void grab_ship(register struct shpstr *, natid);
extern int cede(void);
extern int cens(void);
extern void set_coastal(struct sctstr *);
extern int coll(void);
extern int comm(void);
extern int cons(void);
-extern long do_conv(struct nstr_sect, int, int);
extern int conv(void);
extern int coun(void);
extern int cuto(void);
extern int decl(void);
extern int deli(void);
-extern long do_demo(struct natstr *, struct nstr_sect, int, s_char *, int);
extern int demo(void);
-extern long do_desi(struct natstr *, s_char *, s_char *, long, int);
extern int desi(void);
extern int disa(void);
extern int diss(void);
extern int drop(void);
extern int dump(void);
extern int echo(void);
-extern int doland(s_char, int, s_char *, struct sctstr *);
-extern int docountry(s_char, int, s_char *, float, natid, struct natstr *);
-extern int doship(s_char, int, s_char *, struct shpstr *);
-extern int dounit(s_char, int, s_char *, struct lndstr *);
-extern int doplane(s_char, int, s_char *, struct plnstr *);
extern int edit(void);
-extern int getin(s_char **, s_char **, int *, s_char *);
-extern int errcheck(int, int, int);
extern int enab(void);
extern int enli(void);
extern int explore(void);
extern int foll(void);
extern int force(void);
extern int fort(void);
-extern int is_engineer(int, int);
extern int fuel(void);
extern int give(void);
extern int grin(void);
extern int march(void);
extern int mark(void);
extern int display_mark(s_char *);
-extern int quiet_bigdef(int, struct emp_qelem *, natid, natid, coord,
- coord, int *);
extern int multifire(void);
-extern void use_ammo(struct emp_qelem *);
-extern void do_defdam(struct emp_qelem *, double);
-extern void add_to_fired_queue(struct emp_qelem *, struct emp_qelem *);
extern int mine(void);
extern int landmine(void);
extern int mission(void);
extern int nav_map(int, int, int);
extern int ndump(void);
extern int new(void);
-extern int deity_build_land(int, coord, coord, natid, int);
extern int newe(void);
extern int news(void);
extern int nuke(void);
extern int plan(void);
extern int play(void);
extern int powe(void);
-extern int set_target(s_char *, int *);
extern int count_pop(register int);
extern int prod(void);
extern int pstat(void);
extern int scuttle_tradeship(struct shpstr *, int);
extern int scut(void);
extern void scuttle_ship(struct shpstr *);
-extern void scuttle_land(struct lndstr *);
extern int sdump(void);
extern int sct(void);
extern int sell(void);
extern int skyw(void);
extern int line_of_sight(s_char **rad, int ax, int ay, int bx, int by);
extern int sona(void);
-extern int blankrow(s_char *);
extern void plane_sona(struct emp_qelem *, int, int, struct shiplook *);
extern int spy(void);
-extern int num_units(int, int);
-extern void prunits(int, int);
-extern void prplanes(int, int);
extern int sstat(void);
extern int start(void);
extern int stop(void);
extern int supp(void);
extern int surv(void);
extern int swaps(void);
-extern void print_res(struct sctstr *);
extern int tele(void);
extern int tend(void);
extern int tend_nxtitem(struct nstr_item *, caddr_t);
extern int terr(void);
extern int thre(void);
extern int togg(void);
-extern void anti_torp(int, int, int);
-extern void fire_dchrg(struct shpstr *, struct shpstr *, int, int);
extern s_char *prsub(struct shpstr *);
extern int torp(void);
-extern int canshoot(struct shpstr *, struct shpstr *);
-extern int cantorp(struct shpstr *, struct shpstr *);
-extern int fire_torp(struct shpstr *, struct shpstr *, int, int);
-extern int candchrg(struct shpstr *, struct shpstr *);
extern int trad(void);
extern int check_trade(void);
extern int ontradingblock(int, int *);
extern int turn(void);
extern int upda(void);
extern int upgr(void);
-extern int supgr(void);
-extern int pupgr(void);
-extern int lupgr(void);
extern int vers(void);
extern int wai(void);
extern int wing(void);
extern int wipe(void);
extern int work(void);
-extern int buildeff(struct sctstr *, int, double *);
extern int zdon(void);
/*
/* log.c */
extern void loginit(void);
extern void logerror(s_char *, ...);
-extern void filelogerror(s_char *, ...);
/* maps.c */
extern int draw_map(int, s_char, int, struct nstr_sect *, int);
-extern int bmnxtsct(register struct nstr_sect *);
-extern void bitinit2(struct nstr_sect *, u_char *, int);
extern int unit_map(int, int, struct nstr_sect *, s_char *);
extern int bmaps_intersect(natid, natid);
extern int share_bmap(natid, natid, struct nstr_sect *, s_char, s_char *);
extern int decode(natid, long, void *, int);
extern int nstr_exec(struct nscstr *, register int, void *, int);
/* path.c */
-extern s_char *bp_init(void);
-extern int best_path(struct sctstr *, struct sctstr *, s_char *, int);
extern void bp_enable_cachepath();
extern void bp_disable_cachepath();
extern void bp_clear_cachepath();
extern void setfdtablesize(int, int);
extern s_char *getstarg(s_char *, s_char *, s_char *);
extern s_char *getstring(s_char *, s_char *);
-extern int ifloor(double);
-extern int iceil(double);
#if !defined(_WIN32)
extern s_char *inet_ntoa(struct in_addr);
#endif
extern int deltax(int, int);
extern int deltay(int, int);
extern int mapdist(int, int, int, int);
-extern int mapdsq(int, int, int, int);
extern double dmin(double, double);
#if !defined(_WIN32)
extern int max(int, int);
extern int roundintby(int, int);
extern int same(register s_char *, register s_char *);
extern int scthash(register int, register int, int);
-extern void blocksig(void);
-extern void unblocksig(void);
-extern const s_char *signame(int);
#ifdef NOSTRDUP
extern char *strdup(char *x);
#endif
-extern int strscan(s_char *target, s_char *string);
/*
* src/lib/global/ *.c
*/
extern void global_init(void);
-extern void init_pchr(void);
-extern void init_mchr(void);
-extern void init_plchr(void);
-
/*
/* empmod.c */
/* init_nats.c */
extern int init_nats(void);
-extern int nat_cap(int);
/* login.c */
extern void player_login(void *);
-extern int client_cmd(struct player *, int, char **);
-extern int user_cmd(struct player *, int, char **);
-extern int sanc_cmd(struct player *, int, char **);
-extern int coun_cmd(struct player *, int, char **);
-extern int pass_cmd(struct player *, int, char **);
-extern int play_cmd(struct player *, int, char **);
-extern int kill_cmd(struct player *, int, char **);
-extern int list_cmd(struct player *, int, char **);
-extern int quit_cmd(struct player *, int, char **);
/* nat.c */
extern int natbyname(s_char *, natid *);
extern int natpass(int, s_char *);
extern int emp_getbit(int, int, u_char *);
extern void emp_setbit(int, int, u_char *);
extern void emp_setbitmap(int, int, u_char *, int *);
-extern void emp_bitinit(struct nstr_sect *, u_char *);
/* getele.c */
extern int getele(s_char *, s_char *);
/* land.c */
extern s_char *mission_name(short);
extern s_char *nameofitem(s_char *, struct genitem *, int);
extern int collateral_damage(coord, coord, int, struct emp_qelem *);
-extern int dosupport(struct genlist *, coord, coord, natid, natid);
-extern void build_mission_list(struct genlist *, coord, coord, int, natid);
-extern void build_mission_list_type(struct genlist *, coord, coord, int,
- int, natid);
-extern int perform_mission(coord, coord, natid, struct emp_qelem *, int,
- s_char *, int);
-extern void mission_pln_sel(struct emp_qelem *, int, int, int);
-extern int mission_pln_arm(struct emp_qelem *, coord, coord, int,
- int, struct ichrstr *, int, int, int *);
extern int mission_pln_equip(struct plist *, struct ichrstr *, int,
s_char);
-extern int find_airport(struct emp_qelem *, coord, coord);
-extern void add_airport(struct emp_qelem *, coord, coord);
-extern void divide(struct emp_qelem *, struct emp_qelem *, coord, coord);
-extern int air_damage(struct emp_qelem *, coord, coord, int, natid,
- s_char *, int);
extern int ground_interdict(coord, coord, natid, s_char *);
extern int unit_interdict(coord, coord, natid, s_char *, int, int);
extern int off_support(coord, coord, natid, natid);
extern int def_support(coord, coord, natid, natid);
extern int oprange(struct genitem *, int, int *);
-extern void find_escorts(coord, coord, natid, struct emp_qelem *);
extern int cando(int, int);
extern s_char *mission_short_name(int);
extern void show_mission(int, struct nstr_item *);
extern int air_defense(coord, coord, natid, struct emp_qelem *,
struct emp_qelem *);
/* move.c */
-extern int move_map(s_char *, coord, coord, s_char *);
extern int check_lmines(coord, coord, double);
extern int move_ground(s_char *, struct sctstr *, struct sctstr *,
double, double, s_char *,
extern int neigh(coord, coord, natid);
/* nreport.c */
extern void nreport(natid, int, natid, int);
-extern void filereport(int, int, int, int);
/* nuke.c */
extern int nuk_postread(int, s_char *);
extern int nuk_prewrite(int, s_char *);
extern void pln_init(int, s_char *);
/* plnsub.c */
extern void count_planes(struct shpstr *);
-extern int pln_equip(struct plist *, struct ichrstr *, int, s_char);
extern int pln_onewaymission(struct sctstr *, int *, int *);
extern void pln_newlanding(struct emp_qelem *, coord, coord, int);
extern int can_be_on_ship(int, int);
extern void pr_wall(s_char *, ...);
extern void pr_player(struct player *pl, int id, s_char *buf);
extern void pr_hilite(s_char *buf);
-extern void outid(struct player *pl, int n);
extern void prredir(s_char *redir);
extern void prexec(s_char *file);
extern void prprompt(int min, int btu);
extern void mpr(int, s_char *, ...);
/* radmap.c */
-extern void radmap2(int, int, int, int, int, double, int);
extern int deltx(struct range *, coord);
/* Prototype include a typedef name.
It should be moved after the typedef declaration */
extern int setrej(natid, natid, int, int);
/* retreat.c */
extern void retreat_ship(struct shpstr *, s_char);
-extern int retreat_ship1(struct shpstr *, s_char, int);
-extern int findcondition(s_char);
extern void retreat_land(struct lndstr *, s_char);
-extern int retreat_land1(struct lndstr *, s_char, int);
extern int check_retreat_and_do_shipdamage(struct shpstr *, int);
extern int check_retreat_and_do_landdamage(struct lndstr *, int);
/* sarg.c */
extern int sarg_type(s_char *);
extern int sarg_xy(s_char *, coord *, coord *);
-extern int sarg_getrange(s_char *, register struct range *);
extern int sarg_area(s_char *, register struct range *);
extern int sarg_range(s_char *, coord *, coord *, int *);
extern int sarg_list(s_char *, register int *, int);
extern void sathead(void);
/* sect.c */
extern int sct_postread(int, s_char *);
-extern int checksect(struct sctstr *);
extern int sct_prewrite(int, s_char *);
extern int issector(s_char *);
extern void sct_init(coord, coord, s_char *);
extern int shp_prewrite(int, s_char *);
extern void shp_init(int, s_char *);
/* show.c */
-extern void sort_lookup_list(void);
extern void show_bridge(int);
extern void show_tower(int);
extern void show_item(int);
/* shpsub.c */
extern void shp_sel(struct nstr_item *, struct emp_qelem *);
extern void shp_nav(struct emp_qelem *, double *, double *, int *, natid);
-extern int shp_check_one_mines(struct mlist *);
extern int shp_sweep(struct emp_qelem *, int, natid);
-extern int shp_interdict(struct emp_qelem *, coord, coord, natid);
-extern void shp_mess(s_char *, struct mlist *);
-extern int shp_check_mines(struct emp_qelem *);
-extern int shp_check_nav(struct sctstr *);
extern s_char *shp_path(int, struct shpstr *, s_char *);
extern void shp_put(struct emp_qelem *, natid);
-extern int shp_hit_mine(struct shpstr *, struct mchrstr *);
extern void shp_list(struct emp_qelem *);
extern int shp_hardtarget(struct shpstr *);
extern void shp_view(struct emp_qelem *);
/* supply.c */
extern void resupply_all(struct lndstr *);
extern void resupply_commod(struct lndstr *, int);
-extern int get_minimum(struct lndstr *, int);
extern int supply_commod(int, int, int, int, int);
-extern int s_commod(int, int, int, int, int, int);
extern int try_supply_commod(int, int, int, int, int);
-extern s_char *itemname(int);
-extern int at_minimum(struct lndstr *, int);
extern int has_supply(struct lndstr *);
extern int use_supply(struct lndstr *);
/* takeover.c */
extern int trechk(register natid, register natid, int);
/* whatitem.c */
extern struct ichrstr *whatitem(s_char *, s_char *);
-/* wire.c */
-extern int typed_wire(natid, natid, s_char *, int);
/* wu.c */
extern void clear_telegram_is_new(natid);
extern int typed_wu(natid, natid, s_char *, int);
/* human.c */
extern int do_feed(register struct sctstr *, register struct natstr *,
int *, int *, int *, int);
-extern int growfood(struct sctstr *, register int *, int, int);
extern int feed_people(register int *, int, int *);
-extern void starvation(struct sctstr *);
-extern int grow_people(struct sctstr *, register int,
- register struct natstr *, int *, int,
- register int *);
-extern void trunc_people(struct sctstr *, register struct natstr *,
- register int *);
/* land.c */
-extern void upd_land(register struct lndstr *, int, register int,
- struct natstr *, int *, int);
extern int prod_land(int, int, int *, int);
-extern int landrepair(register struct lndstr *, int *, struct natstr *,
- int *, int);
extern int feed_land(struct lndstr *, register int *, int, int *, int);
extern int plague_land(struct lndstr *, struct natstr *, register int *,
register int *, int);
/* main.c */
extern void update_main(void *);
-extern void do_prod(int, int, int, int *, long int (*)[2], int *, int *,
- int *, int *, int *, int *);
/* material.c */
extern void get_materials(struct sctstr *, int *, int *, int);
/* mobility.c */
extern void mob_sect(register int);
-extern void do_mob_sect(register struct sctstr *, register int);
extern void mob_ship(register int);
-extern void do_mob_ship(register struct shpstr *, register int);
extern void mob_land(register int);
-extern void do_mob_land(register struct lndstr *, register int);
extern void mob_plane(register int);
-extern void do_mob_plane(register struct plnstr *, register int);
-extern void do_mob_sect(register struct sctstr *sp, register int etus);
extern void update_all_mob(void);
extern void update_timestamps(time_t offset);
extern void sct_do_upd_mob(register struct sctstr *sp);
extern void move_sat(register struct plnstr *);
/* nat.c */
extern double logx(double, double);
-extern double limit_level(double, int, int);
extern void prod_nat(int);
-extern void share_incr(register double *, register double *);
/* nav_ship.c */
-extern void scuttle_it(register struct shpstr *);
-extern void swap(register struct shpstr *);
extern int nav_ship(register struct shpstr *);
/* nav_util.c */
extern int check_nav(struct sctstr *);
extern struct sctstr *nxtsctp(register struct nstr_sect *);
/* plague.c */
extern void do_plague(struct sctstr *, struct natstr *, int);
-extern int infect_people(struct natstr *, register int *, u_int, int,
- struct sctstr *);
extern int plague_people(struct natstr *, register int *, register int *,
int);
/* plane.c */
/* produce.c */
extern int produce(struct natstr *, struct sctstr *, int *, int, int, int,
int, int *, int *);
-extern int materials_cost(struct pchrstr *, register int *, int *);
-extern void materials_charge(struct pchrstr *, register int *,
- register int);
/* removewants.c */
extern int update_removewants(void);
/* revolt.c */
-extern void take_casualties(struct sctstr *, int);
extern void revolt(struct sctstr *);
extern void guerrilla(struct sctstr *);
/* sail.c */
-extern void fltp_to_list(struct fltheadstr *, struct emp_qelem *);
extern void sail_ship(natid);
/* sect.c */
extern int dodeliver(struct sctstr *, int *);
-extern int upd_buildeff(struct natstr *, register struct sctstr *, int *,
- int *, int, int *, int, int *);
-extern int enlist(register int *, int, int *);
-extern void meltitems(int, int, int, int *, int, int, int, int);
extern void do_fallout(register struct sctstr *, register int);
extern void spread_fallout(struct sctstr *, int);
extern void decay_fallout(struct sctstr *, int);
extern void produce_sect(int natnum, int etu, int *bp,
long int (*p_sect)[2], int sector_type);
/* ship.c */
-extern void upd_ship(register struct shpstr *, int, register int,
- struct natstr *, int *, int);
extern int prod_ship(int, int, int *, int);
-extern int shiprepair(register struct shpstr *, int *, struct natstr *,
- int *, int);
extern int feed_ship(struct shpstr *, register int *, int, int *, int);
/*
static void strat_bomb(struct emp_qelem *list, struct sctstr *target);
static void comm_bomb(struct emp_qelem *list, struct sctstr *target);
static void eff_bomb(struct emp_qelem *list, struct sctstr *target);
-
+static int pinflak_planedamage(struct plnstr *pp, struct plchrstr *pcp,
+ natid from, int flak);
static void plane_bomb(struct emp_qelem *list, struct sctstr *target);
static void land_bomb(struct emp_qelem *list, struct sctstr *target);
static void ship_bomb(struct emp_qelem *list, struct sctstr *target);
-int pinflak_planedamage(struct plnstr *pp, struct plchrstr *pcp,
- natid from, int flak);
static int bombcomm[] = {
I_CIVIL,
float lflaktable[16] = { 0.20, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50,
0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85,
};
-int
+
+static int
pinflak_planedamage(struct plnstr *pp, struct plchrstr *pcp, natid from,
int flak)
{
extern int etu_per_update;
extern double money_res;
-s_char *dotsprintf(s_char *buf, s_char *format, int data);
-int goodsect(char c);
-void prexpense(long int cash, int *expensesp, s_char priority, int amount);
static void calc_all(long int (*p_sect)[2], int *taxes, int *Ncivs,
int *Nuws, int *bars, int *Nbars, int *mil,
int *ships, int *sbuild, int *nsbuild, int *smaint,
int *units, int *lbuild, int *nlbuild, int *lmaint,
int *planes, int *pbuild, int *npbuild, int *pmaint);
+static s_char *dotsprintf(s_char *buf, s_char *format, int data);
+static int goodsect(char c);
+static void prexpense(long int cash, int *expensesp, s_char priority, int amount);
int
budg(void)
free(bp);
}
-int
+static int
goodsect(char c)
{
register int x;
return 0;
}
-s_char *
+static s_char *
dotsprintf(s_char *buf, s_char *format, int data)
{
sprintf(buf, format, data);
return (s_char *)memset(buf, '.', strspn(buf, " "));
}
-void
+static void
prexpense(long int cash, int *expensesp, s_char priority, int amount)
{
if (cash > *expensesp) {
#include "commands.h"
static void cede_hdr(void);
+static int cede_sect(struct nstr_sect *, natid);
+static int cede_ship(struct nstr_item *, natid);
+static void grab_sect(register struct sctstr *, natid);
+static void grab_ship(register struct shpstr *, natid);
int
cede(void)
return cede_ship(&ni, to);
}
-int
+static int
cede_sect(struct nstr_sect *ns, natid to)
{
struct sctstr sect, osect;
-void
+static void
grab_sect(register struct sctstr *sp, natid to)
{
struct plnstr *pp;
sp->sct_mobil = 0;
}
-int
+static int
cede_ship(struct nstr_item *ni, natid to)
{
struct shpstr ship;
return RET_OK;
}
-void
+static void
grab_ship(register struct shpstr *sp, natid to)
{
register struct plnstr *pp;
#include "land.h"
#include "commands.h"
-long do_conv(struct nstr_sect nstr, int uwtoconvert, int for_real);
+static long do_conv(struct nstr_sect nstr, int uwtoconvert, int for_real);
int
conv(void)
return (int)do_conv(nstr, uwtoconvert, 1);
}
-long
+static long
do_conv(struct nstr_sect nstr, int uwtoconvert, int for_real)
{
struct sctstr sect;
*
*/
-long do_demo(struct natstr *natp, struct nstr_sect nstr, int number,
- s_char *p, int for_real);
+static long do_demo(struct natstr *natp, struct nstr_sect nstr, int number,
+ s_char *p, int for_real);
int
demo(void)
return (int)do_demo(natp, nstr, number, p, 1);
}
-long
+static long
do_demo(struct natstr *natp, struct nstr_sect nstr, int number, s_char *p,
int for_real)
{
#include "optlist.h"
#include "commands.h"
-long do_desi(struct natstr *natp, s_char *sects, s_char *deschar,
- long int cash, int for_real);
+static long do_desi(struct natstr *natp, s_char *sects, s_char *deschar,
+ long int cash, int for_real);
int
desi(void)
return (int)do_desi(natp, player->argp[1], player->argp[2], cash, 1);
}
-long
+static long
do_desi(struct natstr *natp, s_char *sects, s_char *deschar, long int cash,
int for_real)
{
#include "commands.h"
#define END -1
-static void prnat(natid n);
-static void pr_plane(struct plnstr *plane);
+
+static void benefit(natid who, int good);
+static int docountry(s_char op, int arg, s_char *p, float farg, natid nat,
+ struct natstr *np);
+static int doland(s_char op, int arg, s_char *p, struct sctstr *sect);
+static int doplane(s_char op, int arg, s_char *p, struct plnstr *plane);
+static int doship(s_char op, int arg, s_char *p, struct shpstr *ship);
+static int dounit(s_char op, int arg, s_char *p, struct lndstr *land);
+static int getin(s_char **, s_char **, int *, s_char *);
+static void noise(struct sctstr *sptr, int public_amt, s_char *name,
+ int old, int new);
static void pr_land(struct lndstr *land);
+static void pr_plane(struct plnstr *plane);
static void pr_ship(struct shpstr *ship);
+static void prnat(natid n);
static void prsect(struct sctstr *sect);
-static void noise(struct sctstr *sptr, int public_amt, s_char *name,
- int old, int new);
-static void benefit(natid who, int good);
-int doland(s_char op, int arg, s_char *p, struct sctstr *sect);
-int docountry(s_char op, int arg, s_char *p, float farg, natid nat,
- struct natstr *np);
-int doship(s_char op, int arg, s_char *p, struct shpstr *ship);
-int dounit(s_char op, int arg, s_char *p, struct lndstr *land);
-int doplane(s_char op, int arg, s_char *p, struct plnstr *plane);
int
pr("\n");
}
-int
+static int
errcheck(int num, int min, int max)
{
if (num < min)
return (num);
}
-int
+static int
getin(s_char **what, s_char **p, int *arg, s_char *buf)
{
if (!(*what = getstarg(*p, "%c xxxxx -- thing value : ", buf))) {
}
-int
+static int
doland(s_char op, int arg, s_char *p, struct sctstr *sect)
{
natid newown, oldown;
}
-
-int
+static int
docountry(s_char op, int arg, s_char *p, float farg, natid nat,
struct natstr *np)
{
}
-int
+static int
doship(s_char op, int arg, s_char *p, struct shpstr *ship)
{
coord newx, newy;
return RET_OK;
}
-int
+static int
dounit(s_char op, int arg, s_char *p, struct lndstr *land)
{
coord newx, newy;
#include "file.h"
#include "commands.h"
+static int is_engineer(int, int);
+
int
fort(void)
{
return RET_OK;
}
-int
+static int
is_engineer(int x, int y)
{
struct nstr_item ni;
struct lndstr land;
};
+static void add_to_fired_queue(struct emp_qelem *, struct emp_qelem *);
static int defend(struct emp_qelem *al,
struct emp_qelem *dl,
enum targ_type target,
struct sctstr *fsect,
struct shpstr *vship,
struct shpstr *fship, int fx, int fy, int *nd);
+static void do_defdam(struct emp_qelem *, double);
+static int quiet_bigdef(int, struct emp_qelem *, natid, natid, coord,
+ coord, int *);
+static void use_ammo(struct emp_qelem *);
int
multifire(void)
return (dam);
}
-void
+static void
do_defdam(struct emp_qelem *list, double odds)
{
}
}
-int
+static int
quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
coord ax, coord ay, int *nfiring)
{
return ((*nfiring) == 0 ? 0 : (dam / (*nfiring)));
}
-void
+static void
use_ammo(struct emp_qelem *list)
{
struct emp_qelem *qp, *next;
}
-void
+static void
add_to_fired_queue(struct emp_qelem *elem, struct emp_qelem *list)
{
struct emp_qelem *qp;
extern float start_technology, start_research;
extern int morale_base;
-static void ok(s_char *map, int x, int y);
+static int deity_build_land(int, coord, coord, natid, int);
static int isok(int x, int y);
+static void ok(s_char *map, int x, int y);
static struct range defrealm = { -8, -5, 10, 5, 0, 0 };
ok(map, diroff[dir][0] + x, diroff[dir][1] + y);
}
-int
+static int
deity_build_land(int type, coord x, coord y, natid own, int tlev)
{
extern int land_mob_max;
natid cnum;
};
-static int powcmp(struct powsort *p1, struct powsort *p2);
-static void out5(double value, int round_val, int round_flag);
-static void gen_power(void);
static void addtopow(register int *vec, register struct powstr *pow);
+static void gen_power(void);
+static void out5(double value, int round_val, int round_flag);
+static int powcmp(struct powsort *p1, struct powsort *p2);
+static int set_target(s_char *, int *);
int
powe(void)
pow->p_power += vec[I_HCM] / 5.0;
}
-int
+static int
set_target(s_char *p, int *targets)
{
int target;
#include "commands.h"
#include "optlist.h"
+static void scuttle_land(struct lndstr *);
+
union item_u {
struct shpstr ship;
struct plnstr plane;
putship(sp->shp_uid, sp);
}
-void
+static void
scuttle_land(struct lndstr *lp)
{
struct nstr_item ni;
#include "commands.h"
#include "optlist.h"
+static int blankrow(s_char *);
+
int
sona(void)
{
return 1;
}
-int
+static int
blankrow(s_char *s)
{
while (*s) {
* format: spy <SECTS>
*
*/
-static void spyline(struct sctstr *sp);
-static void insert(coord *table, int *len, coord x, coord y);
+
static int check(coord *table, int *len, coord x, coord y);
+static void insert(coord *table, int *len, coord x, coord y);
+static int num_units(int, int);
+static void prplanes(int, int);
+static void prunits(int, int);
+static void spyline(struct sctstr *sp);
int
spy(void)
return 0;
}
-int
+static int
num_units(int x, int y)
{
struct lndstr land;
return n;
}
-void
+static void
prunits(int x, int y)
{
struct lndstr land;
}
}
-void
+static void
prplanes(int x, int y)
{
struct plnstr plane;
#include "file.h"
#include "commands.h"
+static void print_res(struct sctstr *);
/*
* Syntax: swap <SECT> <SECT>
return RET_OK;
}
-void
+static void
print_res(struct sctstr *sp)
{
pr("own sect eff min gold fert oil uran\n");
#include "damage.h"
#include "commands.h"
-void anti_torp(int f, int ntorping, int vshipown);
-void fire_dchrg(struct shpstr *sp, struct shpstr *targ, int range,
- int ntargets);
+static void anti_torp(int f, int ntorping, int vshipown);
+static int candchrg(struct shpstr *, struct shpstr *);
+static int canshoot(struct shpstr *, struct shpstr *);
+static int cantorp(struct shpstr *, struct shpstr *);
+static void fire_dchrg(struct shpstr *sp, struct shpstr *targ, int range,
+ int ntargets);
+static int fire_torp(struct shpstr *, struct shpstr *, int, int);
s_char *prsub(struct shpstr *sp);
return RET_OK;
}
-void
+static void
anti_torp(int f, int ntorping, int vshipown)
{
int range;
}
/* Can ship A shoot at ship B? */
-int
+static int
canshoot(struct shpstr *a, struct shpstr *b)
{
/* Anyone can shoot a normal ship */
}
/* Can ship A torp ship B? */
-int
+static int
cantorp(struct shpstr *a, struct shpstr *b)
{
if ((mchr[(int)a->shp_type].m_flags & M_TORP) == 0)
}
/* Can ship A depth-charge (or fire guns at) ship B? */
-int
+static int
candchrg(struct shpstr *a, struct shpstr *b)
{
if ((mchr[(int)b->shp_type].m_flags & M_SUB) == 0) {
return 1;
}
-void
+static void
fire_dchrg(struct shpstr *sp, struct shpstr *targ, int range, int ntargets)
{
int dam;
}
}
-int
+static int
fire_torp(struct shpstr *sp, struct shpstr *targ, int range, int ntargets)
{
extern int torpedo_damage;
#include "file.h"
#include "commands.h"
+static int lupgr(void);
+static int pupgr(void);
+static int supgr(void);
+
int
upgr(void)
{
return RET_OK;
}
-int
+static int
lupgr(void)
{
struct sctstr sect;
return RET_OK;
}
-int
+static int
supgr(void)
{
struct sctstr sect;
return RET_OK;
}
-int
+static int
pupgr(void)
{
struct sctstr sect;
#include "optlist.h"
#include "commands.h"
+static int buildeff(struct sctstr *, int, double *);
+
int
work(void)
{
return RET_OK;
}
-int
+static int
buildeff(struct sctstr *sp, int work, double *money)
{
int vec[I_MAX + 1];
#endif
va_end(list);
}
-
-/*VARARGS*/
-void
-filelogerror(s_char *format, ...)
-{
-#if !defined(Rel4) && !defined(__linux__) && !defined(__ppc__)
- extern s_char *sys_errlist[];
-#endif /* Rel4 */
- va_list list;
- time_t now;
- s_char buf[512];
- s_char buf1[512];
- int logf;
- s_char *error;
- s_char *p;
-
- if (logfile == 0)
- loginit();
- va_start(list, format);
- vsprintf(buf, format, list);
- if ((p = index(buf, '\n')) != 0)
- *p = 0;
- (void)time(&now);
- error = "log";
- if (errno != 0)
-#ifdef Rel4
- error = strerror(errno);
-#else
- error = (s_char *)sys_errlist[errno];
-#endif /* Rel4 */
- (void)sprintf(buf1, "%s; (%s) %s", buf, error, ctime(&now));
- if ((logf = open(logfile, O_WRONLY | O_CREAT | O_APPEND, 0666)) < 0)
- return;
- (void)write(logf, buf1, strlen(buf1));
- (void)close(logf);
- errno = 0;
- va_end(list);
-}
#include "subs.h"
#include "optlist.h"
+static void bitinit2(struct nstr_sect *, u_char *, int);
+static int bmnxtsct(register struct nstr_sect *);
+
int
draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp,
int country)
/*
* get the next sector in the range
*/
-int
+static int
bmnxtsct(register struct nstr_sect *np)
{
while (1) {
/*NOTREACHED*/
}
-void
+static void
bitinit2(struct nstr_sect *np, u_char *bitmap, int country)
{
extern int *bitmaps[];
* at reboot time (maybe) so we never need to free it */
struct sctstr **neighsects = (struct sctstr **)0;
-s_char *
+static s_char *
bp_init(void)
{
struct bestp *bp;
* Find the best path from sector to to sector, and put the Empire movement
* string in path. Return 0 on success, -1 on error.
*/
-int
+static int
best_path(struct sctstr *from, struct sctstr *to, s_char *path,
int mob_type)
{
#endif
static void empth_restorectx _PROTO(());
-void *
+static void *
empth_start(void *ctx)
{
struct sigaction act;
NTLIB = $(SRCDIR)\lib\libgen.lib
OBJS = atoip.o atopi.o bit.o chance.o copy.o disassoc.o dtable.o \
- emp_config.o getstarg.o getstring.o hpux.o iceil.o inet.o io.o \
+ emp_config.o getstarg.o getstring.o hpux.o inet.o io.o \
io_mask.o ioqueue.o lock.o mapdist.o minmax.o numstr.o onearg.o \
- parse.o plur.o queue.o round.o same.o scthash.o signal.o \
- strdup.o strscan.o vsprintf.o
+ parse.o plur.o queue.o round.o same.o scthash.o \
+ strdup.o vsprintf.o
NTOBJS = atoip.obj atopi.obj bit.obj chance.obj copy.obj disassoc.obj \
- dtable.obj emp_config.obj getstarg.obj getstring.obj hpux.obj iceil.obj \
+ dtable.obj emp_config.obj getstarg.obj getstring.obj hpux.obj \
inet.obj io.obj io_mask.obj ioqueue.obj lock.obj mapdist.obj minmax.obj \
numstr.obj onearg.obj parse.obj plur.obj queue.obj round.obj same.obj \
- scthash.obj signal.obj strdup.obj strscan.obj vsprintf.obj
+ scthash.obj strdup.obj vsprintf.obj
all: $(LIB)
+++ /dev/null
-/*
- * Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- * Ken Stevens, Steve McClure
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ---
- *
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
- *
- * ---
- *
- * iceil.c: integer ceiling/floor functions
- *
- * Known contributors to this file:
- *
- */
-
-#include "gen.h"
-
-int
-iceil(double arg)
-{
- register int i;
-
- i = arg;
- return (i >= arg ? i : i + 1);
-}
-
-int
-ifloor(double arg)
-{
- register int i;
-
- i = arg;
- return (i <= arg ? i : i - 1);
-}
/*
* mapdist returns (integer) distance between two sectors.
- * mapdsq returns the square of the distance -- more efficient.
*/
#include "misc.h"
return (dx - dy) / 2 + dy;
return dy;
}
-
-int
-mapdsq(int x1, int y1, int x2, int y2)
-{
- int sq;
-
- sq = mapdist(x1, y1, x2, y2);
- return sq * sq;
-}
+++ /dev/null
-/*
- * Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- * Ken Stevens, Steve McClure
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ---
- *
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
- *
- * ---
- *
- * sig.c: block and unblock signals for critical sections
- *
- * Known contributors to this file:
- * Doug Hay, 1998
- * Steve McClure, 1998
- */
-
-#include "misc.h"
-#include "gen.h"
-#include <signal.h>
-
-u_int mask;
-
-void
-blocksig(void)
-{
-#if !defined(_WIN32)
- mask = sigsetmask(0xffffffff);
-#endif
-}
-
-void
-unblocksig(void)
-{
-#if !defined(_WIN32)
- sigsetmask(mask);
-#endif
-}
-
-#ifdef sys5
-const s_char *sys_siglist[] = {
- "no signal",
- "interrupt",
- "quit",
- "illegal instruction",
- "trace trap",
- "IOT instruction",
- "system crash imminent",
- "floating point exception",
- "kill",
- "bus error",
- "segmentation violation",
- "bad argument to system call",
- "write on a pipe with no one to read it",
- "alarm clock",
- "software termination",
- "user defined signal 1",
- "user defined signal 2",
- "death of a child",
- "power-fail restart",
- "asychronous i/o",
- "PTY read/write",
- "I/O intervention required",
- "monitor mode granted",
- "monitor mode retracted",
- "sound ack",
- "data pending",
-};
-#else
-#if (!defined __ppc__) && (!defined linux) && (!defined FBSD) && (!defined __linux__)
-/* linux and osx declare sys_siglist in signal.h */
-extern s_char *sys_siglist[];
-#endif /* linux */
-#endif /* sys5 */
-
-const s_char *
-signame(int sig)
-{
-#ifdef POSIX_SIGNALS
- if (sig <= 0 || sig > _sys_nsig)
- return "bad signal";
- return _sys_siglist[sig];
-#else /* POSIX_SIGNALS */
- if (sig <= 0 || sig > NSIG)
- return "bad signal";
- return sys_siglist[sig];
-#endif /* POSIX_SIGNALS */
-}
+++ /dev/null
-/*
- * Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- * Ken Stevens, Steve McClure
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ---
- *
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
- *
- * ---
- *
- * strscan.c: scan a string for any occurence of another string
- *
- * Known contributors to this file:
- * Steve McClure, 2000
- */
-
-#ifdef Rel4
-#include <string.h>
-#endif /* Rel4 */
-#include <stdio.h>
-#include "misc.h"
-
-int
-strscan(s_char *target, s_char *string)
-{
- int i, n, delta;
-
- if ((string == NULL) || (target == NULL))
- return (1);
- n = strlen(target);
- delta = strlen(string);
- if (delta < n)
- return (1);
- delta -= n;
- for (i = 0; i <= delta; i++) {
- if (!strncmp(target, &(string[i]), n))
- return (0);
- }
- return (1);
-}
#include "optlist.h"
#include "global.h"
+static void init_mchr(void);
+static void init_pchr(void);
+static void init_plchr(void);
+
void
global_init(void)
{
/* the same thing should be done for units... */
}
-void
+static void
init_mchr(void)
{
register struct mchrstr *mp;
}
}
-void
+static void
init_plchr(void)
{
register struct plchrstr *pp;
}
}
-void
+static void
init_pchr(void)
{
register struct pchrstr *p;
#include "common.h"
#include "gen.h"
+static int nat_cap(int);
+
int
init_nats(void)
{
return 0;
}
-int
+static int
nat_cap(int btu)
{
extern int s_p_etu;
/*NOTREACHED*/
}
-int
+static int
client_cmd(struct player *player, int ac, char **av)
{
int i;
return RET_OK;
}
-int
+static int
user_cmd(struct player *player, int ac, char **av)
{
if (ac < 1 || av[1] == '\0')
return RET_OK;
}
-int
+static int
sanc_cmd(struct player *player, int ac, char **av)
{
struct nstr_item ni;
return RET_OK;
}
-int
+static int
coun_cmd(struct player *player, int ac, char **av)
{
natid cnum;
return 0;
}
-int
+static int
pass_cmd(struct player *player, int ac, char **av)
{
if (ac < 1 || av[1] == '\0')
}
/*ARGSUSED*/
-int
+static int
play_cmd(struct player *player, int ac, char **av)
{
extern char *banfil;
}
/*ARGSUSED*/
-int
+static int
kill_cmd(struct player *player, int ac, char **av)
{
struct player *other;
}
/*ARGSUSED*/
-int
+static int
list_cmd(struct player *player, int ac, char **av)
{
struct player *lp;
}
/*ARGSUSED*/
-int
+static int
quit_cmd(struct player *player, int ac, char **av)
{
pr_id(player, C_EXIT, "so long\n");
neigh.o nreport.o nstr.o nuke.o nxtitem.o nxtsct.o paths.o plane.o \
plnsub.o pr.o radmap.o rej.o retreat.o sarg.o satmap.o \
sect.o ship.o show.o shpsub.o snxtitem.o snxtsct.o supply.o \
- takeover.o trdsub.o trechk.o whatitem.o wire.o wu.o
+ takeover.o trdsub.o trechk.o whatitem.o wu.o
NTOBJS = aircombat.obj askyn.obj aswplnsubs.obj attsub.obj bigmap.obj \
border.obj bsanct.obj caploss.obj chkmoney.obj cnumb.obj comsub.obj \
plnsub.obj pr.obj radmap.obj rej.obj retreat.obj sarg.obj satmap.obj \
sect.obj ship.obj show.obj shpsub.obj snxtitem.obj \
snxtsct.obj supply.obj takeover.obj trdsub.obj trechk.obj whatitem.obj \
- wire.obj wu.obj
+ wu.obj
all: $(LIB)
}
-/*
- * if we're not player->god, we have to set up the bitmaps
- * correctly for the owned sectors. If we are player->god,
- * forego all this (expensive) nonsense!
- */
-void
-emp_bitinit(struct nstr_sect *np, u_char *bitmap)
-{
- extern int *bitmaps[];
- struct sctstr sect;
- int eff;
-
- while (nxtsct(np, §)) {
- if (!player->owner)
- continue;
- eff = sect.sct_effic / 20;
- if (eff > 4)
- eff = 4;
- emp_setbitmap(np->x, np->y, bitmap, bitmaps[eff]);
- }
- snxtsct_rewind(np);
-}
-
/*
*
* the bit offsets for each bit pattern based on the efficiency of
natid own;
};
-s_char *mission_name(short int mission);
-s_char *nameofitem(s_char *buf, struct genitem *gp, int type);
+static void add_airport(struct emp_qelem *, coord, coord);
+static int air_damage(struct emp_qelem *, coord, coord, int, natid,
+ s_char *, int);
+static void build_mission_list(struct genlist *, coord, coord, int, natid);
+static void build_mission_list_type(struct genlist *, coord, coord, int,
+ int, natid);
+static void divide(struct emp_qelem *, struct emp_qelem *, coord, coord);
+static int dosupport(struct genlist *, coord, coord, natid, natid);
+static int find_airport(struct emp_qelem *, coord, coord);
+static int mission_pln_arm(struct emp_qelem *, coord, coord, int,
+ int, struct ichrstr *, int, int, int *);
+static void mission_pln_sel(struct emp_qelem *, int, int, int);
+static int perform_mission(coord, coord, natid, struct emp_qelem *, int,
+ s_char *, int);
/*
* Interdict commodities & transported planes
return dam;
}
-int
+static int
dosupport(struct genlist *mi, coord x, coord y, natid victim, natid actee)
{
register int cn;
return dam;
}
-void
+static void
build_mission_list(struct genlist *mi, coord x, coord y, int mission,
natid victim)
{
build_mission_list_type(mi, x, y, mission, EF_PLANE, victim);
}
-void
+static void
build_mission_list_type(struct genlist *mi, coord x, coord y, int mission,
int type, natid victim)
{
}
}
-void
+static void
find_escorts(coord x, coord y, natid cn, struct emp_qelem *escorts)
{
struct nstr_item ni;
}
}
-int
+static int
perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
int mission, s_char *s, int hardtarget)
{
* Remove all planes who cannot go on
* the mission from the plane list.
*/
-void
+static void
mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
int hardtarget)
{
* Arm only the planes at x,y
*
*/
-int
+static int
mission_pln_arm(struct emp_qelem *list, coord x, coord y, int dist,
int mission, struct ichrstr *ip, int flags,
int mission_flags, int *tech)
/*
* Return 1 if this x,y pair is in the list
*/
-int
+static int
find_airport(struct emp_qelem *airp, coord x, coord y)
{
struct emp_qelem *qp;
}
/* #*# This needs to be changed to include acc's -KHS */
-void
+static void
add_airport(struct emp_qelem *airp, coord x, coord y)
{
struct airport *a;
* Take all the planes in list 1 that
* are at x,y, and put them into list 2.
*/
-void
+static void
divide(struct emp_qelem *l1, struct emp_qelem *l2, coord x, coord y)
{
struct emp_qelem *qp, *next;
}
}
-int
+static int
air_damage(struct emp_qelem *bombers, coord x, coord y, int mission,
natid victim, s_char *s, int hardtarget)
{
#include "damage.h"
#include "prototypes.h"
-extern int move_map(s_char *what, coord curx, coord cury, s_char *arg);
+static int move_map(s_char *what, coord curx, coord cury, s_char *arg);
int
move_ground(s_char *what, struct sctstr *start, struct sctstr *end,
/*ARGSUSED*/
-int
+static int
move_map(s_char *what, coord curx, coord cury, s_char *arg)
{
struct nstr_sect ns;
#include <fcntl.h>
#include "prototypes.h"
+static void filereport(int, int, int, int);
+
void
nreport(natid actor, int event, natid victim, int times)
{
return np;
}
-void
+static void
filereport(int actor, int event, int victim, int times)
{
struct newscache *np;
#include "prototypes.h"
#include "optlist.h"
+static int pln_equip(struct plist *, struct ichrstr *, int, s_char);
+
int
pln_onewaymission(struct sctstr *target, int *shipno, int *flagp)
{
return mission_flags;
}
-int
+static int
pln_equip(struct plist *plp, struct ichrstr *ip, int flags, s_char mission)
{
register struct plchrstr *pcp;
extern int update_pending;
#include "prototypes.h"
-void outid(struct player *pl, int n);
+static void outid(struct player *pl, int n);
/*VARARGS*/
void
/*
* output hex code + space
*/
-void
+static void
outid(struct player *pl, int n)
{
s_char c;
#include "prototypes.h"
#include "optlist.h"
+static void radmap2(int, int, int, int, int, double, int);
+
void
radmap(int cx, int cy, int eff, int range, double seesub)
{
static s_char **vis;
static s_char *visbuf;
-void
+static void
radmap2(int owner,
int cx, int cy, int eff, int range, double seesub, int pr_flag)
{
#include "prototypes.h"
#include "optlist.h"
+static int findcondition(s_char);
+static int retreat_land1(struct lndstr *, s_char, int);
+static int retreat_ship1(struct shpstr *, s_char, int);
+
struct ccode {
s_char code;
s_char *desc[2];
}
}
-int
+static int
retreat_ship1(struct shpstr *sp, s_char code, int orig)
return CN_NAVIGABLE;
}
#endif
-int
+
+static int
findcondition(s_char code)
{
int x;
}
}
-int
+static int
retreat_land1(struct lndstr *lp, s_char code, int orig)
}
/* returns absolute coords */
-int
+static int
sarg_getrange(s_char *buf, register struct range *rp)
{
register int rlm;
#include "prototypes.h"
#include "optlist.h"
+static int checksect(struct sctstr *);
static void give_back_cap(struct sctstr *sp);
/*ARGSUSED*/
return 1;
}
-int
+static int
checksect(struct sctstr *sp)
{
int mil, civs, loyalcivs;
or land units. */
static int lookup_list_cnt = 0;
-void
+static void
sort_lookup_list(void)
{
struct natstr *np = getnatp(player->cnum);
extern int etu_per_update;
+static int shp_check_nav(struct sctstr *);
+static int shp_check_one_mines(struct mlist *);
+static int shp_hit_mine(struct shpstr *, struct mchrstr *);
+static void shp_mess(s_char *, struct mlist *);
+
void
shp_sel(struct nstr_item *ni, struct emp_qelem *list)
return stopping;
}
-int
+static int
shp_check_one_mines(struct mlist *mlp)
{
struct sctstr sect;
return 0;
}
-int
+static int
shp_check_mines(struct emp_qelem *ship_list)
{
struct emp_qelem *qp;
}
}
-void
+static void
shp_mess(s_char *str, struct mlist *mlp)
{
mpr(mlp->ship.shp_own, "%s %s & stays in %s\n",
free((s_char *)mlp);
}
-int
+static int
shp_check_nav(struct sctstr *sect)
{
extern struct dchrstr dchr[];
return 0;
}
-int
+static int
shp_interdict(struct emp_qelem *list, coord newx, coord newy, natid victim)
{
int stopping = 0;
(20 + (double)sp->shp_speed * onsea / 2.0 - vis));
}
-int
+static int
shp_hit_mine(struct shpstr *sp, struct mchrstr *mcp)
{
double m;
#include "player.h"
#include "prototypes.h"
+static int get_minimum(struct lndstr *, int);
+static s_char *itemname(int);
+static int s_commod(int, int, int, int, int, int);
+
/*
* We want to get enough guns to be maxed out, enough shells to
* fire once, one update's worth of food, enough fuel for
}
/* Get supplies of a certain type */
-int
+static int
s_commod(int own, int x, int y, int type, int total_wanted,
int actually_doit)
{
}
-s_char *
+static s_char *
itemname(int type)
{
register int t;
return 0;
}
-int
-at_minimum(struct lndstr *lp, int type)
-{
- int vec[I_MAX + 1];
-
- getvec(VT_ITEM, vec, (s_char *)lp, EF_LAND);
- if (vec[type] <= get_minimum(lp, type))
- return 1;
-
- return 0;
-}
-
/*
* We want to get enough shells to fire once,
* one update's worth of food, enough fuel for
* one update.
*/
-int
+static int
get_minimum(struct lndstr *lp, int type)
{
struct lchrstr *lcp;
+++ /dev/null
-/*
- * Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- * Ken Stevens, Steve McClure
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ---
- *
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
- *
- * ---
- *
- * wire.c: Write an announcement to the world
- *
- * Known contributors to this file:
- *
- */
-
-#include "misc.h"
-#include <fcntl.h>
-#if !defined(_WIN32)
-#include <sys/uio.h>
-#endif
-#include "nat.h"
-#include "tel.h"
-#include "file.h"
-#include "prototypes.h"
-
-#if 0
-int
-typed_wire(natid from, natid to, s_char *message, int type)
-{
- register s_char *bp;
- int len;
- struct telstr tel;
- struct natstr *np;
- struct iovec iov[2];
- int fd;
- s_char buf[1024];
-
- if ((np = getnatp(to)) == 0 ||
- ((np->nat_stat & STAT_NORM) == 0 &&
- (np->nat_stat & STAT_SANCT) == 0))
- return 0;
- if ((fd = open(wirebox(buf, to), O_WRONLY | O_APPEND, 0)) < 0) {
- logerror("telegram 'open' of %s (#%d) failed",
- wirebox(buf, to), to);
- return 0;
- }
- tel.tel_from = from;
- (void)time(&tel.tel_date);
- bp = message;
- while (*bp++) ;
- len = bp - message;
- if (len >= MAXTELSIZE)
- len = MAXTELSIZE;
- message[len] = 0;
- tel.tel_length = len;
- tel.tel_type = type;
- iov[0].iov_base = (caddr_t)&tel;
- iov[0].iov_len = sizeof(tel);
- iov[1].iov_base = message;
- iov[1].iov_len = len;
- if (writev(fd, iov, 2) < iov[0].iov_len + iov[1].iov_len) {
- logerror("telegram 'write' to #%d failed", to);
- } else {
- np->nat_ann++;
- /* don't do putnat because of expense */
- }
- (void)close(fd);
- return 0;
-}
-#endif
#include "gen.h"
#include "subs.h"
+static int grow_people(struct sctstr *, register int,
+ register struct natstr *, int *, int,
+ register int *);
+static int growfood(struct sctstr *, register int *, int, int);
+static void starvation(struct sctstr *);
+static void trunc_people(struct sctstr *, register struct natstr *,
+ register int *);
+
/*
* feed the individual sector
*
return sctwork;
}
-int
+static int
growfood(struct sctstr *sp, register int *vec, int work, int etu)
{
extern double fgrate;
/*
* Truncate any extra people that may be around
*/
-void
+static void
trunc_people(struct sctstr *sp, register struct natstr *np,
register int *vec)
{
* rate limitation on countries with high tech
* production? Maybe with just high education?
*/
-int
+static int
grow_people(struct sctstr *sp, register int etu,
register struct natstr *np, int *workp, int sctwork,
register int *vec)
/*
* percentage of people who starved
*/
-void
+static void
starvation(struct sctstr *sp)
{
sp->sct_work = 0;
#define MIN(x,y) ((x) > (y) ? (y) : (x))
#endif
-void upd_land(register struct lndstr *lp, int landno, register int etus,
- struct natstr *np, int *bp, int build);
+static int landrepair(register struct lndstr *, int *, struct natstr *,
+ int *, int);
+static void upd_land(register struct lndstr *lp, int landno, register int etus,
+ struct natstr *np, int *bp, int build);
int
prod_land(int etus, int natnum, int *bp, int build)
return k;
}
-void
+static void
upd_land(register struct lndstr *lp, int landno, register int etus,
struct natstr *np, int *bp, int build)
/* build = 1, maintain = 0 */
}
/*ARGSUSED*/
-int
+static int
landrepair(register struct lndstr *land, int *vec, struct natstr *np,
int *bp, int etus)
{
extern int mil_dbl_pay;
int update_pending = 0;
+static void do_prod(int, int, int, int *, long int (*)[2], int *, int *,
+ int *, int *, int *, int *);
+
/*ARGSUSED*/
void
update_main(void *argv)
/*NOTREACHED*/
}
-void
+static void
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 int update_pending;
int do_upd_checking = 0;
+static void do_mob_land(register struct lndstr *, register int);
+static void do_mob_plane(register struct plnstr *, register int);
+static void do_mob_sect(register struct sctstr *sp, register int etus);
+static void do_mob_ship(register struct shpstr *, register int);
int
increase_mob(time_t * counter, float mult)
}
}
-void
+static void
do_mob_sect(register struct sctstr *sp, register int etus)
{
extern float sect_mob_scale;
}
}
-void
+static void
do_mob_ship(register struct shpstr *sp, register int etus)
{
extern int ship_mob_max;
}
}
-void
+static void
do_mob_land(register struct lndstr *lp, register int etus)
{
extern int land_mob_max;
}
}
-void
+static void
do_mob_plane(register struct plnstr *pp, register int etus)
{
extern int plane_mob_max;
#include "update.h"
#include "subs.h"
-float levels[MAXNOC][4];
-
/*
* hap and edu avg mean that the weight on current happiness is
* (cur_hap * hap_avg + hap_prod * etu) / (hap_avg + etu);
extern float edu_avg;
extern float ally_factor;
+static void share_incr(register double *, register double *);
+
/*
* for values below the "easy level" values, production is
* as normal. For values above "easy", production gets harder
float level_easy[4] = { 0.75, 0.75, 5.00, 5.00 };
float level_log[4] = { 1.75, 2.00, 4.00, 6.00 };
+float levels[MAXNOC][4];
+
/*
* technique to limit the sharpers who turn entire countries
* into tech plants overnight...
return log10(d) / log10(base);
}
-double
+static double
limit_level(double level, int type, int flag)
{
double above_easy;
/*
* find out everyones increment
*/
-void
+static void
share_incr(register double *res, register double *tech)
{
register struct natstr *np;
#include <stdlib.h>
extern int check_nav(struct sctstr *sect);
+static void swap(register struct shpstr *);
-void
+static void
scuttle_it(register struct shpstr *sp)
{
struct sctstr *sectp;
/* flip the 2 fields that deal with autonav movement. */
/* CZ 6/1/94 */
-void
+static void
swap(register struct shpstr *sp)
{
coord tcord;
#include "lost.h"
#include "gen.h"
+static int infect_people(struct natstr *, register int *, u_int, int,
+ struct sctstr *);
+
void
do_plague(struct sctstr *sp, struct natstr *np, int etu)
{
}
/*ARGSUSED*/
-int
+static int
infect_people(struct natstr *np, register int *vec, u_int eff, int mobil,
struct sctstr *sp)
{
#include "common.h"
#include "optlist.h"
+static void materials_charge(struct pchrstr *, register int *,
+ register int);
+static int materials_cost(struct pchrstr *, register int *, int *);
+
s_char *levelnames[] =
{ "Technology", "Research", "Education", "Happiness" };
return 0;
}
-int
+static int
materials_cost(struct pchrstr *product, register int *vec, int *costp)
{
register u_char *vp;
return count;
}
-void
+static void
materials_charge(struct pchrstr *product, register int *vec,
register int count)
{
#include "lost.h"
#include "subs.h"
+static void take_casualties(struct sctstr *, int);
+
#define get_che_cnum(x) ((x) >> 8)
#define set_che_cnum(x, cn) ((x) = ((x) & 0xff) | ((cn) << 8))
#define get_che_value(x) ((x) & 0xff)
}
}
-void
+static void
take_casualties(struct sctstr *sp, int mc)
{
int orig_mil;
#include "common.h"
#include <stdlib.h>
+static void fltp_to_list(struct fltheadstr *, struct emp_qelem *);
+
static void
cost_ship(struct shpstr *sp, struct fltelemstr *ep, struct fltheadstr *fp)
{
/* The following is a total hack by Ken Stevens to cut down dramatically on repeated code 1995 */
-void
+static void
fltp_to_list(struct fltheadstr *fltp, struct emp_qelem *list)
{
struct fltelemstr *fe;
* decrease sector efficiency if old type != new type.
* Return amount of work used.
*/
-int
+static int
upd_buildeff(struct natstr *np, register struct sctstr *sp, int *workp,
int *vec, int etu, int *desig, int sctwork, int *cost)
{
* Conversion will happen much more slowly without
* some mil initially.
*/
-int
+static int
enlist(register int *vec, int etu, int *cost)
{
int maxmil;
extern int melt_item_denom[];
-void
+static void
meltitems(int etus, int fallout, int own, int *vec, int type, int x, int y,
int uid)
{
#define MIN(x,y) ((x) > (y) ? (y) : (x))
#endif
+static int shiprepair(register struct shpstr *, int *, struct natstr *,
+ int *, int);
+static void upd_ship(register struct shpstr *, int, register int,
+ struct natstr *, int *, int);
+
int
prod_ship(int etus, int natnum, int *bp, int build)
/* build = 1, maintain = 0 */
return k;
}
-void
+static void
upd_ship(register struct shpstr *sp, int shipno, register int etus,
struct natstr *np, int *bp, int build)
/* build = 1, maintain = 0 */
* battleships +8 % eff each etu. This will cost around
* 8 * 8 * $40 = $2560!
*/
-int
+static int
shiprepair(register struct shpstr *ship, int *vec, struct natstr *np,
int *bp, int etus)
{