#define IO_NEWSOCK 0x4
#define IO_NBLOCK 0x8
#define IO_EOF 0x10
-#define IO_CONN 0x20
#define IO_ERROR 0x40
#define IO_BUFSIZE 4096
extern int io_gets(struct iop *, s_char *, int);
extern int io_puts(struct iop *, s_char *);
extern int io_shutdown(struct iop *, int);
-extern int io_conn(struct iop *);
extern int io_error(struct iop *);
extern int io_eof(struct iop *);
extern int io_fileno(struct iop *);
#ifndef _IOQUEUE_H_
#define _IOQUEUE_H_
-#define IOQ_BUFSIZE 2048
-#define MAXIOV 16
-
struct io {
struct emp_qelem queue;
int size;
time_t lnd_timestamp; /* Last time this unit was touched */
};
-#define LND_NOTANY bit(0) /* Just a placeholder, not used */
-
struct lchrstr {
u_short l_item[I_MAX+1]; /* load limit */
char *l_name; /* full name of type of land unit */
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 char *getstarg(char *input, char *prompt, char buf[]);
extern char *getstring(char *prompt, char buf[]);
extern char *ugetstring(char *prompt, char buf[]);
extern double tfact(natid cn, double mult);
extern double tfactfire(natid cn, double mult);
extern double techfact(int level, double mult);
-extern double techfactfire(int level, double mult);
-extern double reltech(int level1, int level2, double mult);
extern s_char *cname(natid n);
extern s_char *relatename(struct natstr *np, natid other);
#define P_WALKING 1 /* use BestLandPath, only owned */
#define P_FLYING 2 /* use bestpath, any */
#define P_SAILING 3 /* use bestpath, any */
-#define P_DISTING 4 /* use BestDistPath, only owned */
#define MAX_PATH_LEN 1024
#define PM_R bit(0) /* Recon mission */
#define PM_S bit(1) /* Mine-sweeping mission */
-#define PLN_MAXDEF 50
-
/* internal to "fly" module -- really shouldn't be here */
struct plist {
extern int fsize(int);
extern int blksize(int);
extern time_t fdate(int);
-extern void filetruncate(s_char *);
/* hap_fact.c */
extern double hap_fact(struct natstr *, struct natstr *);
/* hours.c */
extern int sct_prewrite(int, s_char *);
extern void item_prewrite(short *);
extern int issector(s_char *);
-extern void sct_init(coord, coord, s_char *);
/* ship.c */
extern s_char *prship(struct shpstr *);
extern int shp_postread(int, s_char *);
extern void auto_fuel_ship(struct shpstr *);
/* nxtitemp.c */
extern s_char *nxtitemp(struct nstr_item *);
-/* nxtsctp.c */
-extern struct sctstr *nxtsctp(register struct nstr_sect *);
/* plague.c */
extern void do_plague(struct sctstr *, struct natstr *, int);
extern int plague_people(struct natstr *, short *, int *, int *, int);
/* bit masks for the autonav mode flags */
-#define AN_SAILDIR bit(1)
#define AN_AUTONAV bit(2)
#define AN_STANDBY bit(3)
#define AN_LOADING bit(4)
#define UDP_MAX 3
#define UDP_DEFAULT UDP_NORMAL
-/* The maximum number of "update_times" allowed */
-#define UDTIMES_MAX 20
-
#define UDDEM_TMCHECK 0
#define UDDEM_COMSET 1
#define UDDEM_DISABLE 2
#define UDDEM_MAX 2
#define UDDEM_DEFAULT UDDEM_TMCHECK
-#define BLITZTIME 20
-
#endif /* _WANTUPD_H_ */
*
*/
-#define MAXIOV 16
-
struct ioqueue {
struct qelem queue; /* queue fwd/back */
int bsize; /* basic block size */
ship.shp_destx[0] = p0x;
ship.shp_desty[0] = p0y;
- ship.shp_autonav &= ~(AN_STANDBY + AN_SAILDIR + AN_LOADING);
+ ship.shp_autonav &= ~(AN_STANDBY | AN_LOADING);
ship.shp_autonav |= AN_AUTONAV;
if (scuttling)
return 0;
return statb.st_mtime;
}
-
-void
-filetruncate(s_char *name)
-{
- close(open(name, O_RDWR | O_TRUNC, 0660));
-}
{
return mult * ((50.0 + level) / (200.0 + level));
}
-
-/*
- * added so that firing range can be different to other ranges
- */
-double
-techfactfire(int level, double mult)
-{
- return mult * ((50.0 + level) / (200.0 + level)) * fire_range_factor;
-}
-
-/*
- * figure out relative difference between two tech levels
- */
-double
-reltech(int level1, int level2, double mult)
-{
- int diff;
-
- diff = level1 - level2;
- return (1.0 + ((diff + 50.0) / (level1 + 50.0))) * mult;
-}
return 0;
}
-int
-io_conn(struct iop *iop)
-{
- return iop->flags & IO_CONN;
-}
-
int
io_error(struct iop *iop)
{
#include "misc.h"
#include "gen.h"
-s_char *
-plur(int n, s_char *no, s_char *yes)
-{
- return n == 1 ? no : yes;
-}
-
s_char *
splur(int n)
{
return 0;
}
-
-void
-sct_init(coord x, coord y, s_char *ptr)
-{
- struct sctstr *sp = (struct sctstr *)ptr;
-
- sp->ef_type = EF_SECTOR;
- sp->sct_x = x;
- sp->sct_y = y;
- sp->sct_dist_x = x;
- sp->sct_dist_y = y;
-}
OBJS = age.o anno.o bp.o deliver.o distribute.o finish.o human.o land.o \
main.o material.o mobility.o move_sat.o nat.o nav_ship.o nav_util.o \
- nxtitemp.o nxtsctp.o plague.o plane.o populace.o prepare.o produce.o \
+ nxtitemp.o plague.o plane.o populace.o prepare.o produce.o \
removewants.o revolt.o sail.o sect.o ship.o
NTOBJS = age.obj anno.obj bp.obj deliver.obj distribute.obj finish.obj \
human.obj land.obj main.obj material.obj mobility.obj move_sat.obj \
- nat.obj nav_ship.obj nav_util.obj nxtitemp.obj nxtsctp.obj plague.obj \
+ nat.obj nav_ship.obj nav_util.obj nxtitemp.obj plague.obj \
plane.obj populace.obj prepare.obj produce.obj removewants.obj \
revolt.obj sail.obj sect.obj ship.obj
+++ /dev/null
-/*
- * Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2005, 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.
- *
- * ---
- *
- * nxtsctp.c: select/get the next sector from a rnage of sectors
- *
- * Known contributors to this file:
- * Dave Pare, 1989
- */
-
-#include "misc.h"
-#include "xy.h"
-#include "sect.h"
-#include "nsc.h"
-#include "file.h"
-#include "update.h"
-#include "gen.h"
-#include "optlist.h"
-
-/*
- * get the next sector in the range
- * that matches the conditions.
- */
-struct sctstr *
-nxtsctp(struct nstr_sect *np)
-{
- while (1) {
- np->dx++;
- np->x++;
- if (np->x >= WORLD_X)
- np->x = 0;
- if (np->dx >= np->range.width) {
- np->dx = 0;
- np->x = np->range.lx;
- np->dy++;
- if (np->dy >= np->range.height)
- return (struct sctstr *)0;
- np->y++;
- if (np->y >= WORLD_Y)
- np->y = 0;
- }
- if ((np->y + np->x) & 01)
- continue;
- if (np->type == NS_DIST) {
- np->curdist = mapdist(np->x, np->y, np->cx, np->cy);
- if (np->curdist > np->dist)
- continue;
- }
- return getsectp(np->x, np->y);
- }
- /*NOTREACHED*/
-}