[comp.sources.games] v04i048: conquer3 - middle earth multi-player game

games@tekred.TEK.COM (06/17/88)

Submitted by: ihnp4!homxc!smile
Comp.sources.games: Volume 4, Issue 48
Archive-name: conquer3/Part07



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 7 (of 8)."
# Contents:  forms.c getopt.c header.h move.c reports.c
# Wrapped by billr@saab on Thu Jun 16 09:40:02 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f forms.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"forms.c\"
else
echo shar: Extracting \"forms.c\" \(14869 characters\)
sed "s/^X//" >forms.c <<'END_OF_forms.c'
X/*conquer : Copyright (c) 1988 by Ed Barlow.
X *  I spent a long time writing this code & I hope that you respect this.
X *  I give permission to alter the code, but not to copy or redistribute
X *  it without my explicit permission.  If you alter the code,
X *  please document changes and send me a copy, so all can have it.
X *  This code, to the best of my knowledge works well,  but it is my first
X *  'C' program and should be treated as such.  I disclaim any
X *  responsibility for the codes actions (use at your own risk).  I guess
X *  I am saying "Happy gaming", and am trying not to get sued in the process.
X *                                                Ed
X */
X
X/*	screen subroutines	*/
X
X/*include files*/
X#include <ctype.h>
X#include "header.h"
X#include "data.h"
X
Xextern FILE *fexe;
Xextern short country;
Xextern FILE *fnews;
X
Xvoid
Xshowscore()
X{
X	int i;
X	int done=FALSE;
X	int position;
X	int count; 	/*number of time through the loop on this screen*/
X	int nationid; 	/*current nation id */
X
X	nationid=1;
X	while((done==FALSE)&&(nationid<MAXNTN)) {
X		clear();
X		standout();
X		mvaddstr(0,(COLS/2)-10,"NATION SCORE SCREEN");
X		standend();
X		mvaddstr(3,0,"nationid is:");
X		mvaddstr(4,0,"name is:");
X		mvaddstr(5,0,"leader:");
X		mvaddstr(6,0,"race:");
X		mvaddstr(7,0,"class:");
X		mvaddstr(8,0,"score:");
X		mvaddstr(9,0,"gold:");
X		mvaddstr(10,0,"military:");
X		mvaddstr(11,0,"civilians:");
X		mvaddstr(12,0,"sectors:");
X
X		count=0;
X		position=2;
X		while((nationid<MAXNTN)&&(count<5)){
X			if((nationid<MAXNTN)&&(ntn[nationid].active!=0)) {
X				position+=13;
X				mvprintw(3,position,"%d",nationid);
X				standout();
X				mvprintw(4,position,"%s",ntn[nationid].name);
X				standend();
X				mvprintw(5,position,"%s",ntn[nationid].leader);
X				for(i=1;i<8;i++)
X					if(ntn[nationid].race==*(races+i)[0])
X						mvprintw(6,position,"%s",*(races+i));
X				if(ntn[nationid].active>=2) mvprintw(7,position,"NPC");
X				else mvprintw(7,position,"%s",*(Class+ntn[nationid].class));
X				mvprintw(8,position,"%ld",ntn[nationid].score);
X				mvprintw(9,position,"%ld",ntn[nationid].tgold);
X				mvprintw(10,position,"%ld",ntn[nationid].tmil);
X				mvprintw(11,position,"%ld",ntn[nationid].tciv);
X				mvprintw(12,position,"%d",ntn[nationid].tsctrs);
X				count++;
X			}
X			nationid++;
X		}
X		standout();
X		mvaddstr(18,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
X		mvaddstr(19,(COLS/2)-9,"HIT SPACE IF DONE");
X		standend();
X		refresh();
X		if (getch()==' ') done=TRUE;
X	}
X}
X
Xvoid
Xdiploscrn()
X{
X	int i;
X	char k;
X	char tempifile[30];
X	short nation, offset, count, olddip, oldnat, temp;
X	FILE *fp, *fopen();
X	short isgod=FALSE;
X	if(country==0) {
X		isgod=TRUE;
X		clear();
X		mvaddstr(0,0,"WHAT NATION NUMBER:");
X		refresh();
X		country = get_number();
X	}
X	while(1){
X		count=1;
X		offset=0;
X		clear();
X		standout();
X		mvaddstr(0,(COLS/2)-10,"NATION DIPLOMACY SUMMARY");
X		standend();
X		mvaddstr(2,0,"                BY YOU,        TO YOU");
X		for(i=1;i<NTOTAL;i++) if((ntn[i].active>0)&&(i!=country)) {
X			if(count%14==0) {
X				offset+=40;
X				mvaddstr(2,40,"                BY YOU,        TO YOU");
X				count++;
X			}
X			mvprintw(count%14+2,offset, "%d. %s",i,ntn[i].name);
X			if((ntn[country].dstatus[i]==WAR)
X			||(ntn[country].dstatus[i]==JIHAD)) standout();
X			mvprintw(count%14+2,offset+14, "=> %s",*(diploname+ntn[country].dstatus[i]));
X			standend();
X			if((ntn[i].dstatus[country]==WAR)
X			||(ntn[i].dstatus[country]==JIHAD)) standout();
X			mvprintw(count%14+2,offset+28, "=> %s",*(diploname+ntn[i].dstatus[country]));
X			standend();
X			count++;
X		}
X		standout();
X		mvaddstr(17,0,"HIT RETURN KEY TO CHANGE STATUS");
X		mvprintw(18,0,"HIT 'B' KEY TO BRIBE WARRING NPC NATION (%ld GOLD/level)",BRIBE);
X		mvaddstr(19,0,"ANY OTHER KEY TO CONTINUE:");
X		standend();
X		refresh();
X		k=getch();
X		if((k!='\n')&&(k!='B')) {
X			if(isgod==TRUE) country=0;
X			return;
X		}
X		if(k=='B'){
X			if(ntn[country].tgold<=BRIBE){
X				mvaddstr(21,0,"NOT ENOUGH GOLD");
X				refresh();
X				getch();
X				return;
X			}
X			mvaddstr(20,0,"BRIBES WORK 50% (only the update will show)");
X			mvaddstr(21,0,"WHAT NATION NUMBER:");
X			refresh();
X			nation = get_number();
X			if(ntn[nation].active<2){
X				mvaddstr(22,0,"NOT NON PLAYER COUNTRY");
X				refresh();
X				getch();
X				return;
X			}
X			/*use maxntn here as cant change with nomads...*/
X			if((nation<=0)||(nation>MAXNTN)){
X				if(isgod==TRUE) country=0;
X				return;
X			}
X			if((isgod!=1)
X			    &&((ntn[nation].dstatus[country]==ALLIED)
X			    ||(ntn[nation].dstatus[country]==JIHAD)
X			    ||(ntn[nation].dstatus[country]==CONFEDERACY))){
X				mvaddstr(22,0,"CANT CHANGE THEIR STATUS");
X				refresh();
X				getch();
X				return;
X			}
X			ntn[nation].dstatus[country]--;
X			ntn[country].tgold-=BRIBE;
X			ntn[nation].tgold+=BRIBE;
X			EADJDIP;
X			oldnat=country;
X			country=nation;
X			nation=oldnat;
X			fprintf(fexe,"L_NGOLD\t%hd \t%d \t%ld \t0 \t0 \t%s\n",XNAGOLD ,country,ntn[country].tgold,"null");
X			EADJDIP;
X			country=oldnat;
X			return;
X		}
X		mvaddstr(21,0,"WHAT NATION NUMBER:");
X		refresh();
X		nation = get_number();
X		/*use maxntn here as cant change with nomads...*/
X		if((nation<=0)||(nation>MAXNTN)){
X			if(isgod==TRUE) country=0;
X			return;
X		}
X		if((isgod==FALSE)
X		    &&(((ntn[country].dstatus[nation]==CONFEDERACY)
X		    &&(ntn[nation].dstatus[country]<WAR))
X		    ||(ntn[country].dstatus[nation]==JIHAD))) {
X			mvprintw(23,0,"SORRY, Can't change status on ntn %s -- hit return",ntn[nation].name);
X			refresh();
X			getch();
X			return;
X		}
X		else{
X			clear();
X			mvaddstr(0,0,"WHAT NEW STATUS");
X			mvaddstr(2,0,"1) CONFEDERACY (irrevocable)");
X			mvaddstr(3,0,"2) ALLIED");
X			mvaddstr(4,0,"3) FRIENDLY");
X			mvaddstr(5,0,"4) NEUTRAL");
X			mvaddstr(6,0,"5) HOSTILE");
X			mvaddstr(7,0,"6) WAR");
X			mvaddstr(8,0,"7) JIHAD (irrevocable):");
X			mvaddstr(12,0,"INPUT:");
X			refresh();
X			temp = get_number();
X			if((temp<1)||(temp>7)){
X				mvprintw(23,0,"SORRY, Invalid inputs -- hit return");
X				refresh();
X				getch();
X				return;
X			}
X			ntn[country].dstatus[nation]=temp;
X			EADJDIP;
X
X			/*prevent ron from being sneaky*/
X			if((temp>HOSTILE)&&(ntn[nation].active>2)
X			&&(ntn[nation].dstatus[country]<WAR)) {
X				olddip=ntn[nation].dstatus[country];
X				oldnat=country;
X				country=nation;
X				nation=oldnat;
X				ntn[country].dstatus[nation]=WAR;
X				EADJDIP;
X				ntn[country].dstatus[nation]=olddip;
X				oldnat=country;
X				country=nation;
X				nation=oldnat;
X			}
X			else if((temp>HOSTILE)&&(ntn[nation].active==1)
X			&&(ntn[nation].dstatus[country]<WAR)) {
X	 			sprintf(tempifile,"%s%d",msgfile,nation);
X				if ((fp=fopen(tempifile,"a+"))==NULL) {
X					mvprintw(4,0,"error opening %s",tempifile);
X					refresh();
X					if (isgod==TRUE) country=0;
X					getch();
X					return;
X				}
X				fprintf(fp,"%s Message to %s from CONQUER\n",ntn[nation].name,ntn[nation].name);
X				fprintf(fp,"%s \n",ntn[nation].name);
X				fprintf(fp,"%s \n",ntn[nation].name);
X				fprintf(fp,"%s       %s has declared war on you\n",ntn[nation].name,ntn[country].name);
X				fputs("END\n",fp);
X				fclose(fp);
X			}
X		}
X	}
X}
X
Xvoid
Xchange()
X{
X	char string[10];
X	int i, cbonus;
X	short armynum;
X	char passwd[8];
X	short isgod=FALSE;
X
X	if(country==0) {
X		isgod=TRUE;
X		clear();
X		mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X		refresh();
X		country = get_number();
X	}
X	clear();
X	mvaddstr(0,(COLS/2)-10,"NATION STATS SUMMARY");
X	mvprintw(5,0,"1. nation name is %s   ",ntn[country].name);
X	mvprintw(6,0,"2. password is XXXXXXXX");
X	if (isgod==TRUE)
X		mvprintw(7,0,"active is %d",ntn[country].active);
X	mvprintw(11,0,"capitol loc: x is %d",ntn[country].capx);
X	mvprintw(12,0,"             y is %d",ntn[country].capy);
X	mvprintw(13,0,"leader is %s",ntn[country].leader);
X	mvprintw(14,0,"class is %s",*(Class+ntn[country].class));
X	mvprintw(15,0,"nations mark is...%c ",ntn[country].mark);
X	for(i=1;i<8;i++) if(ntn[country].race==*(races+i)[0])
X		mvprintw(16,0, "nation race is....%s  ",*(races+i));
X	mvprintw(17,0,"score currently...%ld",ntn[country].score);
X
X	mvprintw(4,(COLS/2), "attack bonus...........+%2d",ntn[country].aplus);
X	mvprintw(5,(COLS/2), "defense bonus..........+%2d",ntn[country].dplus);
X	mvprintw(6,(COLS/2), "maximum move rate.......%2d",ntn[country].maxmove);
X	mvprintw(7,(COLS/2), "reproduction rate......%2d%%",ntn[country].repro);
X	mvprintw(9,(COLS/2), "gold talons.....$%8ld",ntn[country].tgold);
X	mvprintw(10,(COLS/2),"jewels .........$%8ld",ntn[country].jewels);
X	mvprintw(11,(COLS/2),"iron & minerals...%8ld",ntn[country].tiron);
X	if(ntn[country].tfood<2*ntn[country].tciv) standout();
X	mvprintw(12,(COLS/2),"food in granary...%8ld",ntn[country].tfood);
X	standend();
X
X	mvprintw(13,(COLS/2),"total soldiers....%8ld",ntn[country].tmil);
X	mvprintw(14,(COLS/2),"total civilians...%8ld",ntn[country].tciv);
X	mvprintw(15,(COLS/2),"total ships..........%5d",ntn[country].tships);
X	mvprintw(16,(COLS/2),"total sectors........%5d",ntn[country].tsctrs);
X	mvprintw(17,(COLS/2),"spell points.........%5d",ntn[country].spellpts);
X
X	standout();
X	mvaddstr(19,(COLS/2)-9, "HIT ANY KEY TO CONTINUE");
X	mvaddstr(20,(COLS/2)-15,"HIT 1 or 2 TO CHANGE NAME or PASSWD");
X	if(magic(country,VAMPIRE)!=1)
X		mvaddstr(21,(COLS/2)-14,"HIT 3 TO ADD TO YOUR COMBAT BONUS");
X	else	mvaddstr(21,(COLS/2)-17,"( VAMPIRES MAY NOT ADD TO COMBAT BONUS )");
X	if(isgod==TRUE) mvaddstr(22,(COLS/2)-9,"HIT 4 TO DESTROY NATION");
X
X	standend();
X	refresh();
X	switch(getch()){
X	case '1': /*get name*/
X		clear();
X		mvaddstr(0,0,"what name would you like:");
X		clrtoeol();
X		refresh();
X		get_nname(string);
X		if((strlen(string)<=1)||(strlen(string)>NAMELTH)){
X			beep();
X			mvaddstr(2,0,"invalid name--hit return");
X			refresh();
X			getch();
X			if(isgod==TRUE) country=0;
X			return;
X		}
X		/*check if already used*/
X		else for(i=1;i<(country-1);i++){
X			if((strcmp(ntn[i].name,string)==0)&&(i!=country)) {
X				mvaddstr(2,0,"name already used--hit return");
X				beep();
X				refresh();
X				getch();
X				if(isgod==TRUE) country=0;
X				return;
X			}
X		}
X		mvaddstr(2,0,"new name can be used following next update--hit return");
X		refresh();
X		getch();
X		strcpy(ntn[country].name,string);
X		ECHGNAME;
X		break;
X	case '2': /*change password */
X		clear();
X		if(isgod!=1){
X			mvaddstr(0,0,"what is your current password:");
X			refresh();
X			getstr(string);
X			strcpy(passwd,crypt(string,SALT));
X			if((strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)
X			    &&(strncmp(passwd,ntn[country].passwd,PASSLTH)!=0)){
X				beep();
X				mvaddstr(2,0,"invalid password--hit return");
X				refresh();
X				getch();
X				if(isgod==TRUE) country=0;
X				return;
X			}
X		}
X		mvaddstr(2,0,"what is your new password:");
X		refresh();
X		getstr(string);
X		if((strlen(string)>=8)||(strlen(string)<2)) {
X			beep();
X			mvaddstr(2,0,"invalid new password--hit return");
X			refresh();
X			getch();
X			if(isgod==TRUE) country=0;
X			return;
X		}
X		mvaddstr(4,0,"reenter your new password:");
X		refresh();
X		getstr(passwd);
X		if(strcmp(passwd,string)!=0) {
X			if(isgod==TRUE) country=0;
X			return;
X		}
X		mvaddstr(6,0,"new password can be used following next update--hit return");
X		refresh();
X		getch();
X		ECHGPAS;
X		strncpy(ntn[country].passwd,crypt(string,SALT),PASSLTH);
X		break;
X	case '3':
X		if(magic(country,VAMPIRE)==1) {
X			mvaddstr(0,0,"VAMPIRES CAN'T ADD TO COMBAT BONUS (hit return)");
X			refresh();
X			getch();
X			break;
X		}
X		if(magic(country,WARLORD)==1)      cbonus=30;
X		else if(magic(country,CAPTAIN)==1) cbonus=20;
X		else if(magic(country,WARRIOR)==1) cbonus=10;
X		else cbonus=0;
X		i=0;
X		for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) i+=ASOLD;
X		i = max ( i, 1500);
X		armynum = max ( ntn[country].aplus-cbonus, 10 ) / 10;
X		mvprintw(0,0,"DO YOU WISH SPEND %d IRON ON ATTACK (enter y or n):",IRONORE*i*armynum*armynum);
X		refresh();
X		if(getch()=='y'){
X			if(ntn[country].tiron> (long)IRONORE*i*armynum*armynum){
X				ntn[country].aplus+=1;
X				I_APLUS;
X				ntn[country].tiron-= (long) IRONORE*i*armynum*armynum;
X			}
X			else {
X				mvaddstr(0,0,"SORRY - hit any key");
X				clrtoeol();
X				refresh();
X				getch();
X			}
X		}
X		i=0;
X		for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) i+=ASOLD;
X		i = max ( i, 1500);
X		armynum = max ( ntn[country].dplus-cbonus, 10 ) / 10;
X		mvprintw(0,0,"DO YOU WISH SPEND %d IRON ON DEFENSE (enter y or n):",IRONORE*i*armynum*armynum);
X		refresh();
X		if(getch()=='y'){
X			if(ntn[country].tiron>IRONORE*i*armynum*armynum){
X				ntn[country].dplus+=1;
X				I_DPLUS;
X				ntn[country].tiron-= (long) IRONORE*i*armynum*armynum;
X			}
X			else {
X				mvaddstr(0,0,"SORRY - hit any key");
X				clrtoeol();
X				refresh();
X				getch();
X			}
X		}
X		break;
X	case '4':
X		if(isgod==TRUE){
X			clear();
X			mvaddstr(0,0,"DO YOU WANT TO DESTROY THIS NATION (y or n)");
X			refresh();
X
X			if(getch()=='y') {
X				if ((fnews=fopen(newsfile,"w"))==NULL) {
X					printf("error opening news file\n");
X					exit(FAIL);
X				}
X				destroy(country);
X				fclose(fnews);
X			}
X		}
X		break;
X	default:
X		if(isgod==TRUE) country=0;
X		return;
X	}
X	if(isgod==TRUE) country=0;
X	change();
X}
X
Xvoid
Xhelp()
X{
X	int lineno;
X	FILE *fp, *fopen();
X	int done=FALSE;
X	char line[80];
X
X	/*open .help file*/
X	if ((fp=fopen(helpfile,"r"))==NULL) {
X		mvprintw(0,0,"\nerror on read of %s\n",helpfile);
X		refresh();
X		getch();
X		return;
X	}
X
X	while(done==FALSE){
X		/*read in screen (until DONE statement)*/
X		fgets(line,80,fp);
X		if(strncmp(line,"DONE",4)==0) done=TRUE;
X		else {
X			clear();
X			lineno=0;
X			while(strncmp(line,"END",3)!=0) {
X				mvaddstr(lineno,0,line);
X				lineno++;
X				if(lineno>LINES-3) strcpy(line,"END");
X				else fgets(line,80,fp);
X			}
X			standout();
X			mvaddstr(LINES-2,(COLS/2)-24,"HIT ANY KEY TO CONTINUE HELP SCREENS");
X			mvaddstr(LINES-1,(COLS/2)-19,"TO END HELP HIT SPACE KEY");
X			standend();
X			refresh();
X			if(getch()==' ') done=TRUE;
X		}
X	}
X	fclose(fp);
X}
X
Xvoid
Xnewspaper()
X{
X	int lineno;
X	FILE *fp, *fopen();
X	int newpage,done;
X	short pagenum=1;
X	char line[80];
X	char title[80];
X
X	clear();
X	if ((fp=fopen(newsfile,"r"))==NULL) {
X		mvprintw(0,0,"error on read of %s",newsfile);
X		refresh();
X		getch();
X		return;
X	}
X
X	/*open and read one page */
X	done=FALSE;
X	newpage=FALSE;
X	if(fgets(title,80,fp)==NULL) done=TRUE;
X	while(done==FALSE){
X		if(newpage==FALSE){
X			clear();
X			lineno=5;
X			newpage=TRUE;
X			standout();
X			mvprintw(0,20,"CONQUER NEWS REPORT   page %d",pagenum);
X			mvaddstr(1,23,"ALL THE NEWS THAT FITS");
X			mvprintw(3,20,"%s",title+2);
X			standend();
X		}
X
X		if(fgets(line,80,fp)==NULL) done=TRUE;
X		else {
X			if(line[1]!='.') {
X				strcpy(title,line);
X				newpage=FALSE;
X				pagenum++;
X			}
X			else {
X				mvaddstr(lineno++,0,line+2);
X				if(todigit(line[0])!=pagenum) {
X					newpage=FALSE;
X					pagenum=todigit(line[0]);
X				}
X				else if(lineno>LINES-3) newpage=FALSE;
X			}
X		}
X
X		if(newpage==FALSE||done==TRUE){
X			standout();
X			mvaddstr(LINES-2,(COLS/2)-13,"HIT ANY KEY TO CONTINUE");
X			mvaddstr(LINES-1,(COLS/2)-12,"TO END NEWS HIT SPACE");
X			standend();
X			refresh();
X			if(getch()==' ') done=TRUE;
X		}
X	}
X	fclose(fp);
X}
END_OF_forms.c
if test 14869 -ne `wc -c <forms.c`; then
    echo shar: \"forms.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f getopt.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"getopt.c\"
