[comp.sources.games] v06i092: conquer4 - middle earth multi-player game

billr@saab.CNA.TEK.COM (Bill Randle) (06/24/89)

Submitted-by: adb@bu-it.bu.edu (Adam Bryant)
Posting-number: Volume 6, Issue 92
Archive-name: conquer4/Part10
Superseeds: conquer3; Volume 4, Issue 42-49



#! /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 10 (of 14)."
# Contents:  main.c reports.c
# Wrapped by billr@saab on Thu Jun 15 15:20:19 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'main.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'main.c'\"
else
echo shar: Extracting \"'main.c'\" \(29720 characters\)
sed "s/^X//" >'main.c' <<'END_OF_FILE'
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#include	<ctype.h>
X#include	<errno.h>
X#include	"header.h"
X#include	"data.h"
X#include	"patchlevel.h"
X
X#include	<signal.h>
X#include	<pwd.h>
X
Xextern	int armornvy;
X
Xchar	fison[20];
Xchar	*getpass();
Xstruct	s_sector **sct;
Xstruct	s_nation ntn[NTOTAL];	/* player nation stats */
Xstruct	s_world	world;		
Xchar	**occ;	/*is sector occupied by an army?*/
Xshort	**movecost;
Xlong	startgold=0;
Xlong	mercgot=0;
X
Xshort	xoffset=0,yoffset=0;	/*offset of upper left hand corner*/
X/* current cursor postion (relative to 00 in upper corner) */
X/*	position is 2*x,y*/
Xshort	xcurs=0,ycurs=0;
Xshort	redraw=TRUE;	/* if TRUE: redraw map		*/
Xint	done=FALSE;	/* if TRUE: you are done	*/
Xshort	hilmode=HI_OWN;	/* hilight mode */
Xshort	dismode=DI_DESI;/* display mode			*/
Xshort	selector=0;	/* selector (y vbl) for which army/navy... is "picked"*/
Xshort	pager=0;	/* pager for selector 0,1,2,3*/
Xshort	country=0;	/* nation id of owner*/
Xstruct	s_nation	*curntn;
Xint	owneruid;
X
XFILE *fexe, *fopen();
X
X/************************************************************************/
X/*	MAIN() - main loop for conquer					*/
X/************************************************************************/
Xvoid
Xmain(argc,argv)
Xint	argc;
Xchar	**argv;
X{
X	int geteuid(), getuid(), setuid();
X	register int i;
X	char name[NAMELTH+1],filename[80];
X	void srand(),init_hasseen();
X	int getopt();
X	char passwd[PASSLTH+1];
X	long time();
X	extern char *optarg, conqmail[];
X#ifdef SYSMAIL
X	extern char sysmail[];
X#endif SYSMAIL
X	int sflag=FALSE;
X
X	char defaultdir[256];
X	struct passwd *getpwnam();
X	owneruid=getuid();
X	strcpy(defaultdir, DEFAULTDIR);
X	srand((unsigned) time((long *) 0));
X	strcpy(name,"");
X
X	/* process the command line arguments */
X	while((i=getopt(argc,argv,"hn:d:s"))!=EOF) switch(i){
X	/* process the command line arguments */
X	case 'h': /* execute help program*/
X		if (chdir(defaultdir)) {
X			printf("unable to change dir to %s\n",defaultdir);
X			exit(FAIL);
X		}
X		initscr();
X		savetty();
X		noecho();
X		crmode();			/* cbreak mode */
X		signal(SIGINT,SIG_IGN);		/* disable keyboard signals */
X		signal(SIGQUIT,SIG_IGN);
X		help();
X		endwin();
X		putchar('\n');
X		exit(SUCCESS);
X	case 'd':
X		strcpy(defaultdir, optarg);
X		break;
X	case 'n':
X		strcpy(name, optarg);
X		break;
X	case 's': /*print the score*/
X		sflag++;
X		break;
X	case '?': /*  print out command line arguments */
X		printf("Command line format: %s [-hs -d DIR -nNAT]\n",argv[0]);
X		printf("\t-n NAT   play as nation NAT\n");
X		printf("\t-h       print help text\n");
X		printf("\t-d DIR   to use play different game\n");
X		printf("\t-s       print scores\n");
X		exit(SUCCESS);
X	};
X
X	/* now that we have parsed the args, we can go to the
X	 * dir where the files are kept and do some work.
X	 */
X	if (chdir(defaultdir)) {
X		printf("unable to change dir to %s\n",defaultdir);
X		exit(FAIL);
X	}
X
X	readdata();				/* read data*/
X	verifydata( __FILE__, __LINE__ );	/* verify data */
X
X	if(sflag){
X		printscore();
X		exit(SUCCESS);
X	}
X
X	/*
X	*  Set the real uid to the effective.  This will avoid a
X	*  number of problems involving file protection if the
X	*  executable is setuid.
X	*/
X	if (getuid() != geteuid()) { /* we are running suid */
X		(void) umask(077);	/* nobody else can read files */
X		(void) setuid (geteuid ()) ;
X	}
X
X	/* at this stage must be a normal interactive game */
X
X	printf("conquer %s.%d: Copyright (c) 1988 by Edward M Barlow\n",VERSION,PATCHLEVEL);
X
X	/* check for update in progress */
X	sprintf(filename,"%sup",isonfile);
X	if(check_lock(filename,FALSE)==TRUE) {
X		printf("Conquer is updating\n");
X		printf("Please try again later.\n");
X		exit(FAIL);
X	}
X
X	/* identify player and country represented */
X	/* get nation name from command line or by asking user.
X	*     if you fail give name of administrator of game
X	*/
X	if (strlen(name) == 0) {
X		printf("what nation would you like to be: ");
X		gets(name);
X	}
X#ifdef OGOD
X	if(strcmp(name,"god")==0 || strcmp(name,"unowned")==0) {
X		if ( owneruid != (getpwnam(LOGIN))->pw_uid ){
X			printf("sorry -- you can not login as god\n");
X			printf("you need to be logged in as %s\n",LOGIN);
X			exit(FAIL);
X		}
X		strcpy(name,"unowned");
X		hilmode = HI_NONE;
X	}
X#else
X	if(strcmp(name,"god")==0) strcpy(name,"unowned");
X#endif OGOD
X	country=(-1);
X	for(i=0;i<NTOTAL;i++)
X		if(strcmp(name,ntn[i].name)==0) country=i;
X
X	if(country==(-1)) {
X		printf("name not found\n");
X		printf("\nfor rules type <conquer -h>");
X		printf("\nfor more information please contact %s\n",OWNER);
X		return;
X	} else if(country==0) {
X		sprintf(filename,"%sadd",isonfile);
X		if(check_lock(filename,FALSE)==TRUE) {
X			printf("A new player is being added.\n");
X			printf("Continue anyway? [y or n]");
X			while(((i=getchar())!='y')&&(i!='n')) ;
X			if(i!='y') exit(FAIL);
X		}
X	}
X	curntn = &ntn[country];
X
X	/*get encrypted password*/
X	strncpy(passwd,crypt(getpass("\nwhat is your nation's password:"),SALT),PASSLTH);
X	if((strncmp(passwd,curntn->passwd,PASSLTH)!=0)
X	&&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
X		strncpy(passwd,crypt(getpass("\nerror: reenter your nation's password:"),SALT),PASSLTH);
X		if((strncmp(passwd,curntn->passwd,PASSLTH)!=0)
X		&&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
X			printf("\nsorry:");
X			printf("\nfor rules type <conquer -h>");
X			printf("\nfor more information on the system please contact %s\n",OWNER);
X			exit(FAIL);
X		}
X	}
X
X	initscr();		/* SET UP THE SCREEN */
X	copyscreen();		/* copyright screen */
X				/* note the getch() later - everything between
X					now and then is non-interactive */
X	init_hasseen();		/* now we know how big the screen is, 
X					we can init that array!	*/
X
X	/* check terminal size */
X	if (COLS<80 || LINES<24) {
X		fprintf(stderr,"%s: terminal should be at least 80x24\n",argv[0]);
X		fprintf(stderr,"please try again with a different setup\n");
X		beep();
X		refresh();
X		getch();
X		bye(FALSE);
X	}
X
X	strcpy(fison,"START");	/* just in case you abort early */
X	crmode();		/* cbreak mode */
X
X	/* check if user is super-user nation[0] */
X	/*	else setup cursor to capitol*/
X	if((country==0)||(ismonst(ntn[country].active))) {
X		xcurs=LINES/2;
X		xoffset=0;
X		ycurs=COLS/4;
X		yoffset=0;
X		redraw=TRUE;
X		/* create gods lock file but do not limit access */
X		(void) aretheyon();
X	} else {
X		if(curntn->active==INACTIVE) {
X			mvprintw(LINES-2,0,"Sorry, for some reason, your country no longer exists.");
X			mvprintw(LINES-1,0,"If there is a problem, please contact %s.",OWNER);
X			beep();
X			refresh();
X			getch();
X			bye(TRUE);
X		}
X		if(aretheyon()==TRUE) {
X			mvprintw(LINES-2,0,"Sorry, country is already logged in.");
X			mvprintw(LINES-1,0,"Please try again later.    ");
X			beep();
X			refresh();
X			getch();
X			bye(FALSE);
X		}
X		execute(FALSE);
X#ifdef TRADE
X		checktrade();
X#endif TRADE
X		if(curntn->capx>15) {
X			xcurs=15;
X			xoffset= (curntn->capx-15);
X		} else {
X			xcurs= curntn->capx;
X			xoffset= 0;
X		}
X		if(curntn->capy>10) {
X			ycurs=10;
X			yoffset= (curntn->capy-10);
X		} else {
X			yoffset= 0;
X			ycurs= curntn->capy;
X		}
X	}
X	updmove(curntn->race,country);
X
X	/* open output for future printing*/
X	sprintf(filename,"%s%d",exefile,country);
X	if ((fexe=fopen(filename,"a"))==NULL) {
X		beep();
X		mvprintw(LINES-2,0,"error opening %s",filename);
X		refresh();
X		getch();
X		bye(TRUE);
X	}
X
X
X	signal(SIGINT,SIG_IGN);		/* disable keyboard signals */
X	signal(SIGQUIT,SIG_IGN);
X	signal(SIGHUP,hangup);		/* must catch hangups */
X	signal(SIGTERM,hangup);		/* likewise for cheats!! */
X
X	noecho();
X	prep(country,FALSE);		/* initialize prep array */
X	whatcansee();			/* what can they see */
X
X	/* initialize mail files */
X	(void) sprintf(conqmail,"%s%d",msgfile,country);
X#ifdef SYSMAIL
X	if (getenv("MAIL")==0) {
X		(void) sprintf(sysmail,"%s/%s",SPOOLDIR,getenv("USER"));
X	} else {
X		(void) strcpy(sysmail,getenv("MAIL"));
X	}
X#endif SYSMAIL
X
X	getch();		/* get response from copyscreen */
X
X	while(done==FALSE) {			/*main while routine*/
X		coffmap(); 	/* check if cursor is out of bounds*/
X		check_mail();	/* check for new mail */
X		parse();	/* get commands, make moves and input command*/
X	}
X
X	if(country==0) writedata();
X	else {
X		fprintf(fexe,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n",
X			XNAGOLD ,country,curntn->tgold,"null");
X		fprintf(fexe,"L_NMETAL\t%d \t%d \t%ld \t0 \t0 \t%s\n",
X			XNAMETAL ,country,curntn->metals,"null");
X		fprintf(fexe,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n",
X			XNARGOLD ,country,curntn->jewels,"null");
X	}
X	bye(TRUE);	 		/* done so quit */
X}
X
X/************************************************************************/
X/* MAKEBOTTOM() - make the bottom of the screen				*/
X/************************************************************************/
Xvoid
Xmakebottom()
X{
X	standend();
X	move(LINES-4,0);
X	clrtoeol();
X	mvprintw(LINES-3,0,"Conquer: %s.%d Turn %d",VERSION,PATCHLEVEL,TURN);
X	clrtoeol();
X	mvaddstr(LINES-1,0,"  type ? for help");
X	clrtoeol();
X	mvaddstr(LINES-2,0,"  type Q to save & quit");
X	clrtoeol();
X
X	if(country==0) {
X		mvaddstr(LINES-3,COLS-20,"nation...GOD");
X	} else {
X		mvprintw(LINES-3,COLS-20,"nation...%s",curntn->name);
X		mvprintw(LINES-2,COLS-20,"treasury.%ld",curntn->tgold);
X	}
X	mvprintw(LINES-1,COLS-20,"%s of Year %d",PSEASON(TURN),YEAR(TURN));
X
X	/* mail status */
X#ifdef SYSMAIL
X	/* display mail information */
X	if (sys_mail_status==NEW_MAIL) {
X		mvaddstr(LINES-3,COLS/2-6,"You have System Mail");
X	}
X	if (conq_mail_status==NEW_MAIL) {
X		mvaddstr(LINES-2,COLS/2-6,"You have Conquer Mail");
X	}
X#else
X	/* display mail information */
X	if (conq_mail_status==NEW_MAIL) {
X		mvaddstr(LINES-3,COLS/2-6,"You have Conquer Mail");
X	}
X#endif SYSMAIL
X}
X
X/************************************************************************/
X/*	PARSE() - do a command						*/
X/************************************************************************/
Xvoid
Xparse()
X{
X	char	name[20];
X	char	passwd[PASSLTH+1];
X	int	ocountry;
X
X	switch(getch()) {
X	case EXT_CMD:	/* extended command */
X		ext_cmd( -1 );
X		curntn->tgold -= MOVECOST;
X		break;
X	case '':	/*redraw the screen*/
X		whatcansee();	/* what can they see */
X		redraw=TRUE;
X		break;
X	case 'a':	/*army report*/
X		redraw=TRUE;
X		armyrpt(0);
X		curntn->tgold -= MOVECOST;
X		break;
X	case '1':
X	case 'b':	/*move south west*/
X		pager=0;
X		selector=0;
X		xcurs--;
X		ycurs++;
X		break;
X	case 'B':	/*budget*/
X		redraw=TRUE;
X		budget();
X		curntn->tgold -= MOVECOST;
X		break;
X	case 'c':	/*change nation stats*/
X		redraw=TRUE;
X		change();
X		curntn->tgold -= MOVECOST;
X		break;
X	case 'C':	/*construct*/
X		construct();
X		makebottom();
X		curntn->tgold -= MOVECOST;
X		break;
X	case 'd':	/*change display*/
X		newdisplay();
X		curntn->tgold -= MOVECOST;
X		break;
X	case 'D':	/*draft*/
X		draft();
X		curntn->tgold -= MOVECOST;
X		makebottom();
X		break;
X	case 'f': /*report on ships and load/unload*/
X		redraw=TRUE;
X		curntn->tgold -= MOVECOST;
X		fleetrpt();
X		break;
X	case 'F':	/*go to next army*/
X		navygoto();
X		break;
X	case 'g':	/*group report*/
X		redraw=TRUE;
X		curntn->tgold -= MOVECOST;
X		armyrpt(1);
X		break;
X	case 'G':	/*go to next army*/
X		armygoto();
X		break;
X	case 'H':	/*scroll west*/
X		pager=0;
X		selector=0;
X		xcurs-=((COLS-22)/4);
X		break;
X	case '4':
X	case 'h':	/*move west*/
X		pager=0;
X		selector=0;
X		xcurs--;
X		break;
X	case 'I':	/*campaign information*/
X		camp_info();
X		redraw=TRUE;
X		break;
X	case 'J':	/*scroll down*/
X		pager=0;
X		selector=0;
X		ycurs+=((SCREEN_Y_SIZE)/2);
X		break;
X	case '2':
X	case 'j':	/*move down*/
X		pager=0;
X		selector=0;
X		ycurs++;
X		break;
X	case '8':
X	case 'k':	/*move up*/
X		pager=0;
X		selector=0;
X		ycurs--;
X		break;
X	case 'K':	/*scroll up*/
X		pager=0;
X		selector=0;
X		ycurs-=((SCREEN_Y_SIZE)/2);
X		break;
X	case '6':
X	case 'l':	/*move east*/
X		pager=0;
X		selector=0;
X		xcurs++;
X		break;
X	case 'L':	/*scroll east*/
X		pager=0;
X		selector=0;
X		xcurs+=((COLS-22)/4);
X		break;
X	case 'm':	/*move selected item to new x,y */
X		mymove();
X		curntn->tgold -= MOVECOST;
X		makebottom();
X		prep(country,FALSE);
X		pager=0;
X		selector=0;
X		break;
X	case 'M':	/*magic*/
X		redraw=TRUE;
X		curntn->tgold -= MOVECOST;
X		domagic();
X		break;
X	case '3':
X	case 'n':	/*move south-east*/
X		pager=0;
X		selector=0;
X		ycurs++;
X		xcurs++;
X		break;
X	case 'N':	/*read newspaper */
X		redraw=TRUE;
X		curntn->tgold -= MOVECOST;
X		newspaper();
X		break;
X	case 'p':	/*pick*/
X		selector+=2;
X		if(selector>=SCRARM*2) {
X			selector=0;
X			pager+=1;
X		}
X		/*current selected unit is selector/2+SCRARM*pager*/
X		if((selector/2)+(pager*SCRARM)>=units_in_sector(XREAL,YREAL,country)) {
X			pager=0;
X			selector=0;
X		}
X		break;
X	case 'P':	/*production*/
X		redraw=TRUE;
X		curntn->tgold -= MOVECOST;
X		produce();
X		break;
X	case 'Q':	/*quit*/
X	case 'q':	/*quit*/
X		done=TRUE;
X		break;
X	case 'r':	/*redesignate*/
X		redesignate();
X		curntn->tgold -= MOVECOST;
X		makemap();
X		makebottom();
X		break;
X		/*list*/
X	case 'R':	/*Read Messages*/
X		redraw=TRUE;
X		curntn->tgold -= MOVECOST;
X		rmessage();
X		refresh();
X		break;
X	case 's':	/*score*/
X		redraw=TRUE;
X		curntn->tgold -= MOVECOST;
X		showscore();
X		break;
X	case 'S':	/*diplomacy screens*/
X		diploscrn();
X		curntn->tgold -= MOVECOST;
X		redraw=TRUE;
X		break;
X	case 't':	/*fleet loading*/
X		loadfleet();
X		curntn->tgold -= MOVECOST;
X		makeside(FALSE);
X		makebottom();
X		break;
X#ifdef TRADE
X	case 'T':	/*go to commerce section*/
X		trade();
X		curntn->tgold -= MOVECOST;
X		redraw=TRUE;
X		break;
X#endif TRADE
X	case '9':
X	case 'u':	/*move north-east*/
X		pager=0;
X		selector=0;
X		ycurs--;
X		xcurs++;
X		break;
X    	case 'U':	/* scroll north-east */
X		pager=0;
X		selector=0;
X		xcurs+=((COLS-22)/4);
X		ycurs-=((SCREEN_Y_SIZE)/2);
X		break;
X    	case 'v':	/* version credits */
X		credits();
X		redraw=TRUE;
X		break;
X	case 'w':	/* spell casting */
X		wizardry();
X		curntn->tgold -= MOVECOST;
X		break;
X	case 'W':	/*message*/
X		redraw=TRUE;
X		curntn->tgold -= MOVECOST;
X		wmessage();
X		break;
X	case '7':
X	case 'y':	/*move north-west*/
X		pager=0;
X		selector=0;
X		ycurs--;
X		xcurs--;
X		break;
X	case 'Y':	/* scroll north-west */
X		pager=0;
X		selector=0;
X		xcurs-=((COLS-22)/4);
X		ycurs-=((SCREEN_Y_SIZE)/2);
X		break;
X	case 'Z':	/*move civilians up to 2 spaces*/
X		moveciv();
X		curntn->tgold -= MOVECOST;
X		break;
X	case 'z':	/*login as new user */
X#ifdef OGOD
X		if (owneruid != (getpwnam(LOGIN))->pw_uid) break;
X#endif
X		clear();
X		redraw=TRUE;
X		if(country != 0) {
X		fprintf(fexe,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n",
X			XNAGOLD ,country,curntn->tgold,"null");
X		fprintf(fexe,"L_NMETAL\t%d \t%d \t%ld \t0 \t0 \t%s\n",
X			XNAMETAL ,country,curntn->metals,"null");
X		fprintf(fexe,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n",
X			XNARGOLD ,country,curntn->jewels,"null");
X		} else
X		mvaddstr(0,0,"SUPER-USER: YOUR CHANGES WILL NOT BE SAVED IF YOU DO THIS!!!");
X		standout();
X		mvaddstr(2,0,"change login to: ");
X		standend();
X		refresh();
X
X		ocountry=country;
X 		country=get_country();
X
X		/* check validity of country choice */
X		if( country==(-1) || country>=NTOTAL
X		|| ( !isactive(ntn[country].active) && country!=0 )) {
X			country=ocountry;
X			errormsg("invalid country");
X			break;
X		} 
X		if(country==ocountry){
X			errormsg("same country");
X			break;
X		}
X
X		/*get password*/
X		mvaddstr(2,0,"what is your nations password:");
X		refresh();
X		getstr(passwd);
X		strcpy(name,crypt(passwd,SALT));
X		if((strncmp(name,curntn->passwd,PASSLTH)!=0)
X		&&(strncmp(name,ntn[0].passwd,PASSLTH)!=0)){
X			errormsg("sorry:  password invalid");
X			country=ocountry;
X			break;
X		}
X		if(aretheyon()==TRUE) {
X			errormsg("sorry:  country is already logged in.");
X			refresh();
X			country=ocountry;
X			break;
X		}
X
X		if(strcmp(fison,"START")!=0) unlink(fison);
X
X		fclose(fexe);
X		/* open output for future printing*/
X	 	sprintf(name,"%s%d",exefile,country);
X	 	if ((fexe=fopen(name,"a"))==NULL) {
X			beep();
X			printf("error opening %s\n",name);
X			unlink(fison);
X			exit(FAIL);
X	 	}
X		curntn = &ntn[country];
X
X		printf("\n");
X		readdata();
X		execute(FALSE);
X
X		(void) sprintf(conqmail,"%s%d",msgfile,country);
X		updmove(curntn->race,country);
X		/*go to that nations capitol*/
X		if((country==0)||(!isntn(ntn[country].active))) {
X			xcurs=15; xoffset=15;
X			ycurs=15; yoffset=15;
X		} else {
X			if(curntn->capx>15) {
X				xcurs=15;
X				xoffset= (curntn->capx-15);
X			} else {
X				xcurs= curntn->capx;
X				xoffset= 0;
X			}
X			if(curntn->capy>10) {
X				ycurs=10;
X				yoffset= (curntn->capy-10);
X			} else {
X				yoffset= 0;
X				ycurs= curntn->capy;
X			}
X		}
X		whatcansee();
X		redraw=TRUE;
X		break;
X	case '?':	/*display help screen*/
X		redraw=TRUE;
X		help();
X		break;
X	default:
X		beep();
X	}
X}
X
X/************************************************************************/
X/*	MAKESIDE() -	make the right hand side display		*/
X/************************************************************************/
Xvoid
Xmakeside(alwayssee)
Xint	alwayssee;	/* see even if cant really see sector */
X{
X	int	i;
X	int	armbonus;
X	int	found=0,nvyfnd=0;
X	long	enemy;
X	int	y;
X	short	armynum;
X	short	nvynum;
X	int	count;
X	int	nfound=0,nfound2=0;
X	register struct s_sector	*sptr = &sct[XREAL][YREAL];
X
X	if( !alwayssee )
X	if( !canbeseen((int) XREAL,(int) YREAL) ) {
X		for(i=0;i<LINES-3;i++){
X			move(i,COLS-21);
X			clrtoeol();
X		}
X		return;
X	}
X
X	for(count=0;count<LINES-13;count++){	/*clear top right hand side */
X		move(count,COLS-21);
X		clrtoeol();
X	}
X
X	/*check for your armies*/
X	count=units_in_sector(XREAL,YREAL,country);
X	if(pager*SCRARM>count) pager=0;
X
X	/*first army found is #0*/
X	/*show armies / navies in range pager*SCRARM to pager*SCRARM + SCRARM*/
X	/*so if pager=0 show 0 to 5 (SCRARM), pager=2 show 10 to 15*/
X	/*current selected unit is selector/2+4*pager*/
X
X	if(count>(SCRARM+(pager*SCRARM))) mvaddstr(LINES-14,COLS-20,"MORE...");
X
X	nfound=0;
X	for(armynum=0;armynum<MAXARM;armynum++){
X		if((P_ASOLD>0)&&(P_AXLOC==XREAL)&&(P_AYLOC==YREAL)) {
X			if((nfound>=pager*SCRARM)&&(nfound<SCRARM+(pager*SCRARM))) {
X				/*print that army to nfound%SCRARM*/
X				/* patch by rob mayoff */
X				if(selector==(nfound%SCRARM)*2) {
X					mvaddch((nfound%SCRARM)*2,COLS-21,'*');
X					standout();
X				} else	mvaddch((nfound%SCRARM)*2,COLS-21,'>');
X
X				if(P_ATYPE<MINLEADER)
X				mvprintw((nfound%SCRARM)*2,COLS-20,"army %d: %ld %s",armynum,P_ASOLD,*(shunittype+(P_ATYPE%UTYPE)));
X				else 
X				mvprintw((nfound%SCRARM)*2,COLS-20,"%s %d: str=%d",*(unittype+(P_ATYPE%UTYPE)),armynum,P_ASOLD);
X				clrtoeol();
X
X				if(P_ASTAT >= NUMSTATUS )
X				mvprintw((nfound%SCRARM)*2+1,COLS-20," member group %d",P_ASTAT-NUMSTATUS);
X				else
X				mvprintw((nfound%SCRARM)*2+1,COLS-20," mv:%d st:%s",P_AMOVE,*(soldname+P_ASTAT));
X				standend();
X			}
X			nfound++;
X		}
X		if((occ[XREAL][YREAL]!=0)
X		&&(occ[XREAL][YREAL]!=country)
X		&&((sptr->owner==country)||((P_ASOLD>0)&&(P_AXLOC<=XREAL+1)
X		&&(P_AXLOC>=XREAL-1)&&(P_AYLOC<=YREAL+1)&&(P_AYLOC>=YREAL-1))))
X			found=1;
X		if((occ[XREAL][YREAL]!=0)&&(country==0)) found=1;
X	}
X
X	if(nfound<SCRARM+(pager*SCRARM)) for(nvynum=0;nvynum<MAXNAVY;nvynum++){
X		if(((P_NWSHP!=0)||(P_NMSHP!=0)||(P_NGSHP!=0))
X		&&(P_NXLOC==XREAL)&&(P_NYLOC==YREAL)) {
X			if((nfound>=pager*SCRARM)&&(nfound<SCRARM+(pager*SCRARM))) {
X				/*print a navy*/
X				if(selector==(nfound%SCRARM)*2) {
X					if((P_NARMY!=MAXARM)||(P_NPEOP!=0))
X					mvaddch((nfound%SCRARM)*2,COLS-21,'+');
X					else
X					mvaddch((nfound%SCRARM)*2,COLS-21,'*');
X					standout();
X				} else	mvaddch((nfound%SCRARM)*2,COLS-21,'>');
X	
X				mvprintw((nfound%SCRARM)*2,COLS-20,"nvy %d: mv:%hd cw:%hd",nvynum,P_NMOVE,P_NCREW);
X				mvprintw((nfound%SCRARM)*2+1,COLS-20,"war:%2hd mer:%2hd gal:%2hd",
X					P_NWAR(N_LIGHT)+P_NWAR(N_MEDIUM)+P_NWAR(N_HEAVY),
X					P_NMER(N_LIGHT)+P_NMER(N_MEDIUM)+P_NMER(N_HEAVY),
X					P_NGAL(N_LIGHT)+P_NGAL(N_MEDIUM)+P_NGAL(N_HEAVY));
X				standend();
X			}
X			nfound++;
X		}
X		if((occ[XREAL][YREAL]!=0)&&(occ[XREAL][YREAL]!=country)
X		&&(P_NWSHP!=0||P_NMSHP!=0||P_NGSHP!=0)&&(P_NXLOC<=XREAL+1)
X		&&(P_NXLOC>=XREAL-1)&&(P_NYLOC<=YREAL+1)&&(P_NYLOC>=YREAL-1))
X			nvyfnd=1;
X		if((occ[XREAL][YREAL]!=0)&&(country==0)) nvyfnd=1;
X	}
X
X	count=0;
X	nfound2=nfound;
X	if((found==1)||(nvyfnd==1)) for(i=0;i<NTOTAL;i++) {
X		if( !magic(i,HIDDEN) || country == 0 ){
X			enemy=0;
X			for(armynum=0;armynum<MAXARM;armynum++){
X				if((i!=country)
X				&&(ntn[i].arm[armynum].xloc==XREAL)
X				&&(ntn[i].arm[armynum].yloc==YREAL)
X				&&(ntn[i].arm[armynum].sold>0)){
X				if(nfound2>SCRARM) nfound2=SCRARM;
X				if( ntn[i].arm[armynum].unittyp>=MINMONSTER ){
X					mvprintw(nfound2*2+count,COLS-20,"%s: str=%d",*(unittype+(ntn[i].arm[armynum].unittyp%UTYPE)),ntn[i].arm[armynum].sold);
X					count++;
X				} else enemy += ntn[i].arm[armynum].sold;
X				}
X			}
X			if(enemy>0) {
X				if((magic(country,NINJA)==TRUE) || country == 0 )
X					mvprintw(nfound2*2+count,COLS-20,"%s: %d men  ",ntn[i].name,enemy);
X				else if(magic(i,THE_VOID)==TRUE)
X				mvprintw(nfound2*2+count,COLS-20,"%s: ?? men  ",ntn[i].name);
X				else mvprintw(nfound2*2+count,COLS-20,"%s: %ld men  ",ntn[i].name,(enemy*(rand()%60+70)/100));
X				count++;
X			}
X			enemy=0;
X			for(nvynum=0;nvynum<MAXNAVY;nvynum++){
X				if((i!=country)
X				&&(ntn[i].nvy[nvynum].xloc==XREAL)
X				&&(ntn[i].nvy[nvynum].yloc==YREAL)
X				&&(ntn[i].nvy[nvynum].warships
X				+ntn[i].nvy[nvynum].merchant
X				+(int)ntn[i].nvy[nvynum].galleys!=0))
X					enemy += fltships(i,nvynum);
X				}
X			if(enemy>0) {
X				if((magic(country,NINJA)==TRUE) || country == 0 )
X					mvprintw(nfound2*2+count,COLS-20,"%s: %d ships",ntn[i].name,enemy);
X				else if(magic(i,THE_VOID)==TRUE)
X				mvprintw(nfound2*2+count,COLS-20,"%s: ?? ships",ntn[i].name);
X				else mvprintw(nfound2*2+count,COLS-20,"%s: %ld ships",ntn[i].name,(enemy*(rand()%60+70)/100));
X				count++;
X			}
X		}
X	}
X
X	standend();
X	mvprintw(LINES-13,COLS-20,"x is %d",XREAL);
X	clrtoeol();
X	mvprintw(LINES-13,COLS-11,"y is %d",YREAL);
X	clrtoeol();
X
X	if((country!=0)&&(sptr->altitude==WATER)){
X		for(y=LINES-12;y<=LINES-4;y++) {	move(y,COLS-20); clrtoeol();}
X		mvaddstr(LINES-10,COLS-9,"WATER");
X	} else {
X	if((country!=0)&&(country!=sptr->owner)
X	&&(magic(sptr->owner,THE_VOID)==TRUE)){
X		for(y=LINES-11;y<=LINES-4;y++) { 
X			move(y,COLS-20);
X			clrtoeol();
X		}
X	} else {
X
X		for(y=LINES-11;y<=LINES-10;y++) {
X			move(y,COLS-20);
X			clrtoeol();
X		}
X
X		if( sptr->designation!=DNODESIG ) standout();
X		for(i=0;*(des+i)!='0';i++)
X			if(sptr->designation== *(des+i)){
X			mvprintw(LINES-11,COLS-20,"%s",*(desname+i));
X			clrtoeol();
X			break;
X		}
X		standend();
X
X		if((sptr->owner==country)||(country==0)||(magic(country,NINJA)==TRUE))
X		mvprintw(LINES-9,COLS-20,"people: %6d",sptr->people);
X		else
X		mvprintw(LINES-9,COLS-20,"people: %6d",sptr->people*(rand()%60+70)/100);
X		clrtoeol();
X		if((sptr->owner==country)
X		||(sptr->owner==0)
X		||(country == 0)
X		||(!isntn(ntn[sptr->owner].active))){
X			/* exotic trade goods */
X			if( sptr->tradegood != TG_none && tg_ok(country,sptr) ) {
X				standout();
X				mvprintw(LINES-7,COLS-20,"item: %s",tg_name[sptr->tradegood]);
X				clrtoeol();
X				if( *(tg_stype+sptr->tradegood) == 'x' )
X					mvaddstr(LINES-7,COLS-4,"ANY");
X				else
X					mvprintw(LINES-7,COLS-4,"(%c)",*(tg_stype+sptr->tradegood));
X				standend();
X			} else {
X				mvaddstr(LINES-7,COLS-20,"item: none");
X				clrtoeol();
X			}
X
X			if( sptr->jewels != 0 && tg_ok(country,sptr)) {
X				standout();
X				mvprintw(LINES-6,COLS-20,"gold: %2d",sptr->jewels);
X				standend();
X			} else mvaddstr(LINES-6,COLS-20,"gold:  0");
X			if( sptr->metal != 0 && tg_ok(country,sptr)) {
X				standout();
X				mvprintw(LINES-6,COLS-10,"metal: %2d",sptr->metal);
X				standend();
X			} else mvaddstr(LINES-6,COLS-10,"metal:  0");
X
X			armbonus = fort_val(sptr);
X			if(armbonus>0)
X			mvprintw(LINES-5,COLS-20,"fortress: +%d%%",armbonus);
X			else move(LINES-5,COLS-20);
X			clrtoeol();
X		}
X		else {
X			for(y=LINES-7;y<=LINES-5;y++) {
X				move(y,COLS-20);
X				clrtoeol();
X			}
X		}
X	}
X
X	standout();
X	if((sptr->owner==0)||(ntn[sptr->owner].active==NPC_BARBARIAN))
X		mvaddstr(LINES-12,COLS-20,"unowned");
X	else mvprintw(LINES-12,COLS-20,"owner: %s",ntn[sptr->owner].name);
X	standend();
X	clrtoeol();
X
X	for(i=0;*(veg+i)!='0';i++)
X		if(sptr->vegetation==*(veg+i))
X		mvprintw(LINES-11,COLS-9,"%s",*(vegname+i));
X
X	if(((i=tofood(sptr,country)) != 0)
X	&&((magic(sptr->owner,THE_VOID)!=TRUE)
X	||(sptr->owner==country))){
X		if(i>6) standout();
X#ifndef HPUX
X		if(i<10)	mvprintw(LINES-11,COLS-1,"%d",i);
X		else		mvprintw(LINES-11,COLS-2,"%d",i);
X#else
X		if(i<10)	mvprintw(LINES-11,COLS-2,"%d",i);
X		else		mvprintw(LINES-11,COLS-3,"%d",i);
X#endif HPUX
X		standend();
X	}
X
X	if(sptr->owner!=0) for(i=1;i<=8;i++)
X		if(ntn[sptr->owner].race==*(races+i)[0]){
X		mvprintw(LINES-10,COLS-20,"%s",*(races+i));
X		clrtoeol();
X		}
X
X	for(i=0;(*(ele+i) != '0');i++)
X		if( sptr->altitude == *(ele+i) ){
X			mvprintw(LINES-10,COLS-9,"%s",*(elename+i));
X			break;
X		}
X	}
X
X	if(movecost[XREAL][YREAL]<0)
X	mvaddstr(LINES-8,COLS-20,"YOU CAN'T ENTER HERE");
X	else
X	mvprintw(LINES-8,COLS-20,"move cost:  %2d      ",movecost[XREAL][YREAL]);
X}
X
X/************************************************************************/
X/* 	ARETHEYON() - returns TRUE if 'country' is logged on, else FALSE */
X/************************************************************************/
Xint
Xaretheyon()
X{
X	/* return file descriptor for lock file */
X	sprintf(fison,"%s%d",isonfile,country);
X	return(check_lock(fison,TRUE));
X}
X
X/************************************************************************/
X/*	COPYSCREEN() -	print copyright notice to screen		*/
X/* THIS SUBROUTINE MAY NOT BE ALTERED, AND THE MESSAGE CONTAINED HEREIN	*/
X/* MUST BE SHOWN TO EACH AND EVERY PLAYER, EVERY TIME THEY LOG IN	*/
X/************************************************************************/
Xvoid
Xcopyscreen()
X{
X	clear();
X	standout();
X	mvprintw(8,28,"Conquer %s.%d",VERSION,PATCHLEVEL);
X	standend();
X	mvaddstr(10,19, "Copyright (c) 1988 by Edward M Barlow");
X	mvaddstr(11,18,"Written Edward M Barlow and Adam Bryant");
X	mvaddstr(12,26,"All Rights Reserved");
X	mvaddstr(LINES-7,21,"This version is for personal use only");
X	mvaddstr(LINES-5,12,"It is expressly forbidden port this software to any form of");
X	mvaddstr(LINES-4,12,"Personal Computer or to redistribute this software without");
X	mvaddstr(LINES-3,18,"the permission of Edward Barlow or Adam Bryant");
X	mvprintw(LINES-1, 60, "PRESS ANY KEY");
X	refresh();
X}
X
X/************************************************************************/
X/*	BYE()	-	exit gracefully from curses			*/
X/************************************************************************/
Xvoid
Xbye(dounlink)
Xint	dounlink;	/* TRUE if want to do unlink */
X{
X	if( dounlink ) if(strcmp(fison,"START")!=0) unlink(fison);
X	clear();
X	refresh();
X	nocrmode();
X	endwin();
X	if (fexe!=NULL) fclose(fexe);
X	printf("quit & save\n");
X	exit(SUCCESS);
X}
X
X/************************************************************************/
X/*	CREDITS() -	print credits notice to screen			*/
X/************************************************************************/
Xvoid
Xcredits()
X{
X	clear();
X	mvprintw(4,0,"Conquer %s.%d",VERSION,PATCHLEVEL);
X	mvaddstr(5,0,"Copyright (c) 1988 by Edward M Barlow");
X	mvaddstr(6,0,"written Edward M Barlow and Adam Bryant");
X	mvaddstr(12,0,"I would like to thank the following for comments,");
X	mvaddstr(13,0,"   patches, and playtesting:");
X	mvaddstr(15,0,"Derick Hirasawa    Brian Rauchfuss      Joe E. Powell");
X	mvaddstr(16,0,"Andrew Collins     Joe Nolet");
X	mvaddstr(17,0,"Kenneth Moyle      Brian Bresnahan");
X	mvaddstr(18,0,"Paul Davison       Robert Deroy");
X	mvaddstr(20,0,"Also thanks to the many playtesters at Boston University");
X	mvaddstr(21,0,"and at the Communications Hex");
X	errormsg("");
X}
X
X/************************************************************************/
X/*	CAMP_INFO() -	display information about current data file	*/
X/************************************************************************/
Xvoid
Xcamp_info()
X{
X	int mercs=0,solds=0,armynum,nvynum;
X	int numarm=0,numnvy=0,numlead=0;
X
X	clear();
X	standout();
X	mvaddstr(2,COLS/2-16," CONQUER CAMPAIGN INFORMATION ");
X	mvaddstr(5,0,"World Information");
X	mvaddstr(5,COLS-40,"Player Information");
X	standend();
X
X	/* quick statistics */
X	for(armynum=0;armynum<MAXARM;armynum++) {
X		if (P_ASOLD!=0) {
X			numarm++;
X			if (P_ATYPE<MINLEADER) {
X				solds+=P_ASOLD;
X				if (P_ATYPE==A_MERCENARY) mercs+=P_ASOLD;
X			} else if (P_ATYPE<MINMONSTER) {
X				numlead++;
X			}
X		}
X	}
X	for(nvynum=0;nvynum<MAXNAVY;nvynum++) {
X		if (P_NWSHP!=0||P_NGSHP!=0||P_NMSHP!=0) numnvy++;
X	}
X
X	/* global information */
X	mvprintw(7,0,"World Map Size............. %dx%d", MAPX, MAPY);
X	mvprintw(8,0,"Currently Active Nations... %d", WORLDNTN);
X	mvprintw(9,0,"Maximum Active Nations..... %d", NTOTAL-1);
X	mvprintw(10,0,"Land displacement to meet.. %d", MEETNTN);
X	mvprintw(11,0,"Maximum Number of Armies... %d", MAXARM);
X	mvprintw(12,0,"Maximum Number of Navies... %d", MAXNAVY);
X	mvprintw(13,0,"Chance of Scout Capture.... %d%%", PFINDSCOUT);
X
X	/* user information */
X	mvprintw(7,COLS-40,"Number of Leaders........... %d",numlead);
X	mvprintw(8,COLS-40,"Men Needed To Take Land..... %d",TAKESECTOR);
X	mvprintw(9,COLS-40,"Mercenaries in Nation....... %d",mercs);
X	mvprintw(10,COLS-40,"Total Soldiers in Nation.... %d",solds);
X	mvprintw(11,COLS-40,"Current Number of Armies.... %d",numarm);
X	mvprintw(12,COLS-40,"Current Number of Navies.... %d",numnvy);
X
X	standout();
X	mvaddstr(LINES-2,COLS/2-13," HIT ANY KEY TO CONTINUE");
X	standend();
X	refresh();
X
X	getch();
X}
END_OF_FILE
if test 29720 -ne `wc -c <'main.c'`; then
    echo shar: \"'main.c'\" unpacked with wrong size!
