* Ville Virrankoski, 1995
*/
-void fill_update_array();
-int *get_wp();
-int gt_bg_nmbr();
-void pt_bg_nmbr();
-void get_materials();
+void fill_update_array(int *bp, struct sctstr *sp);
+int *get_wp(int *bp, struct sctstr *sp, int cm);
+int gt_bg_nmbr(int *bp, struct sctstr *sp, int comm);
+void pt_bg_nmbr(int *bp, struct sctstr *sp, int comm, int amount);
+void get_materials(struct sctstr *sp, int *bp, int *mvec, int check);
extern int mil_dbl_pay;
extern int att_free_lists(struct emp_qelem *, struct emp_qelem *);
-extern double att_asupport();
-extern double att_dsupport();
-extern double att_mine_dsupport();
extern double combat_mob;
extern s_char *att_mode[];
#ifndef _EMTHREAD_H_
#define _EMTHREAD_H_
-#include "prototype.h"
#include "misc.h"
#if defined(_WIN32)
#define EMPTH_PRINT 0x1
#define EMPTH_STACKCHECK 0x2
-typedef void (*vf_ptr) ();
#define EMPTH_KILLED 1
typedef struct empth_ctx_t {
char *name; /* thread name */
char *desc; /* description */
void *ud; /* user data */
int state; /* my state */
- vf_ptr ep; /* entry point */
+ void (*ep)(void *); /* entry point */
pthread_t id; /* thread id */
} empth_t;
#endif
-int empth_init _PROTO((char **ctx, int flags));
-empth_t *empth_create _PROTO((int, void (*)(), int,
- int, char *, char *, void *));
-empth_t *empth_self();
-void empth_exit _PROTO((void));
-void empth_yield _PROTO((void));
-void empth_terminate _PROTO((empth_t *));
-void empth_select _PROTO((int fd, int flags));
-void empth_wakeup _PROTO((empth_t *));
-void empth_sleep _PROTO((long until));
-empth_sem_t *empth_sem_create _PROTO((char *name, int count));
-void empth_sem_signal _PROTO((empth_sem_t *));
-void empth_sem_wait _PROTO((empth_sem_t *));
-void empth_alarm _PROTO((int));
+int empth_init(char **ctx, int flags);
+empth_t *empth_create(int, void (*)(void *), int, int, char *, char *, void *);
+empth_t *empth_self(void);
+void empth_exit(void);
+void empth_yield(void);
+void empth_terminate(empth_t *);
+void empth_select(int fd, int flags);
+void empth_wakeup(empth_t *);
+void empth_sleep(long until);
+empth_sem_t *empth_sem_create(char *name, int count);
+void empth_sem_signal(empth_sem_t *);
+void empth_sem_wait(empth_sem_t *);
+void empth_alarm(int);
#include "prototypes.h" /* must come at end, after defines and typedefs */
u_char **, u_short **);
extern int ef_byname(s_char *);
-extern int ef_nbread();
+extern int ef_nbread(int type, int id, caddr_t ptr);
extern struct empfile empfile[];
#endif /* _FILE_H_ */
/* procedures using/returning this struct */
-extern struct ichrstr *whatitem();
+extern struct ichrstr *whatitem(s_char *ptr, s_char *prompt);
extern int itm_maxno;
extern int lnd_can_attack(struct lndstr *);
extern int lnd_fortify (struct lndstr *lp, int hard_amt);
-void landdamage();
-void lnd_nav();
-int lnd_check_nav();
-double sqrt();
-s_char *prland();
+void landdamage(struct lndstr *lp, int dam);
+s_char *prland(struct lndstr *lp);
#endif /* _LAND_H_ */
*/
#ifndef _LWP_H_
#define _LWP_H_
-#include "prototype.h"
#ifdef UCONTEXT
#include <ucontext.h>
#else /* UCONTEXT */
#endif /* UCONTEXT */
void *sbtm; /* bottom of stack attached to it */
int size; /* size of stack */
- void (*entry) (); /* entry point */
+ void (*entry)(void *); /* entry point */
int dead; /* whether the process can be rescheduled */
int pri; /* which scheduling queue we're on */
long runtime; /* time at which process is restarted */
#define LWP_MAX_PRIO 8
-struct lwpProc *lwpInitSystem _PROTO((int prio, char **ctxp, int flags));
-struct lwpProc *lwpCreate _PROTO((int prio, void (*)(), int size,
- int flags, char *name, char *desc,
- int argc, char **argv, void *ud));
-void lwpExit _PROTO((void));
-void lwpTerminate _PROTO((struct lwpProc * p));
-void lwpYield _PROTO((void));
-void lwpSleepFd _PROTO((int fd, int flags));
-void lwpSleepUntil _PROTO((long until));
-void lwpWakeupFd _PROTO((struct lwpProc * p));
-void *lwpGetUD _PROTO((struct lwpProc * p));
-void lwpSetUD _PROTO((struct lwpProc * p, char *ud));
-void lwpSetDesc _PROTO((struct lwpProc * p, char *name, char *desc));
-int lwpSetPriority _PROTO((int prio));
-void lwpReschedule _PROTO((void));
+struct lwpProc *lwpInitSystem(int prio, char **ctxp, int flags);
+struct lwpProc *lwpCreate(int prio, void (*)(void *), int size,
+ int flags, char *name, char *desc,
+ int argc, char **argv, void *ud);
+void lwpExit(void);
+void lwpTerminate(struct lwpProc * p);
+void lwpYield(void);
+void lwpSleepFd(int fd, int flags);
+void lwpSleepUntil(long until);
+void lwpWakeupFd(struct lwpProc * p);
+void *lwpGetUD(struct lwpProc * p);
+void lwpSetUD(struct lwpProc * p, char *ud);
+void lwpSetDesc(struct lwpProc * p, char *name, char *desc);
+int lwpSetPriority(int prio);
+void lwpReschedule(void);
-struct lwpSem *lwpCreateSem _PROTO((char *name, int count));
-void lwpSignal _PROTO((struct lwpSem *));
-void lwpWait _PROTO((struct lwpSem *));
-void lwpSelect _PROTO((int argc, char **argv));
-void lwpStatus _PROTO((struct lwpProc * proc, char *format, ...));
+struct lwpSem *lwpCreateSem(char *name, int count);
+void lwpSignal(struct lwpSem *);
+void lwpWait(struct lwpSem *);
+void lwpSelect(void *);
+void lwpStatus(struct lwpProc * proc, char *format, ...);
extern struct lwpProc *LwpCurrent;
/*#define _POSIX_ */
#endif
-#include "prototype.h"
#include "options.h"
/* This is the structure we use to keep track of the global mobility
#define hours(x) (60*60*(x))
#define days(x) (60*60*24*(x))
-typedef void (*voidfunc) ();
typedef int (*qsort_func_t) (const void *, const void *);
/* return codes from command routines */
#define RET_SYN 2 /* syntax error in command */
#define RET_SYS 3 /* system error (missing file, etc) */
-#define MAX_DISTPATH_LEN 10 /* Has to go somewhere */
+double dmax(double n1, double n2);
+double dmin(double n1, double n2);
-/*
- * references to library functions which aren't related to any
- * particular object, and are of general interest
- */
-#if !defined(ALPHA) && !defined(__osf__) && !defined(__linux__) && !defined(_WIN32)
-extern long random();
-#endif
-
-double dmax _PROTO((double n1, double n2));
-double dmin _PROTO((double n1, double n2));
-
-extern s_char *numstr _PROTO((s_char buf[], int n));
-extern s_char *esplur _PROTO((int n));
-extern s_char *splur _PROTO((int n));
-extern s_char *iesplur _PROTO((int n));
-extern s_char *plur _PROTO((int n, s_char *no, s_char *yes));
-extern s_char *getstarg
-_PROTO((s_char *input, s_char *prompt, s_char buf[]));
-extern s_char *getstring _PROTO((s_char *prompt, s_char buf[]));
+extern s_char *numstr(s_char buf[], int n);
+extern s_char *esplur(int n);
+extern s_char *splur(int n);
+extern s_char *iesplur(int n);
+extern s_char *plur(int n, s_char *no, s_char *yes);
+extern s_char *getstarg(s_char *input, s_char *prompt, s_char buf[]);
+extern s_char *getstring(s_char *prompt, s_char buf[]);
extern s_char *prbuf(s_char *format, ...);
-/*
- * frequently used libc functions
- */
-
-#if !defined(_WIN32)
-#if defined(linux)
-#ifndef __STDC__
-extern char *malloc();
-extern char *calloc();
-#endif
-#else
-#if !defined(ALPHA) && !defined(__osf__) && !defined(ultrix) && !defined(hpux) && !defined(FBSD)
-extern char *malloc();
-extern char *calloc();
-#endif
-#endif
-#endif
-
-#if (!defined (aix) && !defined (sgi))
-extern char *ctime();
-extern char *strncpy();
-extern char *strcpy();
-#endif /* !aix && !sgi */
-
-extern time_t time();
-#if !defined(_WIN32)
-#ifdef linux
-#ifndef atof
-extern double atof();
-#endif
-#else
-extern double atof();
-#endif
-#endif
-
-#if !defined(_WIN32)
-#if !defined (__ppc__) && !defined (hpux) && !defined (aix) && !defined (linux) && !defined(ALPHA) && !defined(__osf__) && !defined(SUN4) && !defined (Rel4) && !(defined (ultrix) && (defined (__STDC__) || defined (__SYSTEMFIVE) || defined (__POSIX)))
-extern char *sprintf();
-#endif /* aix */
-#endif
-
#define MAXCHRNV 12
#include "prototypes.h" /* must come at end, after defines and typedefs */
extern void putreject(struct natstr *np, natid them, int how, int what);
extern void putcontact(struct natstr *np, natid them, int contact);
extern void agecontact(struct natstr *np);
-extern struct fixnat *natfield();
#define NF_INFORM bit(0) /* Inform me of telegrams right away */
#define NF_FLASH bit(1) /* Allow other players to flash me (sicko :) */
#ifndef _NSC_H_
#define _NSC_H_
-#include "prototype.h"
#include "xy.h"
#define NS_LSIZE 128
struct range range; /* area of coverage */
int dist; /* dist query: range */
coord cx, cy; /* dist query: center x-y */
- int (*read) (); /* read function */
+ int (*read)(int type, int id, caddr_t ptr); /* read function */
int ncond; /* # of selection conditions */
struct nscstr cond[NS_NCOND]; /* selection conditions */
};
int size; /* NS_LIST: size of list */
int index; /* NS_LIST: index */
int list[NS_LSIZE]; /* NS_LIST: item list */
- int (*read) (); /* read function */
+ int (*read)(int type, int id, caddr_t ptr); /* read function */
int flags; /* EFF_ flags */
int ncond; /* # of selection conditions */
struct nscstr cond[NS_NCOND]; /* selection conditions */
extern int encode(register s_char *, long *, int);
-extern s_char *decodep _PROTO((register long code, register void *addr));
+extern s_char *decodep(register long code, register void *addr);
#endif /* _NSC_H_ */
#ifndef _OPTLIST_H_
#define _OPTLIST_H_
-#include "prototype.h"
-
struct option_list {
char *opt_key;
int *opt_valuep;
extern struct option_list Options[];
-extern void set_option _PROTO((const char *key));
-extern void delete_option _PROTO((const char *key));
+extern void set_option(const char *key);
+extern void delete_option(const char *key);
extern int WORLD_X;
extern int WORLD_Y;
struct keymatch; /* forward decl */
/* function prototype for variable setting routines */
-typedef void KmFunc _PROTO((struct keymatch * kp, s_char **av));
+typedef void KmFunc(struct keymatch * kp, s_char **av);
/* current known routines */
#if defined(__cplusplus) || (defined(__STDC__) &&__STDC__)
extern void pathrange(register coord, register coord, register s_char *,
int, struct range *);
-extern s_char *masktopath();
-extern long pathtomask();
-
-extern double sector_mcost();
+extern double sector_mcost(struct sctstr *sp, int do_bonus);
#define P_NONE 0 /* NO destinations allowed */
#define P_WALKING 1 /* use BestLandPath, only owned */
#define PLN_LOAD(b, t) (t ? (b * (logx((double)t, (double)50.0) < 1.0 ? 1.0 : \
logx((double)t, (double)50.0))) : b)
-double sqrt();
-double logx();
-
-float pln_damage_sect();
+double logx(double d, double base);
void count_planes();
-double sqrt();
-s_char *prplane();
+s_char *prplane(struct plnstr *pp);
/* src/lib/subs/aircombat.c */
#if !defined(_WIN32)
#include <netinet/in.h>
#endif
-#include "prototype.h"
#include "queue.h"
#include "misc.h"
#include "com.h"
+++ /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.
- *
- * ---
- *
- * prototype.h: Various prototype stuff
- *
- * Known contributors to this file:
- *
- */
-
-/* this stuff ought to be somewhere general... */
-#ifndef _PROTOTYPE_H_
-#define _PROTOTYPE_H_
-#if defined(__cplusplus) || (defined(__STDC__) &&__STDC__) || defined(_WIN32)
-#define _PROTO(x) x
-#else
-#define _PROTO(x) ()
-#define const
-#define volatile
-#endif
-#endif /* _PROTOTYPE_H_ */
/* src/lib/empthread/lwp.c */
#ifdef _EMPTH_LWP
extern int empth_init(char **ctx, int flags);
-extern empth_t *empth_create(int prio, void (*entry) (), int size,
+extern empth_t *empth_create(int prio, void (*entry)(void *), int size,
int flags, char *name, char *desc, void *ud);
#if 0
extern void empth_setctx(void *ctx);
/* src/lib/empthread/pthread.c */
#ifdef _EMPTH_POSIX
extern int empth_init(char **ctx_ptr, int flags);
-extern empth_t *empth_create(int prio, void (*entry) (),
+extern empth_t *empth_create(int prio, void (*entry)(void *),
int size, int flags,
char *name, char *desc, void *ud);
extern empth_t *empth_self(void);
extern int decode(natid, long, void *, int);
extern int nstr_exec(struct nscstr *, register int, void *, int);
/* path.c */
-extern void bp_enable_cachepath();
-extern void bp_disable_cachepath();
-extern void bp_clear_cachepath();
+extern void bp_enable_cachepath(void);
+extern void bp_disable_cachepath(void);
+extern void bp_clear_cachepath(void);
extern s_char *BestDistPath(s_char *, struct sctstr *, struct sctstr *,
double *, int);
extern s_char *BestLandPath(s_char *, struct sctstr *, struct sctstr *,
*/
/* shutdown.c */
extern void shutdown_init(void);
-extern void shutdown_sequence(int argc, s_char **argv);
+extern void shutdown_sequence(void *);
#endif /* _PROTOTYPES_H_ */
/* things relating to sectors */
extern int sctoff(coord x, coord y);
-extern double landgun();
+extern double landgun(int effic, int guns);
extern int sct_maxno;
extern struct dchrstr dchr[];
#define getshipp(n) \
(struct shpstr *) ef_ptr(EF_SHIP, n)
-extern double seagun();
+extern double seagun(int effic, int guns);
extern struct mchrstr mchr[];
extern int shp_maxno;
#define SHP_FIR(b, t) (t ? (b * (logx((double)t, (double)60.0) < 1.0 ? 1.0 : \
logx((double)t, (double)60.0))) : b)
-double sqrt();
-double logx();
+double logx(double d, double base);
/* return codes from shp_check_nav */
#define CN_NAVIGABLE (0)
#include "land.h"
#include "ship.h"
-#include "prototype.h"
-
struct trdstr {
short ef_type;
natid trd_owner;
struct shpstr shp;
};
-s_char *trade_nameof _PROTO((struct trdstr * tp, union trdgenstr * tgp));
+s_char *trade_nameof(struct trdstr * tp, union trdgenstr * tgp);
#define gettrade(n, p) \
ef_read(EF_TRADE, n, (caddr_t)p)
int height;
};
-extern s_char *xyfmt();
extern s_char *xyas(coord x, coord y, natid country);
extern s_char *ownxy(struct sctstr *sp);
extern coord xrel(struct natstr *np, coord absx);
#endif
int
-expect(s, match, buf)
-int s;
-int match;
-s_char *buf;
+expect(int s, int match, s_char *buf)
{
int size;
s_char *p;
}
void
-sendcmd(s, cmd, arg)
-int s;
-int cmd;
-s_char *arg;
+sendcmd(int s, int cmd, s_char *arg)
{
extern struct fn fnlist[];
s_char buf[128];
#define _FNLIST_H_
struct fn {
- int (*func) ();
+ int (*func)(void);
s_char *name;
int value;
};
#endif
int
-handleintr(s)
-int s;
+handleintr(int s)
{
extern int interrupt;
#include "misc.h"
int
-hostaddr(name, addr)
-s_char *name;
-struct sockaddr_in *addr;
+hostaddr(s_char *name, struct sockaddr_in *addr)
{
struct hostent *hp;
}
int
-hostport(name, addr)
-s_char *name;
-struct sockaddr_in *addr;
+hostport(s_char *name, struct sockaddr_in *addr)
{
struct servent *sp;
}
int
-hostconnect(addr)
-struct sockaddr_in *addr;
+hostconnect(struct sockaddr_in *addr)
{
int s;
#endif
-static int ioqtobuf();
-static int ioqtoiov();
-static void enqueuecc();
-static int dequeuecc();
+static int ioqtobuf(register struct ioqueue *ioq, s_char *buf, int cc);
+static int ioqtoiov(register struct ioqueue *ioq, register struct iovec *iov, register int max);
+static void enqueuecc(struct ioqueue *ioq, s_char *buf, int cc);
+static int dequeuecc(register struct ioqueue *ioq, register int cc);
-void insque();
-void remque();
-void initque();
-struct qelem *makeqt();
+void insque(struct qelem *, struct qelem *);
+void remque(struct qelem *);
+void initque(struct qelem *p);
+struct qelem *makeqt(int nelem);
void
-ioq_init(ioq, bsize)
-struct ioqueue *ioq;
-int bsize;
+ioq_init(struct ioqueue *ioq, int bsize)
{
extern s_char num_teles[];
* return # of iovec initialized.
*/
int
-ioq_peekiov(ioq, iov, max)
-struct ioqueue *ioq;
-struct iovec *iov;
-int max;
+ioq_peekiov(struct ioqueue *ioq, struct iovec *iov, int max)
{
if (ioq->cc <= 0)
return 0;
* number of bytes actually found.
*/
int
-ioq_peek(ioq, buf, cc)
-struct ioqueue *ioq;
-s_char *buf;
-int cc;
+ioq_peek(struct ioqueue *ioq, s_char *buf, int cc)
{
return ioqtobuf(ioq, buf, cc);
}
int
-ioq_dequeue(ioq, cc)
-struct ioqueue *ioq;
-int cc;
+ioq_dequeue(struct ioqueue *ioq, int cc)
{
if (dequeuecc(ioq, cc) != cc)
return 0;
}
int
-ioq_read(ioq, buf, cc)
-struct ioqueue *ioq;
-s_char *buf;
-int cc;
+ioq_read(struct ioqueue *ioq, s_char *buf, int cc)
{
int n;
}
void
-ioq_write(ioq, buf, cc)
-struct ioqueue *ioq;
-s_char *buf;
-int cc;
+ioq_write(struct ioqueue *ioq, s_char *buf, int cc)
{
enqueuecc(ioq, buf, cc);
}
int
-ioq_qsize(ioq)
-struct ioqueue *ioq;
+ioq_qsize(struct ioqueue *ioq)
{
return ioq->cc;
}
void
-ioq_drain(ioq)
-struct ioqueue *ioq;
+ioq_drain(struct ioqueue *ioq)
{
struct io *io;
struct qelem *qp;
}
s_char *
-ioq_gets(ioq, buf, cc)
-struct ioqueue *ioq;
-s_char *buf;
-int cc;
+ioq_gets(struct ioqueue *ioq, s_char *buf, int cc)
{
register s_char *p;
register s_char *end;
* left for a higher level.
*/
static int
-ioqtobuf(ioq, buf, cc)
-register struct ioqueue *ioq;
-s_char *buf;
-int cc;
+ioqtobuf(register struct ioqueue *ioq, s_char *buf, int cc)
{
register struct io *io;
struct qelem *qp;
* of a full ioqueue still be quick.
*/
static int
-ioqtoiov(ioq, iov, max)
-register struct ioqueue *ioq;
-register struct iovec *iov;
-register int max;
+ioqtoiov(register struct ioqueue *ioq, register struct iovec *iov, register int max)
{
register struct io *io;
register int cc;
* append a buffer to the end of the ioq.
*/
static void
-enqueuecc(ioq, buf, cc)
-struct ioqueue *ioq;
-s_char *buf;
-int cc;
+enqueuecc(struct ioqueue *ioq, s_char *buf, int cc)
{
struct io *io;
* which are no longer used.
*/
static int
-dequeuecc(ioq, cc)
-register struct ioqueue *ioq;
-register int cc;
+dequeuecc(register struct ioqueue *ioq, register int cc)
{
register struct io *io;
register struct qelem *qp;
#include <unistd.h>
#endif
-int expect();
-void sendcmd();
+int expect(int s, int match, s_char *buf);
+void sendcmd(int s, int cmd, s_char *arg);
int
-login(s, uname, cname, cpass, kill_proc)
-int s;
-s_char *uname;
-s_char *cname;
-s_char *cpass;
-int kill_proc;
+login(int s, s_char *uname, s_char *cname, s_char *cpass, int kill_proc)
{
s_char tmp[128];
s_char buf[1024];
int interrupt;
int sock;
-void saveargv();
-void getsose();
-int hostport();
-int hostaddr();
-int hostconnect();
-int login();
-void ioq_init();
-void io_init();
-int handleintr();
-int termio();
-int serverio();
-void servercmd();
-void ioq_drain();
+void saveargv(int ac, s_char **src, s_char **dst);
+void getsose(void);
+int hostport(s_char *name, struct sockaddr_in *addr);
+int hostaddr(s_char *name, struct sockaddr_in *addr);
+int hostconnect(struct sockaddr_in *addr);
+int login(int s, s_char *uname, s_char *cname, s_char *cpass, int kill_proc);
+void ioq_init(struct ioqueue *ioq, int bsize);
+void io_init(void);
+int handleintr(int);
+int termio(int fd, int sock, FILE *auxfi);
+int serverio(int s, struct ioqueue *ioq);
+void servercmd(struct ioqueue *ioq, FILE *auxfi);
+void ioq_drain(struct ioqueue *ioq);
static void intr(int sig);
int
-main(ac, av)
-int ac;
-s_char *av[];
+main(int ac, s_char **av)
{
#ifdef _WIN32
WSADATA WsaData;
#include "queue.h"
void
-insque(p, q)
-struct qelem *p;
-struct qelem *q;
+insque(struct qelem *p, struct qelem *q)
{
p->q_forw = q->q_forw;
p->q_back = q;
}
void
-remque(p)
-struct qelem *p;
+remque(struct qelem *p)
{
p->q_back->q_forw = p->q_forw;
p->q_forw->q_back = p->q_back;
}
void
-initque(p)
-struct qelem *p;
+initque(struct qelem *p)
{
p->q_forw = p;
p->q_back = p;
}
struct qelem *
-makeqt(nelem)
-int nelem;
+makeqt(int nelem)
{
struct qelem *table;
struct qelem *qp;
#include "misc.h"
void
-saveargv(ac, src, dst)
-int ac;
-s_char **src;
-s_char **dst;
+saveargv(int ac, s_char **src, s_char **dst)
{
register s_char *ptr;
register int i;
#include <io.h>
#endif
-extern s_char *gettag();
+extern s_char *gettag(s_char *p);
s_char num_teles[64];
static s_char the_prompt[1024];
FILE *pipe_fp;
int exec_fd;
-void prompt();
-void doredir();
-void dopipe();
-void doexecute();
-void output();
-void screen();
-int sendeof();
-int termio();
-void _noecho();
+void prompt(FILE *auxfi);
+void doredir(s_char *p);
+void dopipe(s_char *p);
+void doexecute(s_char *p, FILE *auxfi);
+void output(int code, s_char *buf, FILE *auxfi);
+void screen(register s_char *buf);
+int sendeof(int);
+int termio(int fd, int sock, FILE *auxfi);
+void _noecho(int);
extern s_char *SO;
extern s_char *SE;
void
-servercmd(ioq, auxfi)
-struct ioqueue *ioq;
-FILE *auxfi;
+servercmd(struct ioqueue *ioq, FILE *auxfi)
{
s_char *ioq_gets(struct ioqueue *, s_char *, int);
s_char buf[1024];
}
void
-prompt(auxfi)
-FILE *auxfi;
+prompt(FILE *auxfi)
{
if (mode == C_PROMPT) {
if (redir_fp) {
* opens redir_fp if successful
*/
void
-doredir(p)
-s_char *p;
+doredir(s_char *p)
{
s_char *how;
s_char *name;
* opens "pipe_fp" if successful
*/
void
-dopipe(p)
-s_char *p;
+dopipe(s_char *p)
{
s_char *tag;
}
void
-doexecute(p, auxfi)
-s_char *p;
-FILE *auxfi;
+doexecute(s_char *p, FILE *auxfi)
{
extern int sock;
int fd;
}
void
-output(code, buf, auxfi)
-int code;
-s_char *buf;
-FILE *auxfi;
+output(int code, s_char *buf, FILE *auxfi)
{
switch (code) {
case C_NOECHO:
}
void
-screen(buf)
-register s_char *buf;
+screen(register s_char *buf)
{
register s_char *sop;
register s_char c;
#include <io.h>
#endif
-void ioq_write();
+void ioq_write(struct ioqueue *ioq, s_char *buf, int cc);
int
-serverio(s, ioq)
-int s;
-struct ioqueue *ioq;
+serverio(int s, struct ioqueue *ioq)
{
s_char *buf;
int n;
static unsigned short tagnum;
void
-io_init()
+io_init(void)
{
taglist = NULL;
buf[0] = 0;
}
s_char *
-gettag(p)
-s_char *p;
+gettag(s_char *p)
{
struct tagstruct *tag1, *tag2;
extern HANDLE hStdIn;
#endif
-int sendeof();
+int sendeof(int sock);
int
-termio(fd, sock, auxfi)
-int fd;
-int sock;
-FILE *auxfi;
+termio(int fd, int sock, FILE *auxfi)
{
s_char out[4096];
int i, n;
}
int
-sendeof(sock)
-int sock;
+sendeof(int sock)
{
#ifndef _WIN32
if (write(sock, "ctld\n", 5) < 5) {
#if defined(hpux) || defined(aix) || defined (sgi) || defined(linux)
void
-_noecho(fd)
-int fd;
+_noecho(int fd)
{
struct termio io;
}
void
-_echo(fd)
-int fd;
+_echo(int fd)
{
struct termio io;
s_char *SO = 0;
s_char *SE = 0;
-int tgetent();
+int tgetent(char *, char *);
void
-parsedelay(r)
-s_char *r;
+parsedelay(s_char *r)
{
s_char *s, *t;
}
void
-getsose()
+getsose(void)
{
#ifndef _WIN32
- extern s_char *tgetstr();
+ extern s_char *tgetstr(char *, char **);
s_char *cp;
s_char *term;
static s_char tbuf[1024];
int
-main()
+main(void)
{
char buf[256];
char *cp;
/* Functions that are "private" to algorithm */
extern void as_add_cachepath(struct as_data *adp);
-extern void as_clear_cachepath();
-extern void as_enable_cachepath();
-extern void as_disable_cachepath();
+extern void as_clear_cachepath(void);
+extern void as_enable_cachepath(void);
+extern void as_disable_cachepath(void);
extern void as_makepath(struct as_data *adp);
extern void as_free_path(struct as_path *pp);
static int as_cachepath_on = 0; /* Default to off */
void
-as_enable_cachepath()
+as_enable_cachepath(void)
{
as_cachepath_on = 1;
}
void
-as_disable_cachepath()
+as_disable_cachepath(void)
{
as_cachepath_on = 0;
}
}
void
-as_clear_cachepath()
+as_clear_cachepath(void)
{
struct as_frompath *from, *from2;
struct as_topath *to, *to2;
struct as_queue *qp;
struct as_path *pp;
#endif /* DEBUG */
- struct as_queue *as_extend(struct as_data *adp);
as_reset(adp);
double odds, damil, dache;
int mob;
int n_cheleft;
- extern double hap_fact();
if (!snxtsct(&nstr, player->argp[1]))
return RET_SYN;
best(void)
{
double cost;
- s_char *BestDistPath(), *BestLandPath(), *s;
+ s_char *s;
struct sctstr s1, s2;
struct nstr_sect nstr, nstr2;
s_char buf[1024];
static void
pin_bomb(struct emp_qelem *list, struct sctstr *target)
{
- extern s_char *effadv();
struct dchrstr *dcp;
int nplanes;
int nships;
extern long lnd_money[MAXNOC];
extern long air_money[MAXNOC];
extern long tpops[MAXNOC];
- extern int mil_dbl_pay;
lnd_money[player->cnum] = sea_money[player->cnum] = 0;
air_money[player->cnum] = 0;
* Steve McClure, 1998-2000
*/
+#include <math.h>
#ifdef Rel4
#include <string.h>
#endif /* Rel4 */
static int cash; /* static ok */
-double sqrt(double);
-double logx();
-
extern int morale_base;
extern int sect_mob_neg_factor;
extern int etu_per_update;
int points;
struct natstr *natp;
float eff = ((float)LAND_MINEFF / 100.0);
- double techfact(int, double);
int mil, lcm, hcm, gun, shell;
int freeland = 0;
cons_choose(struct ltcomstr *ltcp)
{
s_char *p;
- extern int disloan();
- extern int distrea();
- int (*dis) ();
+ int (*dis)();
struct lonstr *lp;
struct trtstr *tp;
s_char prompt[128];
do_desi(struct natstr *natp, s_char *sects, s_char *deschar, long int cash,
int for_real)
{
- extern int opt_NO_LCMS;
- extern int opt_NO_HCMS;
register int n;
s_char *p;
int breaksanct;
int
diss(void)
{
- int quit(void);
struct sctstr sect;
struct lndstr land;
struct shpstr ship;
struct nstr_item ni;
struct lndstr land;
int vec[I_MAX + 1];
- s_char *mission_short_name();
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
return RET_SYN;
struct nstr_item ni;
struct lndstr land;
int vec[I_MAX + 1];
- s_char *mission_short_name();
+ s_char *mission_short_name(int);
int n, i;
struct natstr *np;
time_t now;
int vrange;
int i;
int dist;
- double techfact(int, double);
drange = techfact(lookland->lnd_tech, (double)lookland->lnd_spy);
drange = (drange * ((double)lookland->lnd_effic / 100.0));
int nunits;
struct nstr_item ni;
struct lndstr land;
- s_char *mission_short_name();
+ s_char *mission_short_name(int);
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
return RET_SYN;
return display_mark(" ");
}
-void
+static void
pr_mark(struct comstr *comm)
{
time_t now;
struct sctstr firing;
struct nstr_sect ns;
struct flist *fp;
- double techfact(int, double);
extern int torpedo_damage;
int gun;
extern int land_mob_max;
extern int plane_mob_max;
extern double mission_mob_cost;
- s_char *nameofitem();
s_char prompt[128];
s_char buf[1024];
int i, min;
s_char *p;
s_char mess[128];
- double techfact(int, double);
s_char buf[1024];
if (!snxtitem(&np, EF_LAND, player->argp[1]))
#include "optlist.h"
#include "commands.h"
-
#include <fcntl.h>
+#include <math.h>
extern float start_education, start_happiness;
extern float start_technology, start_research;
struct lchrstr *lp;
struct nstr_item nstr;
struct natstr *natp;
- double techfact(int, double);
int lvec[I_MAX + 1];
int extend = 1;
coord cx, cy;
int i;
int y;
- s_char *pp, *p, *BestDistPath();
+ s_char *pp, *p;
/* Note this is not re-entrant anyway, so we keep the buffers
around */
static s_char *mapbuf = (s_char *)0;
#include "nat.h"
#include "file.h"
#include "commands.h"
-
-extern void shutdown_sequence();
+#include "prototypes.h"
int
shut(void)
#include "path.h"
#include "file.h"
#include "commands.h"
+#include "combat.h"
int
sinfra(void)
struct sctstr sect;
int nsect;
struct nstr_sect nstr;
- double sector_mcost();
- double sector_strength(struct sctstr *);
if (!snxtsct(&nstr, player->argp[1]))
return RET_SYN;
int
thre(void)
{
- extern struct ichrstr *whatitem();
+ extern struct ichrstr *whatitem(s_char *, s_char *);
struct sctstr sect;
struct nstr_sect nstr;
int val;
* Steve McClure, 1996-2000
*/
+#include <math.h>
+
#include "misc.h"
#include "player.h"
#include "xy.h"
time_t
ef_mtime(int type)
{
- extern time_t fdate(int fd);
-
if (empfile[type].fd <= 0)
return 0;
return fdate(empfile[type].fd);
s_char *
kw_parse(int type, s_char *text, int *data)
{
- s_char *get_time(s_char *ptr, int *data);
- s_char *weekday(s_char *ptr, int *data);
s_char *next;
while (isspace(*text))
static s_char *logfile = 0;
s_char *
-getlogfile()
+getlogfile(void)
{
return (s_char *)logfile;
}
}
void
-bp_enable_cachepath()
+bp_enable_cachepath(void)
{
as_enable_cachepath();
}
void
-bp_disable_cachepath()
+bp_disable_cachepath(void)
{
as_disable_cachepath();
}
void
-bp_clear_cachepath()
+bp_clear_cachepath(void)
{
as_clear_cachepath();
}
#include "gen.h"
#include "subs.h"
#include "lost.h"
+#include "combat.h"
int
sect_damage(struct sctstr *sp, int dam, struct emp_qelem *list)
struct plnstr plane;
double real_dam;
int eff;
- double sector_strength();
/* Some sectors are harder/easier to kill.. */
/* Average sector has a dstr of 1, so adjust */
empth_t *
-empth_create(int prio, void (*entry) (), int size, int flags, char *name,
- char *desc, void *ud)
+empth_create(int prio, void (*entry)(void *), int size, int flags,
+ char *name, char *desc, void *ud)
{
/* inherit flags */
if (!flags)
* It is also passed to the entry function...
*/
empth_t *
-empth_create(int prio, void (*entry) (), int size, int flags,
+empth_create(int prio, void (*entry)(void *), int size, int flags,
char *name, char *desc, void *ud)
{
loc_Thread_t *pThread = NULL;
#if 0
-static void empth_setctx _PROTO((void *));
+static void empth_setctx(void *);
#endif
-static void empth_restorectx _PROTO(());
+static void empth_restorectx();
static void *
empth_start(void *ctx)
* More then that priority is not needed even in lwp threads.
*/
empth_t *
-empth_create(int prio, void (*entry) (), int size, int flags,
+empth_create(int prio, void (*entry)(void *), int size, int flags,
char *name, char *desc, void *ud)
{
pthread_t t;
{NULL, NULL, (caddr_t)0, 0, NULL}
};
-static void fixup_files _PROTO((void));
-static struct keymatch *keylookup
-_PROTO((s_char *key, struct keymatch tbl[]));
+static void fixup_files(void);
+static struct keymatch *keylookup(s_char *key, struct keymatch tbl[]);
/*
s_char *
getstarg(s_char *input, s_char *prompt, s_char *buf)
{
- extern s_char *getstring(s_char *prompt, s_char *buf);
-
*buf = '\0';
if (input == 0 || *input == 0) {
if (getstring(prompt, buf) == 0)
int flags;
s_char *assoc;
int bufsize;
- int (*notify) ();
+ int (*notify)(void);
};
void
}
struct iop *
-io_open(int fd, int flags, int bufsize, int (*notify) (void),
+io_open(int fd, int flags, int bufsize, int (*notify)(void),
s_char *assoc)
{
struct iop *iop;
int
onearg(s_char *arg, s_char *prompt)
{
- extern s_char *getstring(s_char *prompt, s_char *buf);
int n;
s_char buf[1024];
struct lwpProc *initcontext = NULL;
int startpoint;
-startcontext()
+static void
+startcontext(void)
{
int space[10000];
int x;
}
void
-lwpInitContext(newp, sp)
-struct lwpProc *newp;
-void *sp;
+lwpInitContext(struct lwpProc *newp, void *sp)
{
struct lwpProc holder;
int endpoint;
#elif defined(hpux)
void
-lwpInitContext(newp, sp)
-volatile struct lwpProc *volatile newp;
-void *sp;
+lwpInitContext(volatile struct lwpProc *volatile newp, void *sp)
{
static jmp_buf *cpp;
extern struct lwpProc *LwpCurrent;
}
int
-lwpSave(jb)
-jmp_buf jb;
+lwpSave(jmp_buf jb)
{
/* save stack pointer and return program counter */
asm("stw %sp, 4(%arg0)");
}
void
-lwpRestore(jb)
-jmp_buf jb;
+lwpRestore(jmp_buf jb)
{
/* restore stack pointer and program counter */
asm volatile ("ldw 4(%arg0), %sp");
#elif defined(BSD386)
void
-lwpInitContext(newp, sp)
-struct lwpProc *newp;
-void *sp;
+lwpInitContext(struct lwpProc *newp, void *sp)
{
newp->context[2] = (int)sp;
newp->context[0] = (int)lwpEntryPoint;
#elif defined(FBSD)
void
-lwpInitContext(newp, sp)
-struct lwpProc *newp;
-void *sp;
+lwpInitContext(struct lwpProc *newp, void *sp)
{
setjmp(newp->context);
newp->context->_jb[2] = (int)sp;
#elif defined(__linux__)
void
-lwpInitContext(newp, sp)
-struct lwpProc *newp;
-void *sp;
+lwpInitContext(struct lwpProc *newp, void *sp)
{
#if defined(__GLIBC__) && (__GLIBC__ >= 2)
#if defined(__PPC__)
#elif defined(SUN3)
void
-lwpInitContext(newp, sp)
-struct lwpProc *newp;
-void *sp;
+lwpInitContext(struct lwpProc *newp, void *sp)
{
newp->context[2] = (int)sp;
newp->context[3] = (int)lwpEntryPoint;
#include <stdio.h>
void
-lwpInitContext(newp, stack)
-struct lwpProc *newp;
-void *stack;
+lwpInitContext(struct lwpProc *newp, void *stack)
{
int *sp = (int *)stack;
int *fp = 0;
}
int
-lwpSave(jb)
-jmp_buf jb;
+lwpSave(jmp_buf jb)
{
asm("movl 4(ap), r0"); /* r0 = &jb */
asm("movl r6, (r0)"); /* jb[0] = r6 */
}
void
-lwpRestore(jb)
-jmp_buf jb;
+lwpRestore(jmp_buf jb)
{
asm("movl 4(ap), r0"); /* r0 = &jb */
asm("movl (r0), r6"); /* r6 = jb[0] */
#elif defined(SUN4)
void
-lwpInitContext(newp, sp)
-struct lwpProc *newp;
-void *sp;
+lwpInitContext(struct lwpProc *newp, void *sp)
{
static jmp_buf *cpp;
extern struct lwpProc *LwpCurrent;
*/
void
-lwpInitContext(newp, sp)
-struct lwpProc *newp;
-void *sp;
+lwpInitContext(struct lwpProc *newp, void *sp)
{
newp->context[4] = (int)sp;
newp->context[5] = (int)lwpEntryPoint;
*/
void
-lwpInitContext(newp, spp)
-struct lwpProc *newp;
-stack_t *spp;
+lwpInitContext(struct lwpProc *newp, stack_t *spp)
{
getcontext(&(newp->context));
newp->context.uc_stack.ss_sp = spp->ss_sp;
#include <c_asm.h>
void
-lwpInitContext(newp, sp)
-struct lwpProc *newp;
-void *sp;
+lwpInitContext(struct lwpProc *newp, void *sp)
{
extern long *_gp;
}
int
-lwpSave(jb)
-jmp_buf jb;
+lwpSave(jmp_buf jb)
{
return _setjmp(jb);
}
void
-lwpRestore(jb)
-jmp_buf jb;
+lwpRestore(jmp_buf jb)
{
/* resume, but get the pv from the jmp_buf */
asm("ldq %pv, 248(%a0)");
extern char *strdup();
#endif /* NOSTRDUP */
-static void lwpStackCheckInit();
-static int lwpStackCheck();
-static void lwpStackCheckUsed();
+static void lwpStackCheckInit(struct lwpProc *newp);
+static int lwpStackCheck(struct lwpProc *newp);
+static void lwpStackCheckUsed(struct lwpProc *newp);
/* check stack direction */
static int
-growsdown(x)
-void *x;
+growsdown(void *x)
{
int y;
* processes here and free them.
*/
void
-lwpReschedule()
+lwpReschedule(void)
{
extern struct lwpQueue LwpSchedQ[];
static int lcount = LCOUNT;
* lwpEntryPoint -- process entry point.
*/
void
-lwpEntryPoint()
+lwpEntryPoint(void)
{
- extern struct lwpProc *LwpCurrent;
#ifdef POSIXSIGNALS
sigset_t set;
#endif /* POSIXSIGNALS */
*LwpContextPtr = LwpCurrent->ud;
lwpStatus(LwpCurrent, "starting at entry point");
- (*LwpCurrent->entry) (LwpCurrent->argc, LwpCurrent->argv,
- LwpCurrent->ud);
+ (*LwpCurrent->entry)(LwpCurrent->ud);
lwpExit();
#ifdef BOUNDS_CHECK
BOUNDS_CHECKING_ON;
* lwpCreate -- create a process.
*/
struct lwpProc *
-lwpCreate(priority, entry, size, flags, name, desc, argc, argv, ud)
-int priority;
-void (*entry) ();
-int size;
-int flags;
-char *name;
-char *desc;
-int argc;
-char *argv[];
-void *ud;
+lwpCreate(int priority, void (*entry)(void *), int size, int flags, char *name, char *desc, int argc, char **argv, void *ud)
{
- extern struct lwpProc *LwpCurrent;
struct lwpProc *newp;
int *s, x;
#ifdef UCONTEXT
}
void
-lwpDestroy(proc)
-struct lwpProc *proc;
+lwpDestroy(struct lwpProc *proc)
{
if (proc->flags & LWP_STACKCHECK) {
lwpStackCheckUsed(proc);
* lwpReady -- put process on ready queue. if null, assume current.
*/
void
-lwpReady(p)
-struct lwpProc *p;
+lwpReady(struct lwpProc *p)
{
- extern struct lwpProc *LwpCurrent;
- extern struct lwpQueue LwpSchedQ[];
-
if (!p)
p = LwpCurrent;
lwpStatus(p, "added to run queue");
* return user's data
*/
void *
-lwpGetUD(p)
-struct lwpProc *p;
+lwpGetUD(struct lwpProc *p)
{
if (!p)
p = LwpCurrent;
* set user's data
*/
void
-lwpSetUD(p, ud)
-struct lwpProc *p;
-char *ud;
+lwpSetUD(struct lwpProc *p, char *ud)
{
if (!p)
p = LwpCurrent;
* set name & desc
*/
void
-lwpSetDesc(p, name, desc)
-struct lwpProc *p;
-char *name;
-char *desc;
+lwpSetDesc(struct lwpProc *p, char *name, char *desc)
{
if (!p)
p = LwpCurrent;
* lwpYield -- yield the processor to another thread.
*/
void
-lwpYield()
+lwpYield(void)
{
lwpStatus(LwpCurrent, "yielding control");
lwpReady(LwpCurrent);
* cause the current process to be scheduled for deletion.
*/
void
-lwpExit()
+lwpExit(void)
{
lwpStatus(LwpCurrent, "marking self as dead");
LwpCurrent->dead = 1;
* remove any lingering FD action
*/
void
-lwpTerminate(p)
-struct lwpProc *p;
+lwpTerminate(struct lwpProc *p)
{
lwpStatus(p, "terminating process");
p->dead = 1;
* if the new priority is lower than the old, we reschedule.
*/
int
-lwpSetPriority(new)
-int new;
+lwpSetPriority(int new)
{
int old = LwpCurrent->pri;
* initialise the coroutine structures
*/
struct lwpProc *
-lwpInitSystem(pri, ctxptr, flags)
-int pri;
-char **ctxptr;
-int flags;
+lwpInitSystem(int pri, char **ctxptr, int flags)
{
- extern struct lwpQueue LwpSchedQ[];
- extern struct lwpProc *LwpCurrent;
struct lwpQueue *q;
int i, *stack;
struct lwpProc *sel;
* used.
*/
static void
-lwpStackCheckInit(newp)
-struct lwpProc *newp;
+lwpStackCheckInit(struct lwpProc *newp)
{
register int i;
register long *lp;
* down the entire process.
*/
static int
-lwpStackCheck(newp)
-struct lwpProc *newp;
+lwpStackCheck(struct lwpProc *newp)
{
register int end, amt;
register unsigned int i;
* Figure out how much stack was used by this thread.
*/
static void
-lwpStackCheckUsed(newp)
-struct lwpProc *newp;
+lwpStackCheckUsed(struct lwpProc *newp)
{
register int i;
register long *lp;
#define LCOUNT -1
#ifdef hpux
-int lwpSave _PROTO((jmp_buf));
-void lwpRestore _PROTO((jmp_buf));
+int lwpSave(jmp_buf);
+void lwpRestore(jmp_buf);
#endif
#if defined(MIPS) || defined(AIX32) || defined(ALPHA) || defined(__vax)
-int lwpSave _PROTO((jmp_buf));
-void lwpRestore _PROTO((jmp_buf));
+int lwpSave(jmp_buf);
+void lwpRestore(jmp_buf);
#elif defined(SUN4)
#define lwpSave(x) _setjmp(x)
#define lwpRestore(x) _longjmp(x, 1)
#endif
/* internal routines */
-void lwpAddTail _PROTO((struct lwpQueue *, struct lwpProc *));
-struct lwpProc *lwpGetFirst _PROTO((struct lwpQueue *));
-void lwpReschedule _PROTO((void));
-void lwpReady _PROTO((struct lwpProc *));
-void lwpOnalarm _PROTO((void));
+void lwpAddTail(struct lwpQueue *, struct lwpProc *);
+struct lwpProc *lwpGetFirst(struct lwpQueue *);
+void lwpReschedule(void);
+void lwpReady(struct lwpProc *);
+void lwpOnalarm(void);
#ifdef UCONTEXT
-void lwpInitContext _PROTO((struct lwpProc *, stack_t *));
+void lwpInitContext(struct lwpProc *, stack_t *);
#else /* GETCONTEXT */
#ifdef hpc
-void lwpInitContext _PROTO((struct lwpProc *, void *));
+void lwpInitContext(struct lwpProc *, void *);
#else
#ifdef hpux
-void lwpInitContext _PROTO((volatile struct lwpProc * volatile, void *));
+void lwpInitContext(volatile struct lwpProc * volatile, void *);
#else
-void lwpInitContext _PROTO((struct lwpProc *, void *));
+void lwpInitContext(struct lwpProc *, void *);
#endif /* hpux */
#endif /* hpc */
#endif /* GETCONTEXT */
-void lwpEntryPoint _PROTO((void));
-void lwpInitSelect _PROTO((struct lwpProc * self));
-void lwpDestroy _PROTO((struct lwpProc * proc));
+void lwpEntryPoint(void);
+void lwpInitSelect(struct lwpProc * self);
+void lwpDestroy(struct lwpProc * proc);
#endif /* _LWP_H */
#ifndef _LWP_H
#define _LWP_H
-#ifndef _PROTO
-#ifdef __cplusplus
-#define _PROTO(x) x
-#else
-#define _PROTO(x) ()
-#endif
-#endif
-
#include <setjmp.h>
#include <sys/time.h>
#define LWP_MAX_PRIO 8
-struct lwpProc *lwpInitSystem _PROTO((int));
-struct lwpProc *lwpCreate
-_PROTO((int, void (*)(), int, int, char **, void *));
-void lwpExit _PROTO((void));
-void lwpTerminate _PROTO((struct lwpProc *));
-void lwpYield _PROTO((void));
-void lwpSleepFd _PROTO((int fd, int flags));
-void lwpSleepUntil _PROTO((long until));
-void lwpWakeupFd _PROTO((struct lwpProc *));
-void *lwpGetUD _PROTO((struct lwpProc *));
-void lwpSetUD _PROTO((struct lwpProc *, char *));
-int lwpSetPriority _PROTO((int));
-void lwpReschedule _PROTO(());
+struct lwpProc *lwpInitSystem(int);
+struct lwpProc *lwpCreate(int, void (*)(void *), int, int, char **, void *);
+void lwpExit(void);
+void lwpTerminate(struct lwpProc *);
+void lwpYield(void);
+void lwpSleepFd(int fd, int flags);
+void lwpSleepUntil(long until);
+void lwpWakeupFd(struct lwpProc *);
+void *lwpGetUD(struct lwpProc *);
+void lwpSetUD(struct lwpProc *, char *);
+int lwpSetPriority(int);
+void lwpReschedule();
-struct lwpSem *lwpCreateSem _PROTO((int));
-void lwpSignal _PROTO((struct lwpSem *));
-void lwpWait _PROTO((struct lwpSem *));
-void lwpSelect _PROTO((int argc, char **argv));
+struct lwpSem *lwpCreateSem(int);
+void lwpSignal(struct lwpSem *);
+void lwpWait(struct lwpSem *);
+void lwpSelect(int argc, char **argv);
extern struct lwpProc *LwpCurrent;
#if defined(_EMPTH_LWP)
struct lwpProc *
-lwpGetFirst(q)
-struct lwpQueue *q;
+lwpGetFirst(struct lwpQueue *q)
{
struct lwpProc *head;
}
void
-lwpAddTail(q, p)
-register struct lwpQueue *q;
-register struct lwpProc *p;
+lwpAddTail(register struct lwpQueue *q, register struct lwpProc *p)
{
if (!q->tail)
q->head = p;
struct lwpSelect LwpSelect;
void
-lwpInitSelect(proc)
-struct lwpProc *proc;
+lwpInitSelect(struct lwpProc *proc)
{
LwpSelect.maxfd = 0;
LwpSelect.nfds = 0;
}
void
-lwpSleepFd(fd, mask)
-int fd;
-int mask;
+lwpSleepFd(int fd, int mask)
{
extern struct lwpProc *LwpCurrent;
}
void
-lwpWakeupFd(proc)
-struct lwpProc *proc;
+lwpWakeupFd(struct lwpProc *proc)
{
if (proc->fd < 0)
return;
}
void
-lwpSleepUntil(until)
-long until;
+lwpSleepUntil(long int until)
{
extern struct lwpProc *LwpCurrent;
/*ARGSUSED*/
void
-lwpSelect(argc, argv)
-int argc;
-char **argv;
+lwpSelect(void *arg)
{
extern struct lwpProc *LwpCurrent;
struct lwpProc *us = LwpCurrent;
* create a lwpSemaphore.
*/
struct lwpSem *
-lwpCreateSem(name, count)
-char *name;
-int count;
+lwpCreateSem(char *name, int count)
{
struct lwpSem *new;
* the blocked process has a higher priority than ours'.
*/
void
-lwpSignal(s)
-struct lwpSem *s;
+lwpSignal(struct lwpSem *s)
{
extern struct lwpProc *LwpCurrent;
* wait on a lwpSemaphore
*/
void
-lwpWait(s)
-struct lwpSem *s;
+lwpWait(struct lwpSem *s)
{
extern struct lwpProc *LwpCurrent;
#include "nat.h"
#include "file.h"
-extern int add();
-extern int anti();
-extern int assa();
-extern int atta();
-extern int boar();
-extern int bdes();
-extern int bomb();
-extern int buil();
-extern int chan();
-extern int coas();
-extern int comm();
-extern int coun();
-extern int decl();
-extern int deli();
-extern int show();
+extern int add(void);
+extern int anti(void);
+extern int assa(void);
+extern int atta(void);
+extern int boar(void);
+extern int bdes(void);
+extern int bomb(void);
+extern int buil(void);
+extern int chan(void);
+extern int coas(void);
+extern int comm(void);
+extern int coun(void);
+extern int decl(void);
+extern int deli(void);
+extern int show(void);
extern int show_motd(void);
-extern int desi();
-extern int diss();
-extern int drop();
+extern int desi(void);
+extern int diss(void);
+extern int drop(void);
extern int echo(void);
-extern int enli();
-extern int fire();
-extern int flee();
-extern int fly();
-extern int force();
-extern int info();
-extern int apro();
-extern int load();
-extern int look();
-extern int map();
-extern int mine();
-extern int move();
-extern int nati();
-extern int navi();
-extern int head(), news();
-extern int nuke();
-extern int offs();
-extern int para();
-extern int path();
-extern int payo();
-extern int powe();
-extern int rada();
-extern int rea();
-extern int real();
-extern int reco();
-extern int rout();
-extern int sona();
-extern int spy();
-extern int tele();
-extern int tend();
-extern int torp();
-extern int tran();
-extern int trea();
-extern int turn();
-extern int vers();
+extern int enli(void);
+extern int fire(void);
+extern int flee(void);
+extern int fly(void);
+extern int force(void);
+extern int info(void);
+extern int apro(void);
+extern int load(void);
+extern int look(void);
+extern int map(void);
+extern int mine(void);
+extern int move(void);
+extern int nati(void);
+extern int navi(void);
+extern int head(void), news(void);
+extern int nuke(void);
+extern int offs(void);
+extern int para(void);
+extern int path(void);
+extern int payo(void);
+extern int powe(void);
+extern int rada(void);
+extern int rea(void);
+extern int real(void);
+extern int reco(void);
+extern int rout(void);
+extern int sona(void);
+extern int spy(void);
+extern int tele(void);
+extern int tend(void);
+extern int torp(void);
+extern int tran(void);
+extern int trea(void);
+extern int turn(void);
+extern int vers(void);
/*
* new commands
*/
-extern int repo();
-extern int laun();
-extern int new();
-extern int shoo();
-extern int thre();
-extern int dist();
-extern int sct();
-extern int plan();
-extern int arm();
-extern int hard();
-extern int upgr();
-extern int surv();
-extern int capi();
-extern int orig();
-extern int conv();
-extern int leve();
-extern int cuto();
-extern int prod();
-extern int wai();
-extern int carg();
-extern int terr();
-extern int sate();
-extern int give();
-extern int edit();
-extern int wipe();
-extern int dump();
-extern int ldump();
-extern int ndump();
-extern int pdump();
-extern int pboa();
-extern int sdump();
-extern int lost();
-extern int explore();
-extern int reso();
-extern int scra();
-extern int rela();
-extern int brea();
-extern int upda();
-extern int hidd();
-extern int orde();
-extern int qorde();
-extern int sorde();
-extern int reje();
-extern int acce();
-extern int sabo();
-extern int scut();
-extern int grin();
-extern int shar();
-extern int sail(); /* Forsman's hacks */
-extern int foll();
-extern int mobq();
-extern int name();
-extern int range();
-extern int zdon();
-extern int fuel();
-extern int multifire();
-extern int retr();
-extern int budg();
-extern int wire();
-extern int stop();
-extern int start();
+extern int repo(void);
+extern int laun(void);
+extern int new(void);
+extern int shoo(void);
+extern int thre(void);
+extern int dist(void);
+extern int sct(void);
+extern int plan(void);
+extern int arm(void);
+extern int hard(void);
+extern int upgr(void);
+extern int surv(void);
+extern int capi(void);
+extern int orig(void);
+extern int conv(void);
+extern int leve(void);
+extern int cuto(void);
+extern int prod(void);
+extern int wai(void);
+extern int carg(void);
+extern int terr(void);
+extern int sate(void);
+extern int give(void);
+extern int edit(void);
+extern int wipe(void);
+extern int dump(void);
+extern int ldump(void);
+extern int ndump(void);
+extern int pdump(void);
+extern int pboa(void);
+extern int sdump(void);
+extern int lost(void);
+extern int explore(void);
+extern int reso(void);
+extern int scra(void);
+extern int rela(void);
+extern int brea(void);
+extern int upda(void);
+extern int hidd(void);
+extern int orde(void);
+extern int qorde(void);
+extern int sorde(void);
+extern int reje(void);
+extern int acce(void);
+extern int sabo(void);
+extern int scut(void);
+extern int grin(void);
+extern int shar(void);
+extern int sail(void); /* Forsman's hacks */
+extern int foll(void);
+extern int mobq(void);
+extern int name(void);
+extern int range(void);
+extern int zdon(void);
+extern int fuel(void);
+extern int multifire(void);
+extern int retr(void);
+extern int budg(void);
+extern int wire(void);
+extern int stop(void);
+extern int start(void);
-extern int land();
-extern int supp();
-extern int lboa();
-extern int lcarg();
-extern int lload();
-extern int army();
-extern int lrange();
-extern int morale();
-extern int lretr();
-extern int landmine();
-extern int fort();
-extern int march();
-extern int llook();
-extern int mission();
-extern int work();
-extern int ltend();
-extern int cede();
-extern int best();
-extern int newe();
-extern int starve();
+extern int land(void);
+extern int supp(void);
+extern int lboa(void);
+extern int lcarg(void);
+extern int lload(void);
+extern int army(void);
+extern int lrange(void);
+extern int morale(void);
+extern int lretr(void);
+extern int landmine(void);
+extern int fort(void);
+extern int march(void);
+extern int llook(void);
+extern int mission(void);
+extern int work(void);
+extern int ltend(void);
+extern int cede(void);
+extern int best(void);
+extern int newe(void);
+extern int starve(void);
-extern int setres();
-extern int setsector();
+extern int setres(void);
+extern int setsector(void);
-extern int disa();
-extern int enab();
+extern int disa(void);
+extern int enab(void);
/*
* Undeclared functions
*/
extern int quit(void);
-extern int cens();
-extern int demo();
-extern int shi();
-extern int wing();
+extern int cens(void);
+extern int demo(void);
+extern int shi(void);
+extern int wing(void);
extern int execute(void);
extern int explain(void);
-extern int set();
+extern int set(void);
extern int flash(void);
-extern int wall();
-extern int shut();
-extern int togg();
-extern int stre();
-extern int skyw();
-extern int play();
-extern int swaps();
+extern int wall(void);
+extern int shut(void);
+extern int togg(void);
+extern int stre(void);
+extern int skyw(void);
+extern int play(void);
+extern int swaps(void);
-extern int trad();
-extern int mark();
-extern int buy();
-extern int mult();
-extern int sell();
-extern int rese();
+extern int trad(void);
+extern int mark(void);
+extern int buy(void);
+extern int mult(void);
+extern int sell(void);
+extern int rese(void);
-extern int repa();
-extern int fina();
-extern int coll();
-extern int cons();
-extern int ledg();
-extern int shark();
-extern int offe();
+extern int repa(void);
+extern int fina(void);
+extern int coll(void);
+extern int cons(void);
+extern int ledg(void);
+extern int shark(void);
+extern int offe(void);
-extern int mobupdate();
+extern int mobupdate(void);
-extern int sinfra();
-extern int improve();
-extern int lsta();
-extern int pstat();
-extern int sstat();
+extern int sinfra(void);
+extern int improve(void);
+extern int lsta(void);
+extern int pstat(void);
+extern int sstat(void);
struct cmndstr player_coms[] = {
/* command form cost addr permit */
{
register unsigned int x;
s_char *redir;
- int kill_player();
s_char scanspace[1024];
if (getcommand(player->combuf) < 0)
print_found(struct shiplook *head)
{
struct shiplook *s;
- extern s_char *effadv(int);
int first;
struct mchrstr *mp;
struct shpstr ship;
/* Doing a sneak attack */
static void
-do_sneak(def, success)
-struct combat *def;
-int success;
+do_sneak(struct combat *def, int success)
{
struct sctstr sect;
struct natstr *natp = getnatp(player->cnum);
{
double eff = 1.0;
double str;
- double sector_strength(struct sctstr *sp);
struct shpstr ship;
if (com->type == EF_SECTOR) {
void
lnd_takemob(struct emp_qelem *list, double loss)
{
- extern double combat_mob;
struct emp_qelem *qp, *next;
struct llist *llp;
int new;
return 0;
}
-int
+static int
only_subs(struct emp_qelem *list)
{
struct emp_qelem *qp;
int
oprange(struct genitem *gp, int type, int *radius)
{
- double techfact(int, double);
int range;
struct shpstr ship;
struct lndstr land;
coord curx, cury, oldx, oldy;
coord tmpx, tmpy;
coord dx, dy;
- s_char *movstr, *BestLandPath(s_char *, struct sctstr *,
- struct sctstr *, double *, int);
+ s_char *movstr;
double sect_mcost;
double total_mcost;
double mv_cost;
/* Is this the originally scared ship, or a follower */
{
- extern double techfact(int, double);
struct sctstr sect;
register int n;
register int m;
/* Is this the originally scared unit, or a follower */
{
- extern double techfact(int, double);
struct sctstr sect;
register int n;
register int m;
* (bailey@mcs.kent.edu)
*/
+#include <math.h>
#include "misc.h"
#include "player.h"
#include "nuke.h"
#include "nat.h"
#include "prototypes.h"
-double sqrt(double);
-double logx(double, double);
/*
* This cruft really belongs in the empglb.c file.
static int
shp_check_nav(struct sctstr *sect)
{
- extern struct dchrstr dchr[];
-
switch (dchr[sect->sct_type].d_flg & 03) {
case NAVOK:
break;
struct nstr_item ni;
struct plnstr p;
struct lndstr land;
- extern double hap_fact(struct natstr *, struct natstr *);
extern int etu_per_update;
extern int sect_mob_neg_factor;
#include "update.h"
#include "subs.h"
#include "common.h"
+#include "prototypes.h"
int
dodistribute(struct sctstr *sp, int imex, s_char *path, double dist_i_cost,
double dist_e_cost)
/* import or export? */
{
- struct sctstr *getdistsp();
- float distpathcost();
struct ichrstr *ip;
struct sctstr *dist;
int amt;
#endif /* SAVE_FINISH_PATHS */
static void assemble_dist_paths(struct distinfo *distptrs);
-s_char *BestDistPath();
+s_char *BestDistPath(s_char *, struct sctstr *, struct sctstr *, double *, int);
s_char *ReversePath(s_char *path);
-double pathcost();
+double pathcost(struct sctstr *, s_char *, int);
void
finish_sects(int etu)
}
}
-s_char
-*
+s_char *
ReversePath(s_char *path)
{
s_char *patharray = "aucdefjhigklmyopqrstbvwxnz";
int vec[I_MAX + 1];
int cvec[I_MAX + 1];
int n;
- double techfact(int, double);
int min = morale_base - (int)np->nat_level[NAT_HLEV];
int mult;
extern double money_land;
landrepair(register struct lndstr *land, int *vec, struct natstr *np,
int *bp, int etus)
{
- extern int mil_dbl_pay;
extern int land_grow_scale;
register int delta;
struct sctstr *sp;
static void do_mob_sect(register struct sctstr *sp, register int etus);
static void do_mob_ship(register struct shpstr *, register int);
-int
+static int
increase_mob(time_t * counter, float mult)
{
time_t secs;
int
nav_ship(register struct shpstr *sp)
{
- extern double techfact(int, double);
struct sctstr *sectp;
s_char *cp, item;
int stopping;
int
check_nav(struct sctstr *sect)
{
- extern struct dchrstr dchr[];
-
switch (dchr[sect->sct_type].d_flg & 03) {
case NAVOK:
break;
void
guerrilla(struct sctstr *sp)
{
- extern s_char *effadv();
struct sctstr *nsp;
int recruit;
int move;
int val;
int oldmob;
struct lndstr *lp;
- s_char *nxtitemp(struct nstr_item *np, int owner);
struct nstr_item ni;
- extern double hap_fact();
mc = cc = 0;
recruit = 0;
int cantake;
int nunits = 0, each, deq;
struct lndstr *lp;
- s_char *nxtitemp(struct nstr_item *np, int owner);
struct nstr_item ni;
/* casualties come out of mil first */
int starved, lvec[I_MAX + 1];
struct nstr_item ni;
struct lndstr *lp;
- s_char *nxtitemp(struct nstr_item *np, int owner);
if (opt_NOFOOD)
return 0; /* no food no work to do */
/*ARGSUSED*/
void
-player_kill_idle(argv)
-void *argv;
+player_kill_idle(void *argv)
{
extern int max_idle;
struct player *p;
/*ARGSUSED*/
void
-delete_lostitems(argv)
-void *argv;
+delete_lostitems(void *argv)
{
extern int lost_items_timeout;
time_t now;
s_char program[] = "server";
-extern void player_accept();
-extern void player_kill_idle();
-extern void update_sched();
-extern void delete_lostitems();
+extern void player_accept(void *);
+extern void player_kill_idle(void *);
+extern void update_sched(void *);
+extern void delete_lostitems(void *);
void nullify_objects(void);
void init_files(void);
void close_files(void);
static void loc_NTTerm(void);
#endif
-extern void mobility_init();
-extern void mobility_check();
-extern void market_update();
+extern void mobility_init(void);
+extern void mobility_check(void *);
+extern void market_update(void *);
#if !defined(_WIN32)
static int mainpid = 0;
#endif
int
-main(argc, argv)
-int argc;
-char *argv[];
+main(int argc, char **argv)
{
time_t now;
int hour[2];
/*ARGSUSED*/
void
-check_all_markets(argv)
-void *argv;
+check_all_markets(void *argv)
{
player->proc = empth_self();
player->cnum = 0;
/*ARGSUSED*/
void
-market_update(argv)
-void *argv;
+market_update(void *argv)
{
time_t now;
struct player *dp;
}
void
-shutdown_sequence(argc, argv)
-int argc;
-s_char **argv;
+shutdown_sequence(void *argv)
{
struct natstr *god;
struct tm *tm;
/*ARGSUSED*/
void
-mobility_check(argv)
-void *argv;
-
+mobility_check(void *argv)
{
extern s_char *timestampfil;
extern int updating_mob;
}
void
-mobility_init()
+mobility_init(void)
{
extern s_char *timestampfil;
extern int updating_mob;
empth_sem_t *update_sem;
-extern void update_main();
-extern void update_wait();
+extern void update_main(void *);
+extern void update_wait(void *argv);
time_t update_time;
/*ARGSUSED*/
void
-update_sched(argv)
-void *argv;
+update_sched(void *argv)
{
extern int s_p_etu;
extern int etu_per_update;
/*ARGSUSED*/
void
-update_wait(argv)
-void *argv;
+update_wait(void *argv)
{
struct player *p;
int running;
#define PLATMIN 36 /* plate altitude for plateau */
#define HIGHMIN 98 /* plate altitude for mountains */
-static void qprint _PROTO((const char *str));
+static void qprint(const char *str);
static const char *outfile = "newcap_script";
/* mark the continents with a * so you can tell them
int map_symbol(int x, int y);
static void fl_sct_init(coord x, coord y, s_char *ptr);
-void print_vars();
+void print_vars(void);
void fl_move(int);
-void next_coast();
-void grow_islands();
+void next_coast(int c, int x, int y, int *xp, int *yp);
+void grow_islands(void);
/****************************************************************************
MAIN
}
void
-print_vars()
+print_vars(void)
{
if (quiet)
return;
printf("World dimensions: %dx%d\n", WORLD_X, WORLD_Y);
}
-int
-my_sqrt(n)
-int n;
+static int
+my_sqrt(int n)
{
int i;
/* How isolated is capital j?
*/
-int
-iso(j, newx, newy)
-int j, newx, newy;
+static int
+iso(int j, int newx, int newy)
{
int i, md, d = WORLD_X + WORLD_Y;
*/
void
-fl_move(j)
-int j;
+fl_move(int j)
{
int i, n, newx, newy;
/* Look for a coastal sector of continent c
*/
-void
-find_coast(c)
-int c;
+static void
+find_coast(int c)
{
int i, j;
/* Used for measuring distances
*/
-int
-next_vector(n)
-int n;
+static int
+next_vector(int n)
{
int i;
/* Test to see if we're allowed to grow there: the arguments di and id
*/
-int
-try_to_grow(c, newx, newy, d)
-int c, newx, newy, d;
+static int
+try_to_grow(int c, int newx, int newy, int d)
{
int i, j, px, py;
*/
void
-next_coast(c, x, y, xp, yp)
-int c, x, y, *xp, *yp;
+next_coast(int c, int x, int y, int *xp, int *yp)
{
int i, nx, ny, wat = 0;
/* Choose a sector to grow from
*/
-int
+static int
new_try(int c)
{
int i, starti;
/* Grow continent c by 1 sector
*/
-int
-grow_one_sector(c)
-int c;
+static int
+grow_one_sector(int c)
{
int done, coast_search, try1, x, y, newx, newy, i, n, sx, sy;
/* Choose a place to start growing an island from
*/
-int
-place_island(c, xp, yp)
-int c, *xp, *yp;
+static int
+place_island(int c, int *xp, int *yp)
{
int d, sx, sy;
int ssy = rnd(WORLD_Y);
*/
void
-grow_islands()
+grow_islands(void)
{
int c, x, y, isiz;
/* Generic function for finding the distance to the closest sea, land, or
mountain
*/
-int
-distance_to_what(x, y, flag)
-int x, y, flag;
+static int
+distance_to_what(int x, int y, int flag)
{
int j, d, px, py;
ADD THE RESOURCES
****************************************************************************/
-int
-set_fert(e)
-int e;
+static int
+set_fert(int e)
{
int fert = 0;
if (e < LANDMIN)
return fert;
}
-int
-set_oil(e)
-int e;
+static int
+set_oil(int e)
{
int oil = 0;
if (e < LANDMIN)
return oil;
}
-int
-set_iron(e)
-int e;
+static int
+set_iron(int e)
{
int iron = 0;
if (e >= IRON_MIN && e < HIGHMIN)
return iron;
}
-int
-set_gold(e)
-int e;
+static int
+set_gold(int e)
{
int gold = 0;
if (e >= GOLD_MIN) {
return gold;
}
-int
-set_uran(e)
-int e;
+static int
+set_uran(int e)
{
int uran = 0;
if (e >= URAN_MIN && e < HIGHMIN)
return uran;
}
-void
-add_resources(sct)
-struct sctstr *sct;
+static void
+add_resources(struct sctstr *sct)
{
sct->sct_fertil = set_fert(sct->sct_elev);
sct->sct_oil = set_oil(sct->sct_elev);
}
static void
-qprint(str)
-const char *str;
+qprint(const char *str)
{
if (quiet == 0)
fputs(str, stdout);
int
main(int argc, char *argv[])
{
- extern s_char *annfil;
extern s_char *timestampfil;
extern s_char *infodir;
extern s_char *commfil;
#include "prototypes.h"
int
-main(argc, argv)
-int argc;
-char *argv[];
+main(int argc, char **argv)
{
if (argc > 1)
emp_config(argv[1]);