else
echo shar: Extracting \"getopt.c\" \(2223 characters\)
sed "s/^X//" >getopt.c <<'END_OF_getopt.c'
X/*
X**  This is a public domain version of getopt(3).
X**  Bugs, fixes to:
X**		Keith Bostic
X**			ARPA: keith@seismo
X**			UUCP: seismo!keith
X**  Added NO_STDIO, opterr handling, Rich $alz (mirror!rs).
X*/
X
X#include <stdio.h>
X#include "header.h"
X#include "data.h"
X
X/*
X**  Error macro.  Maybe we want stdio, maybe we don't.
X**  The (undocumented?) variable opterr tells us whether or not
X**  to print errors.
X*/
X#ifdef SYSV
X#define index(s,c)	strchr(s,c)
Xextern char	*strchr();	/* This may be index	*/
X#else
Xextern char	*index();	/* This may be strchr	*/
X#endif
X
X#ifdef	NO_STDIO
X
X#define tell(s)	\
X	if (opterr) \
X	{ \
X		char	ebuf[2]; \
X		(void)write(2, nargv, (unsigned int)strlen(nargv)); \
X		(void)write(2, s, (unsigned int)strlen(s)); \
X		ebuf[0] = optopt; \
X		ebuf[1] = '\n';	\
X		(void)write(2, ebuf, 2); \
X	}
X
X#else
X
X#define tell(s) \
X	if (opterr) \
X		(void)fputs(*nargv, stderr), \
X		(void)fputs(s,stderr), \
X		(void)fputc(optopt, stderr), \
X		(void)fputc('\n', stderr)
X
X#endif
X
X
X/* Global variables. */
Xstatic char	 EMSG[] = "";
Xint	 opterr = 1;	/* undocumented error-suppressor*/
Xint	 optind = 1;	/* index into argv vector	*/
Xint	 optopt;	/* char checked for validity	*/
Xchar	*optarg;	/* arg associated with option	*/
X
X
Xgetopt(nargc, nargv, ostr)
Xint	  nargc;
Xchar	**nargv;
Xchar	 *ostr;
X{
X	static char	 *place = EMSG;	/* option letter processing	*/
X	register char	 *oli;		/* option letter list index	*/
X
X	if (!*place)			/* update scanning pointer	*/
X	{
X	if (optind >= nargc || *(place = nargv[optind]) != '-' || !*++place)
X		return(EOF);
X	if (*place == '-')	/* found "--"	*/
X	{
X		optind++;
X		return(EOF);
X	}
X	}
X	/* option letter okay? */
X	if ((optopt = *place++) == ':'
X	|| (oli = index(ostr, optopt)) == NULL)
X	{
X	if (!*place)
X		optind++;
X	tell(": illegal option -- ");
X	goto Bad;
X	}
X	if(*++oli != ':')	/* don't need argument	*/
X	{
X	optarg = NULL;
X	if (!*place)
X		optind++;
X	}
X	else	/* need an argument*/
X	{
X	if (*place)
X		optarg = place;	/* no white space */
X	else
X		if (nargc <= ++optind)
X		{
X		place = EMSG;
X		tell(": option requires an argument -- ");
X		goto Bad;
X		}
X		else
X		optarg = nargv[optind];	/* white space	*/
X	place = EMSG;
X	optind++;
X	}
X	return(optopt);	/* dump back option letter	*/
XBad:
X	return('?');
X}
END_OF_getopt.c
if test 2223 -ne `wc -c <getopt.c`; then
    echo shar: \"getopt.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f header.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"header.h\"