fi
# end of 'main.c'
fi
if test -f 'reports.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'reports.c'\"
else
echo shar: Extracting \"'reports.c'\" \(23697 characters\)
sed "s/^X//" >'reports.c' <<'END_OF_FILE'
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;
Xextern short redraw;
X
X#define RPT_LINES 11
X#define RPT_COLS 10
X#define BUF_LINES 10
X#define BUF_COLS 15
X#define MAXINROW ((COLS-BUF_COLS)/RPT_COLS)
X#define MAXINSCR (((LINES-BUF_LINES)/RPT_LINES)*MAXINROW)
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	char	inpkey;
X	int men,attset,defset,bemerc;
X	short oldarmy;
X	int done=FALSE;
X	int xpos,ypos;
X	int isgod=FALSE;
X	int count,count2;    /*number of armies on current screen */
X	short armynum=0;
X
X	if(country==0) {
X		isgod=TRUE;
X		if (get_god()) return;
X	} else {
X		/* if not god, check there are armies to display */
X		men=FALSE;
X		for(armynum=0;men==FALSE && armynum<MAXARM;armynum++)
X			if(P_ASOLD>0 && (!repnum ||
X				(P_AXLOC==XREAL && P_AYLOC==YREAL)))
X				men=TRUE;
X		if (!men) {
X			redraw=FALSE;
X			clear_bottom(0);
X			errormsg("no armies to display");
X			makebottom();
X			return;
X		}
X	}
X	count2=0;
X	/*new army screen*/
X	while(done==FALSE) {
X		clear();
X		armynum=count2;
X		xpos=BUF_COLS;
X		ypos=2;
X		count=0;
X		while((armynum<MAXARM)&&(count<MAXINSCR)){
X			if(P_ASOLD>0 && (!repnum || (P_AXLOC==XREAL && P_AYLOC==YREAL))) {
X				if (count%MAXINROW==0) {
X					/* diplay header information */
X					mvaddstr(ypos+1,0,"soldiers  :");
X					mvaddstr(ypos+2,0,"movement  :");
X					mvaddstr(ypos+3,0,"x location:");
X					mvaddstr(ypos+4,0,"y location:");
X					mvaddstr(ypos+5,0,"status    :");
X					mvaddstr(ypos+6,0,"unit type :");
X					mvaddstr(ypos+7,0,"cost/turn :");
X					mvaddstr(ypos+8,0,"enlist    :");
X				}
X				standout();
X				mvprintw(ypos,xpos,"%d:",armynum);
X				standend();
X				mvprintw(ypos+1,xpos,"%ld",P_ASOLD);
X				mvprintw(ypos+2,xpos,"%d",P_AMOVE);
X				mvprintw(ypos+3,xpos,"%d",P_AXLOC);
X				mvprintw(ypos+4,xpos,"%d",P_AYLOC);
X				if(P_ASTAT>=NUMSTATUS)
X				mvprintw(ypos+5,xpos,"group %d",P_ASTAT-NUMSTATUS);
X				else
X				mvprintw(ypos+5,xpos,"%s",*(soldname+P_ASTAT));
X				mvprintw(ypos+6,xpos,"%s",*(unittype+(P_ATYPE%UTYPE)));
X				if (P_ATYPE<MINMONSTER)
X				mvprintw(ypos+7,xpos,"$%ld",P_ASOLD * *(unitmaint+(P_ATYPE%UTYPE)));
X				else
X				mvprintw(ypos+7,xpos,"$%ld", 5L * *(unitmaint+(P_ATYPE%UTYPE)));
X				if (P_ATYPE<MINMONSTER)
X				mvprintw(ypos+8,xpos,"$%ld",P_ASOLD * *(u_encost+(P_ATYPE%UTYPE)));
X				else
X				mvprintw(ypos+8,xpos,"%d pts", (int)*(u_encost+(P_ATYPE%UTYPE)));
X				count++;
X				if(count<MAXINSCR && count%MAXINROW==0) {
X					ypos+=RPT_LINES;
X					xpos=BUF_COLS;
X				} else {
X					xpos+=RPT_COLS;
X				}
X			}
X			armynum++;
X		}
X
X		/*Operate on any armies that you wish*/
X		standout();
X		mvprintw(0,(COLS/2)-15-strlen(curntn->name)/2,"ARMY STATS SUMMARY FOR %s",curntn->name);
X
X		ypos+=10;
X		mvaddstr(ypos++,(COLS/2)-14,"HIT SPACE KEY IF DONE");
X		mvaddstr(ypos++,(COLS/2)-25,"HIT RETURN TO CHANGE ANY ARMY STATISTICS");
X		mvaddstr(ypos++,(COLS/2)-17,"HIT ANY OTHER KEY FOR MORE");
X		standend();
X		refresh();
X
X		ypos++;
X		if ((inpkey = getch())==' ') done=TRUE;
X		else if((inpkey=='\n')||(inpkey=='\r')) {
X			done=0;
X			mvaddstr(ypos++,0,"WHAT ARMY DO YOU WANT TO CHANGE:");
X			ypos++;
X			clrtoeol();
X			refresh();
X			armynum = get_number();
X			if((armynum<0)||(armynum>MAXARM)) {
X				continue;
X			}
X#ifdef TRADE
X			if(P_ASTAT==TRADED) {
X				errormsg("May not change traded army");
X				continue;
X			}
X#endif TRADE
X			mvaddstr(ypos,0,"OPTIONS: 1) COMMAND 2) DISBAND 3) CHANGE GROUP");
X			if(P_ATYPE<MINLEADER)
X			mvaddstr(ypos,47,"4) MERGE 5) SPLIT ARMY");
X			ypos++;
X			clrtoeol();
X#ifdef OGOD
X			if(isgod==TRUE) mvaddstr(ypos++,0,"GOD OPTIONS: 6) LOCATION 7) SOLDIERS");
X			clrtoeol();
X#endif OGOD
X			ypos++;
X			refresh();
X			switch(getch()){
X			case '1':
X				ext_cmd(armynum);
X				break;
X			case '4':
X				clear_bottom(0);
X				if(P_ATYPE>=MINLEADER){
X					errormsg("SORRY -- army is monster");
X					break;
X				}
X				oldarmy=armynum;
X				mvaddstr(ypos++,0,"TO WHAT ARMY: ");
X				refresh();
X				armynum = get_number();
X
X				combinearmies(armynum,oldarmy);
X				break;
X			case '5':
X				splitarmy(armynum);
X				break;
X			case '2':	/* disband army */
X				clear_bottom(0);
X				if(P_ATYPE<MINLEADER) 
X					mvprintw(ypos++,0,"Disband your %s army %d?",*(unittype+(P_ATYPE%UTYPE)),armynum);
X				else 	mvprintw(ypos++,0,"Disband your %s %d?",*(unittype+(P_ATYPE%UTYPE)),armynum);
X				refresh();
X				if(getch()!='y') break;
X				if(sct[P_AXLOC][P_AYLOC].owner!=country && P_ATYPE!=A_SPY){
X					errormsg("You don't own the sector");
X					break;
X				} else if(P_ASTAT==ONBOARD) {
X					errormsg("That unit must be first be unloaded");
X					break;
X				} else if(P_ATYPE==A_SPY) {
X					/*spys are given a shut up fee */
X					mvprintw(LINES-4,0,"Your spy demands %ld talons to remain quiet",
X					*(u_encost+(P_ATYPE%UTYPE)) * 2);
X					mvprintw(LINES-3,0,"Pay him off? (y or n)");
X					clrtoeol();
X					refresh();
X					if(getch()=='y'){
X					/* spys do not add to population */
X					curntn->tgold -= *(u_encost+(P_ATYPE%UTYPE)) * 2;
X					P_ASOLD=0;
X					AADJMEN;
X					}
X				} else if(P_ATYPE==A_MERCENARY){
X					/*mercs must be payed off*/
X					mvprintw(LINES-4,0,"Your mercenaries demand %ld talons to disband",
X					*(u_encost+(P_ATYPE%UTYPE)) * P_ASOLD);
X	
X					mvprintw(LINES-3,0,"Give them severance pay? (y or n)");
X					clrtoeol();
X					refresh();
X					if(getch()=='y'){
X					curntn->tgold -= *(u_encost+(P_ATYPE%UTYPE)) * P_ASOLD;
X					/*mercs do not add to local populace*/
X					attset = MERCATT;
X					defset = MERCDEF;
X					bemerc = P_ASOLD;
X					P_ASOLD=0;
X					AADJMEN;
X					AADJDISB;
X					}
X				} else if(P_ATYPE==A_ZOMBIE){
X					errormsg("Zombie units cannot disband");
X					break;
X				} else {
X					if (P_ATYPE < MINLEADER) {
X					bemerc = (P_ASOLD*15)/100;
X					/*15% become mercs*/
X					attset = curntn->aplus +
X						*(unitattack+(P_ATYPE%UTYPE));
X					defset = curntn->dplus +
X						*(unitdefend+(P_ATYPE%UTYPE));
X					P_ASOLD -= bemerc;
X					sct[P_AXLOC][P_AYLOC].people+=P_ASOLD;
X					AADJDISB;
X					}
X					P_ASOLD=0;
X					AADJMEN;
X					i=P_AXLOC;
X					j=P_AYLOC;
X					SADJCIV2;
X				}
X				break;
X			case '3':
X				addgroup(armynum);
X				break;
X#ifdef OGOD
X			case '6':
X				if(isgod==TRUE){
X					/*X LOCATION*/
X					mvaddstr(ypos++,0,"What is the New X Loc: ");
X					refresh();
X					men = get_number();
X					if (men>=0 && men<MAPX)
X					P_AXLOC=men;
X					/*Y LOCATION*/
X					mvaddstr(ypos++,0,"What is the New Y Loc: ");
X					refresh();
X					men = get_number();
X					if (men>=0 && men<MAPY)
X					P_AYLOC=men;
X					AADJLOC;
X				}
X				break;
X			case '7':
X				if(isgod==TRUE){
X					/*SOLDIERS*/
X					mvaddstr(ypos++,0,"What is the New Total Soldiers: ");
X					refresh();
X					men = get_number();
X					P_ASOLD=men;
X					AADJMEN;
X				}
X				break;
X#endif OGOD
X			default:
X				errormsg("Invalid Input");
X			}
X			armynum=0;
X		} else {
X			/* go to start of next page in army list */
X			while(armynum<MAXARM && (P_ASOLD==0 || !(!repnum ||
X			(P_AXLOC==XREAL && P_AYLOC==YREAL)))) armynum++;
X			if(armynum==MAXARM) count2=0;
X			else count2=armynum;
X		}
X	}
X	if(isgod==TRUE) reset_god();
X}
X
Xvoid
Xbudget()
X{
X	short armynum,nvynum;
X	long numship=0L,costsold=0L,numsold=0L;
X	long nummonst=0L,costmonst=0L,money;
X	int isgod=FALSE;
X
X	if(country==0) {
X		isgod=TRUE;
X		if (get_god()) return;
X		/* make budget report work for god */
X		startgold=curntn->tgold;
X	}
X
X	clear();
X	standout();
X	mvaddstr(0,(COLS/2)-15,"NEXT SEASON'S BUDGET ESTIMATES");
X	standend();
X	spreadsheet(country);
X  
X	for(armynum=0;armynum<MAXARM;armynum++)
X	if(P_ASOLD>0) {
X		if(P_ATYPE<MINLEADER) {
X			numsold += P_ASOLD;
X			costsold += P_ASOLD * ((long) *(unitmaint+(P_ATYPE%UTYPE)));
X		} else if (P_ATYPE>=MINMONSTER) {
X			nummonst++;
X			costmonst += 5L * ((long) *(unitmaint+(P_ATYPE%UTYPE)));
X		}
X	}
X	for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X		if(P_NWSHP!=0||P_NMSHP!=0||P_NGSHP!=0)
X			numship+=flthold(nvynum);
X
X	standout();
X	mvprintw(3,0,  "nation name is......%s",curntn->name);
X	standend();
X	mvprintw(4,0,  "talons in treasury.$%ld",startgold);
X	mvprintw(5,0,  "number of sectors...%d",spread.sectors);
X	if(curntn->tfood<2*curntn->tciv) standout();
X	mvprintw(7,0,  "granary holds.....%8ld",curntn->tfood);
X	standend();
X	mvprintw(8,0, "jewels owned......%8ld",curntn->jewels);
X	mvprintw(9,0, "metal ore owned...%8ld",curntn->metals);
X	mvprintw(3,COLS-50, "%8ld people in gold mines.%8ld",spread.ingold,spread.revjewels);
X	mvprintw(4,COLS-50, "%8ld people in mines......%8ld",spread.inmetal,spread.revmetal);
X	mvprintw(5,COLS-50, "%8ld people in farms......%8ld",spread.infarm,spread.revfood);
X	mvprintw(6,COLS-50,"%8ld people in cities.....%8ld",spread.incap,spread.revcap);
X	mvprintw(7,COLS-50,"%8ld people in towns......%8ld",spread.incity,spread.revcity);
X	mvprintw(8,COLS-50, "%8ld people elsewhere.....%8ld",spread.inothr,spread.revothr);
X	standout();
X	mvprintw(9,COLS-50,"%8ld people INCOME........%8ld",spread.civilians,spread.gold - curntn->tgold);
X	standend();
X	mvprintw(11,COLS-50,"%8ld troops...............%8ld",numsold,costsold);
X	mvprintw(12,COLS-50,"%8ld monsters.............%8ld",nummonst,costmonst);
X
X	mvprintw(13,COLS-50,"%8ld ship holds @ %4d....%8ld",numship,SHIPMAINT,numship*SHIPMAINT);
X	mvprintw(14,COLS-50,"other expenses this turn......%8ld",startgold-curntn->tgold);
X	standout();
X	money=costmonst+costsold+(numship*SHIPMAINT)+startgold-curntn->tgold;
X	mvprintw(15,COLS-50,"TOTAL EXPENSES................%8ld",money);
X	money=spread.gold - curntn->tgold - money;	/* net income */
X	standend();
X	mvprintw(17,COLS-50,"NET INCOME....................%8ld",money);
X	mvprintw(16,COLS-50,"CHARITY.......................%8ld",max((money*curntn->charity)/100,0));
X	standout();
X	mvprintw(18,COLS-50,"NEXT SEASON'S TREASURY........%8ld",(startgold + money)*(100-curntn->charity)/100);
X
X	mvaddstr(LINES-3,(COLS/2)-15,"HIT 'P' TO SEE PRODUCTION SCREEN");
X	mvaddstr(LINES-2,(COLS/2)-15,"HIT 'C' FOR CHANGE NATION SCREEN");
X	mvaddstr(LINES-1,(COLS/2)-14,"HIT ANY OTHER KEY TO CONTINUE");
X	standend();
X	refresh();
X	switch( getch() ) {
X	case 'p':
X	case 'P': produce(); break;
X	case 'c':
X	case 'C': change(); break;
X	}
X	if(isgod==TRUE) reset_god();
X}
X
Xvoid
Xproduce()
X{
X	FILE *fp;
X	short armynum;
X	long military=0;
X	long nummonst=0L,costmonst=0L;
X	int isgod=FALSE;
X
X	if(country==0) {
X		isgod=TRUE;
X		if (get_god()) return;
X	}
X	fp=fopen("temp","w");
X	clear();
X	standout();
X	mvaddstr(0,(COLS/2)-17,"NEXT SEASON'S PRODUCTION ESTIMATES");
X	standend();
X
X	spreadsheet(country);
X	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X	for(armynum=0;armynum<MAXARM;armynum++)
X	if(P_ASOLD>0)
X	{
X		if (P_ATYPE<MINLEADER) {
X			military+=P_ASOLD;
X		} else if (P_ATYPE>=MINMONSTER) {
X			nummonst++;
X			costmonst += (long) *(unitmaint+(P_ATYPE%UTYPE));
X		}
X	}
X
X	standout();
X	mvprintw(4,0,  "nation name is....%s",curntn->name);
X	standend();
X	mvprintw(5,0,  "talons in treasury..$%ld",startgold);
X	mvaddstr(7,0,  "FOOD PRODUCTION");
X	mvprintw(9,0,  "granary now holds.........%8ld tons",curntn->tfood);
X	mvprintw(10,0, "%8ld people in farms..%8ld tons",spread.infarm,spread.food - curntn->tfood);
X	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X	mvprintw(12,0, "%8ld people @ %3.1f eat.%8.0f tons",spread.civilians,P_EATRATE,P_EATRATE*(float)spread.civilians);
X	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X	mvprintw(13,0, "%8ld soldiers eat.....%8.0f tons",military,military*2*P_EATRATE);
X	military+= military+spread.civilians; /* military is amount eaten */
X	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X	standout();
X	mvprintw(15,0, "ESTIMATE NET FOOD.........%8.0f tons",spread.food-curntn->tfood-P_EATRATE*military);
X	mvprintw(16,0, "ESTIMATE FOOD SUPPLY......%8.0f tons",spread.food-P_EATRATE*military);
X	standend();
X	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X
X	mvaddstr(7,COLS/2+1,  "OTHER PRODUCTION");
X	mvprintw(9,COLS/2+1, "jewels owned is...............%8ld",curntn->jewels);
X	mvprintw(10,COLS/2+1, "%8ld people in goldmines..%8ld",spread.ingold,spread.jewels-curntn->jewels);
X	mvprintw(11,COLS/2+1, "%8ld monsters.............%8ld",nummonst,-costmonst);
X	standout();
X	mvprintw(12,COLS/2+1, "ESTIMATE JEWEL SUPPLY.........%8ld",spread.jewels-costmonst);
X	standend();
X
X	mvprintw(14,COLS/2+1, "metal ore owned is............%8ld",curntn->metals);
X	mvprintw(15,COLS/2+1, "%8ld people in mines......%8ld",spread.inmetal,spread.metal-curntn->metals);
X	standout();
X	mvprintw(16,COLS/2+1, "ESTIMATE METAL SUPPLY.........%8ld",spread.metal);
X	standend();
X
X	standout();
X	mvaddstr(LINES-3,(COLS/2)-15,"HIT 'B' TO SEE BUDGET SCREEN");
X	mvaddstr(LINES-2,(COLS/2)-17,"HIT 'C' FOR CHANGE NATION SCREEN");
X	mvaddstr(LINES-1,(COLS/2)-15,"HIT ANY OTHER KEY TO CONTINUE");
X	standend();
X	refresh();
X	switch( getch() ) {
X		case 'b':
X		case 'B': budget(); break;
X		case 'c':
X		case 'C': change(); break;
X	}
X
X	if(isgod==TRUE) reset_god();
X	fclose(fp);
X}
X
X#undef RPT_LINES
X#undef RPT_COLS
X#undef BUF_LINES
X#undef BUF_COLS
X#define RPT_LINES 13
X#define RPT_COLS 11
X#define BUF_LINES 10
X#define BUF_COLS 15
Xchar *fltstr[]= {"Light", "Medium", "Heavy"};
X/*report on ships and allow changes */
Xvoid
Xfleetrpt()
X{
X	short navy,armynum;
X	short newx,newy,newnavy;
X	short done=FALSE;
X	int i,j;
X	int xpos,ypos,crew,people;
X	int count,count2;       /*screen number */
X	short nvynum=0;    /*current ship id */
X	short shipsize;
X	int isgod=FALSE;
X	if(country==0) {
X		isgod=TRUE;
X		if (get_god()) return;
X	}
X	else {
X		/* if not god, check if there are navies to display */
X		for(count=nvynum=0;count==0 && nvynum<MAXNAVY;nvynum++)
X			if (P_NWSHP!=0||P_NMSHP!=0||P_NGSHP!=0) count=1;
X		if(count==0){
X			clear_bottom(0);
X			errormsg("no navies");
X			redraw=FALSE;
X			makebottom();
X			return;
X		}
X  	}
X
X	count2=0;
X	while(done==FALSE) {
X		clear();
X		ypos=2;
X		xpos=BUF_COLS;
X		count=0;
X		nvynum=count2;
X		while((nvynum<MAXNAVY)&&(count<MAXINSCR)){
X			if((P_NWSHP!=0)||(P_NMSHP!=0)||(P_NGSHP!=0)) {
X
X				/* give a navy report */
X				if (count%MAXINROW==0) {
X					mvaddstr(ypos+2,0, "warships  :");
X					mvaddstr(ypos+3,0, "merchants :");
X					mvaddstr(ypos+4,0, "galleys   :");
X					mvaddstr(ypos+5,0, "x location:");
X					mvaddstr(ypos+6,0, "y location:");
X					mvaddstr(ypos+7,0, "crew/unit :");
X					mvaddstr(ypos+8,0, "move left :");
X					mvaddstr(ypos+9,0, "carrying  :");
X					mvaddstr(ypos+10,0, "civilians :");
X				}
X
X				/* give naval information */
X				standout();
X				mvprintw(ypos,xpos,"%d:",nvynum);
X				standend();
X				mvprintw(ypos+1,xpos,"lt/md/hv");
X				mvprintw(ypos+2,xpos,"%2hd/%2hd/%2hd",P_NWAR(N_LIGHT),P_NWAR(N_MEDIUM),P_NWAR(N_HEAVY));
X				mvprintw(ypos+3,xpos,"%2hd/%2hd/%2hd",P_NMER(N_LIGHT),P_NMER(N_MEDIUM),P_NMER(N_HEAVY));
X				mvprintw(ypos+4,xpos,"%2hd/%2hd/%2hd",P_NGAL(N_LIGHT),P_NGAL(N_MEDIUM),P_NGAL(N_HEAVY));
X				mvprintw(ypos+5,xpos,"%d",(int)P_NXLOC);
X				mvprintw(ypos+6,xpos,"%d",(int)P_NYLOC);
X				mvprintw(ypos+7,xpos,"%d",(int)P_NCREW);
X				mvprintw(ypos+8,xpos,"%d",(int)P_NMOVE);
X				if(P_NARMY==MAXARM)
X					mvaddstr(ypos+9,xpos,"(none)");
X				else {
X					armynum=P_NARMY;
X					if(P_ATYPE<MINLEADER)
X						mvprintw(ypos+9,xpos,"army %d",armynum);
X					else
X						mvprintw(ypos+9,xpos,"%s %d",*(unittype+(P_ATYPE%UTYPE)),armynum);
X				}
X				mvprintw(ypos+10,xpos,"%d",P_NPEOP*fltmhold(nvynum));
X
X				count++;
X				if(count<MAXINSCR && count%MAXINROW==0) {
X					ypos+=RPT_LINES;
X					xpos=BUF_COLS;
X				} else {
X					xpos+=RPT_COLS;
X				}
X			}
X			nvynum++;
X		}
X
X		/*Operate on any navies that you wish*/
X		standout();
X		mvprintw(0,(COLS/2)-15-strlen(curntn->name)/2,"NAVY STATS SUMMARY FOR %s",curntn->name);
X
X		ypos+=12;
X		mvaddstr(ypos++,(COLS/2)-14,"HIT SPACE KEY IF DONE");
X		mvaddstr(ypos++,(COLS/2)-18,"HIT RETURN TO CHANGE A NAVY");
X		mvaddstr(ypos++,(COLS/2)-17,"HIT ANY OTHER KEY FOR MORE");
X		ypos++;
X		standend();
X		refresh();
X
X		if ((navy=getch())==' ') done=TRUE;
X		else if ((navy=='\n')||(navy=='\r')){
X			mvaddstr(ypos++,0,"WHAT NAVY DO YOU WANT TO CHANGE:");
X			clrtoeol();
X			refresh();
X			nvynum = get_number();
X#ifdef TRADE
X			if (curntn->nvy[nvynum].commodity==TRADED) {
X				errormsg("Sorry - That Navy is up for trade");
X				continue;
X			}
X#endif TRADE
X			if((nvynum<0)||(nvynum>=MAXNAVY)) {
X				errormsg("Invalid Naval unit");
X				continue;
X			}
X			mvaddstr(ypos++,0,"OPTIONS: 1) TRANSFER / MERGE, 2) SPLIT NAVY, 3) DISBAND NAVY");
X  			clrtoeol();
X#ifdef OGOD
X			if(isgod==TRUE) mvaddstr(ypos++,0,"GOD OPTIONS:  4) ADJUST SHIPS, 5) LOCATION, 6) CREW");
X			ypos++;
X			clrtoeol();
X#endif OGOD
X			refresh();
X			switch(getch()){
X			case '1':
X				mvaddstr(ypos++,0,"TO WHAT NAVY: ");
X				clrtoeol();
X				refresh();
X				newnavy = get_number();
X				if(newnavy<0 || newnavy>=MAXNAVY) {
X					errormsg("Sorry - Invalid Navy unit");
X					break;
X				}
X				newx = curntn->nvy[newnavy].xloc;
X				newy = curntn->nvy[newnavy].yloc;
X#ifdef TRADE
X				if (curntn->nvy[newnavy].commodity==TRADED) {
X					errormsg("Sorry - That Navy is up for trade");
X				} else
X#endif TRADE
X				if(nvynum==newnavy) {
X					errormsg("Sorry -- That is the same Navy");
X				}
X				else if((P_NARMY!=MAXARM)
X				&&(curntn->nvy[newnavy].armynum!=MAXARM)) {
X					errormsg("Sorry -- One of the two Armies must be unloaded");
X				}
X				else if((newx==P_NXLOC)&&(newy==P_NYLOC)) {
X					crew = flthold(nvynum)*P_NCREW;
X					people = fltmhold(nvynum)*P_NPEOP;
X					crew += flthold(newnavy)*curntn->nvy[newnavy].crew;
X					people += flthold(newnavy)*curntn->nvy[newnavy].people;
X					for(i=N_LIGHT;i<=N_HEAVY;i++) {
X						(void) addwships(newnavy,i,P_NWAR(i));
X						(void) addmships(newnavy,i,P_NMER(i));
X						(void) addgships(newnavy,i,P_NGAL(i));
X					}
X					P_NCREW=0;
X					P_NWSHP=0;
X					P_NMSHP=0;
X					P_NGSHP=0;
X					if (P_NARMY!=MAXARM) {
X						curntn->nvy[newnavy].armynum=P_NARMY;
X						P_NARMY=MAXARM;
X					}
X					P_NPEOP=0;
X					NADJWAR;
X					NADJMER;
X					NADJGAL;
X					NADJCRW;
X					NADJHLD;
X					if(P_NMOVE>curntn->nvy[newnavy].smove)
X						curntn->nvy[newnavy].smove=P_NMOVE;
X					P_NMOVE=0;
X					NADJMOV;
X					nvynum=newnavy;
X					if (flthold(nvynum)>0)
X					P_NCREW=(unsigned char)(crew/flthold(nvynum));
X					if (fltmhold(nvynum)>0)
X					P_NPEOP=(unsigned char)(people/fltmhold(nvynum));
X					NADJMOV;
X					NADJWAR;
X					NADJMER;
X					NADJGAL;
X					NADJCRW;
X					NADJHLD;
X				}
X				else {
X					errormsg("Navies not together");
X				}
X				break;
X			case '2':
X				newnavy=nvynum;
X				navy=(-1);
X				for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X				if(((P_NWSHP==0)&&(P_NMSHP==0)&&(P_NGSHP==0))
X				&&(navy==(-1)))
X					navy=nvynum;
X				if(navy==(-1)) {
X					errormsg("Too many Navies");
X					break;
X				}
X				nvynum=newnavy;
X				curntn->nvy[navy].xloc=P_NXLOC;
X				curntn->nvy[navy].yloc=P_NYLOC;
X				curntn->nvy[navy].crew=P_NCREW;
X				curntn->nvy[navy].people=P_NPEOP;
X				curntn->nvy[navy].smove=P_NMOVE;
X					
X				mvaddstr(LINES-2,0,"Do you wish to separate warships from remainder of fleet?");
X				refresh();
X				if(getch()=='y') {
X					curntn->nvy[navy].warships=P_NWSHP;
X					P_NWSHP=0;
X					NADJWAR;
X					nvynum=navy;
X					P_NMSHP=0;
X					P_NGSHP=0;
X					P_NARMY=MAXARM;
X					P_NPEOP=0;
X					NADJMOV;
X					NADJCRW;
X					NADJWAR;
X					NADJMER;
X					NADJGAL;
X					NADJHLD;
X					break;
X				} else if(P_NARMY!=MAXARM) {
X					errormsg("Army must be unloaded before Navy is divided");
X					break;
X				}
X				for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) {
X					mvprintw(ypos,0,"How Many %s Warships To Split?",fltstr[shipsize]);
X					clrtoeol();
X					refresh();
X					newnavy = get_number();
X					if(newnavy>P_NWAR(shipsize)) newnavy=0;
X					NSUB_WAR(newnavy);
X					(void) addwships(navy,shipsize,newnavy);
X				}
X				for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) {
X					mvprintw(ypos,0,"How Many %s Merchants To Split?",fltstr[shipsize]);
X					clrtoeol();
X					refresh();
X					newnavy = get_number();
X					if(newnavy>P_NMER(shipsize)) newnavy=0;
X					NSUB_MER(newnavy);
X					(void) addmships(navy,shipsize,newnavy);
X				}
X				for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) {
X					mvprintw(ypos,0,"How Many %s Galleys To Split?",fltstr[shipsize]);
X					clrtoeol();
X					refresh();
X					newnavy = get_number();
X					if(newnavy>P_NGAL(shipsize)) newnavy=0;
X					NSUB_GAL(newnavy);
X					(void) addgships(navy,shipsize,newnavy);
X				}
X
X				NADJWAR;
X				NADJMER;
X				NADJGAL;
X				nvynum=navy;
X				P_NARMY=MAXARM;
X				NADJMOV;
X				NADJCRW;
X				NADJWAR;
X				NADJMER;
X				NADJGAL;
X				NADJHLD;
X				break;
X			case '3':
X				/* DISBAND NAVY */
X				i=P_NXLOC;
X				j=P_NYLOC;
X				if(sct[i][j].altitude == WATER && isgod==FALSE) {
X					errormsg("Ships need to be on land or in harbor");
X					break;
X				}
X				if(sct[i][j].owner != country && isgod==FALSE) {
X					errormsg("You don't own the land");
X					break;
X				}
X				sct[i][j].people+=P_NCREW*flthold(nvynum);
X				sct[i][j].people+=P_NPEOP*fltmhold(nvynum);
X				if(P_NARMY!=MAXARM) {
X					armynum=P_NARMY;
X					P_NARMY=MAXARM;
X					P_ASTAT=DEFEND;
X					AADJSTAT;
X				}
X				P_NWSHP=0;
X				P_NMSHP=0;
X				P_NGSHP=0;
X				P_NCREW=0;
X				P_NPEOP=0;
X				SADJCIV2;
X				NADJCRW;
X				NADJWAR;
X				NADJGAL;
X				NADJMER;
X				NADJHLD;
X				break;
X#ifdef OGOD
X			case '4':
X				if (isgod==TRUE) {
X					/* ADJUST SHIPS */
X					P_NWSHP=0;
X					P_NMSHP=0;
X					P_NGSHP=0;
X					for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) {
X						mvprintw(ypos,0,"How Many %s Warships?",fltstr[shipsize]);
X						clrtoeol();
X						refresh();
X						newnavy = get_number();
X						if(newnavy>N_MASK) newnavy=0;
X						(void) NADD_WAR(newnavy);
X					}
X					for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) {
X						mvprintw(ypos,0,"How Many %s Merchants?",fltstr[shipsize]);
X						clrtoeol();
X						refresh();
X						newnavy = get_number();
X						if(newnavy>N_MASK) newnavy=0;
X						(void) NADD_MER(newnavy);
X					}
X					for(shipsize=N_LIGHT;shipsize<=N_HEAVY;shipsize++) {
X						mvprintw(ypos,0,"How Many %s Galleys?",fltstr[shipsize]);
X						clrtoeol();
X						refresh();
X						newnavy = get_number();
X						if(newnavy>N_MASK) newnavy=0;
X						(void) NADD_GAL(newnavy);
X					}
X					NADJWAR;
X					NADJMER;
X					NADJGAL;
X				}
X				break;
X			case '5':
X				if (isgod==TRUE) {
X					/*X LOCATION*/
X					mvaddstr(ypos++,0,"What Is The New X Loc: ");
X					refresh();
X					crew = get_number();
X					if (crew>=0 && crew<MAPX)
X						P_NXLOC=crew;
X					/*Y LOCATION*/
X					mvaddstr(ypos,0,"What Is The New Y Loc: ");
X					clrtoeol();
X					refresh();
X					crew = get_number();
X					if (crew>=0 && crew<MAPY)
X						P_NYLOC=crew;
X					NADJLOC;
X				}
X				break;
X			case '6':
X				if (isgod==TRUE) {
X					/* ADJUST CREWSIZE */
X					mvaddstr(ypos,0,"What value for crew/ship unit: ");
X					refresh();
X					crew = get_number();
X					if (crew>=0 && crew<=SHIPCREW)
X						P_NCREW = crew;
X					NADJCRW;
X				}
X				break;
X#endif OGOD
X			default:
X				errormsg("Invalid Input");
X			}
X			noecho();
X			nvynum=0;
X		} else {
X			/* go to start of next page in navy list */
X			while((nvynum<MAXNAVY)
X			&&((P_NWSHP==0)&&(P_NMSHP==0)&&(P_NGSHP==0)))
X				nvynum++;
X			if(nvynum==MAXNAVY) count2=0;
X			else count2=nvynum;
X		}
X	}
X	if(isgod==TRUE) reset_god();
X}
END_OF_FILE
if test 23697 -ne `wc -c <'reports.c'`; then
    echo shar: \"'reports.c'\" unpacked with wrong size!
fi
# end of 'reports.c'
fi
echo shar: End of archive 10 \(of 14\).
cp /dev/null ark10isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 14 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0