[comp.sources.games] v02i060: conquest - middle earth multi-player game, Part03/05

games-request@tekred.TEK.COM (10/26/87)

Submitted by: ihnp4!mhuxd!smile (E.BARLOW)
Comp.sources.games: Volume 2, Issue 60
Archive-name: conquest/Part03



#! /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 3 (of 5)."
# Contents:  commands.c main.c reports.c run
# Wrapped by billr@tekred on Mon Oct 26 10:33:05 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f commands.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"commands.c\"
else
echo shar: Extracting \"commands.c\" \(16412 characters\)
sed "s/^X//" >commands.c <<'END_OF_commands.c'
X/*conquest is copyrighted 1986 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/*	commands.c		*/
X
X/*include files*/
X#include "header.h"
X#include <ctype.h>
X
Xextern short xcurs,ycurs,xoffset,yoffset;
Xextern FILE *fexe;		/*execute file pointer*/
Xextern short country;
X
X/*change current hex designation*/
Xredesignate()
X{
X	char newdes;
X	short x,y;
X
X	if(country==0){
X		mvaddstr(LINES-1,0,"SUPER USER: CHANGE (v)egitation, (e)levation, (d)esig, (o)wner");
X		refresh();
X		switch(getch()){
X		case 'e':
X			/*simple contour map definitions*/
X			mvprintw(LINES-2,7,"ELEVATIONS: change to %c, %c, %c, %c or %c?",WATER,PEAK,MOUNTAIN,HILL,CLEAR);
X			refresh();
X			newdes=getch();
X			if(newdes!=WATER&&newdes!=PEAK&&newdes!=MOUNTAIN&&newdes!=HILL&&newdes!=CLEAR) return;
X			sct[XREAL][YREAL].altitude=newdes;
X			/*will fall through as must change vegitation*/
X		case 'v':
X			/*vegitation types*/
X			mvprintw(LINES-2,7,"VEGITATIONS: change to %c, %c, %c, %c, %c, %c, %c, %c, %c, %c, %c or %c?",VOLCANO,DESERT,WASTE,BARREN,LT_VEG,GOOD,WOOD,FORREST,JUNGLE,SWAMP,ICE,NONE);
X			refresh();
X			newdes=getch();
X			if(newdes!=VOLCANO&&newdes!=DESERT&&newdes!=WASTE&&newdes!=BARREN&&newdes!=LT_VEG&&newdes!=NONE&&newdes!=GOOD&&newdes!=WOOD&&newdes!=FORREST&&newdes!=JUNGLE&&newdes!=SWAMP&&newdes!=ICE) return;
X			sct[XREAL][YREAL].vegitation=newdes;
X			if(isdigit(sct[XREAL][YREAL].vegitation)==0) 
X				sct[XREAL][YREAL].designation=newdes;
X			return;
X		case 'o':
X			mvprintw(LINES-2,7,"what nation owner:");
X			refresh();
X			scanw("%hd",&x);
X			sct[XREAL][YREAL].owner=x;
X			return;
X		}
X	}
X	if((country!=0)&&(sct[XREAL][YREAL].owner!=country)) {
X		mvprintw(LINES-1,0,"You do not own: hit any key");
X		refresh();
X		getch();
X		return;
X	}
X	mvprintw(LINES-1,0,"hit space to not redesignate anyting");
X	clrtoeol();
X	mvprintw(LINES-2,7,"$%d: redesignate to %c, %c, %c, %c or %c?",DESCOST,DMINE,DGOLDMINE,DFARM,DCITY,DCAPITOL);
X	clrtoeol();
X	refresh();
X	/*read answer*/
X	newdes=getch();
X
X	if(newdes!=DMINE&&newdes!=DGOLDMINE&&newdes!=DFARM&&newdes!=DCITY&&newdes!=DCAPITOL) return;
X
X	if((SOWN==country)||(country==0)) {
X		if((isdigit(sct[XREAL][YREAL].vegitation)!=0)||(country==0)) {
X			if(((newdes!=DCITY)&&(newdes!=DCAPITOL))||(country==0)) {
X				/*decrement treasury*/
X				sct[XREAL][YREAL].designation=newdes;
X				if(country==0) {
X					country=sct[XREAL][YREAL].owner;
X					SADJDES;
X					country=0;
X				}
X				else {
X					SADJDES;
X					ntn[country].tgold-=DESCOST;
X				}
X			}
X			else if((newdes==DCAPITOL)&&(sct[XREAL][YREAL].designation==DCITY)){
X
X				ntn[country].tgold-=5*DESCOST;
X				ntn[country].tiron-=DESCOST;
X				x=ntn[country].capx;
X				y=ntn[country].capy;
X				sct[x][y].designation=DCITY;
X				if(country==0) {
X					country=sct[x][y].owner;
X					SADJDES2;
X					country=0;
X				}
X				else SADJDES2;
X				sct[XREAL][YREAL].designation=newdes;
X				ntn[country].capx=XREAL;
X				ntn[country].capy=YREAL;
X				if(country==0) {
X					country=sct[XREAL][YREAL].owner;
X					SADJDES;
X					country=0;
X				}
X				else SADJDES;
X			}
X			else if((newdes==DCAPITOL)&&(sct[XREAL][YREAL].designation!=DCITY)){
X				mvprintw(LINES-1,0,"Sector must be a city: hit any key  ");
X			}
X			else if((ntn[country].tiron>DESCOST)&&(newdes==DCITY)){
X				if(sct[XREAL][YREAL].people>=500){
X					ntn[country].tgold-=5*DESCOST;
X					ntn[country].tiron-=DESCOST;
X					sct[XREAL][YREAL].designation=newdes;
X					if(country==0) {
X						country=sct[XREAL][YREAL].owner;
X						SADJDES;
X						country=0;
X					}
X					else SADJDES;
X				}
X				else mvprintw(LINES-1,0,"Need 500 people to build to city");
X			}
X			else mvprintw(LINES-1,0,"Not enough iron: hit any key  ");
X		}
X		else mvprintw(LINES-1,0,"vegitation unlivable: hit any key  ");
X	}
X	else mvprintw(LINES-1,0,"Sorry, you don't own sector: hit any key ");
X	refresh();
X}
X
X/*build fort or ship-type */
Xconstruct()
X{
X	int nearsea;
X	int cost;
X	int x,y;
X	short nvynum=0;
X	short mnumber,wnumber;
X	short isgod=0;
X	char type;
X
X	if(country==0){
X		isgod=1;
X		country=sct[XREAL][YREAL].owner;
X	}
X
X	if(sct[XREAL][YREAL].owner!=country) {
X		mvprintw(LINES-1,0,"You do not own: hit any key");
X		refresh();
X		getch();
X		if(isgod==1) country=0;
X		return;
X	}
X
X	if((sct[XREAL][YREAL].designation==DCITY)||(sct[XREAL][YREAL].designation==DCAPITOL)) {
X		/*calculate cost for fort*/
X		cost=FORTCOST;
X		if(isgod==1) cost=0;
X		else for(x=1;x<=sct[XREAL][YREAL].fortress;x++) 
X			cost*=2;
X
X		mvprintw(LINES-2,0,"Do you wish to construct a <f>ort (%d gold) or <s>hips:",cost);
X		clrtoeol();
X		refresh();
X		type=getch();
X	}
X	else {
X		mvprintw(LINES-2,0,"Must construct in city or capitol--hit any key");
X		clrtoeol();
X		refresh();
X		getch();
X		return;
X	}
X
X	/* construct ships*/
X	if (type=='s') {
X		/*check if next to sea*/
X		nearsea=0;
X		for(x=XREAL-1;x<=XREAL+1;x++)
X			for(y=YREAL-1;y<=YREAL+1;y++)
X				if(sct[x][y].altitude==WATER) nearsea=1;
X
X		if (nearsea==0) {
X			mvprintw(LINES-2,0,"not in a harbor: hit space");
X			clrtoeol();
X			refresh();
X			getch();
X			if(isgod==1) country=0;
X			return;
X		}
X
X		mvprintw(LINES-2,0,"build how many merchant ships:");
X		clrtoeol();
X		refresh();
X		echo();
X		scanw("%hd",&mnumber);
X		noecho();
X		mvprintw(LINES-2,0,"build how many warships:");
X		clrtoeol();
X		refresh();
X		echo();
X		scanw("%hd",&wnumber);
X		noecho();
X		/*sanity checks*/
X		if((wnumber>100)||(wnumber<0)) wnumber=0;
X		if((mnumber>100)||(mnumber<0)) mnumber=0;
X		mvprintw(LINES-2,0,"constructing %hd warships and %hd merchant",wnumber,mnumber);
X		clrtoeol();
X
X		if((nvynum=getselunit()-MAXARM)>=0){
X			if(nvynum>=MAXNAVY){
X				mvaddstr(LINES-1,0,"INVALID NAVY--hit any key");
X				clrtoeol();
X				refresh();
X				getch();
X				if(isgod==1) country=0;
X				return;
X			}
X			mvaddstr(LINES-1,0,"Do you wish to raise a new fleet (y or n)");
X			clrtoeol();
X			refresh();
X			if(getch()!='y') nvynum=(-1);
X		}
X
X		if(nvynum<0) {
X			mvprintw(LINES-2,0,"raising a new fleet");
X			clrtoeol();
X			refresh();
X
X			nvynum=0;
X			x=(-1);
X			while((x==(-1))&&(nvynum<MAXNAVY)) {
X				if(NWAR+NMER<=0) {
X					x=nvynum;
X					NWAR=0;
X					NMER=0;
X					NADJSHP;
X				}
X				nvynum++;
X			}
X			nvynum=x;
X		}
X
X		if(nvynum==(-1)){
X			mvaddstr(LINES-1,0,"NO FREE NAVIES--hit any key");
X			clrtoeol();
X			refresh();
X			getch();
X			if(isgod==1) country=0;
X			return;
X		}
X
X		mvprintw(LINES-3,0,"Raising fleet %d",nvynum);
X		if((nvynum>=0)&&(nvynum<MAXNAVY)) {
X			NXLOC=XREAL;
X			NYLOC=YREAL;
X			NWAR+=wnumber;
X			NMER+=mnumber;
X			if(isgod==0) {
X			ntn[country].tgold-= (int) wnumber*WARSHPCOST;
X			ntn[country].tgold-= (int) mnumber*MERSHPCOST;
X			}
X			NMOVE=0;
X			NADJSHP;
X			NADJLOC;
X			NADJMOV;
X		}
X		else mvprintw(LINES-2,0,"ERROR!!!!!!!!!!!!!");
X
X		refresh();
X		makebottom();
X	}
X	/* construct fortification points*/
X	else if(type=='f'){
X		if(sct[XREAL][YREAL].people>=500) {
X
X			mvprintw(LINES-1,25,"you build one fort point for %d gold",cost);
X			ntn[country].tgold-=cost;
X			sct[XREAL][YREAL].fortress++;
X			INCFORT;
X		}
X		else mvprintw(LINES-1,25,"need 500 people");
X	}
X	else mvprintw(LINES-1,0,"error");
X
X	if(isgod==1) country=0;
X	refresh();
X}
X
X/*DRAFT IF IN A CITY*/
Xdraft()
X{
X	short armynum;
X	short men=0;
X	short army=(-1);
X	short isgod=0;
X	if(country==0) {
X		isgod=1;
X		country=sct[XREAL][YREAL].owner;
X	}
X	else if(sct[XREAL][YREAL].owner!=country) {
X		mvprintw(LINES-1,0,"You do not own: hit any key");
X		refresh();
X		getch();
X		return;
X	}
X
X	if((sct[XREAL][YREAL].designation!=DCITY)&&(sct[XREAL][YREAL].designation!=DCAPITOL)) {
X		mvprintw(LINES-1,0,"must raise in cities: hit any key");
X		refresh();
X		getch();
X		if(isgod==1) country=0;
X		return;
X	}
X
X	if((sct[XREAL][YREAL].designation==DCITY)&&(sct[XREAL][YREAL].people*(2*CITYLIMIT+(ntn[country].tsctrs/2))<ntn[country].tciv)){
X		mvprintw(LINES-1,0,"need %d people in city: hit any key",ntn[country].tciv/(2*CITYLIMIT+(ntn[country].tsctrs/2)));
X		refresh();
X		getch();
X		if(isgod==1) country=0;
X		return;
X	}
X
X	if(ntn[country].tgold <= 0){
X		mvprintw(LINES-1,0,"you dont have any gold: hit any key");
X		refresh();
X		getch();
X		if(isgod==1) country=0;
X		return;
X	}
X
X	/*raise an untrained army */
X	mvprintw(LINES-3,0,"how many men do you wish to raise");
X	clrtoeol();
X	refresh();
X	echo();
X	scanw("%hd",&men);
X	noecho();
X	if(men<=0) return;
X	if(men > sct[XREAL][YREAL].people/4) {
X		mvprintw(LINES-2,0,"can only raise %d soldiers",sct[XREAL][YREAL].people/4);
X		clrtoeol();
X		refresh();
X		men = sct[XREAL][YREAL].people/4;
X	}
X	if(men > (short) 10*ntn[country].tiron) {
X		mvprintw(LINES-2,0,"aborting--only enough iron for %d troops",ntn[country].tiron/10);
X		clrtoeol();
X		refresh();
X		getch();
X		if(isgod==1) country=0;
X		return;
X	}
X	else {
X		move(LINES-2,0);
X		clrtoeol();
X		ntn[country].tiron-= (int) 10*men;
X	}
X
X	/*count is order of that army in sector*/
X	/*armynum is number of that army*/
X	if((armynum=getselunit())>=0){
X		if(armynum>=MAXARM){
X			mvaddstr(LINES-1,0,"INVALID ARMY--hit any key");
X			clrtoeol();
X			refresh();
X			getch();
X			if(isgod==1) country=0;
X			return;
X		}
X		mvaddstr(LINES-1,0,"Do you wish to raise a new army");
X		clrtoeol();
X		refresh();
X		if(getch()!='y') army=armynum;
X		else army=(-1);
X	}
X	if(army==(-1)) {
X		mvprintw(LINES-2,0,"raising a new army");
X		clrtoeol();
X		refresh();
X		armynum=0;
X		while((army==(-1))&&(armynum<MAXARM)) {
X			if(ASOLD<=0) {
X				army=armynum;
X				ASOLD=0;
X				AADJMEN;
X			}
X			armynum++;
X		}
X		if(army==(-1)){
X			mvaddstr(LINES-1,0,"NO FREE ARMIES--hit any key");
X			clrtoeol();
X			refresh();
X			getch();
X			if(isgod==1) country=0;
X			return;
X		}
X		armynum=army;
X	}
X
X	AYLOC=YREAL;
X	AXLOC=XREAL;
X	AADJLOC;
X	AMOVE=0;
X	AADJMOV;
X	ASTAT=DEFEND;
X	AADJSTAT;
X	ASOLD+=men;
X	AADJMEN;
X	sct[XREAL][YREAL].people -= men;
X	SADJCIV;
X	if(isgod==0)
X		/*magiced get 1/2 enlistment costs*/
X		if((magic(country,WARRIOR)==1)||(magic(country,WARLORD)==1)||(magic(country,CAPTAIN)==1))
X			ntn[country].tgold -= (int) men*ENLISTCOST/2;
X		else ntn[country].tgold -= (int) men*ENLISTCOST;
X	else country=0;
X}
X
X/*adjust picked army*/
Xadjarm()
X{
X	short status;
X	short armynum=0;
X	armynum=getselunit();
X	if((armynum<0)||(armynum>MAXARM)) {
X		beep();
X		mvprintw(LINES-1,0,"Sorry you have an Invalid army number (%d)",armynum);
X		refresh();
X		getch();
X		return;
X	}
X	clear();
X	mvprintw(0,10,"ADJUST ARMY %d OF NATION %s",armynum,ntn[country].name);
X	mvaddstr(2,10,"1.  March ");
X	mvaddstr(3,10,"2.  Scouting--will not engage enemy if possible");
X	mvaddstr(4,10,"3.  Attack anybody (Hostile+) within 2 sectors");
X	mvaddstr(5,10,"4.  Defend ");
X	mvaddstr(6,10,"5.  Garrison--for a city or Capital");
X	mvaddstr(12,10,"Enter your choice (return to continue):");
X	refresh();
X	echo();
X	scanw("%hd",&status);
X	noecho();
X	if((status<1)||(status>5)) return;
X	if((status==SCOUT)&&(ASOLD>25)){
X		clear();
X		mvaddstr(12,(COLS/2)-6,"MUST HAVE < 25 MEN TO SCOUT");
X		mvaddstr(13,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
X		refresh();
X		getch();
X		return;
X	}
X	ASTAT=status;
X	AADJSTAT;
X}
X
X/*go through MSGFILE not rewriting to temp messages you discard*/
X/* then move temp to MSGFILE*/
Xrmessage()
X{
X	FILE *mesgfp;
X	FILE *fptemp;
X	int i;
X	int count;
X	int contd;
X	int done=0;
X	char line[80];
X	char save[20][80];
X
X	clear();
X	/*open file*/
X	strcpy(line,MSGFILE);
X	strcat(line,":temp");
X	fptemp=fopen(line,"w");
X	if ((mesgfp=fopen(MSGFILE,"r"))==NULL) {
X		mvprintw(0,0,"error on read of %s--hit return",MSGFILE);
X		refresh();
X		getch();
X		return;
X	}
X
X	/*read in file a line at at time*/
X	if(fgets(line,80,mesgfp)==NULL) done=1;
X	while(done==0) {
X		contd=0;
X		count=3;
X		if(strncmp(line,ntn[country].name,strlen(ntn[country].name))==0) {
X			clear();
X			standout();
X			/*print to end of message*/
X			while(contd==0) {
X				if(count<22) strcpy(save[count-3],line);
X				mvprintw(count,0,"%s",line);
X				standend();
X				for(i=0;i<strlen(ntn[country].name);i++) 
X					mvaddch(count,i,' ');
X				count++;
X				if(fgets(line,80,mesgfp)==NULL) contd=1;
X				if(strncmp(line,"END",3)==0) contd=1;
X			}
X			standout();
X			mvaddstr(LINES-3,(COLS/2)-22,"HIT RETURN TO SAVE MESSAGE");
X			mvaddstr(LINES-2,(COLS/2)-22,"HIT ANY OTHER KEY TO CONTINUE");
X			standend();
X			refresh();
X			if(getch()=='\n') {
X				for(i=0;i<count-3;i++) fputs(save[i],fptemp);
X				strcpy(line,"END\n");
X				fputs(line,fptemp);
X			}
X		}
X		else fputs(line,fptemp);
X		if(fgets(line,80,mesgfp)==NULL) done=1;
X	}
X	fclose(mesgfp);
X	fclose(fptemp);
X
X	/*IMPLEMENT A MOVE BETWEEN TMP FILE AND REAL FILE HERE*/
X	strcpy(line,"mv ");
X	strcat(line,MSGFILE);
X	strcat(line,":temp");
X	strcat(line," ");
X	strcat(line,MSGFILE);
X	system(line);
X}
X
Xwmessage()
X{
X	FILE *fp, *fopen();
X	int x,y;
X	int done=0;
X	char ch;
X	char name[12];
X	int temp=(-1);
X	int linedone;
X	char line[100];
X	int nationid;
X
X	/*what nation to send to*/
X	clear();
X	mvprintw(0,0,"to send a message to the administrator, send to 'god':");
X	mvprintw(2,0,"What country name do you wish to send to:");
X	refresh();
X	echo();
X	getstr(name);
X	noecho();
X
X	/*is name valid*/
X	for(nationid=0;nationid<MAXNTN;nationid++) if(ntn[nationid].active!=0)
X		if(strcmp(name,ntn[nationid].name)==0) temp=nationid;
X
X	if(strcmp(name,"god")==0) temp=0;
X
X	if (temp==(-1)) {
X		mvprintw(2,0,"error--invalid name");
X		refresh();
X		getch();
X		return;
X	}
X
X	if ((fp=fopen(MSGFILE,"a+"))==NULL) {
X		mvprintw(4,0,"error opening %s",MSGFILE);
X		refresh();
X		getch();
X		return;
X	}
X
X	move(0,0);
X	clrtoeol();
X	move(2,0);
X	clrtoeol();
X	standout();
X	mvprintw(3,(COLS-25)/2,"message to nation %s",name);
X	mvprintw(LINES-2,(COLS-25)/2,"end with a return on a new line");
X	mvprintw(LINES-1,(COLS-35)/2,"btw... This is my first editor, any comments?");
X	standend();
X
X	fprintf(fp,"%s Message to %s from %s\n",name,name,ntn[country].name);
X	fprintf(fp,"%s \n",name);
X	y=6;
X	x=0;
X	refresh();
X	while(done==0) {
X		linedone=0;
X		ch=' ';
X		/*read line*/
X		while(linedone==0){
X			if(ch=='\b'){
X				if(x>0) x--;
X				mvaddch(y,x,' ');
X				move(y,x);
X				line[x]=' ';
X				refresh();
X				ch=getch();
X			}
X			else if(ch=='\n') linedone=1;
X			else{
X				/*concatonate to end*/
X				line[x]=ch;
X				mvaddch(y,x,ch);
X				if(x<99) x++;
X				else linedone=1;
X				refresh();
X				ch=getch();
X			}
X		}
X		line[x]='\0';
X		if(x<=1) done=1;
X		/*write to file*/
X		fprintf(fp,"%s %s\n",name,line);
X		x=0;
X		y++;
X	}
X	fputs("END\n",fp);
X	mvprintw(20,0,"Done with messaging");
X	fclose(fp);
X}
X
X/*strategic move of civilians...once only*/
Xmoveciv()
X{
X	short people;
X	short i,j;
X
X	mvaddstr(LINES-1,0,"Moving civilians costs 50 per civilian");
X	if(sct[XREAL][YREAL].owner!=country){
X		mvprintw(LINES-2,0,"you do not own:  hit return");
X		clrtoeol();
X		refresh();
X		getch();
X		return;
X	}
X	else if(sct[XREAL][YREAL].people==0){
X		mvaddstr(LINES-2,0,"nobody lives here!!!:  hit return");
X		clrtoeol();
X		refresh();
X		getch();
X		makebottom();
X		return;
X	}
X
X	clear();
X	mvprintw(0,0,"sector contains %d people",sct[XREAL][YREAL].people);
X	mvaddstr(1,0,"how many people to move?");
X	clrtoeol();
X	refresh();
X	echo();
X	scanw("%hd",&people);
X	noecho();
X	if((people<0)||(people>sct[XREAL][YREAL].people)||(people*50>ntn[country].tgold)){
X		mvaddstr(4,0,"wrong oh great moosebreath...");
X		clrtoeol();
X		refresh();
X		getch();
X		makebottom();
X		return;
X	}
X
X	mvprintw(4,0,"sector location is x=%d, y=%d",XREAL,YREAL);
X	mvaddstr(6,0,"what x location to move to?");
X	refresh();
X	echo();
X	scanw("%hd",&i);
X	refresh();
X	noecho();
X
X	if((i-(XREAL))>2||(i-(XREAL))<-2) {
X		mvprintw(9,0,"can only move 2 sectors (you tried %hd)...--hit any key",i-(XREAL));
X		refresh();
X		getch();
X		return;
X	}
X
X	mvaddstr(9,0,"what y location to move to?");
X	clrtoeol();
X	refresh();
X	echo();
X	scanw("%hd",&j);
X	noecho();
X	if((j-(YREAL)>2)||((YREAL)-j>2)) {
X		mvprintw(9,0,"can only move 2 sectors (you tried %hd)...--hit any key",j-(XREAL));
X		refresh();
X		getch();
X		return;
X	}
X	if(sct[XREAL][YREAL].owner!=country){
X		mvaddstr(11,0,"you dont own it...");
X		clrtoeol();
X		refresh();
X		getch();
X		return;
X	}
X	ntn[country].tgold-=50*people;
X	sct[XREAL][YREAL].people-=people;
X	SADJCIV;
X	sct[i][j].people+=people;
X	SADJCIV2;
X}
END_OF_commands.c
if test 16412 -ne `wc -c <commands.c`; then
    echo shar: \"commands.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main.c\"
else
echo shar: Extracting \"main.c\" \(17234 characters\)
sed "s/^X//" >main.c <<'END_OF_main.c'
X/*conquest is copyrighted 1986 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 files*/
X#include <ctype.h>
X#include "header.h"
X
X/*initialization data*/
X/*Movement costs*/
Xchar *ele=       "#^%-~";
Xchar *elename[]= {  "PEAK", "MOUNTAIN", "HILL", "FLAT","WATER"};
Xchar *veg=       "VDW46973JSI~";
Xchar *vegname[]= { "VOLCANO", "DESERT", "WASTE", "BARREN(4)", "LT VEG(6)",
X"GOOD (9)", "WOOD (7)", "FOREST(3)", "JUNGLE", "SWAMP", "ICE", "NONE"};
Xchar *numbers=   "0123456789";
Xchar *Class[]= { "NPC", "king", "emperor", "wizard", "priest", "pirate", 
X"trader", "tyrant", "demon", "dragon", "shadow"};
Xchar *races[]= { "GOD","ORC","ELF","DWARF","LIZARD",
X"HUMAN","PIRATE","BARBARIAN","NOMAD","UNKNOWN"};
Xchar *diploname[]= { "UNMET", "CONFEDERACY", "ALLIED", "FRIENDLY",
X"NEUTRAL", "HOSTILE", "WAR", "JIHAD"};
Xchar *soldname[]= { "","MARCH","SCOUT","ATTACK","DEFEND","GARRISON"};
Xchar *des=       "cCmfx$!-";
Xchar *desname[]= {"CITY", "CAPITOL", "MINE", "FARM", "DEVASTATED", "GOLDMINE", 
X"CASTLE", "NODESIG", "PEAK", "WATER"};
X
X/*Declarations*/
Xstruct s_sector sct[MAPX][MAPY];
Xstruct nation ntn[NTOTAL];   /* player nation stats */
X
X/*is sector occupied by an army?*/
Xshort occ[MAPX][MAPY];
Xshort movecost[MAPX][MAPY];
Xextern int armornvy;
Xint startgold=0;
X
X/*offset of upper left hand corner*/
Xshort xoffset=0,yoffset=0;
X/*current cursor postion (relative to 00 in upper corner)*/
X/*	position is 2*x,y*/
Xshort xcurs=0,ycurs=0;
X/*redraw map in this turn if redraw is a 1*/
Xshort redraw=TRUE;
X/*1 if you have quit*/
Xint done=0;
X/*display state*/
Xshort hilmode=0;   /*highlight modes: 0=owned sectors, 1= armies, 2=none*/
Xshort dismode=2;   /*display mode: 1=vegitation, 2=desig, 3=contour*/
X/*		 4=armies/navies, 5=commodities, 6=fertility*/
Xshort selector=0;  /*selector (y vbl) for which army/navy... is "picked"*/
X/* nation id of owner*/
Xshort country=0;
X
XFILE *fexe, *fopen();
X
Xmain(argc,argv)
Xint argc;
Xchar **argv;
X{
X	register int i;
X	char name[20];
X	void srand();
X	int getopt();
X	char passwd[20];
X	long time();
X
X	srand((unsigned) time((long *) 0));
X	/* process the command line arguments */
X	while((i=getopt(argc,argv,"maxph"))!=EOF) switch(i){
X	case 'm':  /*make a new world*/
X		makeworld();
X		exit(1);
X	case 'a': /*anyone with password can add player*/
X		readdata();
X		if(strncmp(crypt(getpass("\nwhat is super user password:"),SALT),ntn[0].passwd,PASSLTH)!=0) {
X			printf("sorry, must be super user to add player\n");
X			exit(1);
X		}
X		newlogin();
X		exit(1);
X	case 'x': /* execute program*/
X		readdata();
X		update();
X		writedata();
X		exit(1);
X	case 'p': /*print the map*/
X		readdata();
X		if(strncmp(crypt(getpass("\nwhat is super user password:"),SALT),ntn[0].passwd,PASSLTH)!=0) {
X			printf("sorry, must be super user to get map\n");
X			exit(1);
X		}
X		printf("what type of map\noptions are\n");
X		printf("\t1) altitudes\n\t2) vegitations\n");
X		printf("\t3) nations\n\n");
X		printf("\tINPUT:");
X		scanf("%hd",&dismode);
X		if(dismode==1) printele();
X		else if(dismode==2) printveg();
X		else pr_ntns();
X		exit(1);
X	case 'h': /* execute help program*/
X		initscr();
X		savetty();
X		noecho();
X		raw();
X		help();
X		endwin();
X		putchar('\n');
X		exit(1);
X	case '?': /* print out command line arguments */
X		printf("Cmd line format: conquest [-maxdhp]\n\t-m   make a world\n\t-a   add new player\n\t-x   execute program\n\t-h   print help text\n\t-p   print a map\n ");
X		exit(1);
X	};
X
X	/* read data*/
X	readdata();
X	armornvy=AORN;
X
X	/* identify the player and the country he represents */
X
X	/* get nation name either from command line or by asking
X *     if you fail will give you the name of administrator of game
X */
X
X	/* verify existence of nation*/
X	printf("conquest: copyrighted by Ed Barlow (1986)\n");
X	printf("what nation would you like to be:");
X	scanf("%s",name);
X	if(strcmp(name,"god")==0) strcpy(name,"unowned");
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 <conquest -h>");
X		printf("\nfor more information please contact %s\n",OWNER);
X		return;
X	}
X
X	/*get encrypted password*/
X	strcpy(passwd,crypt(getpass("\nwhat is your password:"),SALT));
X	if((strncmp(passwd,ntn[country].passwd,PASSLTH)!=0)&&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
X		strcpy(passwd,crypt(getpass("\nerror: reenter your password:"),SALT));
X		if((strncmp(passwd,ntn[country].passwd,PASSLTH)!=0)&&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
X			printf("\nsorry:");
X			printf("\nfor rules type <conquest -h>");
X			printf("\nfor more information on the system please contact %s\n",OWNER);
X			exit(1);
X		}
X	}
X
X	/* check if user is super-user nation[0] */
X	/* 	else setup cursor to capitol*/
X	if(country==0) {
X		printf("welcome super user\n");
X		xcurs=1;
X		xoffset=0;
X		ycurs=1;
X		yoffset=0;
X	}
X	else {
X		printf("\nverifing that nation %s exists\n",ntn[country].name);
X		startgold = ntn[country].tgold;
X		execute();
X		if(ntn[country].capx>15) {
X			xcurs=15;
X			xoffset= (ntn[country].capx-15);
X		}
X		else {
X			xcurs= ntn[country].capx;
X			xoffset= 0;
X		}
X		if(ntn[country].capy>10) {
X			ycurs=10;
X			yoffset= (ntn[country].capy-10);
X		}
X		else {
X			yoffset= 0;
X			ycurs= ntn[country].capy;
X		}
X	}
X
X	updmove(ntn[country].race);
X
X	/* open output for future printing*/
X	if ((fexe=fopen(EXEFILE,"a"))==NULL) {
X		beep();
X		printf("error opening %s\n",EXEFILE);
X		exit(1);
X	}
X
X	/* SET UP THE SCREEN */
X	printf("about to set up the screen");
X	initscr();
X	savetty();
X	raw();
X
X	prep();
X	noecho();
X
X	/*main while routine*/
X	done=0;
X	while (done==0)
X	{
X		/* check if cursor is out of bounds*/
X		if((xcurs<1)||(ycurs<1)||(xcurs>=(COLS-21)/2)||((ycurs>=LINES-5))||((XREAL)>=MAPX)||((YREAL)>=MAPY)) offmap();
X
X		/*update map*/
X		if(redraw==TRUE) {
X			clear();
X			makemap();    /* update map*/
X			makebottom();
X			redraw=FALSE;
X		}
X		move(ycurs,2*xcurs);
X		makeside(); /*update side*/
X		move(ycurs,2*xcurs);
X		refresh();
X		/*get commands, make moves and input command*/
X		parse();
X	}
X
X	if(country==0) writedata();
X	else {
X	fprintf(fexe,"NGOLD\t%d \t%d \t%d \t0 \t0 \t%s\n",XNAGOLD ,country,ntn[country].tgold,"null");
X	fprintf(fexe,"NIRON\t%d \t%d \t%d \t0 \t0 \t%s\n",XNAIRON ,country,ntn[country].tiron,"null");
X	fprintf(fexe,"NRGOLD\t%d \t%d \t%d \t0 \t0 \t%s\n",XNARGOLD ,country,ntn[country].jewels,"null");
X	}
X	/*done so quit*/
X	clear();
X	printw("quitting\n");
X	refresh();
X	noraw();
X	resetty();
X	endwin();
X	fclose(fexe);
X	exit(1);
X}
X
X/*make the bottom of the screen*/
Xmakebottom()
X{
X	move(LINES-4,0);
X	clrtoeol();
X	mvprintw(LINES-3,0,"Conquest version %d",VERSION);
X	clrtoeol();
X	mvaddstr(LINES-1,0,"  type ? for help");
X	clrtoeol();
X	mvaddstr(LINES-2,0,"  type Q to quit");
X	clrtoeol();
X	if(country==0) mvaddstr(LINES-3,COLS-20,"nation..GOD  ");
X	else {
X		mvprintw(LINES-3,COLS-20,"nation...%s",ntn[country].name);
X		mvprintw(LINES-2,COLS-20,"treasury.%d",ntn[country].tgold);
X		mvprintw(LINES-1,COLS-20,"score....%d",ntn[country].score);
X	}
X}
X
X/* parse */
Xparse()
X{
X	register int i;
X	char name[20];
X	char passwd[12];
X	int ocountry;
X
X	switch(getch()) {
X	case '':	/*redraw the screen*/
X		redraw=TRUE;
X		break;
X	case 'a':	/*army report*/
X		redraw=TRUE;
X		armyrpt();
X		break;
X	case 'A':	/*adjust army*/
X		redraw=TRUE;
X		adjarm();
X		break;
X	case 'b':	/*move south west*/
X		xcurs--;
X		ycurs++;
X		break;
X	case 'B':	/*budget*/
X		redraw=TRUE;
X		budget();
X		break;
X	case 'c':	/*change nation stats*/
X		redraw=TRUE;
X		change();
X		break;
X	case 'C':	/*construct*/
X		construct();
X		break;
X	case 'd':	/*change display*/
X		newdisplay();
X		break;
X	case 'D':	/*draft*/
X		draft();
X		break;
X	case 'f': /*report on ships and load/unload*/
X		redraw=TRUE;
X		fleetrpt();
X		break;
X	case 'H':	/*scroll west*/
X		xcurs-=((COLS-22)/4);
X		break;
X	case 'h':	/*move west*/
X		xcurs--;
X		break;
X	case 'J':	/*scroll down*/
X		ycurs+=((LINES-5)/2);
X		break;
X	case 'j':	/*move down*/
X		ycurs++;
X		break;
X	case 'k':	/*move up*/
X		ycurs--;
X		break;
X	case 'K':	/*scroll up*/
X		ycurs-=((LINES-5)/2);
X		break;
X	case 'l':	/*move east*/
X		xcurs++;
X		break;
X	case 'L':	/*scroll east*/
X		xcurs+=((COLS-22)/4);
X		break;
X	case 'm': 	/*move selected item to new x,y */
X		redraw=TRUE;
X		mymove();
X		prep();
X		break;
X	case 'M': 	/*magic*/
X		redraw=TRUE;
X		domagic();
X		break;
X	case 'n':	/*move south-east*/
X		ycurs++;
X		xcurs++;
X		break;
X	case 'N':	/*read newspaper */
X		redraw=TRUE;
X		newspaper();
X		break;
X	case 'p':	/*pick*/
X		selector+=2;
X		if((mvinch(selector,COLS-21))!='>') selector=0;
X		break;
X	case 'P':	/*production*/
X		redraw=TRUE;
X		produce();
X		break;
X	case 'Q':	/*quit*/
X	case 'q':	/*quit*/
X		done=1;
X		break;
X	case 'r': 	/*redesignate*/
X		redraw=TRUE;
X		redesignate();
X		break;
X		/*list*/
X	case 'R': 	/*Read Messages*/
X		redraw=TRUE;
X		rmessage();
X		refresh();
X		break;
X	case 's':	/*score*/
X		redraw=TRUE;
X		showscore();
X		break;
X	case 'S':	/*diplomacy screens*/
X		diploscrn();
X		redraw=TRUE;
X		break;
X	case 'u':	/*move north-east*/
X		ycurs--;
X		xcurs++;
X		break;
X	case 'W': 	/*message*/
X		redraw=TRUE;
X		wmessage();
X		break;
X	case 'y':	/*move north-west*/
X		ycurs--;
X		xcurs--;
X		break;
X	case 'Z':	/*move civilians up to 2 spaces*/
X		redraw=TRUE;
X		moveciv();
X		break;
X	case 'z':	/*login as new user */
X		fprintf(fexe,"NGOLD\t%d \t%d \t%d \t0 \t0 \t%s\n",XNAGOLD ,country,ntn[country].tgold,"null");
X		redraw=TRUE;
X		fprintf(fexe,"NIRON\t%d \t%d \t%d \t0 \t0 \t%s\n",XNAIRON ,country,ntn[country].tiron,"null");
X		fprintf(fexe,"NRGOLD\t%d \t%d \t%d \t0 \t0 \t%s\n",XNARGOLD ,country,ntn[country].jewels,"null");
X		standout();
X		clear();
X		mvaddstr(0,0,"change login to : ");
X		standend();
X		refresh();
X		echo();
X		scanw("%s",name);
X		noecho();
X
X		ocountry=country;
X		country=(-1);
X		if(strcmp(name,"god")==0) country=0;
X		else for(i=1;i<NTOTAL;i++)
X			if((strcmp(name,ntn[i].name)==0)&&(ntn[i].active>=1))
X				country=i;
X
X		if(country==(-1)) {
X			mvaddstr(2,0,"name not found");
X			country=ocountry;
X			break;
X		}
X
X		/*get password*/
X		mvaddstr(2,0,"what is your password:");
X		refresh();
X		getstr(passwd);
X		strcpy(name,crypt(passwd,SALT));
X
X		if((strncmp(name,ntn[country].passwd,PASSLTH)!=0)&&(strncmp(name,ntn[0].passwd,PASSLTH)!=0)){
X			mvaddstr(3,0,"sorry:");
X			refresh();
X			country=ocountry;
X			break;
X		}
X
X		readdata();
X		startgold = ntn[country].tgold;
X		execute();
X		updmove(ntn[country].race);
X		/*go to that nations capital*/
X		if(country!=0) {
X			if(ntn[country].capx>15) {
X				xcurs=15;
X				xoffset= (ntn[country].capx-15);
X			}
X			else {
X				xcurs= ntn[country].capx;
X				xoffset= 0;
X			}
X			if(ntn[country].capy>10) {
X				ycurs=10;
X				yoffset= (ntn[country].capy-10);
X			}
X			else {
X				yoffset= 0;
X				ycurs= ntn[country].capy;
X			}
X		}
X		break;
X	case '?':	/*display help screen*/
X		redraw=TRUE;
X		help();
X		break;
X	default:
X		beep();
X	}
X}
X
Xmakeside()
X{
X	int i;
X	int found=0,nvyfnd=0;
X	int enemy;
X	int y;
X	short armynum;
X	short nvynum;
X	int count;
X	int nfound=0;
X
X	/*clear side if you cant see it as you are out of bounds*/
X	if(inch()==' ') {
X		for(i=0;i<LINES-3;i++){
X			move(i,COLS-21);
X			clrtoeol();
X		}
X		return;
X	}
X
X	/*clear top right hand side each new sector*/
X	for(count=0;count<11;count++){
X		move(count,COLS-21);
X		clrtoeol();
X	}
X
X	/*check for your armies*/
X	for(armynum=0;armynum<MAXARM;armynum++){
X		/*show any of your armies in sector*/
X		if((ASOLD>0)&&(AXLOC==XREAL)&&(AYLOC==YREAL)) {
X			if(nfound<5) {
X				mvaddch(nfound*2,COLS-21,'>');
X				if(selector==nfound*2) standout();
X				mvprintw(nfound*2,COLS-20,"army %d: %d men  ",armynum,ASOLD);
X				mvprintw(nfound*2+1,COLS-20," mv:%d st:%s",AMOVE,*(soldname+ASTAT));
X				clrtoeol();
X				standend();
X				nfound++;
X			}
X			else mvaddstr(10,COLS-20,"MORE...");
X		}
X		if((occ[XREAL][YREAL]!=0)&&(occ[XREAL][YREAL]!=country)&&((SOWN==country)||((ASOLD>0)&&(AXLOC<=XREAL+1)&&(AXLOC>=XREAL-1)&&(AYLOC<=YREAL+1)&&(AYLOC>=YREAL-1)))) found=1;
X	}
X
X	for(nvynum=0;nvynum<MAXNAVY;nvynum++){
X		if(((NWAR+NMER)!=0)&&(NXLOC==XREAL)&&(NYLOC==YREAL)) {
X			if(nfound<6) {
X				mvaddstr(nfound*2,COLS-21,">");
X				if(selector==nfound*2) standout();
X				mvprintw(nfound*2,COLS-20,"navy %d: move %d",nvynum,NMOVE);
X				clrtoeol();
X				mvprintw(nfound*2+1,COLS-20," war:%d mer:%d",NWAR,NMER);
X				clrtoeol();
X				standend();
X				nfound++;
X			}
X			else mvaddstr(10,COLS-20,"MORE...");
X		}
X		if((occ[XREAL][YREAL]!=0)&&(occ[XREAL][YREAL]!=country)&&(sct[XREAL][YREAL].altitude==WATER)&&(NWAR+NMER>0)&&(NXLOC<=XREAL+1)&&(NXLOC>=XREAL-1)&&(NYLOC<=YREAL+1)&&(NYLOC>=YREAL-1)) nvyfnd=1;
X	}
X
X	count=0;
X	if(found==1) for(i=0;i<NTOTAL;i++) {
X		if(magic(i,HIDDEN)!=1){
X			enemy=0;
X			for(armynum=0;armynum<MAXARM;armynum++){
X				if((i!=country)&&(ntn[i].arm[armynum].xloc==XREAL)&&(ntn[i].arm[armynum].yloc==YREAL)&&(ntn[i].arm[armynum].sold>0)) enemy+=ntn[i].arm[armynum].sold;
X			}
X			if(enemy>0) {
X				if(magic(country,SPY)==1)
X					mvprintw(nfound*2+count,COLS-20,"%s: %d men  ",ntn[i].name,enemy);
X				else if(magic(i,THE_VOID)==1){
X				mvprintw(nfound*2+count,COLS-20,"%s: ?? men  ",ntn[i].name);
X				clrtoeol();
X				}
X				else mvprintw(nfound*2+count,COLS-20,"%s: %d men  ",ntn[i].name,(enemy*(rand()%60+70)/100));
X				count++;
X			}
X		}
X	}
X	if(nvyfnd==1) for(i=0;i<MAXNTN;i++) {
X		if(magic(i,HIDDEN)!=1){
X			for(nvynum=0;nvynum<MAXNAVY;nvynum++){
X				if((ntn[i].arm[nvynum].xloc==XREAL)&&(ntn[i].arm[nvynum].yloc==YREAL)&&(ntn[i].arm[nvynum].sold>0)){
X					if(magic(country,SPY)==1){
X						mvprintw(nfound*2+count,COLS-20,"%s: %d ships  ",ntn[i].name,ntn[i].nvy[nvynum].warships+ntn[i].nvy[nvynum].merchant);
X					}
X					else if(magic(i,THE_VOID)==1){
X					mvprintw(nfound*2+count,COLS-20,"%s: ?? ships",ntn[i].name);
X					clrtoeol();
X					}
X					else mvprintw(nfound*2+count,COLS-20,"%s: %d ships  ",ntn[i].name,(ntn[i].nvy[nvynum].warships+ntn[i].nvy[nvynum].merchant)*(rand()%6+7)/10);
X					count++;
X				}
X			}
X		}
X	}
X
X	standend();
X	mvprintw(11,COLS-20,"x is %d  ",XREAL);
X	mvprintw(11,COLS-11,"y is %d  ",YREAL);
X
X	if((country!=0)&&(sct[XREAL][YREAL].altitude=='~')){
X		for(y=12;y<=20;y++) mvaddstr(y,COLS-20,"                    ");
X		mvaddstr(14,COLS-9,"WATER");
X	}
X	else {
X	if((country!=0)&&(country!=sct[XREAL][YREAL].owner)&&(magic(sct[XREAL][YREAL].owner,THE_VOID)==1)){
X		for(y=13;y<=20;y++) mvaddstr(y,COLS-20,"                    ");
X	}
X	else {
X
X		for(y=13;y<=14;y++) mvaddstr(y,COLS-20,"                    ");
X
X		for(i=0;i<=7;i++)
X			if(sct[XREAL][YREAL].designation==*(des+i)){
X			mvprintw(13,COLS-20,"%s",*(desname+i));
X			clrtoeol();
X			}
X
X		if((sct[XREAL][YREAL].owner==country)||(country==0))
X		mvprintw(15,COLS-20,"people: %6d",sct[XREAL][YREAL].people);
X		else 	
X		mvprintw(15,COLS-20,"people: %6d",sct[XREAL][YREAL].people*(rand()%60+70)/100);
X
X		if((sct[XREAL][YREAL].owner==country)||(sct[XREAL][YREAL].owner==0)||(sct[XREAL][YREAL].owner>=MAXNTN)){
X			mvprintw(17,COLS-20,"gold is:   %3d",sct[XREAL][YREAL].gold);
X			mvprintw(18,COLS-20,"iron is:   %3d",sct[XREAL][YREAL].iron);
X			if(sct[XREAL][YREAL].fortress>0){
X			mvprintw(19,COLS-20,"fortress:   %2d",sct[XREAL][YREAL].fortress);
X			}
X			else mvaddstr(19,COLS-20,"               ");
X		}
X		else {
X		for(y=17;y<=19;y++) mvaddstr(y,COLS-20,"                    ");
X		}
X	}
X
X	standout();
X	if(sct[XREAL][YREAL].owner==0) mvaddstr(12,COLS-20,"unowned");
X	else mvprintw(12,COLS-20,"owner: %s",ntn[sct[XREAL][YREAL].owner].name);
X	standend();
X	clrtoeol();
X
X	for(i=0;i<=10;i++)
X		if(sct[XREAL][YREAL].vegitation==*(veg+i))
X		mvprintw(13,COLS-9,"%s",*(vegname+i));
X
X	if(sct[XREAL][YREAL].owner!=0) for(i=1;i<=8;i++)
X		if(ntn[sct[XREAL][YREAL].owner].race==*(races+i)[0]){
X		mvprintw(14,COLS-20,"%s",*(races+i));
X		clrtoeol();
X		}
X
X	for(i=0;i<=4;i++)
X		if(sct[XREAL][YREAL].altitude==*(ele+i))
X		mvprintw(14,COLS-9,"%s",*(elename+i));
X	}
X
X	if(movecost[XREAL][YREAL]<0) 
X	mvaddstr(16,COLS-20,"YOU CAN'T ENTER HERE");
X	else
X	mvprintw(16,COLS-20,"move cost:  %2d      ",movecost[XREAL][YREAL]);
X
X}
X
Xoffmap()
X{
X	redraw=FALSE;
X	/*set offset offsets can not be < 0*/
X	if(xcurs<1){
X		if(XREAL<=0) {
X			xoffset=0;
X			xcurs=0;
X		}
X		else {
X			redraw=TRUE;
X			xoffset-=15;
X			xcurs+=15;
X		}
X	}
X	else if(xcurs >= (COLS-22)/2){
X		if(XREAL<MAPX) {
X			redraw=TRUE;
X			xoffset+=15;
X			xcurs-=15;
X		}
X	}
X	if(XREAL>=MAPX) xcurs=MAPX-1-xoffset;
X	if(xoffset<0) xoffset=0;
X	if(xcurs<0) xcurs=0;
X	else if(xcurs >= (COLS-22)/2) {
X		redraw=TRUE;
X		xoffset+=15;
X		xcurs-=15;
X	}
X
X	if(ycurs<1){
X		if(YREAL<=0) {
X			yoffset=0;
X			ycurs=0;
X		}
X		else {
X			redraw=TRUE;
X			ycurs+=15;
X			yoffset-=15;
X		}
X	}
X	else if(ycurs >= LINES-5){
X		if(YREAL<MAPY) {
X			redraw=TRUE;
X			yoffset+=15;
X			ycurs-=15;
X		}
X	}
X	if(YREAL>=MAPY) ycurs=MAPY-1-yoffset;
X	if(yoffset<0) yoffset=0;
X	if(ycurs<0) ycurs=0;
X	else if(ycurs >= LINES - 5) {
X		redraw=TRUE;
X		yoffset+=15;
X		ycurs-=15;
X	}
X}
END_OF_main.c
if test 17234 -ne `wc -c <main.c`; then
    echo shar: \"main.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\" \(17114 characters\)