else
echo shar: Extracting \"header.h\" \(6342 characters\)
sed "s/^X//" >header.h <<'END_OF_header.h'
X/* conquer : Copyright (c) 1988 by Ed Barlow. */
X/* MODIFICATION OF THIS FILE IMPLIES THAT THE MODIFIER WILL ACCEPT
X	A LIMITED USE COPYRIGHT AS FOLLOWS:
X
X	1) This software is copyrighted and protected by law.  The
X		sole owner of this software, which hereafter is known as
X		"conquer" is Edward M. Barlow, who hereby grants you a
X		personal, non-exclusive right to use this software.
X	2) conquer may not be redistributed in any form.  Any requests for
X		new software shall, for now, be the perogative of the author.
X	3) loss or damage caused by this software shall not be
X		the responsibility of the author.
X	4) Ed Barlow shall be notified of enhancements to this software via
X		electronic mail and, if there is no response, via US mail to:
X
X			Ed Barlow
X			562 Clubhouse Dr,
X			Middletown NJ 07748
X
X		My home phone is 201-671-2896.  Use it sparingly and call
X		before 11PM if it is important.
X	5) you agree to use your best efforts to see that any user
X		of conquer complies with the terms and conditions stated above.
X	6) The above copyright notice will not be tampered with in any form.
X*/
X
X/* Special thanks to Brian Beuning, Adam Bryant, and any others who helped
X	me by making enhancements and bug reports */
X
X/*--------------PLEASE MODIFY DATA FILE NAMES IN misc.c--------------------*/
X
X/*-------MODIFICATION IS REQUIRED OF THE FOLLOWING 2 DEFINE STATEMENTS-----*/
X#define OWNER	"Ed Barlow"	/*administrators name*/
X#define LOGIN	"smile"		/*administrators login id !!!IMPORTANT!!!*/
X                                /*only the administrative UID may update...*/
X
X
X/*-------------------MODIFICATION IS OPTIONAL ON THE FOLLOWING-------------*/
X#define VERSION "version 3.0"   /* version number of the game */
X#define SYSV		/*comment this line out if on a BSD machine*/
X#define PWATER 45	/*percentage of water in the world*/
X#define MAPX 48 	/*Number of X Sectors on Map (divisible by 8)*/
X#define MAPY 48		/*Number of Y Sectors on Map (divisible by 8)*/
X			/*MAPX and MAPY must be >= 24*/
X#define MAXNTN 28	/*number of nations (including player & npc ntns)*/
X			/*but not including pirates...*/
X#define MAXPTS 	40	/*points to buy stuff in beginning with*/
X#define MAXARM		50	/*maximum number of armies per nation*/
X#define MAXNAVY		16	/*maximum number of fleets per nation*/
X
X/*THE FOLLOWING SHOULD BE COMMENTED OUT IF YOU DO NOT WANT THE FUNCTION*/
X/*#define HIDELOC		/*defined if news is not to report sectors*/
X#define OGOD		/*defined if you wish to enhance god mode*/
X			/* this gives features like god passwords... */
X#define DERVDESG	/*allow DERVISH to redesignate in a DESERT/ICE */
X#define LZARD		/*defined if lizard npc's exist at beginning*/
X#define MONSTER	/*defined if pirates/barbarians/nomads exist*/
X#define CHEAT		/* npcs will cheat to keep up */
X#define STORMS		/* have storms strike fleets */
X#define VULCANIZE	/* add in volcano eruptions.... */
X#define PVULCAN 20      /* % chance of eruption each round (see above)*/
X/* #define ORCTAKE      /* define if want orcs to takeover orc NPCS */
X#define TAKEPRICE 500000L /* price for orc takeover (see above) in jewels */
X#define PMOUNT 20       /* % of land that is mountains */
X#define PSTORM 3        /* % chance that a storm will strike a fleet */
X			/* unless it is in harbor */
X#define NPC		/*defined if non player country exists at beginning*/
X#define CMOVE		/*Defined if you wish the computer to move
X                          Player nations if they forget to move*/
X#define BEEP		/*defined if you wish terminal to beep*/
X#define HILIGHT		/*defined if your terminal supports inverse video*/
X#define RANEVENT	/*defined if random events possible (not fully tested)*/
X#define NORANDEVENTS 3  /*number of random events on average turn*/
X
X/*---BELOW THIS POINT ARE PARAMETERS YOU MIGHT OPTIONALLY WISH TO CHANGE---*/
X
X#define LANDSEE 2	/*how far you can see on land, by armies, by navies*/
X#define NAVYSEE 1	/*making these numbers large takes CPU time*/
X#define ARMYSEE 2
X
X/*Below taxation rates are in thousand dollars (US 1985) per 100 humans per
X *point of whatever -- ie 1 person in veg of 9 means produce $70x9=630K
X *thousand dollars */
X#define TAXFOOD		40L
X#define TAXIRON		60L
X#define TAXGOLD		70L
X/*City and Capitol tax rates based on people only (no multipleier)*/
X#define TAXCAP		1000L
X#define TAXCITY		750L
X
X#define SHIPMAINT	5000L	/*ship mainatinance cost*/
X
X#define TOMANYPEOPLE	3500L	/* too many people in sector - 1/2 repro */
X				/* and 1/2 production - not in cities/capitol*/
X#define TOMUCHMINED	100000L	/* 100% chance of droping mine value of sector*/
X				/* actual chance is prorated */
X#define DESFOOD		4	/* food value of sector to redesignate it */
X
X/* min soldiers to take sector */
X#define TAKESECTOR	max(75,(ntn[country].tmil/150))
X
X#define	FINDPERCENT	15	/* percent to find gold/iron in sector */
X#define DESCOST		5000L	/*cost to redesignatie*/
X				/*this is also the iron cost for cities*/
X#define FORTCOST	1000L	/*cost to build a fort point*/
X#define WARSHPCOST	80000L	/*cost to build one warship*/
X#define MERSHPCOST	80000L	/*cost to build one merchant*/
X#define	SHIPCREW	50	/* full strength crew on a ship */
X#define SHIPHOLD	300	/*number of humans a merchant can hold*/
X#define CITYLIMIT	8	/*% of ntns people in sector before => city*/
X#define CITYPERCENT	20	/* percent of npc pop able to live in cities */
X/* note that militia are not considered military below */
X#define MILRATIO	8	/* ratio civ:mil for non player countries*/
X#define MILINCAP	10	/*ratio (mil in cap):mil for NPCs*/
X#define	MILINCITY	10	/* militia in city/cap = people/MILINCITY */
X#define NPCTOOFAR	15	/* npcs should not stray this far from cap */
X#define BRIBE		100000L	/*amount of gold to bribe one level*/
X#define IRONORE		7	/*iron per soldier needed for +1% weapons*/
X
X/*--------------------Extended command definitions--------------------------*/
X#define EXT_CMD '\033'		/* ESC to start extended command */
X
X/*--------------------DO NOT TO ALTER BELOW THIS LINE-----------------------*/
X
X#define MAXX		(MAPX / 8)	/*Number of X areas on map*/
X#define MAXY		(MAPY / 8)	/*Number of Y areas on map*/
X#define NUMAREAS	(MAXX * MAXY)	/*total # areas, MAXX*MAXY*/
X#define NTOTAL		(MAXNTN +4) /*MAXNTN+4*/
X#define NLIZARD		(MAXNTN )   /*MAXNTN+0*/
X#define NNOMAD		(MAXNTN +1) /*MAXNTN+1*/
X#define NBARBARIAN	(MAXNTN +2) /*MAXNTN+2*/
X#define NPIRATE		(MAXNTN +3) /*MAXNTN+3*/
END_OF_header.h
if test 6342 -ne `wc -c <header.h`; then
    echo shar: \"header.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f move.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"move.c\"
