From: Eric S. Raymond Date: Thu, 1 Dec 1994 15:54:42 +0000 (+0000) Subject: Adapted for modrn C compiler. X-Git-Tag: 1.0~6 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=b8b0d9d82273da5dd70cb6f02120e2a1bebb8626;p=vms-empire.git Adapted for modrn C compiler. --- diff --git a/Makefile b/Makefile index 1900fae..eae6fa1 100644 --- a/Makefile +++ b/Makefile @@ -6,15 +6,6 @@ # See the file COPYING, distributed with empire, for restriction # and warranty information. -# Change the line below for your compiler. You will probably want -# 'cc'. ('mcc' is a "merge compiler" that takes errors, merges them -# with the source, and tosses you into an editor. I also use various -# cross compilers on this line.) - -#CC = mcc -#CC = cpccc -CC = cc - # Change the line below for your system. If you are on a Sun or Vax, # you may want BSD. @@ -23,8 +14,8 @@ SYS = SYSV # Use -g to compile the program for debugging. -#DEBUG = -g -DDEBUG -DEBUG = -O +DEBUG = -g -DDEBUG +#DEBUG = -O # Use -p to profile the program. #PROFILE = -p -DPROFILE @@ -32,13 +23,12 @@ PROFILE = # Define all necessary libraries. 'curses' is necessary. 'termcap' # is needed on BSD systems. -LIBS = -lcurses +LIBS = -ldcurses #LIBS = -lcurses -ltermcap # You shouldn't have to modify anything below this line. -FLAGS = $(DEBUG) $(PROFILE) -c -D$(SYS) -CCCMD = $(CC) $(FLAGS) +CFLAGS = $(DEBUG) $(PROFILE) -D$(SYS) INS = /etc/install FILES = \ @@ -80,9 +70,6 @@ all: empire empire: $(OFILES) $(CC) $(PROFILE) -o empire $(OFILES) $(LIBS) -$(OFILES): extern.h empire.h - $(CCCMD) $< - lint: $(FILES) lint -u -D$(SYS) $(FILES) -lcurses diff --git a/compmove.c b/compmove.c index 9d80d0c..a4b0533 100644 --- a/compmove.c +++ b/compmove.c @@ -29,6 +29,9 @@ For each move the user wants us to make, we do the following: static view_map_t emap[MAP_SIZE]; /* pruned explore map */ +int load_army(); + void move_objective(); + void comp_move (nmoves) int nmoves; @@ -498,7 +501,6 @@ army_move (obj) piece_info_t *obj; { long move_away(); - void move_objective(); long find_attack(); void make_army_load_map(), make_unload_map(), make_tt_load_map(); void board_ship(); diff --git a/display.c b/display.c index 707c48a..3aabdfa 100644 --- a/display.c +++ b/display.c @@ -1,4 +1,4 @@ -/* $Id$ - (c) Copyright 1987, 1988 Chuck Simmons */ +/* $Id: display.c,v 1.5 1992/08/18 22:39:00 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */ /* * Copyright (C) 1987, 1988 Chuck Simmons @@ -35,6 +35,9 @@ static int save_sector; /* the currently displayed sector */ static int save_cursor; /* currently displayed cursor position */ static int change_ok = TRUE; /* true if new sector may be displayed */ +static void show_loc(); +static disp_square(); + #ifdef A_COLOR void init_colors() { @@ -104,7 +107,7 @@ int whose; /* whose map to display */ view_map_t vmap[]; long loc; /* location to display */ { - void print_sector(), show_loc(); + void print_sector(); if (change_ok || whose != whose_map || !on_screen (loc)) print_sector (whose, vmap, loc_sector (loc)); @@ -246,7 +249,7 @@ pretty. */ -static disp_square(vp) +static int disp_square(vp) view_map_t *vp; { #ifdef A_COLOR diff --git a/edit.c b/edit.c index 346a5f7..cfb917d 100644 --- a/edit.c +++ b/edit.c @@ -22,13 +22,15 @@ edit.c -- Routines to handle edit mode commands. #include "empire.h" #include "extern.h" +void e_move(); + void edit(edit_cursor) long edit_cursor; { char e_cursor(); void e_leave(), e_print(), e_random(); - void e_stasis(), e_move(), e_end(), e_wake(), e_sleep(); + void e_stasis(), e_end(), e_wake(), e_sleep(); void e_info(), e_prod(), e_help(), e_explore(); void e_fill(), e_land(), e_city_func(), e_transport(); void e_attack(), e_repair(); diff --git a/empire.c b/empire.c index 6f1d8cd..a485975 100644 --- a/empire.c +++ b/empire.c @@ -1,4 +1,4 @@ -/* $Id$ - (c) Copyright 1987, 1988 Chuck Simmons */ +/* $Id: empire.c,v 1.2 1990/03/29 23:22:07 eric Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */ /* * Copyright (C) 1987, 1988 Chuck Simmons @@ -17,6 +17,8 @@ parser, and the simple commands. #include "empire.h" #include "extern.h" +void c_examine(), c_movie(); + void empire () { void do_command(); @@ -64,8 +66,8 @@ void do_command (orders) char orders; { - void c_debug(), c_quit(), c_sector(), c_map(), c_examine(); - void c_give(), c_movie(); + void c_debug(), c_quit(), c_sector(), c_map(); + void c_give(); char e; int ncycle; diff --git a/extern.h b/extern.h index fe0a4df..934ebe9 100644 --- a/extern.h +++ b/extern.h @@ -1,4 +1,4 @@ -/* $Id$ - (c) Copyright 1987, 1988 Chuck Simmons */ +/* $Id: extern.h,v 1.2 1990/03/29 23:22:44 eric Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */ /* * Copyright (C) 1987, 1988 Chuck Simmons @@ -172,7 +172,7 @@ int get_range(); void rndini(); /* math routines */ long irand(); int dist(); -int sqrt(); +int isqrt(); int find_nearest_city(); city_info_t *find_city(); /* object routines */ diff --git a/game.c b/game.c index 68d74a7..8b2adba 100644 --- a/game.c +++ b/game.c @@ -22,6 +22,8 @@ game.c -- Routines to initialize, save, and restore a game. #include "empire.h" #include "extern.h" +long remove_land(); + /* Initialize a new game. Here we generate a new random map, put cities on the map, select cities for each opponent, and zero out the lists of @@ -165,7 +167,7 @@ for a city, we remove land cells which are too close to the city. static long land[MAP_SIZE]; void place_cities () { - long regen_land(), remove_land(); + long regen_land(); long placed, i, loc; long num_land; diff --git a/main.c b/main.c index 3d3fcec..1a49384 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id$ - (c) Copyright 1987, 1988 Chuck Simmons */ +/* $Id: main.c,v 1.2 1990/03/29 23:22:23 eric Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */ /* * Copyright (C) 1987, 1988 Chuck Simmons @@ -98,7 +98,7 @@ char *argv[]; /* compute min distance between cities */ land = MAP_SIZE * (100 - WATER_RATIO) / 100; /* available land */ land /= NUM_CITY; /* land per city */ - MIN_CITY_DIST = sqrt (land); /* distance between cities */ + MIN_CITY_DIST = isqrt (land); /* distance between cities */ empire (); /* call main routine */ return (0); diff --git a/map.c b/map.c index 9e7b864..f2727d9 100644 --- a/map.c +++ b/map.c @@ -1,4 +1,4 @@ -/* $Id$ - (c) Copyright 1987, 1988 Chuck Simmons */ +/* $Id: map.c,v 1.2 1990/03/30 11:23:26 eric Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */ /* * Copyright (C) 1987, 1988 Chuck Simmons @@ -42,6 +42,7 @@ STATIC int objective_cost(); STATIC int terrain_type(); STATIC void start_perimeter(); STATIC void add_cell(); +STATIC int vmap_count_path (); static perimeter_t p1; /* perimeter list for use as needed */ static perimeter_t p2; diff --git a/math.c b/math.c index a0b8437..9d33f2e 100644 --- a/math.c +++ b/math.c @@ -75,7 +75,7 @@ Find the square root of an integer. We actually return the floor of the square root using Newton's method. */ -int sqrt (n) +int isqrt (n) int n; { int guess; diff --git a/usermove.c b/usermove.c index 865251d..dcc7c4e 100644 --- a/usermove.c +++ b/usermove.c @@ -16,6 +16,10 @@ usermove.c -- Let the user move her troops. #include "empire.h" #include "extern.h" +void fatal(); +void move_to_dest(); +void move_army_to_city(); + void user_move () { void piece_move(); @@ -408,8 +412,6 @@ void move_land (obj) piece_info_t *obj; { - void move_to_dest(); - long best_dist, best_loc; long new_dist; piece_info_t *p; @@ -599,8 +601,6 @@ void user_skip (obj) piece_info_t *obj; { - void move_army_to_city(); - if (obj->type == ARMY && user_map[obj->loc].contents == 'O') move_army_to_city (obj, obj->loc); else obj->moved++; @@ -869,8 +869,6 @@ user_dir_army (obj, loc) piece_info_t *obj; long loc; { - void fatal(); - int enemy_killed; enemy_killed = FALSE;