-/* $Id: display.c,v 1.11 2006/07/25 16:51:22 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
+/* $Id: display.c,v 1.12 2006/07/25 16:58:26 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
/*
* Copyright (C) 1987, 1988 Chuck Simmons
int on_screen(long loc);
#ifdef A_COLOR
-void init_colors()
+void init_colors(void)
{
start_color();
trashed and no sector is shown on the screen.
*/
-void kill_display () {
+void kill_display (void) {
whose_map = UNOWNED;
}
screen even if the location to be displayed is already on the screen.
*/
-void sector_change () {
+void sector_change (void) {
change_ok = TRUE;
}
sector is not displayed, return -1.
*/
-int cur_sector () {
+int cur_sector (void) {
if (whose_map != USER) return (-1);
return (save_sector);
}
is not on the screen, we return -1.
*/
-long cur_cursor () {
+long cur_cursor (void) {
if (whose_map != USER) return (-1);
return (save_cursor);
}
view_map_t vmap[];
long loc; /* location to display */
{
- void print_sector();
-
if (change_ok || whose != whose_map || !on_screen (loc))
print_sector (whose, vmap, loc_sector (loc));
print_zoom (vmap)
view_map_t *vmap;
{
- void print_zoom_cell();
+ void print_zoom_cell ();
int row_inc, col_inc;
int r, c;
*/
void
-display_score ()
+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
-ttinit()
+ttinit(void)
{
(void) initscr();
(void) noecho();
*/
void
-clear_screen () {
+clear_screen (void) {
(void) clear ();
(void) refresh ();
kill_display ();
*/
void
-redisplay () {
+redisplay (void) {
(void) refresh ();
}
void
-redraw () {
+redraw (void) {
(void) clearok (curscr, TRUE);
(void) refresh ();
}
*/
void
-delay () {
+delay (void) {
int t = delay_time;
int i = 500;
(void) refresh ();
*/
void
-close_disp()
+close_disp(void)
{
(void) move (LINES - 1, 0);
(void) clrtoeol ();
#include "extern.h"
void e_move(long *path_start, long loc);
-extern int get_piece_name();
+extern int get_piece_name(void);
void
edit(edit_cursor)
*/
void
-e_leave () {
+e_leave (void) {
}
/*
*/
void
-e_help () {
+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 ();
-/* $Id: empire.c,v 1.5 2006/07/25 15:59:54 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
+/* $Id: empire.c,v 1.6 2006/07/25 16:43:14 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
/*
* Copyright (C) 1987, 1988 Chuck Simmons
#include "empire.h"
#include "extern.h"
-void c_examine(), c_movie();
+void c_examine(void), c_movie(void);
/*
* 03a 01Apr88 aml .Hacked movement algorithms for computer.
*/
void
-empire () {
+empire (void) {
void do_command();
void print_zoom();
do_command (orders)
char orders;
{
- void c_debug(), c_quit(), c_sector(), c_map();
- void c_give();
+ void c_debug(), c_quit(void), c_sector(void), c_map(void);
+ void c_give(void);
char e;
int ncycle;
*/
void
-c_quit () {
+c_quit (void) {
if (getyn ("QUIT - Are you sure? ")) {
empend ();
}
*/
void
-c_sector () {
+c_sector (void) {
int num;
num = get_range ("Sector number? ", 0, NUM_SECTORS-1);
*/
void
-c_map () {
+c_map (void) {
FILE *f;
int i, j;
char line[MAP_HEIGHT+2];
*/
void
-c_examine () {
+c_examine (void) {
int num;
num = get_range ("Sector number? ", 0, NUM_SECTORS-1);
*/
void
-c_movie () {
+c_movie (void) {
(void) clear ();
for (;;) {
comp_move (1);
-/* $Id: extern.h,v 1.9 2006/07/25 16:43:14 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
+/* $Id: extern.h,v 1.10 2006/07/25 16:58:26 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
/*
* Copyright (C) 1987, 1988 Chuck Simmons
/* global routines */
-void empire();
+void empire(void);
void attack(piece_info_t *att_obj, long loc);
void comp_move(int nmoves);
-void user_move();
+void user_move(void);
void edit(long edit_cursor);
/* map routines */
/* display routines */
void announce (char *);
-void redisplay();
-void kill_display ();
-void sector_change ();
-int cur_sector ();
-long cur_cursor ();
+void redisplay (void);
+void kill_display (void);
+void sector_change (void);
+int cur_sector (void);
+long cur_cursor (void);
void display_loc (int whose, view_map_t vmap[], long loc);
void display_locx (int whose, view_map_t vmap[], long loc);
void print_sector (int whose, view_map_t vmap[], int sector);
void print_zoom (view_map_t *vmap);
void print_pzoom (char *s, path_map_t *pmap, view_map_t *vmap);
void print_xzoom (view_map_t *vmap);
-void display_score ();
+void display_score (void);
#ifdef A_COLOR
-void init_colors ();
+void init_colors (void);
#endif /* A_COLOR */
-void redraw ();
-void clear_screen ();
-void delay ();
-void close_disp ();
+void redraw (void);
+void clear_screen (void);
+void delay (void);
+void close_disp (void);
void 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 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 addprintf (char *str, int a, int b, int c, int d, int e, int f, int g, int h);
void addprintf1 (char *str, char *a, int b, int c, int d, int e, int f, int g, int h);
void addprintf2 (char *str, char *a, int b, int c, int d, char *e, char *f, int g, int h);
-void init_game (); /* game routines */
-void save_game ();
-int restore_game ();
-void save_movie_screen ();
-void replay_movie ();
+void init_game (void); /* game routines */
+void save_game (void);
+int restore_game (void);
+void save_movie_screen (void);
+void replay_movie (void);
void get_str (char *buf, int sizep); /* input routines */
void get_strq (char *buf, int sizep);
-char get_chx ();
+char get_chx (void);
int getint (char *message);
-char get_c ();
-char get_cq ();
+char get_c (void);
+char get_cq (void);
int getyn (char *message);
int get_range (char *message, int low, int high);
-void rndini (); /* math routines */
+void rndini (void); /* math routines */
long irand (long high);
int dist (long a, long b);
int isqrt (int n);
/* terminal routines */
void pdebug (char *s, int a, int b, int c, int d, int e, int f, int g, int h);
-void topini ();
+void topini (void);
void clreol (int linep, int colp);
void topmsg (int linep, char *buf, int a, int b, int c, int d, int e, int f, int g, int h);
void topmsg1 (int linep, char *buf, char *a, int b, int c, int d, int e, int f, int g, int h);
void comment (char *buf, int a, int b, int c, int d, int e, int f, int g, int h);
void comment1 (char *buf,char *a, int b, int c, int d, int e, int f, int g, int h);
void extra (char *buf, int a, int b, int c, int d, int e, int f, int g, int h);
-void huh ();
+void huh (void);
void help (char **text, int nlines);
-void set_need_delay ();
+void set_need_delay (void);
void ksend (char *buf, int a, int b, int c, int d, int e, int f, int g, int h);
void ksend1 (char *buf, char *a, int b, int c, int d, int e, int f, int g, int h);
/* utility routines */
-void ttinit ();
+void ttinit (void);
void assert (char *expression, char *file, int line);
-void empend ();
+void empend (void);
char upper (char c);
void tupper (char *str);
-void check ();
+void check (void);
int loc_disp (int loc);
-
-/* randon routines we use */
-long time();
-void exit();
-void perror();
-void srand();
-#ifndef LINUX
-char *strcpy();
-#endif
*/
#include <string.h>
+#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "empire.h"
#include "extern.h"
long remove_land(long loc, long num_land);
-int select_cities();
+int select_cities(void);
int find_next(long *mapi);
int good_cont(long mapi);
int xread(FILE *f, char *buf, int size);
pieces on the board.
*/
-void init_game () {
- void make_map(), place_cities();
+void init_game (void) {
+ void make_map(void), place_cities(void);
long i;
static int height[2][MAP_SIZE];
static int height_count[MAX_HEIGHT+1];
-void make_map () {
+void make_map (void) {
int from, to, k;
long i, j, sum, loc;
/* avoid compiler problems with large automatic arrays */
static long land[MAP_SIZE];
-void place_cities () {
+void place_cities (void) {
long regen_land();
long placed, i, loc;
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 find_cont(), make_pair();
+int select_cities (void) {
+ void find_cont(void), make_pair(void);
long compi, useri;
city_info_t *compp, *userp;
city. We rank the continents.
*/
-void find_cont () {
+void find_cont (void) {
long i;
long mapi;
*/
static long ncity, nland, nshore;
-static void mark_cont();
+static void mark_cont(long);
int good_cont (mapi)
long mapi;
between the user's continent and the computer's continent.
*/
-void make_pair () {
+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 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 () {
+int restore_game (void) {
void read_embark();
FILE *f; /* file to save game in */
piece_info_t *list;
int piece_type;
{
- void inconsistent();
+ void inconsistent(void);
piece_info_t *ship;
piece_info_t *obj;
}
}
-void inconsistent () {
+void inconsistent (void) {
(void) printf ("saved game is inconsistent. Please remove it.\n");
exit (1);
}
static char mapbuf[MAP_SIZE];
void
-save_movie_screen ()
+save_movie_screen (void)
{
FILE *f; /* file to save game in */
long i;
*/
void
-replay_movie ()
+replay_movie (void)
{
void print_movie_cell();
#include "empire.h"
#include "extern.h"
-extern int get_piece_name();
+extern int get_piece_name(void);
/*
Find the nearest city to a location. Return the location
view_map_t vmap[];
long loc;
{
- void update(), check();
+ void update(), check(void);
int i;
long xloc;
/* Get the name of a type of object. */
int
-get_piece_name ()
+get_piece_name (void)
{
char c;
int i;
void move_to_dest(piece_info_t *obj,long dest);
void move_army_to_city(piece_info_t *obj,long city_loc);
int awake(piece_info_t *obj);
-extern int get_piece_name();
+extern int get_piece_name(void);
void
-user_move () {
+user_move (void) {
void piece_move();
int i, j, sec, sec_start;
*/
void
-user_help () {
+user_help (void) {
char c;
help (help_user, user_lines);
*/
void
-user_cancel_auto () {
+user_cancel_auto (void) {
if (!automove)
comment ("Not in auto mode!",0,0,0,0,0,0,0,0);
else {
*/
void
-user_redraw () {
+user_redraw (void) {
redraw ();
}
-/* $Id: util.c,v 1.5 2006/07/25 15:59:54 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
+/* $Id: util.c,v 1.6 2006/07/25 16:43:14 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
/*
* Copyright (C) 1987, 1988 Chuck Simmons
*/
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
#include <signal.h>
#include "empire.h"