sed "s/^X//" >reports.c <<'END_OF_reports.c'
X/*conquest is copyrighted 1986 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/*	screen subroutines	*/
X
X/*include files*/
X#include <ctype.h>
X#include "header.h"
X
Xextern FILE *fexe;
Xextern short country;
Xextern int startgold;
X
X/*report on armies and allow changes*/
Xarmyrpt()
X{
X	int i,j;
X	int chg;
X	short army;
X	int men;
X	int oldx,oldy;
X	short oldarmy;
X	int done=0;
X	int position;
X	int isgod=0;
X	int count;    /*number of armies on current screen */
X	short armynum=0;    /*current nation id */
X	if(country==0) {
X		standout();
X		isgod=1;
X		clear();
X		mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X		clrtoeol();
X		standend();
X		refresh();
X		echo();
X		scanw("%hd",&country);
X		if(country<0||country>NTOTAL) return;
X		noecho();
X	}
X	armynum=0;
X	/*new army screen*/
X	while(done==0) {
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
X		position=5;
X		count=0;
X		while((armynum<MAXARM)&&(count!=6)){
X			if(ASOLD>0) {
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			}
X			armynum++;
X		}
X		if(armynum>=MAXARM) done=1;
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=1;
X		if (army=='\n'){
X			mvaddstr(16,0,"WHAT ARMY DO YOU WANT TO CHANGE:");
X			clrtoeol();
X			refresh();
X			echo();
X			scanw("%hd",&armynum);
X			noecho();
X			if((armynum<0)||(armynum>MAXARM)) return;
X			mvaddstr(18,0,"1) CHANGE STATUS, 2) TRANSFER / MERGE, 3) SPLIT ARMY, 4) DISBAND ARMY:");
X			clrtoeol();
X			if(isgod==1) mvaddstr(20,0,"5) LOCATION, 6) SOLDIERS:");
X			refresh();
X			switch(getch()){
X			case '1':
X				mvaddstr(21,0,"1=MARCH, 2=SCOUT, 3=ATTACK, 4=DEFEND, 5=GARRISON");
X				clrtoeol();
X				refresh();
X				scanw("%d",&chg);
X				if(chg<1) return;
X				if(chg>5) return;
X				if((chg==2)&&(ASOLD>25)){
X					clear();
X					mvaddstr(12,(COLS/2)-6,"NEED < 25 MEN TO SCOUT");
X					mvaddstr(13,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
X					refresh();
X					getch();
X					if(isgod==1) country=0;
X					return;
X				}
X				else if((chg>0)&&(chg<7)) {
X					ASTAT=chg; 
X					AADJSTAT;
X				}
X				break;
X			case '2':
X				oldx=AXLOC;
X				oldy=AYLOC;
X				oldarmy=armynum;
X				mvaddstr(22,0,"TO WHAT ARMY: ");
X				clrtoeol();
X				refresh();
X				echo();
X				scanw("%hd",&armynum);
X				if(armynum==oldarmy) {
X					mvprintw(23,0,"SORRY -- SAME (%d,%d",armynum,oldarmy);
X					refresh();
X					getch();
X				}
X				else if((armynum<0)||(armynum>MAXARM)){
X					mvprintw(23,0,"SORRY -- INVALID ARMY %d",armynum);
X					refresh();
X					getch();
X				}
X				else if(ntn[country].arm[oldarmy].stat==SCOUT){
X					mvaddstr(23,0,"SORRY -- ORIGIN ARMY IS SCOUTING");
X					refresh();
X					getch();
X				}
X				else if(ASTAT==SCOUT){
X					mvaddstr(23,0,"SORRY -- TARGET ARMY IS SCOUTING");
X					refresh();
X					getch();
X				}
X				else if((oldx==AXLOC)&&(oldy==AYLOC)&&(ASOLD>0)) {
X					ASOLD+= ntn[country].arm[oldarmy].sold;
X					ntn[country].arm[oldarmy].sold=0;
X					AADJMEN;
X					if(AMOVE>ntn[country].arm[oldarmy].smove)
X						AMOVE=ntn[country].arm[oldarmy].smove;
X					AADJMOV;
X					armynum=oldarmy;
X					AADJMEN;
X				}
X				else {
X					mvaddstr(23,0,"Armies not together (hit any key) ");
X					refresh();
X					getch();
X				}
X				noecho();
X				break;
X			case '3':
X				mvaddstr(21,0,"HOW MANY MEN TO SPLIT: ");
X				clrtoeol();
X				refresh();
X				echo();
X				scanw("%d",&men);
X				noecho();
X				if((armynum<0)||(armynum>MAXARM)) return;
X				if((men<25)||(ASOLD-men<25)){
X					mvaddstr(23,0,"TOO FEW MEN TRANSFERED OR LEFT");
X					refresh();
X					getch();
X				}
X				else if(men<ASOLD){
X					ASOLD-=men;
X					AADJMEN;
X					oldarmy=armynum;
X					oldx=AXLOC;
X					oldy=AYLOC;
X					armynum=(-1);
X					for(army=0;army<MAXARM;army++)
X						if(ntn[country].arm[army].sold==0){
X							if(armynum==(-1)) armynum=army;
X						}
X					/*overflow*/
X					if(armynum==(-1)) {
X						mvaddstr(23,0,"TOO MANY ARMIES: ");
X						armynum=oldarmy;
X						ASOLD+=men;
X						AADJMEN;
X					}
X					else {
X						AMOVE=ntn[country].arm[oldarmy].smove;
X						ASTAT=DEFEND;
X						AXLOC=oldx;
X						AYLOC=oldy;
X						ASOLD=men;
X						AADJSTAT;
X						AADJMEN;
X						AADJLOC;
X						AADJMOV;
X					}
X				}
X				else {
X					mvaddstr(23,0,"TOO MANY MEN : ");
X					refresh();
X					getch();
X				}
X				break;
X			case '4':
X				if(sct[AXLOC][AYLOC].owner!=country){
X					mvaddstr(21,0,"YOU DONT OWN SECTOR-- hit return");
X					clrtoeol();
X					refresh();
X					getch();
X				}
X				else if(magic(country,VAMPIRE)==1){
X					mvaddstr(21,0,"VAMPIRES CANT DISBAND--hit return");
X					clrtoeol();
X					refresh();
X					getch();
X				}
X				else {
X					i=AXLOC;
X					j=AYLOC;
X					sct[i][j].people+=ASOLD;
X					ASOLD=0;
X					AADJMEN;
X					SADJCIV2;
X				}
X				break;
X			case '5':
X				if(isgod==1){
X					/*X LOCATION*/
X					mvaddstr(21,0,"WHAT IS THE NEW X LOC: ");
X					refresh();
X					echo();
X					scanw("%d",&men);
X					AXLOC=men;
X					/*Y LOCATION*/
X					mvaddstr(21,0,"WHAT IS THE NEW Y LOC: ");
X					refresh();
X					scanw("%d",&men);
X					noecho();
X					AYLOC=men;
X					AADJLOC;
X				}
X				break;
X			case '6':
X				if(isgod==1){
X					/*SOLDIERS*/
X					mvaddstr(21,0,"WHAT IS THE NEW TOTAL SOLDIERS: ");
X					refresh();
X					echo();
X					scanw("%d",&men);
X					noecho();
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==1) country=0;
X}
X
Xbudget()
X{
X	register int xsctr,ysctr;
X	short armynum,nvynum;
X
X	int ingold=0,iniron=0,infood=0,incap=0,incity=0;
X	int revgold=0,reviron=0,revfood=0;
X	int expship=0,expsold=0;
X	int isgod=0;
X	if(country==0) {
X		isgod=1;
X		clear();
X		mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X		clrtoeol();
X		refresh();
X		echo();
X		scanw("%hd",&country);
X		noecho();
X	}
X	clear();
X	standout();
X	mvaddstr(0,(COLS/2)-10,"NEXT YEARS BUDGET ESTIMATES");
X	standend();
X
X	for(xsctr=0;xsctr<MAPX;xsctr++) for(ysctr=0;ysctr<MAPX;ysctr++) if(sct[xsctr][ysctr].owner==country) {
X		if(sct[xsctr][ysctr].designation==DFARM){
X			infood+= sct[xsctr][ysctr].people;
X			revfood+=todigit(sct[xsctr][ysctr].vegitation)*sct[xsctr][ysctr].people*TAXFOOD/100;
X		}
X		else if(sct[xsctr][ysctr].designation==DMINE) {
X			iniron+= sct[xsctr][ysctr].people;
X			reviron+=sct[xsctr][ysctr].iron*sct[xsctr][ysctr].people*TAXIRON/100;
X		}
X		else if(sct[xsctr][ysctr].designation==DGOLDMINE) {
X			ingold+= sct[xsctr][ysctr].people;
X			revgold+=sct[xsctr][ysctr].gold*sct[xsctr][ysctr].people*TAXGOLD/100;
X		}
X		else if(sct[xsctr][ysctr].designation==DCAPITOL) incap+= sct[xsctr][ysctr].people;
X		else if(sct[xsctr][ysctr].designation==DCITY)    incity+= sct[xsctr][ysctr].people;
X	}
X	for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) expsold+= ASOLD;
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	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, "%5d people in gold mines:%8ld",ingold,revgold);
X	mvprintw(8,30, "%5d people in iron mines:%8ld",iniron,reviron);
X	mvprintw(9,30, "%5d people in farms:     %8ld",infood,revfood);
X	mvprintw(10,30,"%5d people in capital:   %8d",incap,incap*TAXCAP/100);
X	mvprintw(11,30,"%5d people in cities:    %8d",incity,incity*TAXCITY/100);
X	standout();
X	mvprintw(12,30,"%5d people TOTAL INCOME: %8d",ntn[country].tciv,revfood+reviron+revgold+(incap*TAXCAP/100)+(incity*TAXCITY/100));
X	standend();
X
X	if(magic(country,VAMPIRE)!=1) 
X	mvprintw(14,30,"%5d troops at %5d each:%8d",expsold,SOLDMAINT,expsold*SOLDMAINT);
X	else
X	mvprintw(14,30,"%5d troops at     0 each:0",expsold);
X	mvprintw(15,30,"%5d ships at %5d each: %8d",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:            %8d",(expsold*SOLDMAINT)+(expship*SHIPMAINT)+startgold-ntn[country].tgold);
X	mvprintw(18,30,"NET INCOME:                %8d",revfood+reviron+revgold+(incap*TAXCAP/100)+(incity*TAXCITY/100)-(expsold*SOLDMAINT)-(expship*SHIPMAINT)-startgold+ntn[country].tgold);
X	mvaddstr(20,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
X	standend();
X	refresh();
X	getch();
X
X	if(isgod==1) country=0;
X}
X
Xproduce()
X{
X	register int xsctr,ysctr;
X	short armynum;
X	int civilians=0, military=0;
X	int ingold=0 ,indesert=0,iniron=0,infood=0;
X	int revgold=0,reviron=0,revdesert=0,revfood=0;
X	int isgod=0;
X
X	if(country==0) {
X		isgod=1;
X		clear();
X		mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X		clrtoeol();
X		refresh();
X		echo();
X		scanw("%hd",&country);
X		noecho();
X	}
X	clear();
X	standout();
X	mvaddstr(0,(COLS/2)-20,"NEXT YEARS PRODUCTION ESTIMATES");
X	standend();
X
X	for(xsctr=0;xsctr<MAPX;xsctr++) for(ysctr=0;ysctr<MAPX;ysctr++) if(sct[xsctr][ysctr].owner==country) {
X		civilians += sct[xsctr][ysctr].people;
X
X		if(sct[xsctr][ysctr].designation==DFARM){
X			infood+= sct[xsctr][ysctr].people;
X			revfood+=todigit(sct[xsctr][ysctr].vegitation)*sct[xsctr][ysctr].people;
X		}
X		else if(sct[xsctr][ysctr].designation==DMINE) {
X			iniron+= sct[xsctr][ysctr].people;
X			reviron+=sct[xsctr][ysctr].iron*sct[xsctr][ysctr].people;
X		}
X		else if(sct[xsctr][ysctr].designation==DGOLDMINE) {
X			ingold+= sct[xsctr][ysctr].people;
X			revgold+=sct[xsctr][ysctr].gold*sct[xsctr][ysctr].people;
X		}
X		else if(((magic(country,DERVISH)==1)||(magic(country,DESTROYER)==1))&&((sct[xsctr][ysctr].vegitation==ICE)||(sct[xsctr][ysctr].vegitation==DESERT))&&(sct[xsctr][ysctr].people>0)) {
X			indesert+= sct[xsctr][ysctr].people;
X			revdesert+=6*sct[xsctr][ysctr].people;
X		}
X	}
X	if(magic(sct[xsctr][ysctr].owner,MINER)==1) {
X		mvaddstr(20,0,"MINER");
X		reviron*=2;
X		revgold*=2;
X	}
X
X	standout();
X	mvprintw(5,0,  "nation name is ...%s   ",ntn[country].name);
X	mvprintw(6,0,  "gold in treasury..$%8d",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, "%5d people in farms..%8d tons",infood,revfood);
X	if((magic(country,DERVISH)==1)||(magic(country,DESTROYER)==1)) {
X	mvprintw(11,0, "dervish: %5d people..%8d tons",indesert,revdesert);
X	}
X	for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) military+=ASOLD;
X	mvprintw(12,0, "%5d civilians eat....%8d tons",civilians,civilians);
X	mvprintw(13,0, "%5d soldiers  eat....%8d tons",military,military*2);
X	mvprintw(15,0, "TOTAL NET FOOD.........%8d tons",revfood+revdesert-civilians-military*2);
X	if(ntn[country].tfood+revfood+revdesert-civilians-military*2<FOODTHRESH*civilians) {
X	mvprintw(16,0, "TOTAL NEXT YEARS FOOD..%8ld tons",ntn[country].tfood+revfood+revdesert-civilians-military*2);
X	}
X	else{
X	mvprintw(16,0, "TOTAL NEXT YEARS FOOD..%8ld tons",FOODTHRESH*civilians);
X	mvprintw(17,0, "REVENUE FROM EXCESS....%8ld gold",ntn[country].tfood+revfood+revdesert-civilians-military*2-FOODTHRESH*civilians);
X	}
X
X	mvaddstr(8,40,  "OTHER PRODUCTION");
X	mvprintw(10,40, "jewels owned is............%8d",ntn[country].jewels);
X	mvprintw(11,40, "%5d people in goldmines :%8d",ingold,revgold);
X	mvprintw(12,40, "ESTIMATE NEXT YEARS JEWELS %8d",ntn[country].jewels+revgold);
X	mvprintw(14,40, "iron ore owned is..........%8ld",ntn[country].tiron);
X	mvprintw(15,40, "%5d people in iron mines:%8d",iniron,reviron);
X	mvprintw(16,40, "ESTIMATE NEXT YEARS IRON   %8ld",ntn[country].tiron+reviron);
X
X	mvaddstr(20,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
X	refresh();
X	getch();
X
X	if(isgod==1) country=0;
X}
X
X/*report on ships and allow changes */
Xfleetrpt()
X{
X	short navy;
X	short oldx,oldy,oldnavy;
X	short done=0;
X	int position;
X	int count;       /*screen number */
X	short nvynum=0;    /*current ship id */
X	short wships,mships;
X	int isgod=0;
X	if(country==0) {
X		standout();
X		isgod=1;
X		clear();
X		mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X		clrtoeol();
X		standend();
X		refresh();
X		echo();
X		scanw("%hd",&country);
X		if(country<0||country>NTOTAL) return;
X		noecho();
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=1;
X		refresh();
X		if(isgod==1) country=0;
X		return;
X	}
X	nvynum=0;
X	while(done==0) {
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=1;
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=1;
X		if (navy=='\n'){
X			mvaddstr(16,0,"WHAT NAVY DO YOU WANT TO CHANGE:");
X			clrtoeol();
X			refresh();
X			echo();
X			scanw("%hd",&nvynum);
X			noecho();
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				echo();
X				scanw("%hd",&nvynum);
X				if(nvynum==oldnavy) {
X					mvprintw(23,0,"SORRY -- SAME (%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				noecho();
X				break;
X			case '2':
X				mvaddstr(21,0,"HOW MANY WARSHIPS TO SPLIT: ");
X				clrtoeol();
X				refresh();
X				echo();
X				scanw("%hd",&wships);
X				mvaddstr(21,0,"HOW MANY MERCHANTS TO SPLIT: ");
X				clrtoeol();
X				refresh();
X				scanw("%hd",&mships);
X				noecho();
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==1) country=0;
X}
END_OF_reports.c
if test 17114 -ne `wc -c <reports.c`; then
    echo shar: \"reports.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f run -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"run\"
else
echo shar: Extracting \"run\" \(256 characters\)
sed "s/^X//" >run <<'END_OF_run'
X#RUN CONQUEST WHEN AT COMMAND DOES NOT EXIST
X#date 
X#while [ 1 ] 
X#do  
X#$(EXECUTABLE)/conquest -x 
X#/bin/sleep 86400 
X#done 
X
X#please read up on the at command,  this now, and 24 hours from the time run.
Xdate 
Xconquest -x
Xat now+1day << 'EOF' 
X	run
XEOF; 
END_OF_run
if test 256 -ne `wc -c <run`; then
    echo shar: \"run\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 3 \(of 5\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 5 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