else
echo shar: Extracting \"move.c\" \(15082 characters\)
sed "s/^X//" >move.c <<'END_OF_move.c'
X/*conquer : Copyright (c) 1988 by Ed Barlow.
X *  I spent a long time writing this code & I hope that you respect this.
X *  I give permission to alter the code, but not to copy or redistribute
X *  it without my explicit permission.  If you alter the code,
X *  please document changes and send me a copy, so all can have it.
X *  This code, to the best of my knowledge works well,  but it is my first
X *  'C' program and should be treated as such.  I disclaim any
X *  responsibility for the codes actions (use at your own risk).  I guess
X *  I am saying "Happy gaming", and am trying not to get sued in the process.
X *                                                Ed
X */
X
X
X/*include files*/
X#include "header.h"
X#include "data.h"
X#include <ctype.h>
X
Xextern FILE *fexe;
X/*redraw map in this turn if redraw is a 1*/
Xextern short redraw;
Xextern short selector;
Xextern short pager;
Xextern short xcurs,ycurs,xoffset,yoffset;
Xextern short hilmode;   /*highlight modes: 0=owned sectors, 1= armies, 2=none*/
X
X/* nation id of owner*/
Xextern short country;
Xint armornvy=AORN;	/*is one if navy*/
X
Xvoid
Xmymove()
X{
X	int mveleft;
X	int i,j,x,y;
X	char carried;
X	int total,Tarmynum,Tnation;
X	int startx=0,starty=0;
X	int ctransport=0;	 /*number of civilians to transport*/
X	int valid=FALSE;     /*1 if move was a valid move (you must pay cost)*/
X	short armynum;
X	int oldxcurs,oldycurs;
X	short nvynum;
X	int done=FALSE;	/*done is TRUE if done with this move*/
X	int capacity;
X
X	armornvy=AORN;
X	clear_bottom(0);
X	/*get selected army or navy*/
X	if((armynum=getselunit())<0) {
X		errormsg("ERROR: FAKE UNIT SELECTED: ");
X		armornvy=AORN;
X		return;
X	}
X
X	/*navy*/
X	if((armynum>=MAXARM)&&(armynum<MAXARM+MAXNAVY)) {
X		nvynum=armynum-MAXARM;
X		armynum=(-1);
X		mvprintw(LINES-4,0,"NAVY %d: ",nvynum);
X		standend();
X		clrtoeol();
X		capacity=NMER*SHIPHOLD;
X		if((NMOVE<=0)) {
X			errormsg("NO MOVE POINTS LEFT");
X			armornvy=AORN;
X			return;
X		}
X		if( capacity > 0 ) {
X			int	has_army;
X			int	has_civilians;
X			char	prompt[ 200 ];
X
X			has_army = solds_in_sector( XREAL, YREAL, country ) > 0;
X			has_civilians = (sct[XREAL][YREAL].owner == country) &&
X				(sct[XREAL][YREAL].people > 0);
X
X			if( !has_civilians && !has_army ) {
X				carried = 'n';
X			} else {
X				strcpy( prompt, "Transport " );
X				if( has_army )
X					strcat( prompt, "(a)rmy, " );
X				if( has_civilians )
X					strcat( prompt, "(c)iv, " );
X				if( has_army && has_civilians )
X					strcat( prompt, "(b)oth, " );
X				strcat( prompt, "(n)othing: " );
X
X				mvaddstr( LINES-4, 13, prompt );
X				clrtoeol();
X				refresh();
X				carried = getch();
X			}
X		}
X		else carried='n';
X
X		/*transport army*/
X		if(carried=='a'||carried=='b'){
X			mvprintw(LINES-3,0,"CAPACITY=%d ;WHAT ARMY TO XPORT?:",capacity);
X			clrtoeol();
X			refresh();
X			armynum = get_number();
X			if((armynum<MAXARM)&&(armynum>=0)
X			&&(AXLOC==XREAL)&&(AYLOC==YREAL)){
X				if(ASOLD>capacity){
X					errormsg("ERROR: TOO MANY TROOPS");
X					armornvy=AORN;
X					return;
X				}
X				else if(AMOVE==0){
X					errormsg("SORRY: ARMY HAS NO MOVEMENT POINTS");
X					armornvy=AORN;
X					return;
X				}
X				else capacity-=ASOLD;
X			}
X			else {
X				errormsg("ERROR: INVALID ARMY!");
X				armornvy=AORN;
X				return;
X			}
X		}
X		/*transport civilians*/
X		if(carried=='c'||carried=='b'){
X			mvprintw(LINES-2,0,"CAPACITY=%d ;HOW MANY CIVILIANS XPORT?:",capacity);
X			clrtoeol();
X			refresh();
X			ctransport = get_number();
X			if(ctransport>0&&ctransport<=sct[XREAL][YREAL].people&&(ctransport<=capacity)){
X				startx=XREAL;
X				starty=YREAL;
X			}
X			else {
X				errormsg("NUMBER OF MEN ERROR");
X				armornvy=AORN;
X				return;
X			}
X		}
X	}
X	/*army*/
X	else {
X		mvprintw(LINES-4,0,"ARMY %d: ",armynum);
X		clrtoeol();
X		if(AMOVE<=0){
X			errormsg("NO MOVEMENT POINTS LEFT");
X			redraw=FALSE;
X			armornvy=AORN;
X			return;
X		}
X	}
X
X	clear_bottom(3);
X	standout();
X	mvaddstr(LINES-2,0,"MOVEMENT SCREEN - see documentation");
X	clrtoeol();
X	mvaddstr(LINES-1,0,"HIT SPACE IF DONE         ");
X	clrtoeol();
X	standend();
X	move(ycurs,xcurs*2);
X	refresh();
X
X	while(done==FALSE){
X		valid=TRUE;
X		if(armornvy==NAVY) mveleft=NMOVE;
X		else mveleft=AMOVE;
X		oldxcurs=xcurs;
X		oldycurs=ycurs;
X		switch(getch()) {
X		case '1':
X		case 'b':
X			xcurs--;
X			ycurs++;
X			break;
X		case '4':
X		case 'h':
X			xcurs--;
X			break;
X		case '2':
X		case 'j':		/*move down*/
X			ycurs++;
X			break;
X		case '8':
X		case 'k':		/*move up*/
X			ycurs--;
X			break;
X		case '6':
X		case 'l':		/*move east*/
X			xcurs++;
X			break;
X		case '3':
X		case 'n':		/*move south-east*/
X			ycurs++;
X			xcurs++;
X			break;
X		case '9':
X		case 'u':		/*move north-east*/
X			ycurs--;
X			xcurs++;
X			break;
X		case '7':
X		case 'y':		/*move north-west*/
X			ycurs--;
X			xcurs--;
X			break;
X		case '':		/* redraw map */
X			valid=FALSE;
X			redraw=TRUE;
X			coffmap();
X				/*see within one sector of unit*/
X				if(hilmode==3) {
X					for(i=XREAL-xoffset-1;i<=XREAL-xoffset+1;i++){
X						for(j=YREAL-yoffset-1;j<=YREAL-yoffset+1;j++){
X							highlight(i,j);
X							see(i,j);
X						}
X					}
X					for(i=0;i<MAXARM;i++) if(ntn[country].arm[i].sold>0){
X						standout();
X						see(ntn[country].arm[i].xloc-xoffset,ntn[country].arm[i].yloc-yoffset);
X					}
X					for(i=0;i<MAXNAVY;i++) if(ntn[country].nvy[i].merchant+ntn[country].nvy[i].warships>0){
X						standout();
X						see(ntn[country].nvy[i].xloc-xoffset,ntn[country].nvy[i].yloc-yoffset);
X
X					}
X				}
X				else for(i=XREAL-xoffset-1;i<=XREAL-xoffset+1;i++){
X					for(j=YREAL-yoffset-1;j<=YREAL-yoffset+1;j++){
X						highlight(i,j);
X						see(i,j);
X					}
X				}
X			move(ycurs,xcurs*2);
X			refresh();
X			break;
X		case ' ':
X			valid=FALSE;
X			done=TRUE;
X			break;
X		default:
X			beep();
X			valid=FALSE;
X		}
X
X		/*if valid move check if have enough movement points*/
X		if(valid==TRUE)
X		if(armornvy==ARMY) {
X			if((movecost[XREAL][YREAL]<0)
X			||(movecost[XREAL][YREAL]>mveleft)) {
X				beep();
X				valid=FALSE;
X				xcurs=oldxcurs;
X				ycurs=oldycurs;
X			} else {
X				AMOVE-=movecost[XREAL][YREAL];
X				if(AMOVE<=0) done=TRUE;
X			}
X
X		} else if(armornvy==NAVY) {
X			if(movecost[XREAL][YREAL]>mveleft){
X				beep();
X				valid=FALSE;
X				xcurs=oldxcurs;
X				ycurs=oldycurs;
X			} else if(movecost[XREAL][YREAL] > 0){
X				/* LAND OF SOME TYPE */
X				if(((sct[XREAL][YREAL].designation==DCITY)
X				||(sct[XREAL][YREAL].designation==DCAPITOL))){
X					/* harbor */
X					if(NMOVE>=4) NMOVE-=4;
X					else {
X						beep();
X						valid=FALSE;
X						xcurs=oldxcurs;
X						ycurs=oldycurs;
X					}
X				} else {	/* coastland */
X				standout();
X				mvprintw(LINES-3,0,"DO YOU WISH TO LAND SHIPS?");
X				standend();
X				clrtoeol();
X				refresh();
X				if(getch()=='y') {
X					move(3,0);
X					clrtoeol();
X					if(NMOVE>=10) NMOVE=0;
X					else {
X						beep();
X						valid=FALSE;
X						xcurs=oldxcurs;
X						ycurs=oldycurs;
X					}
X				} else {
X					move(3,0);
X					clrtoeol();
X					valid=FALSE;
X					xcurs=oldxcurs;
X					ycurs=oldycurs;
X					move(ycurs,xcurs*2);
X					refresh();
X				}
X				}
X			} else NMOVE+=movecost[XREAL][YREAL];
X
X			if(NMOVE<=0) done=TRUE;
X
X		} else if(armornvy==AORN){
X			errormsg("ERROR - NOT ARMY OR NAVY");
X			return;
X		}
X
X		/*calc enemy soldiers */
X		total=0;
X		if(armornvy==ARMY) {
X			for(Tnation=0;Tnation<NTOTAL;Tnation++)
X			if(Tnation!=country)
X			for(Tarmynum=0;Tarmynum<MAXARM;Tarmynum++)
X			if((ntn[Tnation].arm[Tarmynum].sold>0)
X			&&(ntn[Tnation].arm[Tarmynum].xloc==XREAL)
X			&&(ntn[Tnation].arm[Tarmynum].yloc==YREAL)
X			&&((ntn[country].dstatus[Tnation]>=HOSTILE)
X			||(ntn[Tnation].dstatus[country]>=HOSTILE))
X			&&(ntn[Tnation].arm[Tarmynum].stat!=SCOUT)
X			&&(ntn[Tnation].arm[Tarmynum].unittyp!=A_NINJA))
X				total+=ntn[Tnation].arm[Tarmynum].sold;
X		}
X		/*naval total is number of at war WARSHIPS within one sector*/
X		else {
X			for(Tnation=0;Tnation<NTOTAL;Tnation++)
X			if(Tnation!=country)
X			for(Tarmynum=0;Tarmynum<MAXNAVY;Tarmynum++)
X			if((ntn[Tnation].nvy[Tarmynum].warships>0)
X			&&(ntn[Tnation].nvy[Tarmynum].xloc<=XREAL+1)
X			&&(ntn[Tnation].nvy[Tarmynum].xloc>=XREAL-1)
X			&&(ntn[Tnation].nvy[Tarmynum].yloc<=YREAL+1)
X			&&(ntn[Tnation].nvy[Tarmynum].yloc>=YREAL-1)
X			&&(ntn[Tnation].dstatus[country]>=HOSTILE))
X				total+=ntn[Tnation].nvy[Tarmynum].warships;
X		}
X
X		/*if moved and not done*/
X		if((valid==TRUE)&&(done==FALSE)){
X			/*check if offmap and correct*/
X			coffmap();
X
X			mvaddstr(LINES-3,0,"                  ");
X
X			/*scouts/ninja and rocs/griffon ignore zones of
X			control*/
X			if((armornvy==ARMY)
X			&&(ASTAT!=SCOUT)
X			&&(ATYPE!=A_NINJA)
X			&&(ATYPE!=A_ROC)
X			&&(ATYPE!=A_GRIFFON)){
X				if((sct[XREAL][YREAL].owner!=0)
X				&&(sct[XREAL][YREAL].owner!=country)
X				&&(sct[XREAL][YREAL].people>100)
X		&&(ntn[sct[XREAL][YREAL].owner].dstatus[country]>FRIENDLY)
X		&&(ntn[country].dstatus[sct[XREAL][YREAL].owner]<WAR)){
X		/*if other owner (with civilians) and not hostile then stop*/
X					beep();
X					mvaddstr(LINES-3,0,"HALT! YOU MAY NOT PASS HERE!");
X					clrtoeol();
X					refresh();
X					AMOVE=0;
X					AADJMOV;
X					done=TRUE;
X				}
X				else if(total>0){
X					/*stop if you have < 2* total*/
X					if(ASOLD < 2 * total){
X						AMOVE=0;
X						AADJMOV;
X						mvprintw(LINES-3,0,"Zone Of Control ");
X						beep();
X						done=TRUE;
X					}
X					else mvaddstr(LINES-3,0,"SAFE -- hit return");
X				}
X			}
X			else if((armornvy==NAVY)&&(total>0)){
X				/*25% stop if they have > total*/
X				if((ntn[country].nvy[nvynum].warships < total)
X				&&(rand()%4==0)){
X					NMOVE=0;
X					NADJMOV;
X					mvprintw(LINES-3,0,"%d Enemy WarShips Sighted ",total);
X					beep();
X					done=TRUE;
X				}
X				else mvaddstr(LINES-3,0,"SAFE -- hit return");
X			}
X
X			standout();
X			if(armornvy==ARMY){
X				mvprintw(LINES-2,0,"MOVESCREEN: move left: %d  ",AMOVE);
X			}
X			else mvprintw(LINES-2,0,"MOVESCREEN: move left: %d  ",NMOVE);
X			clrtoeol();
X
X			mvprintw(LINES-1,20,"move cost is %d  ",abs(movecost[XREAL][YREAL]));
X			standend();
X			move(ycurs,xcurs*2);
X
X			/*if you just moved off map then see it*/
X			if(inch()==' ') {
X				if(armornvy==ARMY) {
X					AXLOC=XREAL;
X					AYLOC=YREAL;
X				}
X				else if(armornvy==NAVY) {
X					NXLOC=XREAL;
X					NYLOC=YREAL;
X				}
X				makemap();
X			}
X			else {
X				makeside();
X				/*see within one sector of unit*/
X				if(hilmode==3) {
X					for(i=XREAL-xoffset-1;i<=XREAL-xoffset+1;i++){
X						for(j=YREAL-yoffset-1;j<=YREAL-yoffset+1;j++){
X							highlight(i,j);
X							see(i,j);
X						}
X					}
X					for(i=0;i<MAXARM;i++) if(ntn[country].arm[i].sold>0){
X						standout();
X						see(ntn[country].arm[i].xloc-xoffset,ntn[country].arm[i].yloc-yoffset);
X					}
X					for(i=0;i<MAXNAVY;i++) if(ntn[country].nvy[i].merchant+ntn[country].nvy[i].warships>0){
X						standout();
X						see(ntn[country].nvy[i].xloc-xoffset,ntn[country].nvy[i].yloc-yoffset);
X
X					}
X				}
X				else for(i=XREAL-xoffset-1;i<=XREAL-xoffset+1;i++){
X					for(j=YREAL-yoffset-1;j<=YREAL-yoffset+1;j++){
X						highlight(i,j);
X						see(i,j);
X					}
X				}
X			}
X			move(ycurs,xcurs*2);
X			refresh();
X		}
X	}
X
X	/*at this point you are done with move*/
X	/*move unit now to XREAL,YREAL*/
X	selector=0;
X	pager=0;
X	mvaddstr(LINES-1,0,"DONE MOVEMENT");
X	clrtoeol();
X	if(armornvy==ARMY){
X		AXLOC=XREAL;
X		AYLOC=YREAL;
X		AADJLOC;
X		AADJMOV;
X		/*if sector unowned take it*/
X		/*first check if occupied*/
X		/* if (other owner and unoccupied) or (no owner) you take*/
X		if(ASOLD>=TAKESECTOR){
X			if(SOWN==0){
X				mvprintw(LINES-2,0,"TAKING UNOWNED SECTOR");
X				SOWN=country;
X				SADJOWN;
X				AMOVE=0;
X				AADJMOV;
X			}
X			else if((sct[AXLOC][AYLOC].owner!=country)
X				&&((sct[AXLOC][AYLOC].designation==DCITY)
X				||(sct[AXLOC][AYLOC].designation==DCAPITOL))){
X				mvprintw(LINES-2,0,"ENTERING CITY SECTOR");
X			}
X			else if((ASOLD > 7*total)&&(total!=0)){
X				/*over run if > 7x as many*/
X				mvaddstr(LINES-3,0,"OVERRAN HOSTILE ARMY ");
X				AMOVE=0;
X				AADJMOV;
X				x=country;
X				y=armynum;
X				for(Tnation=0;Tnation<MAXNTN;Tnation++)
X				if(Tnation!=x)
X				for(Tarmynum=0;Tarmynum<MAXARM;Tarmynum++)
X				if((ntn[Tnation].arm[Tarmynum].xloc==XREAL)
X				&&(ntn[Tnation].arm[Tarmynum].yloc==YREAL)
X				&&((ntn[x].dstatus[Tnation]>=HOSTILE)
X				||(ntn[Tnation].dstatus[x]>=HOSTILE))) {
X					country=Tnation;
X					armynum=Tarmynum;
X					ASOLD=0;
X					AADJMEN;
X				}
X				country=x;
X				armynum=y;
X				if(sct[XREAL][YREAL].owner!=country){
X				if((sct[XREAL][YREAL].people>0)
X				&&(ntn[sct[XREAL][YREAL].owner].race!=ntn[country].race))
X				if(magic(country,SLAVER)==TRUE) {
X					flee(XREAL,YREAL,0,TRUE);
X				} else{
X					flee(XREAL,YREAL,0,FALSE);
X				}
X				SOWN=country;
X				SADJOWN;
X				if (is_habitable(AXLOC,AYLOC)) {
X					sct[AXLOC][AYLOC].designation=DDEVASTATED;
X					SADJDES;
X				}
X				}
X				beep();
X			}
X			else if((SOWN!=country)
X			&&((occ[XREAL][YREAL]==0)
X				||(occ[XREAL][YREAL]==country))
X			&&(ntn[country].dstatus[SOWN]>HOSTILE)
X			&&((ASTAT==ATTACK)||(ASTAT==DEFEND))) {
X				/*people flee if not of same race*/
X				if((sct[XREAL][YREAL].people>0)
X				&&(ntn[sct[XREAL][YREAL].owner].race!=ntn[country].race))
X				if(magic(country,SLAVER)==TRUE) {
X					flee(XREAL,YREAL,0,TRUE);
X				} else{
X					flee(XREAL,YREAL,0,FALSE);
X				}
X				mvprintw(LINES-2,0,"TAKING SECTOR");
X				SOWN=country;
X				SADJOWN;
X				AMOVE=0;
X				AADJMOV;
X			}
X			clrtoeol();
X			refresh();
X		}
X	} else if(armornvy==AORN){
X		mvprintw(LINES-3,0,"ERROR");
X		return;
X	} else {
X		/*else navy*/
X		mvprintw(LINES-1,0,"NAVY DONE: ");
X		clrtoeol();
X		NXLOC=XREAL;
X		NYLOC=YREAL;
X		NADJLOC;
X		NADJMOV;
X		if((carried=='a'||carried=='b')
X		&&(sct[XREAL][YREAL].altitude!=WATER)&&(armynum>=0)
X		&&(armynum<MAXARM)) {
X			if((SOWN!=0)&&(SOWN!=country)&&(ATYPE!=A_MARINES)){
X				mvprintw(LINES-2,0,"SECTOR OWNED - CANT LAND");
X				refresh();
X				sleep(1);
X			} else {
X				AXLOC=XREAL;
X				AYLOC=YREAL;
X				AADJLOC;
X				AMOVE=0;
X				AADJMOV;
X				/*take unowned land*/
X				if((SOWN==0)&&(ASOLD>=TAKESECTOR)) {
X					SOWN=country;
X					SADJOWN;
X				}
X			}
X		}
X		/*land civilians*/
X		if((carried=='b'||carried=='c')
X		&&(sct[XREAL][YREAL].altitude!=WATER)
X		&&(ctransport>0)) {
X			if(SOWN==country) {
X				sct[XREAL][YREAL].people+=ctransport;
X				SADJCIV;
X				sct[startx][starty].people-=ctransport;
X				i=startx;
X				j=starty;
X				SADJCIV2;
X			}
X			else mvprintw(LINES-3,0,"cant move people to %d,%d as unowned",XREAL,YREAL);
X		}
X		if((carried=='a'||carried=='b'||carried=='c')
X		&&(sct[XREAL][YREAL].altitude==WATER)) {
X			mvaddstr(LINES-3,0,"You stopped in WATER, returning any transported people");
X		}
X	}
X	redraw=FALSE;
X	makemap();
X	armornvy=AORN;
X}
X
X/*get selected army or navy: if navy, number is MAXARM+nvynum*/
Xint
Xgetselunit()
X{
X	int number=(-1);
X	short armynum=0;
X	short nvynum=0;
X	int count=0;
X	/*current selected unit is selector/2+5*pager*/
X	/*count is order of that army in sector*/
X	/*armynum is number of that army*/
X	for(armynum=0;armynum<MAXARM;armynum++){
X		if((ASOLD>0)&&(AXLOC==XREAL)&&(AYLOC==YREAL)) {
X			if((5*pager)+(selector/2)==count) number=armynum;
X			count++;
X		}
X	}
X
X	if(number==(-1)){
X	for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X		if((NMER+NWAR>0)&&(NXLOC==XREAL)&&(NYLOC==YREAL)) {
X			if((5*pager)+(selector/2)==count) number=MAXARM+nvynum;
X			count++;
X		}
X	}
X	if(number>=0){
X		if(number>=MAXARM) armornvy=NAVY;
X		else armornvy=ARMY;
X	}
X	return(number);
X}
END_OF_move.c
if test 15082 -ne `wc -c <move.c`; then
    echo shar: \"move.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f reports.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"reports.c\"
