#include "extern.h"
void
-attack_city (att_obj, loc)
-piece_info_t *att_obj;
-loc_t loc;
+attack_city(piece_info_t *att_obj, loc_t loc)
{
city_info_t *cityp;
int att_owner, city_owner;
*/
void
-attack_obj (att_obj, loc)
-piece_info_t *att_obj;
-loc_t loc;
+attack_obj(piece_info_t *att_obj, loc_t loc)
{
void describe(), survive();
}
void
-attack (att_obj, loc)
-piece_info_t *att_obj;
-loc_t loc;
+attack(piece_info_t *att_obj, loc_t loc)
{
if (map[loc].contents == '*') /* attacking a city? */
attack_city (att_obj, loc);
*/
void
-survive (obj, loc)
-piece_info_t *obj;
-loc_t loc;
+survive(piece_info_t *obj, loc_t loc)
{
while (obj_capacity (obj) < obj->count)
kill_obj (obj->cargo, loc);
}
void
-describe (win_obj, lose_obj, loc)
-piece_info_t *win_obj, *lose_obj;
-loc_t loc;
+describe(piece_info_t *win_obj, piece_info_t *lose_obj, loc_t loc)
{
char buf[STRSIZE];
char buf2[STRSIZE];
void move_objective(piece_info_t *obj,path_map_t pathmap[],loc_t new_loc,char *adj_list);
void
-comp_move (nmoves)
+comp_move(nmoves)
int nmoves;
{
void do_cities(), do_pieces(), check_endgame();
*/
void
-do_cities () {
+do_cities(void) {
void comp_prod();
int i;
*/
void
-comp_prod (cityp, is_lake)
-city_info_t *cityp;
-int is_lake;
+comp_prod(city_info_t *cityp, int is_lake)
{
void comp_set_prod(), comp_set_needed();
*/
void
-comp_set_prod (cityp, type)
-city_info_t *cityp;
-int type;
+comp_set_prod(city_info_t *cityp, int type)
{
if (cityp->prod == type) return;
*/
int
-overproduced (cityp, city_count)
-city_info_t *cityp;
-int *city_count;
+overproduced(city_info_t *cityp, int *city_count)
{
int i;
*/
int
-need_more (city_count, prod1, prod2)
-int *city_count;
-int prod1, prod2;
+need_more(int *city_count, int prod1, int prod2)
{
if (city_count[prod1] * ratio[prod2]
<= city_count[prod2] * ratio[prod1])
*/
void
-comp_set_needed (cityp, city_count, army_ok, is_lake)
-city_info_t *cityp;
-int *city_count;
-int army_ok;
-int is_lake;
+comp_set_needed(city_info_t *cityp, int *city_count, int army_ok, int is_lake)
{
int best_prod;
int prod;
*/
int
-lake (loc)
-loc_t loc;
+lake(loc_t loc)
{
int cont_map[MAP_SIZE];
scan_counts_t counts;
static path_map_t path_map[MAP_SIZE];
void
-do_pieces () { /* move pieces */
+do_pieces(void) { /* move pieces */
void cpiece_move();
int i;
*/
void
-cpiece_move (obj)
-piece_info_t *obj;
+cpiece_move(piece_info_t *obj)
{
void move1();
*/
void
-move1 (obj)
-piece_info_t *obj;
+move1(piece_info_t *obj)
{
void army_move(), transport_move(), fighter_move(), ship_move();
*/
void
-army_move (obj)
-piece_info_t *obj;
+army_move(piece_info_t *obj)
{
loc_t move_away();
loc_t find_attack();
*/
void
-unmark_explore_locs (xmap)
-view_map_t *xmap;
+unmark_explore_locs(view_map_t *xmap)
{
count_t i;
*/
void
-make_army_load_map (obj, xmap, vmap)
-piece_info_t *obj;
-view_map_t *xmap;
-view_map_t *vmap;
+make_army_load_map(piece_info_t *obj, view_map_t *xmap, view_map_t *vmap)
{
piece_info_t *p;
int i;
/* Return true if an army is considered near a location for loading. */
int
-nearby_load (obj, loc)
-piece_info_t *obj;
-loc_t loc;
+nearby_load(piece_info_t *obj, loc_t loc)
{
return obj->func == 1 && dist (obj->loc, loc) <= 2;
}
/* Return number of nearby armies. */
int
-nearby_count (loc)
-loc_t loc;
+nearby_count(loc_t loc)
{
piece_info_t *obj;
int count;
/* Make load map for a ship. */
void
-make_tt_load_map (xmap, vmap)
-view_map_t *xmap;
-view_map_t *vmap;
+make_tt_load_map(view_map_t *xmap, view_map_t *vmap)
{
piece_info_t *p;
static int tcont_map[MAP_SIZE];
void
-make_unload_map (xmap, vmap)
-view_map_t *xmap;
-view_map_t *vmap;
+make_unload_map(view_map_t *xmap, view_map_t *vmap)
{
count_t i;
scan_counts_t counts;
*/
void
-board_ship (obj, pmap, dest)
-piece_info_t *obj;
-path_map_t *pmap;
-loc_t dest;
+board_ship(piece_info_t *obj, path_map_t *pmap, loc_t dest)
{
if (!load_army (obj)) {
obj->func = 1; /* loading */
*/
piece_info_t *
-find_best_tt (best, loc)
-piece_info_t *best;
-loc_t loc;
+find_best_tt(piece_info_t *best, loc_t loc)
{
piece_info_t *p;
*/
int
-load_army (obj)
-piece_info_t *obj;
+load_army(piece_info_t *obj)
{
piece_info_t *p;
int i;
*/
loc_t
-move_away (vmap, loc, terrain)
-view_map_t *vmap;
-loc_t loc;
-char *terrain;
+move_away(view_map_t *vmap, loc_t loc, char *terrain)
{
loc_t new_loc;
int i;
*/
loc_t
-find_attack (loc, obj_list, terrain)
-loc_t loc;
-char *obj_list;
-char *terrain;
+find_attack(loc_t loc, char *obj_list, char *terrain)
{
loc_t new_loc, best_loc;
int i, best_val;
*/
void
-transport_move (obj)
-piece_info_t *obj;
+transport_move(piece_info_t *obj)
{
void tt_do_move();
*/
void
-fighter_move (obj)
-piece_info_t *obj;
+fighter_move(piece_info_t *obj)
{
loc_t new_loc;
*/
void
-ship_move (obj)
-piece_info_t *obj;
+ship_move(piece_info_t *obj)
{
loc_t new_loc;
char *adj_list;
*/
void
-move_objective (obj, pathmap, new_loc, adj_list)
-piece_info_t *obj;
-path_map_t pathmap[];
-loc_t new_loc;
-char *adj_list;
+move_objective(piece_info_t *obj, path_map_t pathmap[],
+ loc_t new_loc, char *adj_list)
{
char *terrain;
char *attack_list;
*/
void
-check_endgame () { /* see if game is over */
+check_endgame(void) { /* see if game is over */
int nuser_city, ncomp_city;
int nuser_army, ncomp_army;
* Map input character to direction offset.
* Attempts to enable arrow and keypad keys.
*/
-int direction(c)
-chtype c;
+int direction(chtype c)
{
switch (c)
{
*/
void
-display_loc (whose, vmap, loc)
-int whose; /* whose map to display */
-view_map_t vmap[];
-loc_t loc; /* location to display */
+display_loc (int whose, view_map_t vmap[], loc_t loc)
+/* whose is whose map to display; loc is location to display */
{
if (change_ok || whose != whose_map || !on_screen (loc))
print_sector (whose, vmap, loc_sector (loc));
*/
void
-display_locx (whose, vmap, loc)
-int whose; /* whose map to display */
-view_map_t vmap[];
-loc_t loc; /* location to display */
+display_locx (int whose, view_map_t vmap[], loc_t loc)
+/* whose is whose map to display; loc is location to display */
{
if (whose == whose_map && on_screen (loc))
show_loc (vmap, loc);
*/
void
-show_loc (vmap, loc)
-view_map_t vmap[];
-loc_t loc;
+show_loc (view_map_t vmap[], loc_t loc)
{
int r, c;
*/
void
-print_sector (whose, vmap, sector)
-char whose; /* USER or COMP */
-view_map_t vmap[]; /* map to display */
-int sector; /* sector to display */
+print_sector(int whose, view_map_t vmap[], int sector)
+/* whose is USER or COMP, vmap is map to display, sector is sector to display */
{
void display_screen();
*/
-static void disp_square(vp)
-view_map_t *vp;
+static void disp_square(view_map_t *vp)
{
#ifdef A_COLOR
chtype attr;
Display the portion of the map that appears on the screen.
*/
-void display_screen (vmap)
-view_map_t vmap[];
+void display_screen(view_map_t vmap[])
{
int display_rows, display_cols;
int r, c;
*/
int
-move_cursor (cursor, offset)
-loc_t *cursor; /* current cursor position */
-int offset; /* offset to add to cursor */
+move_cursor(loc_t *cursor, int offset)
+/* cursor is current cursor position, offset is offset to add to cursor */
{
loc_t t;
int r, c;
See if a location is displayed on the screen.
*/
-int on_screen (loc)
-loc_t loc;
+int on_screen (loc_t loc)
{
int new_r, new_c;
/* Print a view map for debugging. */
void
-print_xzoom (vmap)
-view_map_t *vmap;
+print_xzoom(view_map_t *vmap)
{
print_zoom (vmap);
#if 0
char zoom_list[] = "XO*tcbsdpfaTCBSDPFAzZ+. ";
void
-print_zoom (vmap)
-view_map_t *vmap;
+print_zoom(view_map_t *vmap)
{
void print_zoom_cell ();
*/
void
-print_zoom_cell (vmap, row, col, row_inc, col_inc)
-view_map_t *vmap;
-int row, col;
-int row_inc, col_inc;
+print_zoom_cell(view_map_t *vmap,
+ int row, int col, int row_inc, int col_inc)
{
int r, c;
char cell;
*/
void
-print_pzoom (s, pmap, vmap)
-char *s;
-path_map_t *pmap;
-view_map_t *vmap;
+print_pzoom(char *s, path_map_t *pmap, view_map_t *vmap)
{
void print_pzoom_cell();
*/
void
-print_pzoom_cell (pmap, vmap, row, col, row_inc, col_inc)
-path_map_t *pmap;
-view_map_t *vmap;
-int row, col;
-int row_inc, col_inc;
+print_pzoom_cell(path_map_t *pmap, view_map_t *vmap,
+ int row, int col, int row_inc, int col_inc)
{
int r, c;
int sum, d;
*/
void
-display_score (void)
+display_score(void)
{
pos_str (1, cols-12, " User Comp",0,0,0,0,0,0,0,0);
pos_str (2, cols-12, "%5d %5d", user_score, comp_score,0,0,0,0,0,0);
*/
void
-clreol(linep, colp)
-int linep, colp;
+clreol(int linep, int colp)
{
(void) move (linep, colp);
(void) clrtoeol();
*/
void
-clear_screen (void) {
+clear_screen(void)
+{
(void) clear ();
(void) refresh ();
kill_display ();
*/
void
-redisplay (void) {
+redisplay(void)
+{
(void) refresh ();
}
void
-redraw (void) {
+redraw(void)
+{
(void) clearok (curscr, TRUE);
(void) refresh ();
}
*/
void
-delay (void) {
+delay(void)
+{
int t = delay_time;
int i = 500;
(void) refresh ();
*/
void
-pos_str1 (row, col, str, a, b, c, d, e, f, g, h)
-int row, col;
-char *str, *a;
-int b, c, d, e, f, g, h;
+pos_str1(int row, int col, char *str, char *a,
+ int b, int c, int d, int e, int f, int g, int h)
{
(void) move (row, col);
addprintf1 (str, a, b, c, d, e, f, g, h);
}
+
void
-pos_str (row, col, str, a, b, c, d, e, f, g, h)
-int row, col;
-char *str;
-int a, b, c, d, e, f, g, h;
+pos_str(int row, int col, char *str,
+ int a, int b, int c, int d, int e, int f, int g, int h)
{
(void) move (row, col);
addprintf (str, a, b, c, d, e, f, g, h);
void
/* VARARGS1 */
-addprintf (str, a, b, c, d, e, f, g, h)
-char *str;
-int a, b, c, d, e, f, g, h;
+addprintf(char *str, int a, int b, int c, int d, int e, int f, int g, int h)
{
char junkbuf[STRSIZE];
}
void
/* VARARGS1 */
-addprintf1 (str, a, b, c, d, e, f, g, h)
-char *str;
-char *a;
-int b, c, d, e, f, g, h;
+addprintf1(char *str, char *a, int b, int c, int d, int e, int f, int g, int h)
{
char junkbuf[STRSIZE];
(void) sprintf (junkbuf, str, a, b, c, d, e, f, g, h);
(void) addstr (junkbuf);
}
+
void
/* VARARGS1 */
-addprintf2 (str, a, b, c, d, e, f, g, h)
-char *str;
-char *a, *e, *f;
-int b, c, d, g, h;
+addprintf2(char *str, char *a, int b, int c, int d, char *e, char *f, int g, int h)
{
char junkbuf[STRSIZE];
extern char zoom_list[];
void
-print_movie_cell (mbuf, row, col, row_inc, col_inc)
-char *mbuf;
-int row, col;
-int row_inc, col_inc;
+print_movie_cell(char *mbuf, int row, int col, int row_inc, int col_inc)
{
int r, c;
char cell;
extern int get_piece_name(void);
void
-edit(edit_cursor)
-loc_t edit_cursor;
+edit(loc_t edit_cursor)
{
char e_cursor();
void e_leave(), e_print(), e_random();
*/
char
-e_cursor (edit_cursor)
-loc_t *edit_cursor;
+e_cursor(loc_t *edit_cursor)
{
chtype e;
int p;
*/
void
-e_leave (void) {
+e_leave(void) {
}
/*
*/
void
-e_print (edit_cursor)
-loc_t *edit_cursor;
+e_print(loc_t *edit_cursor)
{
int sector;
*/
void
-e_set_func (loc, func)
-loc_t loc;
-long func;
+e_set_func(loc_t loc, long func)
{
piece_info_t *obj;
obj = find_obj_at_loc (loc);
/* Set the function of a city for some piece. */
void
-e_set_city_func (cityp, type, func)
-city_info_t *cityp;
-int type;
-long func;
+e_set_city_func(city_info_t *cityp, int type, long func)
{
cityp->func[type] = func;
}
*/
void
-e_random (loc)
-loc_t loc;
+e_random(loc_t loc)
{
e_set_func (loc, RANDOM);
}
void
-e_city_random (cityp, type)
-city_info_t *cityp;
-int type;
+e_city_random(city_info_t *cityp, int type)
{
e_set_city_func (cityp, type, RANDOM);
}
*/
void
-e_fill (loc)
-loc_t loc;
+e_fill(loc_t loc)
{
if (user_map[loc].contents == 'T' || user_map[loc].contents == 'C')
e_set_func (loc, FILL);
}
void
-e_city_fill (cityp, type)
-city_info_t *cityp;
-int type;
+e_city_fill(city_info_t *cityp, int type)
{
if (type == TRANSPORT || type == CARRIER)
e_set_city_func (cityp, type, FILL);
*/
void
-e_explore (loc)
-loc_t loc;
+e_explore(loc_t loc)
{
e_set_func (loc, EXPLORE);
}
void
-e_city_explore (cityp, type)
-city_info_t *cityp;
-int type;
+e_city_explore(city_info_t *cityp, loc_t type)
{
e_set_city_func (cityp, type, EXPLORE);
}
*/
void
-e_land (loc)
-loc_t loc;
+e_land(loc_t loc)
{
if (user_map[loc].contents == 'F')
e_set_func (loc, LAND);
else huh ();
}
+
/*
Set an army's function to TRANSPORT.
*/
void
-e_transport (loc)
-loc_t loc;
+e_transport(loc_t loc)
{
if (user_map[loc].contents == 'A')
e_set_func (loc, WFTRANSPORT);
*/
void
-e_attack (loc)
-loc_t loc;
+e_attack(loc_t loc)
{
if (user_map[loc].contents == 'A')
e_set_func (loc, ARMYATTACK);
}
void
-e_city_attack (cityp, type)
-city_info_t *cityp;
-int type;
+e_city_attack(city_info_t *cityp, int type)
{
if (type == ARMY)
e_set_city_func (cityp, type, ARMYATTACK);
*/
void
-e_repair (loc)
-loc_t loc;
+e_repair(loc_t loc)
{
if (strchr ("PDSTBC", user_map[loc].contents))
e_set_func (loc, REPAIR);
}
void
-e_city_repair (cityp, type)
-city_info_t *cityp;
-int type;
+e_city_repair(city_info_t *cityp, int type)
{
if (type == ARMY || type == FIGHTER || type == SATELLITE)
huh ();
static char dirs[] = "WEDCXZAQ";
void
-e_stasis (loc)
-loc_t loc;
+e_stasis(loc_t loc)
{
char e;
char *p;
}
void
-e_city_stasis (cityp, type)
-city_info_t *cityp;
-int type;
+e_city_stasis(city_info_t *cityp, int type)
{
char e;
char *p;
*/
void
-e_wake (loc)
-loc_t loc;
+e_wake(loc_t loc)
{
city_info_t *cityp;
piece_info_t *obj;
}
void
-e_city_wake (cityp, type)
-city_info_t *cityp;
-int type;
+e_city_wake(city_info_t *cityp, int type)
{
e_set_city_func (cityp, type, NOFUNC);
}
*/
void
-e_city_func (path_start, loc, path_type)
-loc_t *path_start;
-loc_t loc;
-int *path_type;
+e_city_func(loc_t *path_start, loc_t loc, int *path_type)
{
int type;
char e;
*/
void
-e_move (path_start, loc)
-loc_t *path_start;
-loc_t loc;
+e_move(loc_t *path_start, loc_t loc)
{
if (!isupper(user_map[loc].contents)) huh (); /* nothing there? */
else if (user_map[loc].contents == 'X') huh (); /* enemy city? */
*/
void
-e_end (path_start, loc, path_type)
-loc_t *path_start;
-loc_t loc;
-int path_type;
+e_end(loc_t *path_start, loc_t loc, int path_type)
{
city_info_t *cityp;
*/
void
-e_sleep (loc)
-loc_t loc;
+e_sleep(loc_t loc)
{
if (user_map[loc].contents == 'O') huh (); /* can't sleep a city */
else e_set_func (loc, SENTRY);
*/
void
-e_info (edit_cursor)
-loc_t edit_cursor;
+e_info(loc_t edit_cursor)
{
- void e_city_info(), e_piece_info();
+ void e_city_info(loc_t), e_piece_info(loc_t edit_cursor, char ab);
char ab;
*/
void
-e_piece_info (edit_cursor, ab)
-loc_t edit_cursor;
-char ab;
+e_piece_info(loc_t edit_cursor, char ab)
{
piece_info_t *obj;
int type;
*/
void
-e_city_info (edit_cursor)
-loc_t edit_cursor;
+e_city_info(loc_t edit_cursor)
{
piece_info_t *obj;
city_info_t *cityp;
*/
void
-e_prod (loc)
-loc_t loc;
+e_prod(loc_t loc)
{
city_info_t *cityp;
*/
void
-e_help (void) {
+e_help(void) {
help (help_edit, edit_lines);
prompt ("Press any key to continue: ",0,0,0,0,0,0,0,0);
(void) get_chx ();
*/
void
-empire (void) {
- void do_command();
+empire(void) {
+ void do_command(char);
void print_zoom();
char order;
*/
void
-do_command (orders)
-char orders;
+do_command(char orders)
{
- void c_debug(), c_quit(void), c_sector(void), c_map(void);
+ void c_debug(char order), c_quit(void), c_sector(void), c_map(void);
void c_give(void);
char e;
*/
void
-c_give () {
+c_give(void) {
int unowned[NUM_CITY];
count_t i, count;
*/
void
-c_debug (order)
-char order;
+c_debug(char order)
{
char e;
*/
void
-c_quit (void) {
+c_quit(void) {
if (getyn ("QUIT - Are you sure? ")) {
empend ();
}
*/
void
-c_sector (void) {
+c_sector(void) {
int num;
num = get_range ("Sector number? ", 0, NUM_SECTORS-1);
*/
void
-c_map (void) {
+c_map(void) {
FILE *f;
int i, j;
char line[MAP_HEIGHT+2];
*/
void
-c_examine (void) {
+c_examine(void) {
int num;
num = get_range ("Sector number? ", 0, NUM_SECTORS-1);
*/
void
-c_movie (void) {
+c_movie(void) {
for (;;) {
comp_move (1);
print_zoom (comp_map);
pieces on the board.
*/
-void init_game (void) {
+void init_game(void) {
void make_map(void), place_cities(void);
count_t i;
static int height[2][MAP_SIZE];
static int height_count[MAX_HEIGHT+1];
-void make_map (void) {
+void make_map(void) {
int from, to, k;
count_t i, j, sum;
loc_t loc;
/* avoid compiler problems with large automatic arrays */
static loc_t land[MAP_SIZE];
-void place_cities (void) {
+void place_cities(void) {
count_t regen_land();
count_t placed, i;
remove any land which is too close to a city.
*/
-count_t regen_land (placed)
-count_t placed;
+count_t regen_land(count_t placed)
{
count_t num_land;
count_t i;
Remove land that is too close to a city.
*/
-count_t remove_land (loc, num_land)
-loc_t loc;
-count_t num_land;
+count_t remove_land(loc_t loc, count_t num_land)
{
count_t new, i;
static int rank_tab[MAX_CONT]; /* indices to cont_tab in order of rank */
static pair_t pair_tab[MAX_CONT*MAX_CONT]; /* ranked pairs of continents */
-int select_cities (void) {
+int select_cities(void) {
void find_cont(void), make_pair(void);
loc_t compi, useri;
city. We rank the continents.
*/
-void find_cont (void) {
+void find_cont(void) {
loc_t i;
loc_t mapi;
If there are no more continents, we return false.
*/
-int find_next (mapi)
-loc_t *mapi;
+int find_next(loc_t *mapi)
{
count_t i;
long val;
static count_t ncity, nland, nshore;
static void mark_cont(loc_t);
-int good_cont (mapi)
-loc_t mapi;
+int good_cont(loc_t mapi)
{
long val;
*/
static void
-mark_cont (mapi)
-loc_t mapi;
+mark_cont(loc_t mapi)
{
int i;
between the user's continent and the computer's continent.
*/
-void make_pair (void) {
+void make_pair(void) {
int i, j, k, npair;
long val;
#define wbuf(buf) if (!xwrite (f, (char *)buf, sizeof (buf))) return
#define wval(val) if (!xwrite (f, (char *)&val, sizeof (val))) return
-void save_game (void) {
+void save_game(void) {
FILE *f; /* file to save game in */
f = fopen (savefile, "w"); /* open for output */
#define rbuf(buf) if (!xread (f, (char *)buf, sizeof(buf))) return (FALSE);
#define rval(val) if (!xread (f, (char *)&val, sizeof(val))) return (FALSE);
-int restore_game (void) {
+int restore_game(void) {
void read_embark();
FILE *f; /* file to save game in */
the ship has the same amount of cargo it previously had.
*/
-void read_embark (list, piece_type)
-piece_info_t *list;
-int piece_type;
+void read_embark(piece_info_t *list, int piece_type)
{
void inconsistent(void);
}
}
-void inconsistent (void) {
+void inconsistent(void) {
(void) printf ("saved game is inconsistent. Please remove it.\n");
exit (1);
}
Also, tell the user why the write did not work if it didn't.
*/
-int xwrite (f, buf, size)
-FILE *f;
-char *buf;
-int size;
+int xwrite(FILE *f, char *buf, int size)
{
int bytes;
and return FALSE.
*/
-int xread (f, buf, size)
-FILE *f;
-char *buf;
-int size;
+int xread(FILE *f, char *buf, int size)
{
int bytes;
static char mapbuf[MAP_SIZE];
void
-save_movie_screen (void)
+save_movie_screen(void)
{
FILE *f; /* file to save game in */
count_t i;
*/
void
-replay_movie (void)
+replay_movie(void)
{
void print_movie_cell();
/* in declared order, with city first */
static char *pieces = "OAFPDSTCBZXafpdstcbz";
-void stat_display (mbuf, round)
-char *mbuf;
-int round;
+void stat_display(char *mbuf, int round)
{
count_t i;
int counts[2*NUM_OBJECTS+2];
#define OPTFLAGS "w:s:d:S:f:"
-int main (argc, argv)
+int main(argc, argv)
int argc;
char *argv[];
{
*/
void
-vmap_cont (cont_map, vmap, loc, bad_terrain)
-int *cont_map;
-view_map_t *vmap;
-loc_t loc;
-char bad_terrain;
+vmap_cont (int *cont_map, view_map_t *vmap, loc_t loc, char bad_terrain)
{
(void) bzero ((char *)cont_map, MAP_SIZE * sizeof (int));
vmap_mark_up_cont (cont_map, vmap, loc, bad_terrain);
*/
void
-vmap_mark_up_cont (cont_map, vmap, loc, bad_terrain)
-int *cont_map;
-view_map_t *vmap;
-loc_t loc;
-char bad_terrain;
+vmap_mark_up_cont (int *cont_map, view_map_t *vmap, loc_t loc, char bad_terrain)
{
int i, j;
loc_t new_loc;
or lakes.
*/
-static void rmap_mark_up_cont();
+static void rmap_mark_up_cont(int *cont_map, loc_t loc, char bad_terrain);
void
-rmap_cont (cont_map, loc, bad_terrain)
-int *cont_map;
-loc_t loc;
-char bad_terrain;
+rmap_cont (int *cont_map, loc_t loc, char bad_terrain)
{
(void) bzero ((char *)cont_map, MAP_SIZE * sizeof (int));
rmap_mark_up_cont (cont_map, loc, bad_terrain);
*/
static void
-rmap_mark_up_cont (cont_map, loc, bad_terrain)
-int *cont_map;
-loc_t loc;
-char bad_terrain;
+rmap_mark_up_cont (int *cont_map, loc_t loc, char bad_terrain)
{
int i;
loc_t new_loc;
#define COUNT(c,item) case c: item += 1; break
scan_counts_t
-vmap_cont_scan (cont_map, vmap)
-int *cont_map;
-view_map_t *vmap;
+vmap_cont_scan (int *cont_map, view_map_t *vmap)
{
scan_counts_t counts;
count_t i;
*/
scan_counts_t
-rmap_cont_scan (cont_map)
-int *cont_map;
+rmap_cont_scan (int *cont_map)
{
scan_counts_t counts;
count_t i;
*/
int
-map_cont_edge (cont_map, loc)
-int *cont_map;
-loc_t loc;
+map_cont_edge (int *cont_map, loc_t loc)
{
loc_t i, j;
/* Find an objective over a single type of terrain. */
loc_t
-vmap_find_xobj (path_map, vmap, loc, move_info, start, expand)
-path_map_t path_map[];
-view_map_t *vmap;
-loc_t loc;
-move_info_t *move_info;
-int start;
-int expand;
+vmap_find_xobj (path_map_t path_map[], view_map_t *vmap,
+ loc_t loc, move_info_t *move_info, int start, int expand)
{
perimeter_t *from;
perimeter_t *to;
/* Find an objective for a piece that crosses land and water. */
loc_t
-vmap_find_aobj (path_map, vmap, loc, move_info)
-path_map_t path_map[];
-view_map_t *vmap;
-loc_t loc;
-move_info_t *move_info;
+vmap_find_aobj (path_map_t path_map[], view_map_t *vmap,
+ loc_t loc, move_info_t *move_info)
{
return vmap_find_xobj (path_map, vmap, loc, move_info, T_LAND, T_AIR);
}
/* Find an objective for a piece that crosses only water. */
loc_t
-vmap_find_wobj (path_map, vmap, loc, move_info)
-path_map_t path_map[];
-view_map_t *vmap;
-loc_t loc;
-move_info_t *move_info;
+vmap_find_wobj (path_map_t path_map[], view_map_t *vmap,
+ loc_t loc, move_info_t *move_info)
{
return vmap_find_xobj (path_map, vmap, loc, move_info, T_WATER, T_WATER);
}
/* Find an objective for a piece that crosses only land. */
loc_t
-vmap_find_lobj (path_map, vmap, loc, move_info)
-path_map_t path_map[];
-view_map_t *vmap;
-loc_t loc;
-move_info_t *move_info;
+vmap_find_lobj (path_map_t path_map[], view_map_t *vmap,
+ loc_t loc, move_info_t *move_info)
{
return vmap_find_xobj (path_map, vmap, loc, move_info, T_LAND, T_LAND);
}
*/
loc_t
-vmap_find_lwobj (path_map, vmap, loc, move_info, beat_cost)
-path_map_t path_map[];
-view_map_t *vmap;
-loc_t loc;
-move_info_t *move_info;
-int beat_cost;
+vmap_find_lwobj (path_map_t path_map[], view_map_t *vmap,
+ loc_t loc, move_info_t *move_info, int beat_cost)
{
perimeter_t *cur_land;
perimeter_t *cur_water;
*/
STATIC int
-best_adj (pmap, loc, type)
-path_map_t *pmap;
-loc_t loc;
-int type;
+best_adj (path_map_t *pmap, loc_t loc, int type)
{
int i;
loc_t new_loc;
*/
loc_t
-vmap_find_wlobj (path_map, vmap, loc, move_info)
-path_map_t path_map[];
-view_map_t *vmap;
-loc_t loc;
-move_info_t *move_info;
+vmap_find_wlobj (path_map_t path_map[], view_map_t *vmap,
+ loc_t loc, move_info_t *move_info)
{
perimeter_t *cur_land;
perimeter_t *cur_water;
static int init_done = 0;
STATIC void
-start_perimeter (pmap, perim, loc, terrain)
-path_map_t *pmap;
-perimeter_t *perim;
-loc_t loc;
-int terrain;
+start_perimeter (path_map_t *pmap, perimeter_t *perim, loc_t loc, int terrain)
{
int i;
*/
STATIC void
-expand_perimeter (pmap, vmap, move_info, curp, type, cur_cost, inc_wcost, inc_lcost, waterp, landp)
-path_map_t *pmap; /* path map to update */
-view_map_t *vmap;
-move_info_t *move_info; /* objectives and weights */
-perimeter_t *curp; /* perimeter to expand */
-int type; /* type of terrain to expand */
-int cur_cost; /* cost to reach cells on perimeter */
-int inc_wcost; /* cost to enter new water cells */
-int inc_lcost; /* cost to enter new land cells */
-perimeter_t *waterp; /* pointer to new water perimeter */
-perimeter_t *landp; /* pointer to new land perimeter */
+expand_perimeter (path_map_t *pmap, view_map_t *vmap, move_info_t *move_info,
+ perimeter_t *curp,
+ int type, int cur_cost, int inc_wcost, int inc_lcost,
+ perimeter_t *waterp, perimeter_t *landp)
+/* pmap = path map to update */
+/* move_info = objectives and weights */
+/* curp = perimeter to expand */
+/* type = type of terrain to expand */
+/* cur_cost = cost to reach cells on perimeter */
+/* inc_wcost = cost to enter new water cells */
+/* inc_lcost = cost to enter new land cells */
+/* waterp = pointer to new water perimeter */
+/* landp = pointer to new land perimeter */
{
register long i;
register int j;
/* Add a cell to a perimeter list. */
STATIC void
-add_cell (pmap, new_loc, perim, terrain, cur_cost, inc_cost)
-path_map_t *pmap;
-loc_t new_loc;
-perimeter_t *perim;
-int terrain;
-int cur_cost;
-int inc_cost;
+add_cell (path_map_t *pmap, loc_t new_loc,
+ perimeter_t *perim, int terrain, int cur_cost, int inc_cost)
{
register path_map_t *pm = &pmap[new_loc];
/* Compute the cost to move to an objective. */
STATIC int
-objective_cost (vmap, move_info, loc, base_cost)
-view_map_t *vmap;
-move_info_t *move_info;
-loc_t loc;
-int base_cost;
+objective_cost (view_map_t *vmap, move_info_t *move_info,
+ loc_t loc, int base_cost)
{
char *p;
int w;
*/
STATIC int
-terrain_type (pmap, vmap, move_info, from_loc, to_loc)
-path_map_t *pmap;
-view_map_t *vmap;
-move_info_t *move_info;
-loc_t from_loc;
-loc_t to_loc;
+terrain_type (path_map_t *pmap, view_map_t *vmap, move_info_t *move_info,
+ loc_t from_loc, loc_t to_loc)
{
if (vmap[to_loc].contents == '+') return T_LAND;
if (vmap[to_loc].contents == '.') return T_WATER;
*/
void
-vmap_prune_explore_locs (vmap)
-view_map_t *vmap;
+vmap_prune_explore_locs (view_map_t *vmap)
{
path_map_t pmap[MAP_SIZE];
perimeter_t *from, *to;
*/
STATIC void
-expand_prune (vmap, pmap, loc, type, to, explored)
-view_map_t *vmap;
-path_map_t *pmap;
-loc_t loc;
-int type;
-perimeter_t *to;
-int *explored;
+expand_prune (view_map_t *vmap, path_map_t *pmap,
+ loc_t loc, int type, perimeter_t *to, int *explored)
{
int i;
loc_t new_loc;
*/
loc_t
-vmap_find_dest (path_map, vmap, cur_loc, dest_loc, owner, terrain)
-path_map_t path_map[];
-view_map_t vmap[];
-loc_t cur_loc; /* current location of piece */
-loc_t dest_loc; /* destination of piece */
-int owner; /* owner of piece being moved */
-int terrain; /* terrain we can cross */
+vmap_find_dest (path_map_t path_map[], view_map_t vmap[],
+ loc_t cur_loc, loc_t dest_loc, int owner, int terrain)
+/* cur_loc = current location of piece */
+/* dest_loc = destination of piece */
+/* owner = owner of piece being moved */
+/* terrain = terrain we can cross */
{
perimeter_t *from;
perimeter_t *to;
*/
void
-vmap_mark_path (path_map, vmap, dest)
-path_map_t *path_map;
-view_map_t *vmap;
-loc_t dest;
+vmap_mark_path (path_map_t *path_map, view_map_t *vmap, loc_t dest)
{
int n;
loc_t new_dest;
*/
void
-vmap_mark_adjacent (path_map, loc)
-path_map_t path_map[];
-loc_t loc;
+vmap_mark_adjacent (path_map_t path_map[], loc_t loc)
{
int i;
loc_t new_loc;
*/
void
-vmap_mark_near_path (path_map, loc)
-path_map_t path_map[];
-loc_t loc;
+vmap_mark_near_path (path_map_t path_map[], loc_t loc)
{
int i, j;
loc_t new_loc, xloc;
#include "empire.h"
#include "extern.h"
-void rndini()
+void rndini(void)
{
srand((unsigned)(time(0) & 0xFFFF));
}
-long irand(high)
-long high;
+long irand(long high)
{
if (high < 2) {
return (0);
return (rand() % high);
}
-int rndint(minp, maxp)
-int minp, maxp;
+int rndint(int minp, int maxp)
{
int size;
#define ABS(a) ((a) < 0 ? -(a) : (a))
int
-dist (a, b)
-loc_t a, b;
+dist(loc_t a, loc_t b)
{
int ax, ay, bx, by;
of the square root using Newton's method.
*/
-int isqrt (n)
-int n;
+int isqrt(int n)
{
int guess;
*/
int
-find_nearest_city (loc, owner, city_loc)
-loc_t loc;
-int owner;
-loc_t *city_loc;
+find_nearest_city(loc_t loc, int owner, loc_t *city_loc)
{
loc_t best_loc;
long best_dist;
Given the location of a city, return the index of that city.
*/
-city_info_t *find_city (loc)
-loc_t loc;
+city_info_t *find_city(loc_t loc)
{
return (map[loc].cityp);
}
half of its hits moves at half-speed, for example.
*/
-int obj_moves (obj)
-piece_info_t *obj;
+int obj_moves (piece_info_t *obj)
{
return (piece_attr[obj->type].speed * obj->hits
+ piece_attr[obj->type].max_hits - 1) /* round up */
Figure out the capacity for an object.
*/
-int obj_capacity (obj)
-piece_info_t *obj;
+int obj_capacity(piece_info_t *obj)
{
return (piece_attr[obj->type].capacity * obj->hits
+ piece_attr[obj->type].max_hits - 1) /* round up */
list of objects at the given location for one of the given type.
*/
-piece_info_t *find_obj (type, loc)
-int type;
-loc_t loc;
+piece_info_t *find_obj(int type, loc_t loc)
{
piece_info_t *p;
Find a non-full item of the appropriate type at the given location.
*/
-piece_info_t *find_nfull (type, loc)
-int type;
-loc_t loc;
+piece_info_t *find_nfull(int type, loc_t loc)
{
piece_info_t *p;
*/
loc_t
-find_transport (owner, loc)
-int owner;
-loc_t loc;
+find_transport(int owner, loc_t loc)
{
int i;
loc_t new_loc;
*/
piece_info_t *
-find_obj_at_loc (loc)
-loc_t loc;
+find_obj_at_loc(loc_t loc)
{
piece_info_t *p, *best;
If an object is on a ship, remove it from that ship.
*/
-void disembark (obj)
-piece_info_t *obj;
+void disembark(piece_info_t *obj)
{
if (obj->ship) {
UNLINK (obj->ship->cargo, obj, cargo_link);
Move an object onto a ship.
*/
-void embark (ship, obj)
-piece_info_t *ship, *obj;
+void embark(piece_info_t *ship, piece_info_t *obj)
{
obj->ship = ship;
LINK (ship->cargo, obj, cargo_link);
anything in the object, it is killed as well.
*/
-void kill_obj (obj, loc)
-piece_info_t *obj;
-loc_t loc;
+void kill_obj(piece_info_t *obj, loc_t loc)
{
void kill_one();
/* kill an object without scanning */
-void kill_one (list, obj)
-piece_info_t **list;
-piece_info_t *obj;
+void kill_one(piece_info_t **list, piece_info_t *obj)
{
UNLINK (list[obj->type], obj, piece_link); /* unlink obj from all lists */
UNLINK (map[obj->loc].objp, obj, loc_link);
to unowned. We scan around the city's location.
*/
-void kill_city (cityp)
-city_info_t *cityp;
+void kill_city(city_info_t *cityp)
{
view_map_t *vmap;
piece_info_t *p;
static int sat_dir[4] = {MOVE_NW, MOVE_SW, MOVE_NE, MOVE_SE};
void
-produce (cityp)
-city_info_t *cityp;
+produce(city_info_t *cityp)
{
piece_info_t **list;
piece_info_t *new;
etc.
*/
-void move_obj (obj, new_loc)
-piece_info_t *obj;
-loc_t new_loc;
+void move_obj(piece_info_t *obj, loc_t new_loc)
{
view_map_t *vmap;
loc_t old_loc;
/* Return next direction for a sattellite to travel. */
static loc_t
-bounce (loc, dir1, dir2, dir3)
-loc_t loc, dir1, dir2, dir3;
+bounce(loc_t loc, loc_t dir1, loc_t dir2, loc_t dir3)
{
int new_loc;
/* Move a satellite one square. */
static void
-move_sat1 (obj)
-piece_info_t *obj;
+move_sat1(piece_info_t *obj)
{
int dir;
loc_t new_loc;
*/
void
-move_sat (obj)
-piece_info_t *obj;
+move_sat(piece_info_t *obj)
{
obj->moved = 0;
move onto transports, and fighters may move onto cities or carriers.
*/
-int good_loc (obj, loc)
-piece_info_t *obj;
-loc_t loc;
+int good_loc(piece_info_t *obj, loc_t loc)
{
view_map_t *vmap;
piece_info_t *p;
return (FALSE);
}
-void describe_obj (obj)
-piece_info_t *obj;
+void describe_obj(piece_info_t *obj)
{
char func[STRSIZE];
char other[STRSIZE];
*/
void
-scan (vmap, loc)
-view_map_t vmap[];
-loc_t loc;
+scan(view_map_t vmap[], loc_t loc)
{
void update(), check(void);
*/
void
-scan_sat (vmap, loc)
-view_map_t *vmap;
-loc_t loc;
+scan_sat(view_map_t vmap[], loc_t loc)
{
int i;
loc_t xloc;
char city_char[] = {'*', 'O', 'X'};
void
-update (vmap, loc)
-view_map_t vmap[];
-loc_t loc;
+update(view_map_t vmap[], loc_t loc)
{
piece_info_t *p;
*/
void
-set_prod (cityp)
-city_info_t *cityp;
+set_prod(city_info_t *cityp)
{
int i;
/* Get the name of a type of object. */
int
-get_piece_name (void)
+get_piece_name(void)
{
char c;
int i;
static int need_delay;
static FILE *my_stream;
+
void
/* VARARGS1 */
-pdebug (s, a, b, c, d, e, f, g, h)
-char *s;
-int a, b, c, d, e, f, g, h;
+pdebug(char *s,
+ int a, int b, int c, int d, int e, int f, int g, int h)
{
if (!print_debug) return;
comment (s, a, b, c, d, e, f, g, h);
*/
void
-topini()
+topini(void)
{
info (0, 0, 0);
}
void
/* VARARGS2 */
-topmsg(linep, buf, a, b, c, d, e, f, g, h)
-int linep;
-char *buf;
-int a, b, c, d, e, f, g, h;
+topmsg(int linep, char *buf,
+ int a, int b, int c, int d, int e, int f, int g, int h)
{
if (linep < 1 || linep > NUMTOPS)
linep = 1;
}
void
-topmsg1 (linep, buf, a, b, c, d, e, f, g, h)
-int linep;
-char *buf;
-char *a;
-int b, c, d, e, f, g, h;
+topmsg1(int linep, char *buf, char *a,
+ int b, int c, int d, int e, int f, int g, int h)
{
if (linep < 1 || linep > NUMTOPS)
linep = 1;
(void) clrtoeol ();
}
+
void
-topmsg2 (linep, buf, a, b, c, d, e, f, g, h)
-int linep;
-char *buf;
-char *a, *e, *f;
-int b, c, d, g, h;
+topmsg2(int linep, char *buf,
+ char *a, int b, int c, int d, char *e, char *f, int g, int h)
{
if (linep < 1 || linep > NUMTOPS)
linep = 1;
(void) clrtoeol ();
}
+
/*
Print a prompt on the first message line.
*/
void
/* VARARGS1 */
-prompt (buf, a, b, c, d, e, f, g, h)
-char *buf;
-int a,b,c,d,e,f,g,h;
+prompt(char *buf,
+ int a, int b, int c, int d, int e, int f, int g, int h)
{
- topmsg (1, buf, a, b, c, d, e, f, g, h);
+ topmsg(1, buf, a, b, c, d, e, f, g, h);
}
+
void
-prompt1 (buf, a, b, c, d, e, f, g, h)
-char *buf, *a;
-int b,c,d,e,f,g,h;
+prompt1(char *buf, char *a,
+ int b, int c, int d, int e, int f, int g, int h)
{
- topmsg1 (1, buf, a, b, c, d, e, f, g, h);
+ topmsg1(1, buf, a, b, c, d, e, f, g, h);
}
+
void
-prompt2 (buf, a, b, c, d, e, f, g, h)
-char *buf, *a, *e, *f;
-int b,c,d,g,h;
-{
- topmsg2 (1, buf, a, b, c, d, e, f, g, h);
+prompt2 (char *buf,
+ char *a, int b, int c, int d, char *e, char *f, int g, int h){
+ topmsg2(1, buf, a, b, c, d, e, f, g, h);
}
/*
void
/* VARARGS1 */
-error (buf, a, b, c, d, e, f, g, h)
-char *buf;
-int a, b, c, d, e, f, g, h;
+error(char *buf,
+ int a, int b, int c, int d, int e, int f, int g, int h)
{
- topmsg (2, buf, a, b, c, d, e, f, g, h);
+ topmsg(2, buf, a, b, c, d, e, f, g, h);
}
/*
void
/* VARARGS1 */
-extra (buf, a, b, c, d, e, f, g, h)
-char *buf;
-int a, b, c, d, e, f, g, h;
+extra(char *buf,
+ int a, int b, int c, int d, int e, int f, int g, int h)
{
- topmsg (3, buf, a, b, c, d, e, f, g, h);
+ topmsg(3, buf, a, b, c, d, e, f, g, h);
}
/*
*/
void
-huh ()
+huh(void)
{
error ("Type H for Help.",0,0,0,0,0,0,0,0);
}
*/
void
-info (a, b, c)
-char *a, *b, *c;
+info(char *a, char *b, char *c)
{
if (need_delay) delay ();
topmsg (1, a,0,0,0,0,0,0,0,0);
}
void
-set_need_delay () {
+set_need_delay(void) {
need_delay = 1;
}
void
-comment (buf, a, b, c, d, e, f, g, h)
-char *buf;
-int a, b, c, d, e, f, g, h;
+comment (char *buf,
+ int a, int b, int c, int d, int e, int f, int g, int h)
{
if (need_delay) delay ();
topmsg (1, 0,0,0,0,0,0,0,0,0);
}
void
-comment1 (buf, a, b, c, d, e, f, g, h)
-char *buf, *a;
-int b, c, d, e, f, g, h;
+comment1(char *buf, char *a,
+ int b, int c, int d, int e, int f, int g, int h)
{
if (need_delay) delay ();
topmsg1 (1, 0,0,0,0,0,0,0,0,0);
/* kermyt begin */
void
-ksend (buf, a, b, c, d, e, f, g, h)
-char *buf;
-int a,b,c,d,e,f,g,h;
+ksend(char *buf,
+ int a, int b, int c, int d, int e, int f, int g, int h)
{
if(!(my_stream=fopen("info_list.txt","a")))
{
fclose(my_stream);
return;
}
+
void
-ksend1 (buf, a, b, c, d, e, f, g, h)
-char *buf, *a;
-int b,c,d,e,f,g,h;
+ksend1(char *buf, char *a,
+ int b, int c, int d, int e, int f, int g, int h)
{
if(!(my_stream=fopen("info_list.txt","a")))
{
*/
void
-get_str (buf, sizep)
-char *buf;
-int sizep;
+get_str(char *buf, int sizep)
{
(void) echo();
get_strq(buf, sizep);
*/
void
-get_strq (buf, sizep)
-char *buf;
-int sizep;
+get_strq(char *buf, int sizep)
{
sizep = sizep; /* size of buf, currently unused */
*/
char
-get_chx()
+get_chx(void)
{
char c;
*/
int
-getint (message)
-char *message;
+getint(char *message)
{
char buf[STRSIZE];
char *p;
*/
char
-get_c ()
+get_c(void)
{
char c; /* one char and a null */
*/
char
-get_cq ()
+get_cq(void)
{
char c;
*/
int
-getyn (message)
-char *message;
+getyn(char *message)
{
char c;
*/
int
-get_range (message, low, high)
-char *message;
-int low, high;
+get_range(char *message, int low, int high)
{
int result;
*/
void
-help (text, nlines)
-char **text;
-int nlines;
+help(char **text, int nlines)
{
int i, r, c;
int text_lines;
#define COL_DIGITS ((MAP_WIDTH <= 100) ? 2 : ((MAP_WIDTH <= 1000 ? 3 : (1 / 0))))
int
-loc_disp (int loc)
+loc_disp(int loc)
{
int row = loc / MAP_WIDTH;
int nrow = row;
extern int get_piece_name(void);
void
-user_move (void) {
+user_move(void) {
void piece_move();
int i, j, sec, sec_start;
*/
void
-piece_move (obj)
-piece_info_t *obj;
+piece_move(piece_info_t *obj)
{
void move_random(), move_fill(), move_land(), move_explore();
void move_path(), move_dir(), move_armyload(), ask_user();
move the piece to a random adjacent square.
*/
-void move_random (obj)
-piece_info_t *obj;
+void move_random(piece_info_t *obj)
{
loc_t loc_list[8];
int i, nloc;
territory.
*/
-void move_explore (obj)
-piece_info_t *obj;
+void move_explore(piece_info_t *obj)
{
path_map_t path_map[MAP_SIZE];
loc_t loc;
*/
void
-move_transport (obj)
-piece_info_t *obj;
+move_transport(piece_info_t *obj)
{
loc_t loc;
static view_map_t amap[MAP_SIZE];
void
-move_armyload (obj)
-piece_info_t *obj;
+move_armyload(piece_info_t *obj)
{
loc_t loc;
piece_info_t *p;
*/
void
-move_armyattack (obj)
-piece_info_t *obj;
+move_armyattack(piece_info_t *obj)
{
path_map_t path_map[MAP_SIZE];
loc_t loc;
}
void
-move_ttload (obj)
-piece_info_t *obj;
+move_ttload(piece_info_t *obj)
{
ABORT;
obj = obj;
*/
void
-move_repair (obj)
-piece_info_t *obj;
+move_repair(piece_info_t *obj)
{
path_map_t path_map[MAP_SIZE];
loc_t loc;
Otherwise we awaken the object.
*/
-void move_fill (obj)
-piece_info_t *obj;
+void move_fill(piece_info_t *obj)
{
if (obj->count == obj_capacity (obj)) /* full? */
obj->func = NOFUNC; /* awaken full boat */
*/
void
-move_land (obj)
-piece_info_t *obj;
+move_land(piece_info_t *obj)
{
long best_dist;
loc_t best_loc;
we wake it up.
*/
-void move_dir (obj)
-piece_info_t *obj;
+void move_dir(piece_info_t *obj)
{
loc_t loc;
int dir;
move in the first direction we find.
*/
-void move_path (obj)
-piece_info_t *obj;
+void move_path(piece_info_t *obj)
{
if (obj->loc == obj->func)
obj->func = NOFUNC;
move.
*/
-void move_to_dest (obj, dest)
-piece_info_t *obj;
-loc_t dest;
+void move_to_dest(piece_info_t *obj, loc_t dest)
{
path_map_t path_map[MAP_SIZE];
int fterrain;
Ask the user to move her piece.
*/
-void ask_user (obj)
-piece_info_t *obj;
+void ask_user(piece_info_t *obj)
{
void user_skip(), user_fill(), user_dir(), user_set_dir();
void user_wake(), user_set_city_func(), user_cancel_auto();
*/
void
-reset_func (obj)
-piece_info_t *obj;
+reset_func(piece_info_t *obj)
{
city_info_t *cityp;
*/
void
-user_skip (obj)
-piece_info_t *obj;
+user_skip(piece_info_t *obj)
{
if (obj->type == ARMY && user_map[obj->loc].contents == 'O')
move_army_to_city (obj, obj->loc);
*/
void
-user_fill (obj)
-piece_info_t *obj;
+user_fill(piece_info_t *obj)
{
if (obj->type != TRANSPORT && obj->type != CARRIER) (void) beep ();
else obj->func = FILL;
*/
void
-user_help (void) {
+user_help(void) {
char c;
help (help_user, user_lines);
*/
void
-user_set_dir (obj)
-piece_info_t *obj;
+user_set_dir(piece_info_t *obj)
{
char c;
*/
void
-user_wake (obj)
-piece_info_t *obj;
+user_wake(piece_info_t *obj)
{
obj->func = NOFUNC;
}
*/
void
-user_random (obj)
-piece_info_t *obj;
+user_random(piece_info_t *obj)
{
obj->func = RANDOM;
}
*/
void
-user_sentry (obj)
-piece_info_t *obj;
+user_sentry(piece_info_t *obj)
{
obj->func = SENTRY;
}
*/
void
-user_land (obj)
-piece_info_t *obj;
+user_land(piece_info_t *obj)
{
if (obj->type != FIGHTER) (void) beep ();
else obj->func = LAND;
*/
void
-user_explore (obj)
-piece_info_t *obj;
+user_explore(piece_info_t *obj)
{
obj->func = EXPLORE;
}
*/
void
-user_transport (obj)
-piece_info_t *obj;
+user_transport(piece_info_t *obj)
{
if (obj->type != ARMY) (void) beep ();
else obj->func = WFTRANSPORT;
*/
void
-user_armyattack (obj)
-piece_info_t *obj;
+user_armyattack(piece_info_t *obj)
{
if (obj->type != ARMY) (void) beep ();
else obj->func = ARMYATTACK;
*/
void
-user_repair (obj)
-piece_info_t *obj;
+user_repair(piece_info_t *obj)
{
if (obj->type == ARMY || obj->type == FIGHTER) (void) beep ();
else obj->func = REPAIR;
*/
void
-user_set_city_func (obj)
-piece_info_t *obj;
+user_set_city_func(piece_info_t *obj)
{
void e_city_fill(), e_city_explore(), e_city_stasis();
void e_city_wake(), e_city_random(), e_city_repair();
*/
void
-user_build (obj)
-piece_info_t *obj;
+user_build(piece_info_t *obj)
{
city_info_t *cityp;
*/
void
-user_dir (obj, dir)
-piece_info_t *obj;
-int dir;
+user_dir(piece_info_t *obj, int dir)
{
void user_dir_army(), user_dir_fighter(), user_dir_ship();
*/
void
-user_dir_army (obj, loc)
-piece_info_t *obj;
-loc_t loc;
+user_dir_army(piece_info_t *obj, loc_t loc)
{
int enemy_killed;
*/
void
-user_dir_fighter (obj, loc)
-piece_info_t *obj;
-loc_t loc;
+user_dir_fighter(piece_info_t *obj, loc_t loc)
{
if (map[loc].contents == '*')
fatal (obj, loc,
*/
void
-user_dir_ship (obj, loc)
-piece_info_t *obj;
-loc_t loc;
+user_dir_ship(piece_info_t *obj, loc_t loc)
{
int enemy_killed;
*/
void
-move_army_to_city (obj, city_loc)
-piece_info_t *obj;
-loc_t city_loc;
+move_army_to_city(piece_info_t *obj, loc_t city_loc)
{
piece_info_t *tt;
*/
void
-user_cancel_auto (void) {
+user_cancel_auto(void)
+{
if (!automove)
comment ("Not in auto mode!",0,0,0,0,0,0,0,0);
else {
*/
void
-user_redraw (void) {
+user_redraw (void)
+{
redraw ();
}
*/
int
-awake (obj)
-piece_info_t *obj;
+awake(piece_info_t *obj)
{
int i;
char c;
*/
void
-fatal (obj, loc, message, response)
-piece_info_t *obj;
-loc_t loc;
-char *message;
-char *response;
+fatal(piece_info_t *obj, loc_t loc, char *message, char *response)
{
if (getyn (message)) {
comment (response,0,0,0,0,0,0,0,0);
#include <ctype.h>
void
-tupper (str)
-char *str;
+tupper(char *str)
{
while (*str) {
if (islower (*str)) *str = upper (*str);
*/
char
-upper (c)
-char c;
+upper(char c)
{
if (islower (c))
return toupper (c);
*/
void
-assert (expression, file, line)
-char *expression;
-char *file;
-int line;
+assert(char *expression, char *file, int line)
{
char buf[STRSIZE];
*/
void
-empend ()
+empend(void)
{
close_disp ();
exit (0);
static int in_cargo[LIST_SIZE]; /* TRUE if object in a cargo list */
void
-check () {
+check(void) {
void check_cargo(), check_obj(), check_obj_cargo();
long i, j;
*/
void
-check_obj (list, owner)
-piece_info_t **list;
-int owner;
+check_obj(piece_info_t **list, int owner)
{
long i, j;
piece_info_t *p;
*/
void
-check_cargo (list, cargo_type)
-piece_info_t *list;
-int cargo_type;
+check_cargo(piece_info_t *list, int cargo_type)
{
piece_info_t *p, *q;
long j, count;
*/
void
-check_obj_cargo (list)
-piece_info_t **list;
+check_obj_cargo(piece_info_t **list)
{
piece_info_t *p;
long i;