else
echo shar: Extracting \"reports.c\" \(13951 characters\)
sed "s/^X//" >reports.c <<'END_OF_reports.c'
X/* Conquer: Copyright (c) 1988 by Edward M Barlow
X *  I spent a long time writing this code & I hope that you respect this.
X *  I give permission to alter the code, but not to copy or redistribute
X *  it without my explicit permission.  If you alter the code,
X *  please document changes and send me a copy, so all can have it.
X *  This code, to the best of my knowledge works well,  but it is my first
X *  'C' program and should be treated as such.  I disclaim any
X *  responsibility for the codes actions (use at your own risk).  I guess
X *  I am saying "Happy gaming", and am trying not to get sued in the process.
X *                                                Ed
X */
X
X
X/*	screen subroutines	*/
X
X/*include files*/
X#include <ctype.h>
X#include "header.h"
X#include "data.h"
X
Xextern FILE *fexe;
Xextern short country;
Xextern long startgold;
Xextern short xcurs,ycurs;
Xextern short xoffset,yoffset;
X
X/*report on armies and allow changes*/
Xvoid
Xarmyrpt(repnum)
X	int repnum;
X	/* 0 is for full report 'a' and 1 is for group report 'g' */
X{
X	int i,j;
X	short army;
X	int men;
X	short oldarmy;
X	int done=FALSE;
X	int position;
X	int isgod=FALSE;
X	int count;    /*number of armies on current screen */
X	short armynum=0;    /*current nation id */
X	if(country==0) {
X		standout();
X		isgod=TRUE;
X		clear();
X		mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X		clrtoeol();
X		standend();
X		refresh();
X		country = get_number();
X		if(country<0||country>NTOTAL) return;
X	}
X	armynum=0;
X	/*new army screen*/
X	while(done==FALSE) {
X		clear();
X		/*Operate on any armies that you wish*/
X		standout();
X		mvprintw(0,(COLS/2)-20,"ARMY STATS SUMMARY FOR %s",ntn[country].name);
X		standend();
X		/* give a army report */
X
X		mvaddstr(3,0,"soldiers  :");
X		mvaddstr(4,0,"movement  :");
X		mvaddstr(5,0,"x location:");
X		mvaddstr(6,0,"y location:");
X		mvaddstr(7,0,"status    :");
X		mvaddstr(8,0,"unit type :");
X		mvaddstr(9,0,"cost/turn :");
X		mvaddstr(10,0,"enlist    :");
X
X		position=5;
X		count=0;
X		while((armynum<MAXARM)&&(count!=6)){
X			if(ASOLD>0 && (!repnum || (AXLOC==XREAL && AYLOC==YREAL))) {
X				count++;
X				position+=10;
X				standout();
X				mvprintw(2,position,"%d:",armynum);
X				standend();
X				mvprintw(3,position,"%d",ASOLD);
X				mvprintw(4,position,"%d",AMOVE);
X				mvprintw(5,position,"%d",AXLOC);
X				mvprintw(6,position,"%d",AYLOC);
X				mvprintw(7,position,"%s",*(soldname+ASTAT));
X				mvprintw(8,position,"%s",*(unittype+(ATYPE%100)));
X				mvprintw(9,position,"$%d",ASOLD * *(unitmaint+(ATYPE%100)));
X				mvprintw(10,position,"$%d",ASOLD * *(u_encost+(ATYPE%100)));
X			}
X			armynum++;
X		}
X		if(armynum>=MAXARM) done=TRUE;
X
X		standout();
X		mvaddstr(12,(COLS/2)-10,"HIT SPACE KEY IF DONE");
X		mvaddstr(13,(COLS/2)-14,"HIT RETURN TO CHANGE AN ARMY");
X		mvaddstr(14,(COLS/2)-14,"HIT ANY OTHER KEY TO CONTINUE");
X		standend();
X		refresh();
X		if ((army=getch())==' ') done=TRUE;
X		if (army=='\n'){
X			done=0;
X			mvaddstr(16,0,"WHAT ARMY DO YOU WANT TO CHANGE:");
X			clrtoeol();
X			refresh();
X			armynum = get_number();
X			if((armynum<0)||(armynum>MAXARM)) return;
X			if(ATYPE<99)
X			mvaddstr(18,0,"1) CHANGE STATUS, 2) TRANSFER / MERGE, 3) SPLIT ARMY, 4) DISBAND ARMY");
X			else mvaddstr(18,0,"1) CHANGE STATUS, 4) DISBAND ARMY:");
X			clrtoeol();
X			if(isgod==TRUE) mvaddstr(20,0,"5) LOCATION, 6) SOLDIERS:");
X			refresh();
X			switch(getch()){
X			case '1':
X				adjarm(armynum);
X				break;
X			case '2':
X				clear_bottom(0);
X				if(ATYPE>=MINMONSTER){
X					errormsg("SORRY -- army is monster");
X					break;
X				}
X				oldarmy=armynum;
X				mvaddstr(LINES-4,0,"TO WHAT ARMY: ");
X				refresh();
X				armynum = get_number();
X
X				combinearmies(armynum,oldarmy);
X				break;
X			case '3':
X				splitarmy(armynum);
X				break;
X			case '4':
X				clear_bottom(0);
X				if(sct[AXLOC][AYLOC].owner!=country){
X					errormsg("YOU DONT OWN SECTOR");
X					break;
X				}
X				else if(ATYPE==A_MERCENARY){
X					/*mercs must be payed off*/
X					/*mercs do not add to local populace*/
X					mvprintw(LINES-4,0,"Your mercenaries demand %ld gold to disband",
X					*(u_encost+(ATYPE%100)) * ASOLD);
X					mvprintw(LINES-3,0,"continue? (y or n)");
X					refresh();
X					if(getch()=='y'){
X					ntn[country].tgold -= *(u_encost+(ATYPE%100)) * ASOLD;
X					ASOLD=0;
X					AADJMEN;
X					}
X				} else if(magic(country,VAMPIRE)==1){
X					errormsg("VAMPIRES CANT DISBAND");
X					break;
X				} else {
X					sct[AXLOC][AYLOC].people+=ASOLD;
X					ASOLD=0;
X					AADJMEN;
X					i=AXLOC;
X					j=AYLOC;
X					SADJCIV2;
X				}
X				break;
X			case '5':
X				if(isgod==TRUE){
X					/*X LOCATION*/
X					mvaddstr(21,0,"WHAT IS THE NEW X LOC: ");
X					refresh();
X					men = get_number();
X					AXLOC=men;
X					/*Y LOCATION*/
X					mvaddstr(21,0,"WHAT IS THE NEW Y LOC: ");
X					refresh();
X					men = get_number();
X					AYLOC=men;
X					AADJLOC;
X				}
X				break;
X			case '6':
X				if(isgod==TRUE){
X					/*SOLDIERS*/
X					mvaddstr(21,0,"WHAT IS THE NEW TOTAL SOLDIERS: ");
X					refresh();
X					men = get_number();
X					ASOLD=men;
X					AADJMEN;
X				}
X				break;
X			default:
X				mvaddstr(21,0,"ERROR : HIT ANY CHAR TO CONTINUE");
X				clrtoeol();
X				refresh();
X				getch();
X			}
X			noecho();
X			armynum=0;
X		}
X	}
X	if(isgod==TRUE) country=0;
X}
X
Xvoid
Xbudget()
X{
X	short armynum,nvynum;
X	long expship=0L,expsold=0L,nosold=0L;	/*nosold = # men,exp expense */
X	int isgod=FALSE;
X
X	if(country==0) {
X		isgod=TRUE;
X		clear();
X		mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X		clrtoeol();
X		refresh();
X		country = get_number();
X	}
X
X	clear();
X	standout();
X	mvaddstr(0,(COLS/2)-10,"NEXT YEARS BUDGET ESTIMATES");
X	standend();
X
X	spreadsheet(country);
X
X	for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) {
X		nosold+= ASOLD;
X		expsold += ASOLD * *(unitmaint+(ATYPE%100));
X	}
X	for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X		if(NWAR+NMER>0) expship+=(NWAR+NMER);
X
X	standout();
X	mvprintw(5,0,  "nation name is.....%s   ",ntn[country].name);
X	mvprintw(6,0,  "gold in treasury..$%8ld",ntn[country].tgold);
X	mvprintw(7,0,  "number of sectors..%d",spread.sectors);
X	standend();
X	if(ntn[country].tfood<ntn[country].tciv) standout();
X	mvprintw(9,0,  "granary holds ....%8ld",ntn[country].tfood);
X	standend();
X	mvprintw(10,0, "jewels owned is...%8ld",ntn[country].jewels);
X	mvprintw(11,0, "iron ore owned is.%8ld",ntn[country].tiron);
X	mvprintw(7,30, "%8d people in gold mines:%8ld",spread.ingold,spread.revjewels);
X	mvprintw(8,30, "%8d people in iron mines:%8ld",spread.iniron,spread.reviron);
X	mvprintw(9,30, "%8d people in farms:     %8ld",spread.infarm,spread.revfood);
X	mvprintw(10,30,"%8d people in capitol:   %8ld",spread.incap,spread.revcap);
X	mvprintw(11,30,"%8d people in towns:     %8ld",spread.incity,spread.revcity);
X	standout();
X	mvprintw(12,30,"%8ld people TOTAL INCOME: %8ld",spread.civilians,spread.gold - ntn[country].tgold);
X	standend();
X
X	if(magic(country,VAMPIRE)==1)  expsold/=4;
X	mvprintw(14,30,"%8d troops:              %8ld",nosold,expsold);
X
X	mvprintw(15,30,"%8d ships at %5d each: %8ld",expship,SHIPMAINT,expship*SHIPMAINT);
X	mvprintw(16,30,"other expenses this turn:     %8ld",startgold-ntn[country].tgold);
X	standout();
X	mvprintw(17,30,"TOTAL EXPENSES:               %8ld",expsold+(expship*SHIPMAINT)+startgold-ntn[country].tgold);
X	mvprintw(18,30,"NET INCOME:                   %8ld",spread.gold-expsold-(expship*SHIPMAINT)-startgold);
X
X	mvaddstr(20,(COLS/2)-13,"HIT 'P' TO SEE PRODUCTION STATS");
X	mvaddstr(21,(COLS/2)-12,"HIT ANY OTHER KEY TO CONTINUE");
X	standend();
X	refresh();
X	if(getch()=='P'){
X		produce();
X	}
X	if(isgod==TRUE) country=0;
X}
X
Xvoid
Xproduce()
X{
X	short armynum;
X	int military=0;
X	int isgod=FALSE;
X
X	if(country==0) {
X		isgod=TRUE;
X		clear();
X		mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X		clrtoeol();
X		refresh();
X		country = get_number();
X	}
X	clear();
X	standout();
X	mvaddstr(0,(COLS/2)-12,"NEXT YEARS PRODUCTION ESTIMATES");
X	standend();
X
X	spreadsheet(country);
X	for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) military+=ASOLD;
X
X	standout();
X	mvprintw(5,0,  "nation name is ...%9s",ntn[country].name);
X	mvprintw(6,0,  "gold in treasury..$%8ld",ntn[country].tgold);
X	standend();
X	mvaddstr(8,0,  "FOOD PRODUCTION");
X	mvprintw(9,0,  "granary now holds.........%8ld tons",ntn[country].tfood);
X	mvprintw(10,0, "%8d people in farms..%8ld tons",spread.infarm,spread.food-ntn[country].tfood);
X	mvprintw(12,0, "%8d civilians eat....%8d tons",spread.civilians,spread.civilians);
X	mvprintw(13,0, "%8d soldiers  eat....%8d tons",military,military*2);
X	mvprintw(15,0, "TOTAL NET FOOD............%8d tons",spread.food-ntn[country].tfood-spread.civilians-military*2);
X	if(spread.food-spread.civilians-military*2<FOODTHRESH*(100+ntn[country].repro)*spread.civilians/100){
X	mvprintw(16,0, "TOTAL NEXT YEARS FOOD.....%8ld tons",spread.food-spread.civilians-military*2);
X	}
X	else{
X	mvprintw(16,0, "TOTAL NEXT YEARS FOOD.....%8ld tons",FOODTHRESH*(100+ntn[country].repro)*spread.civilians/100);
X	mvprintw(17,0, "REVENUE FROM EXCESS.......%8ld gold",spread.food-spread.civilians-military*2-FOODTHRESH*(100+ntn[country].repro)*spread.civilians/100);
X	}
X
X	mvaddstr(8,41,  "OTHER PRODUCTION");
X	mvprintw(10,41, "jewels owned is...............%8ld",ntn[country].jewels);
X	mvprintw(11,41, "%8d people in goldmines :%8ld",spread.ingold,spread.jewels-ntn[country].jewels);
X	mvprintw(12,41, "ESTIMATE NEXT YEARS JEWELS    %8ld",spread.jewels);
X	mvprintw(14,41, "iron ore owned is.............%8ld",ntn[country].tiron);
X	mvprintw(15,41, "%8d people in iron mines:%8ld",spread.iniron,spread.iron-ntn[country].tiron);
X	mvprintw(16,41, "ESTIMATE NEXT YEARS IRON      %8ld",spread.iron);
X
X	standout();
X	mvaddstr(20,(COLS/2)-12,"HIT 'B' TO SEE BUDGET SCREEN");
X	mvaddstr(21,(COLS/2)-12,"HIT ANY OTHER KEY TO CONTINUE");
X	standend();
X	refresh();
X	if(getch()=='B'){
X		budget();
X	}
X
X	if(isgod==TRUE) country=0;
X}
X
X/*report on ships and allow changes */
Xvoid
Xfleetrpt()
X{
X	short navy;
X	short oldx,oldy,oldnavy;
X	short done=FALSE;
X	int position;
X	int count;       /*screen number */
X	short nvynum=0;    /*current ship id */
X	short wships,mships;
X	int isgod=FALSE;
X	if(country==0) {
X		standout();
X		isgod=TRUE;
X		clear();
X		mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X		clrtoeol();
X		standend();
X		refresh();
X		country = get_number();
X		if(country<0||country>NTOTAL) return;
X	}
X
X	count=0;
X	for(nvynum=0;nvynum<MAXNAVY;nvynum++) count+=NWAR+NMER;
X	if(count==0){
X		clear();
X		standout();
X		mvaddstr(5,(COLS/2)-6, "NO NAVIES ");
X		mvaddstr(15,(COLS/2)-14,"HIT ANY KEY TO CONTINUE");
X		standend();
X		done=TRUE;
X		refresh();
X		if(isgod==TRUE) country=0;
X		return;
X	}
X	nvynum=0;
X	while(done==FALSE) {
X		clear();
X		/*Operate on any navies that you wish*/
X		standout();
X		mvprintw(0,(COLS/2)-20,"NAVY STATS SUMMARY FOR %s",ntn[country].name);
X		standend();
X		/* give a navy report */
X
X		mvaddstr(3,0, "warships  :");
X		mvaddstr(4,0, "merchant :");
X		mvaddstr(5,0, "x location:");
X		mvaddstr(6,0, "y location:");
X		mvaddstr(7,0,"move left :");
X
X		position=5;
X		count=0;
X		while((nvynum<MAXNAVY)&&(count!=6)){
X			if((NWAR+NMER)>0) {
X				count++;
X				position+=10;
X				standout();
X				mvprintw(2,position,"%d:",nvynum);
X				standend();
X				mvprintw(3,position,"%d",NWAR);
X				mvprintw(4,position,"%d",NMER);
X				mvprintw(5,position,"%d",NXLOC);
X				mvprintw(6,position,"%d",NYLOC);
X				mvprintw(7,position,"%d",NMOVE);
X			}
X			nvynum++;
X		}
X		if(nvynum>=MAXNAVY) done=TRUE;
X
X		standout();
X		mvaddstr(12,(COLS/2)-10,"HIT SPACE KEY IF DONE");
X		mvaddstr(13,(COLS/2)-14,"HIT RETURN TO CHANGE A NAVY");
X		mvaddstr(14,(COLS/2)-14,"HIT ANY OTHER KEY TO CONTINUE");
X		standend();
X		refresh();
X		if ((navy=getch())==' ') done=TRUE;
X		if (navy=='\n'){
X			mvaddstr(16,0,"WHAT NAVY DO YOU WANT TO CHANGE:");
X			clrtoeol();
X			refresh();
X			nvynum = get_number();
X			if((nvynum<0)||(nvynum>MAXNAVY)) return;
X			mvaddstr(18,0,"1) TRANSFER / MERGE, 2) SPLIT NAVY, 3) DISBAND NAVY:");
X			clrtoeol();
X			refresh();
X			switch(getch()){
X			case '1':
X				oldx=NXLOC;
X				oldy=NYLOC;
X				oldnavy=nvynum;
X				mvaddstr(22,0,"TO WHAT NAVY: ");
X				clrtoeol();
X				refresh();
X				nvynum = get_number();
X				if(nvynum==oldnavy) {
X					mvprintw(23,0,"SORRY -- SAME NAVY (%d,%d)",nvynum,oldnavy);
X					refresh();
X					getch();
X				}
X				else if((nvynum<0)||(nvynum>MAXNAVY)){
X					mvprintw(23,0,"SORRY -- INVALID NAVY %d",nvynum);
X					refresh();
X					getch();
X				}
X				else if((oldx==NXLOC)&&(oldy==NYLOC)) {
X					NWAR+=ntn[country].nvy[oldnavy].warships;
X					NMER+=ntn[country].nvy[oldnavy].merchant;
X					NADJSHP;
X					if(NMOVE>ntn[country].nvy[oldnavy].smove)
X						NMOVE=ntn[country].nvy[oldnavy].smove;
X					NADJMOV;
X					nvynum=oldnavy;
X					NWAR=0;
X					NMER=0;
X					NADJSHP;
X				}
X				else {
X					mvaddstr(23,0,"Navies not together (hit any key) ");
X					refresh();
X					getch();
X				}
X				break;
X			case '2':
X				mvaddstr(21,0,"HOW MANY WARSHIPS TO SPLIT: ");
X				clrtoeol();
X				refresh();
X				wships = get_number();
X				mvaddstr(21,0,"HOW MANY MERCHANTS TO SPLIT: ");
X				clrtoeol();
X				refresh();
X				mships = get_number();
X				if(wships<0) wships=0;
X				if(mships<0) mships=0;
X				if((wships<=NWAR)&&(mships<=NMER)){
X					NWAR-=wships;
X					NMER-=mships;
X					NADJSHP;
X					oldnavy=nvynum;
X					oldx=NXLOC;
X					oldy=NYLOC;
X					navy=(-1);
X					for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X						if((NWAR+NMER==0)&&(navy==(-1)))
X							navy=nvynum;
X					nvynum=navy;
X					/*overflow*/
X					if(nvynum==(-1)) {
X						mvaddstr(23,0,"TOO MANY NAVIES: ");
X						nvynum=oldnavy;
X						NWAR+=wships;
X						NMER+=mships;
X						NADJSHP;
X					}
X					else {
X						NMOVE=ntn[country].nvy[oldnavy].smove;
X						NXLOC=oldx;
X						NYLOC=oldy;
X						NWAR=wships;
X						NMER=mships;
X						NADJSHP;
X						NADJLOC;
X						NADJMOV;
X					}
X				}
X				else {
X					mvaddstr(23,0,"TOO MANY SHIPS: ");
X					refresh();
X					getch();
X				}
X				break;
X			case '3':
X				NWAR=0;
X				NMER=0;
X				NADJSHP;
X				break;
X			default:
X				mvaddstr(21,0,"ERROR : HIT ANY CHAR TO CONTINUE");
X				clrtoeol();
X				refresh();
X				getch();
X			}
X			noecho();
X			nvynum=0;
X		}
X	}
X	if(isgod==TRUE) country=0;
X}
END_OF_reports.c
if test 13951 -ne `wc -c <reports.c`; then
    echo shar: \"reports.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 7 \(of 8\).
cp /dev/null ark7isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 8 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0