[comp.sources.games] v06i088: 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 88
Archive-name: conquer4/Part06
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 6 (of 14)."
# Contents:  commands.c nations txt2
# Wrapped by billr@saab on Thu Jun 15 15:20:14 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'commands.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'commands.c'\"
else
echo shar: Extracting \"'commands.c'\" \(32409 characters\)
sed "s/^X//" >'commands.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 "header.h"
X#include "data.h"
X#include <ctype.h>
X
X#ifdef SYSMAIL
X#include <sys/types.h>
X#endif SYSMAIL
Xextern long conq_mail_size;
X
Xextern FILE *fexe;			/*execute file pointer*/
Xextern short country;
Xextern short selector;
Xextern short pager;
Xextern short xcurs,ycurs,xoffset,yoffset;
Xextern short redraw;
X
Xint roads_this_turn = 0;
X
X/* routine to determine if the given designation is ok; TRUE for ok */
Xint
Xdesg_ok(prtflag, desg, sptr)
X	int prtflag;
X	char desg;
X	struct	s_sector	*sptr;
X{
X	/* check vegetation */
X	if((desg!=DNODESIG)&&(desg!=DROAD)&&(desg!=DFORT)
X	&&(desg!=DSTOCKADE)&&(tofood(sptr,country)<DESFOOD)) {
X		if(prtflag) errormsg("vegetation too sparse");
X		return(FALSE);
X	}
X
X	/* don't allow the same designation */
X	if(desg==sptr->designation) {
X		if(prtflag) errormsg("Hey, get your act together!  There is already one there.");
X		return(FALSE);
X	}
X
X	/* check for city/capitol being made into something else */
X	if((desg!=DRUIN)
X	&&((desg!=DCAPITOL && sptr->designation==DCITY)
X	||sptr->designation==DCAPITOL)) {
X		if(prtflag) {
X			char buf[80];
X			sprintf(buf,"Must first burn down city/capitol (designate as '%c')",DRUIN);
X			errormsg(buf);
X		}
X		return(FALSE);
X	}
X
X	/* check for proper population */
X	if((sptr->people<500)
X	&&(desg==DCAPITOL || desg==DCITY || desg==DTOWN)) {
X		if(prtflag) errormsg("Need 500 people to build a city or town");
X		return(FALSE);
X	}
X
X	/* only god may create pirate  */
X	if(desg==DBASECAMP) {
X		if(prtflag) errormsg("A Pirate Cove?? Are you serious?!");
X		return(FALSE);
X	}
X
X	/* should not appear in display list */
X	if (prtflag==FALSE &&
X	((desg==DSPECIAL && sptr->tradegood!=TG_stones) || desg==DNODESIG))
X		return(FALSE);
X
X	if (desg==DRUIN) {
X		if(sptr->designation!=DCITY&&sptr->designation!=DCAPITOL) {
X			if(prtflag) errormsg("Ruins may only come from cities or capitols");
X			return(FALSE);
X		}
X	}
X
X	if (desg==DCAPITOL || desg==DCITY) {
X		if((desg==DCAPITOL && sptr->designation!=DCITY)
X		&& sptr->designation!=DTOWN && sptr->designation!=DRUIN) {
X			if(prtflag) errormsg("You can't build a city from that!");
X			return(FALSE);
X		}
X	}
X
X	/* have this for now... may be too harsh */
X	if (desg==DMILL || desg==DGRANARY) {
X		if((sptr->tradegood != TG_none)
X		&&(*(tg_stype + sptr->tradegood) != DFARM)
X		&&(*(tg_stype + sptr->tradegood) != 'x')) {
X			if(prtflag) errormsg("You can't have one of those here!");
X			return(FALSE);
X		}
X	}
X
X	if (desg==DUNIVERSITY || desg==DLUMBERYD) {
X		if((sptr->tradegood != TG_none)
X		&&(*(tg_stype + sptr->tradegood) != desg)
X		&&(*(tg_stype + sptr->tradegood) != 'x')) {
X			if(prtflag) errormsg("You can't have one of those here!");
X			return(FALSE);
X		}
X	}
X
X	if(desg==DMINE || desg==DGOLDMINE) {
X		if( !tg_ok( country, sptr )) {
X			if(prtflag) errormsg("Your people refuse to be unemployed");
X			return(FALSE);
X		}
X		if((desg==DMINE && sptr->metal==0 )
X		||( desg==DGOLDMINE && sptr->jewels==0)) {
X			if(prtflag) errormsg("Your people refuse to be unemployed");
X			return(FALSE);
X		}
X	}
X
X	if((desg==DSPECIAL)&&(magic(country,SUMMON)!=TRUE)) {
X		if(prtflag) errormsg("You are gonna need SUMMON power to use those stones!");
X		return(FALSE);
X	}
X
X	return(TRUE);
X}
X
X/*change current hex designation*/
Xvoid
Xredesignate()
X{
X	char	newdes;
X	char	tgtype[NAMELTH+1];
X	struct s_sector *sptr= &sct[XREAL][YREAL];
X	short	x,y;
X	long	metal=0;
X	int	isgod=FALSE;
X
X	if(country==0){
X		isgod=TRUE;
X		country=sptr->owner;
X		curntn= &ntn[country];
X
X		clear_bottom(0);
X		mvaddstr(LINES-4,0,"SUPER USER: CHANGE (v)egetation, (e)levation, (d)esig, (o)wner, (t)radegood");
X		refresh();
X		switch(getch()){
X		case 'd':
X			/* fall into normal redesignation command */
X			break;
X		case 'e':
X			/*simple contour map definitions*/
X			mvprintw(LINES-3,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
X			&&newdes!=HILL&&newdes!=CLEAR) {
X				reset_god();
X				return;
X			}
X			sptr->altitude=newdes;
X			if((newdes==PEAK)||(newdes==WATER)) {
X				sptr->owner=0;
X				sptr->people=0;
X				sptr->fortress=0;
X			}
X			/*will fall through as must change vegetation*/
X		case 'v':
X			/*vegetation types*/
X			mvprintw(LINES-3,7,"VEGETATIONS: change to %c, %c, %c, %c, %c, %c, %c, %c, %c, %c, %c or %c?",
X			VOLCANO,DESERT,TUNDRA,BARREN,LT_VEG,
X			GOOD,WOOD,FOREST,JUNGLE,SWAMP,ICE,NONE);
X			refresh();
X			newdes=getch();
X			if(newdes!=VOLCANO
X			&&newdes!=DESERT&&newdes!=TUNDRA
X			&&newdes!=BARREN&&newdes!=LT_VEG
X			&&newdes!=NONE&&newdes!=GOOD
X			&&newdes!=WOOD&&newdes!=FOREST&&newdes!=JUNGLE
X			&&newdes!=SWAMP&&newdes!=ICE) {
X				reset_god();
X				return;
X			}
X			sptr->vegetation=newdes;
X			if(tofood(sptr,0)!=0)
X				sptr->designation=newdes;
X			reset_god();
X			return;
X		case 'o':
X			mvprintw(LINES-3,7,"what nation owner:");
X			refresh();
X			x = get_country();
X			if (x<NTOTAL) sptr->owner=x;
X			reset_god();
X			return;
X		case 't':
X			x=TRUE;
X			while(x==TRUE) {
X				mvaddstr(LINES-2,7,"new sector tradegood type:");
X				clrtoeol();
X				refresh();
X				get_nname(tgtype);
X				if(strlen(tgtype)==0) {
X					reset_god();
X					return;
X				}
X				for(y=0;x==TRUE && y<=TG_none;y++)
X				if(strcmp(tg_name[y],tgtype)==0) x=FALSE;
X			}
X			y--;
X			if((y!=TG_none)&&(y>END_NORMAL)) {
X				mvaddstr(LINES-1,7,"new sector value: ");
X				refresh();
X				x = get_number();
X				if(x<100 && x>=0)
X				if(y>END_MINE) {
X					sptr->jewels = (char)x;
X					sptr->metal = 0;
X				} else {
X					sptr->metal  = (char)x;
X					sptr->jewels = 0;
X				}
X			} else {
X				sptr->jewels=0;
X				sptr->metal=0;
X			}
X			sptr->tradegood= (char)y;
X			reset_god();
X			return;
X		default:
X			reset_god();
X			return;
X		}
X	}
X
X	if((SOWN!=country)&&(isgod==FALSE)) {
X		errormsg("Hey!  You don't own that sector!");
X		return;
X	}
X	clear_bottom(0);
X
X	mvaddstr(LINES-4,0,"Possible sector designations: ");
X	x = 30;
X	y = LINES-4;
X	for(newdes=0; *(des+newdes) != '0'; newdes++ ) {
X		if((isgod==TRUE)||desg_ok(FALSE,*(des+newdes),sptr)) {
X			mvprintw(y,x,"(%c)",*(des+newdes));
X			x+=4;
X			if(x>COLS-15) {
X				x=5;
X				y++;
X			}
X		}
X	}
X
X	if((sptr->tradegood != TG_none)
X	&&( *(tg_stype+sptr->tradegood) != 'x')
X	&&( isgod==TRUE || desg_ok(FALSE,*(tg_stype+sptr->tradegood),sptr)) )
X	mvprintw(y,x,"(%c special=>%c)",DSPECIAL,*(tg_stype+sptr->tradegood));
X
X	mvaddstr(++y,0,"<Any other key to return>  What new designation:");
X	refresh();
X
X	/*read answer*/
X	if((newdes=getch())==DSPECIAL) {
X		if((sptr->tradegood == TG_none)
X		||( *(tg_stype+sptr->tradegood) == 'x')||(isgod==FALSE
X		&& !desg_ok(FALSE,*(tg_stype+sptr->tradegood),sptr)) ) {
X			errormsg("no special designation possible" );
X			if(isgod==TRUE) reset_god();
X			return;
X		} else
X			newdes = *(tg_stype + sptr->tradegood);
X	}
X
X	for(x=0; *(des+x) != '0'; x++ )
X		if(newdes == *(des+x)) break;
X
X	if(*(des+x) == '0') {
X		if(isgod==TRUE) reset_god();
X		return;
X	}
X
X	/* validate designation */
X	if((isgod==FALSE)&&!desg_ok(TRUE,newdes,sptr)) {
X		return;
X	}
X
X	if (newdes == DROAD && isgod==FALSE) {
X		if( sptr->people < 100 ) {
X			errormsg("Need 100+ people to build a road!");
X			return;
X		}
X		roads_this_turn++;
X		if (roads_this_turn>2) {
X			roads_this_turn=2;
X			errormsg("Only two roads a turn!  Let the road crews sleep!!");
X			return;
X		}
X	}
X
X	/* do not need metal to build a capitol from a city */
X	if((newdes==DFORT)||(newdes == DTOWN)) metal=DESCOST;
X	else if((newdes == DCITY)
X	||(newdes == DCAPITOL && sptr->designation!=DCITY)) metal=5*DESCOST;
X
X	if((newdes!=DTOWN)&&(newdes!=DFORT)&&(newdes!=DCITY)&&(newdes!=DCAPITOL)){
X		/*decrement treasury*/
X		if((newdes==DRUIN)||(newdes==DDEVASTATED)) {
X			DEVASTATE(XREAL,YREAL);
X		} else{
X			sptr->designation=newdes;
X		}
X		SADJDES;
X		if(newdes == DSTOCKADE)
X			curntn->tgold-=STOCKCOST*(1-isgod);
X		else
X			curntn->tgold-=DESCOST*(1-isgod);
X
X	} else if((isgod==FALSE)&&(curntn->metals<metal)) {
X		errormsg("Not enough metal for city, town, or fort");
X	} else if((newdes==DCITY)||(newdes==DCAPITOL)) {
X
X		if(sptr->designation==DRUIN){
X			curntn->tgold-=10*DESCOST*(1-isgod);
X			curntn->metals-=metal/2*(1-isgod);
X		} else {
X			curntn->tgold-=20*DESCOST*(1-isgod);
X			if(newdes==DCITY || sptr->designation!=DCITY)
X				curntn->metals-=metal*(1-isgod);
X		}
X		x=curntn->capx;	/* need this for SADJDES2 */
X		y=curntn->capy;
X		/* can only have one capitol */
X		if(newdes==DCAPITOL){
X			if (sct[x][y].owner==country) {
X				sct[x][y].designation=DCITY;
X				SADJDES2;
X			}
X			curntn->capx=XREAL;
X			curntn->capy=YREAL;
X		}
X		sptr->designation=newdes;
X		SADJDES;
X	} else if((newdes==DFORT)||(newdes==DTOWN)){
X		curntn->tgold-=10*DESCOST*(1-isgod);
X		curntn->metals-=metal*(1-isgod);
X		sptr->designation=newdes;
X		SADJDES;
X	} else	errormsg("Serious error: What designation are you?");
X	if(isgod==TRUE) reset_god();
X}
X
X/*build fort or ship-type */
Xvoid
Xconstruct()
X{
X	int	tmpvar,tmpvar2,onboard;
X	long	cost;
X	int	armbonus;
X	int	x,y;
X	short	nvynum=0;
X	short	shipsize,amount;
X	short	isgod=FALSE;
X	char	type;
X
X	clear_bottom(0);
X	if(country==0){
X		isgod=TRUE;
X		country=sct[XREAL][YREAL].owner;
X		curntn= &ntn[country];
X	}
X
X	if(sct[XREAL][YREAL].owner!=country) {
X		errormsg("You do not own");
X		if(isgod==TRUE) reset_god();
X		return;
X	}
X	if((isgod==FALSE)&&(sct[XREAL][YREAL].people<=500)) {
X		errormsg("You need over 500 people to construct");
X		return;
X	}
X
X	if((isgod==FALSE) && (curntn->tgold < 0 )) {
X		errormsg("You are broke");
X		return;
X	}
X	tmpvar=FALSE;
X	for(x=XREAL-1;x<=XREAL+1;x++)
X		for(y=YREAL-1;y<=YREAL+1;y++)
X			if(ONMAP(x,y) && sct[x][y].altitude==WATER)
X				tmpvar=TRUE;
X
X	if((sct[XREAL][YREAL].designation==DTOWN)
X	||(sct[XREAL][YREAL].designation==DFORT)
X	||(sct[XREAL][YREAL].designation==DCAPITOL)
X	||(sct[XREAL][YREAL].designation==DCITY)) {
X		/*calculate cost for fort*/
X		cost=FORTCOST;
X		if(isgod==TRUE) cost=0;
X		else for(x=1;x<=sct[XREAL][YREAL].fortress;x++)
X			cost*=2;
X
X		if(sct[XREAL][YREAL].designation==DTOWN) armbonus=TOWNSTR;
X		else if(sct[XREAL][YREAL].designation==DFORT) armbonus=FORTSTR;
X		else if(sct[XREAL][YREAL].designation==DCAPITOL) armbonus=CITYSTR;
X		else if(sct[XREAL][YREAL].designation==DCITY) armbonus=CITYSTR;
X		if(magic(country,ARCHITECT)==TRUE) armbonus*=2;
X
X		if(tmpvar)
X		mvprintw(LINES-4,0,"<f>ortify sector (+%d%%/%ld talons); <b>uild or <r>epair ships?: ",armbonus,cost);
X		else
X		mvprintw(LINES-4,0,"<f>ortify sector (+%d%% - %ld talons):",armbonus,cost);
X		refresh();
X		type=getch();
X	} else {
X		errormsg("Must construct in town, city, or fortress");
X		if (isgod==TRUE) reset_god();
X		return;
X	}
X
X	/* construct ships*/
X	if((type=='b')||(type=='r')) {
X		/*check if next to sea*/
X		if((tmpvar==FALSE)||(sct[XREAL][YREAL].designation==DFORT)){
X			errormsg("not in a harbor");
X			if(isgod==TRUE) reset_god();
X			return;
X		}
X
X		nvynum=getselunit()-MAXARM;
X		if(type=='r') {
X			if((nvynum>=MAXNAVY)||(nvynum<0)){
X				errormsg("INVALID NAVY");
X				if(isgod==TRUE) reset_god();
X				return;
X			}
X
X			if (P_NCREW==SHIPCREW) {
X				errormsg("You may only &^#$! repair damaged fleets!!!");
X				if(isgod==TRUE) reset_god();
X				return;
X			}
X			clear_bottom(0);
X			shipsize = flthold(nvynum);
X			mvprintw(LINES-4,0,"Repairing Fleet (%d)",nvynum);
X			mvprintw(LINES-4,30,"Storage Units [%d]",shipsize);
X			mvprintw(LINES-3,0,"crew per unit = %d",(int)P_NCREW);
X			mvprintw(LINES-3,30,"max crew per unit = %d",SHIPCREW);
X			mvaddstr(LINES-2,0,"How many crew per unit do you wish to add:");
X			clrtoeol();
X			refresh();
X			amount = (short) get_number();
X
X			/* find cost of repairs on all ships */
X			cost = 0;
X			for(tmpvar=N_LIGHT;tmpvar<=N_HEAVY;tmpvar++) {
X				cost += (tmpvar+1)*WARSHPCOST*P_NWAR(tmpvar);
X				cost += (tmpvar+1)*MERSHPCOST*P_NMER(tmpvar);
X				cost += (tmpvar+1)*GALSHPCOST*P_NGAL(tmpvar);
X			}
X			cost *= amount / SHIPCREW;
X
X			if(isgod==TRUE)				cost=0;
X			else if(magic(country,SAILOR)==TRUE)	cost/=2L;
X
X			if( curntn->tgold < cost ) {
X				errormsg("NOT ENOUGH GOLD");
X				if(isgod==TRUE) reset_god();
X				return;
X			}
X			if( sct[XREAL][YREAL].people < amount * shipsize) {
X				errormsg("NOT ENOUGH CIVILIANS IN SECTOR");
X				if(isgod==TRUE) reset_god();
X				return;
X			}
X			if( SHIPCREW < P_NCREW + amount ){
X				errormsg("THAT WOULD EXCEED MAXIMUM SHIP CREW");
X				if(isgod==TRUE) reset_god();
X				return;
X			}
X
X			curntn->tgold -= cost;
X			sct[XREAL][YREAL].people -= amount*shipsize;
X			P_NCREW += (unsigned char) amount;
X			NADJCRW;
X			SADJCIV;
X
X			if(isgod==TRUE) reset_god();
X			return;
X		}
X
X		mvaddstr(LINES-3,0,"Do you wish to raise a new fleet? (y or n)");
X		clrtoeol();
X		refresh();
X		if(getch()=='y') nvynum=(-1);
X
X		clear_bottom(0);
X		if(nvynum<0) {
X			nvynum=0;
X			x=(-1);
X			while((x==(-1))&&(nvynum<MAXNAVY)) {
X				if(P_NWSHP==0 && P_NMSHP==0 && P_NGSHP==0) {
X					x=nvynum;
X					P_NWSHP=0;
X					P_NMSHP=0;
X					P_NGSHP=0;
X					P_NCREW=0;
X					P_NARMY=MAXARM;
X					P_NPEOP=0;
X					NADJHLD;
X					NADJCRW;
X					NADJWAR;
X					NADJMER;
X					NADJGAL;
X				}
X				nvynum++;
X			}
X			nvynum=x;
X			if(nvynum<0){
X				errormsg("NO FREE NAVIES");
X				if(isgod==TRUE) reset_god();
X				return;
X			} else
X			mvprintw(LINES-1,0,"Raising New Fleet (%d)",nvynum);
X		} else mvprintw(LINES-1,0,"Adding to Fleet (%d)",nvynum);
X
X		/* process type first to be consistant with drafting */
X		mvaddstr(LINES-4,0,"What ship type to construct: (W)arship (M)erchant (G)alley?");
X		refresh();
X		/*
X		 *  Note:  3 and 6 hard-coded for ship sizes based on
X		 *   0 = light   1 = medium  2 = heavy
X		 *         Bad technique, but it is not worth saying
X		 *   (N_HEAVY-N_LIGHT+1) everywhere.
X		 */
X		switch(getch()) {
X		case 'w':
X		case 'W':
X			shipsize=0;
X			break;
X		case 'g':
X		case 'G':
X			shipsize=3;
X			break;
X		case 'm':
X		case 'M':
X			shipsize=6;
X			break;
X		case ' ':
X			if(isgod==TRUE) reset_god();
X			return;
X		default:
X			errormsg("Invalid Ship Type");
X			if(isgod==TRUE) reset_god();
X			return;
X		}
X
X		mvaddstr(LINES-3,0,"What ship class to construct: (L)ight  (M)edium");
X		if(sct[XREAL][YREAL].designation!=DTOWN) addstr("  (H)eavy?");
X		else addstr("?");
X		refresh();
X		switch(getch()) {
X		case 'l':
X		case 'L':
X			shipsize+=N_LIGHT;
X			break;
X		case 'm':
X		case 'M':
X			shipsize+=N_MEDIUM;
X			break;
X		case 'h':
X		case 'H':
X			if(sct[XREAL][YREAL].designation==DTOWN) {
X				errormsg("Towns cannot construct heavy ships");
X				if(isgod==TRUE) reset_god();
X				return;
X			}
X			shipsize+=N_HEAVY;
X			break;
X		case ' ':
X			if(isgod==TRUE) reset_god();
X			return;
X		default:
X			errormsg("Invalid Ship Class");
X			if(isgod==TRUE) reset_god();
X			return;
X		}
X
X		mvaddstr(LINES-2,0,"How many ships to construct?");
X		refresh();
X		amount = (short) get_number();
X
X		/*sanity checks*/
X		if((amount>N_MASK)) amount=0;
X		if (amount==0)
X		{
X			if(isgod==TRUE) reset_god();
X			return;
X		}
X
X		/* 6 and 3 hard coded ... see above comment */
X		cost = (long) amount * ( shipsize%3 + 1 );
X		if (shipsize>=6) {
X			cost *= MERSHPCOST;
X		} else if (shipsize>=3) {
X			cost *= GALSHPCOST;
X		} else {
X			cost *= WARSHPCOST;
X		}
X
X		if(isgod==TRUE)				cost=0;
X		else if(magic(country,SAILOR)==TRUE)	cost/=2L;
X
X		if((cost > curntn->tgold) && (cost > 0)) {
X			errormsg("sorry - not enough talons");
X			return;
X		}
X
X		if( sct[XREAL][YREAL].people < amount * SHIPCREW ){
X			errormsg("NOT ENOUGH CIVILIANS IN SECTOR");
X			if(isgod==TRUE) reset_god();
X			return;
X		}
X
X		if((nvynum>=0)&&(nvynum<MAXNAVY)) {
X			clear_bottom(0);
X			tmpvar = amount*SHIPCREW*(shipsize%3+1)
X				+ flthold(nvynum)*P_NCREW;
X			onboard = P_NPEOP*fltmhold(nvynum);
X
X			if (shipsize>=6) {
X				shipsize %= 3;
X				tmpvar2 = NADD_MER(amount);
X			} else if (shipsize>=3) {
X				shipsize %= 3;
X				tmpvar2 = NADD_GAL(amount);
X			} else {
X				shipsize %= 3;
X				tmpvar2 = NADD_WAR(amount);
X			}
X
X			/* check for bad build */
X			if (tmpvar2==FALSE) {
X				errormsg("Too many such ships in fleet.");
X				if(isgod==TRUE) reset_god();
X				return;
X			}
X
X			/* crew average based on number of holding units */
X			P_NCREW = (unsigned char)( tmpvar / flthold(nvynum) );
X
X			sct[XREAL][YREAL].people-=amount*(shipsize+1)*SHIPCREW;
X			curntn->tgold -= cost;
X
X			P_NXLOC =XREAL;
X			P_NYLOC =YREAL;
X			P_NMOVE=0;
X
X			mvprintw(LINES-4,0,"Fleet (%2d):     Warships  = [Light %2hd/Medium %2hd/Heavy %2hd]",nvynum,P_NWAR(N_LIGHT),P_NWAR(N_MEDIUM),P_NWAR(N_HEAVY));
X			mvprintw(LINES-3,0,"                Merchants = [Light %2hd/Medium %2hd/Heavy %2hd]",P_NMER(N_LIGHT),P_NMER(N_MEDIUM),P_NMER(N_HEAVY));
X			mvprintw(LINES-2,0,"Avg Crew[%3d]   Galleys   = [Light %2hd/Medium %2hd/Heavy %2hd]",(int)P_NCREW,P_NGAL(N_LIGHT),P_NGAL(N_MEDIUM),P_NGAL(N_HEAVY));
X
X			if(fltmhold(nvynum)>0)
X			P_NPEOP = (unsigned char) (onboard/fltmhold(nvynum));
X			else P_NPEOP = 0;
X			SADJCIV;
X			NADJCRW;
X			NADJWAR;
X			NADJMER;
X			NADJGAL;
X			NADJHLD;
X			NADJLOC;
X			NADJMOV;
X			mvprintw(LINES-2,65,"HIT ANY KEY");
X			refresh();
X			getch();
X
X		} else errormsg("ERROR!!!!!!!!!!!!!");
X	}
X	/* construct fortification points*/
X	else if(type=='f'){
X		/* can only go into debt as much as the nation has jewels */
X		if ((curntn->tgold - cost) >= ((-1)*10*curntn->jewels)) {
X			mvprintw(LINES-2,5,"you build +%d%% fort points for %ld gold",armbonus,cost);
X			curntn->tgold-=cost;
X			sct[XREAL][YREAL].fortress++;
X			INCFORT;
X			errormsg("");
X		} else errormsg("you are broke");
X	}
X	else errormsg("invalid input error");
X
X	if(isgod==TRUE) reset_god();
X	refresh();
X}
X
X/*DRAFT IF IN A CITY*/
Xvoid
Xdraft()
X{
X	short	armynum,x,y,i;
X	long	men=0,mercs;
X	short	army=(-1), isgod=FALSE, newtype=0;
X	long	i_cost, e_cost;
X	char	ch;
X
X	clear_bottom(0);
X	if(country==0) {
X		isgod=TRUE;
X		country=sct[XREAL][YREAL].owner;
X		curntn= &ntn[country];
X	} else if(sct[XREAL][YREAL].owner!=country) {
X		errormsg("You do not own");
X		return;
X	}
X
X	if((sct[XREAL][YREAL].designation!=DTOWN)
X	&&(sct[XREAL][YREAL].designation!=DCAPITOL)
X	&&(sct[XREAL][YREAL].designation!=DCITY)) {
X		errormsg("must raise in towns/cities/capitols");
X		if(isgod==TRUE) reset_god();
X		return;
X	}
X	if(curntn->tgold <= 0){
X		errormsg("you are broke");
X		if(isgod==TRUE) reset_god();
X		return;
X	}
X
X	if((sct[XREAL][YREAL].designation==DTOWN)
X	&&(sct[XREAL][YREAL].people*(2*CITYLIMIT+(curntn->tsctrs/2))<curntn->tciv)){
X		mvprintw(LINES-1,0,"need %d people in sector: hit any key",curntn->tciv/(2*CITYLIMIT+(curntn->tsctrs/2)));
X		refresh();
X		getch();
X		if(isgod==TRUE) reset_god();
X		return;
X	}
X
X	/*ask what type of unit*/
X	y=LINES-2;
X	mvaddstr(y,0,"options: 1) spy 2) scout");
X	clrtoeol();
X	x=25;
X	for(i=0;i<=NOUNITTYPES;i++){
X		if(unitvalid(i)==TRUE) {
X			mvprintw(y,x+2,"%s",*(shunittype+i));
X			mvprintw(y,x,"(%c)",*(shunittype+i)[0]);
X			x+= strlen( *(shunittype+i) ) +3;
X			if(x>COLS-10){
X				x=0;
X				y++;
X			}
X		}
X	}
X	move(y,x);
X	clrtoeol();
X	if((magic(country,WARRIOR)==TRUE)
X	||(magic(country,WARLORD)==TRUE)
X	||(magic(country,CAPTAIN)==TRUE))
X	mvaddstr(LINES-3,0,"(Warrior = 1/2 enlist cost) what type of unit do you want:");
X	else
X	mvaddstr(LINES-3,0,"what type of unit do you want to raise:");
X
X	clrtoeol();
X	refresh();
X	ch = getch();
X	for(newtype=0;newtype<=NOUNITTYPES;newtype++)
X		if(ch == *(shunittype+newtype)[0]) break;
X
X	if((newtype == NOUNITTYPES+1 )||(unitvalid(newtype)==FALSE)) {
X		if( ch == '1' ) newtype=A_SPY;
X		else if( ch == '2' ) newtype=A_SCOUT;
X		else {
X			errormsg("Invalid type");
X			if (isgod==TRUE) reset_god();
X			return;
X		}
X	}
X	clear_bottom(0);
X
X	/* marines and sailors may only be drafted in harbors */
X	if(newtype==A_MARINES || newtype==A_SAILOR) {
X		i=FALSE;
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) i=TRUE;
X
X		/* not a harbor */
X		if (i==FALSE) {
X			if (newtype==A_MARINES)
X			errormsg("Huh?  What would marines do without the water?");
X			else errormsg("You gotta be kinding!?  Sailors on land?");
X			if (isgod==TRUE) reset_god();
X			return;
X		}
X	}
X
X	/*raise an untrained army */
X	i = FALSE;
X	if( newtype==A_SPY || newtype==A_SCOUT ) {
X		men=1;
X	} else {
X		mvprintw(LINES-3,0,"how many %s do you wish to raise:",unittype[newtype]);
X		clrtoeol();
X		refresh();
X		men = get_number();
X		if(men<=0) {
X			if (isgod==TRUE) reset_god();
X			return;
X		}
X	}
X
X	/* i_people*256 is initial people -> can  draft up to following */
X  	/*	draftable = max_draft - already drafted */
X  	/*		  = imen/4 - ( imen - people)   */
X  	/*		  = -3/4 * imen + people)  	*/
X	/*	192 comes from 3*256/4 			*/
X	if((men > sct[XREAL][YREAL].people - (sct[XREAL][YREAL].i_people*192))
X  	||(sct[XREAL][YREAL].i_people <= 0)) {
X  		if(sct[XREAL][YREAL].i_people <= 0)
X  		errormsg("error: sector wasn't city at beginning of turn");
X		else errormsg("error: raising too many soldiers");
X		if(isgod==TRUE) reset_god();
X		return;
X	}
X
X	/* check that you dont have too many mercenaries */
X	mercs=0;
X	if(newtype == A_MERCENARY){
X		int totalsolds=0;
X		for(armynum=0;armynum<MAXARM;armynum++){
X			if(P_ATYPE<MINLEADER) {
X				if(P_ATYPE==A_MERCENARY) mercs+=P_ASOLD;
X				totalsolds+=P_ASOLD;
X			}
X		}
X		if(men+mercs > (totalsolds+men)/2) {
X			errormsg("you would then have more than 50%% mercenaries");
X			if(isgod==TRUE) reset_god();
X			return;
X		}
X		if(mercgot+men > MERCMEN/NTOTAL) {
X			errormsg("there are not that many mercanaries available");
X			if(isgod==TRUE) reset_god();
X			return;
X		}
X	}
X
X	e_cost= (long) *(u_encost+newtype) * men;
X	i_cost= (long) *(u_enmetal+newtype) * men;
X
X	/*magiced get 1/2 enlistment costs*/
X	if((magic(country,WARRIOR)==TRUE)
X	||(magic(country,WARLORD)==TRUE)
X	||(magic(country,CAPTAIN)==TRUE))
X		e_cost/=2;
X
X	if((magic(country,SAPPER)==TRUE)
X	&&((newtype==A_SIEGE)||(newtype==A_CATAPULT))){
X		e_cost/=2;
X		i_cost/=2;
X	}
X
X	/*check to see if enough gold*/
X	if(e_cost >  curntn->tgold) {
X		errormsg("You don't have enough talons");
X		if(isgod==TRUE) reset_god();
X		return;
X	} else if(i_cost > curntn->metals) {
X		mvprintw(LINES-2,0,"You don't have %ld metal",i_cost);
X		clrtoeol();
X		refresh();
X		getch();
X		if(isgod==TRUE) reset_god();
X		return;
X	} else {
X		move(LINES-2,0);
X		clrtoeol();
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 || newtype==A_SPY || newtype==A_SCOUT) {
X			army = -1;
X		} else {
X			/*if different types, must raise new army*/
X			if((newtype == P_ATYPE)&&(P_ASTAT!=ONBOARD)) {
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			else army=(-1);
X		}
X	}
X	if(army==(-1)) {
X		mvprintw(LINES-2,0,"(%s, gold talons=%ld, metal=%ld) raising a new army",*(unittype+newtype),e_cost,i_cost);
X		clrtoeol();
X		refresh();
X		sleep(1);
X
X		armynum=0;
X		while((army==(-1))&&(armynum<MAXARM)) {
X			if(P_ASOLD<=0) {
X				army=armynum;
X				P_ASOLD=0;
X				if( newtype==A_MILITIA )
X				P_ASTAT=MILITIA;/* new militia units=MILITIA */
X				else
X				P_ASTAT=DEFEND; /* set new armies to DEFEND */
X				AADJSTAT;
X				AADJMEN;
X			}
X			armynum++;
X		}
X		if(army==(-1)){
X			errormsg("NO FREE ARMIES");
X			if(isgod==TRUE) reset_god();
X			return;
X		}
X		armynum=army;
X	} else {
X		mvprintw(LINES-2,0,"(%s, gold talons=%ld, metal=%ld) adding to existing army",*(unittype+newtype),e_cost,i_cost);
X		clrtoeol();
X		refresh();
X		sleep(2);
X	}
X
X	if( newtype == A_SPY ) {
X		while(TRUE){
X			clear_bottom(0);
X			mvaddstr(LINES-3,0,"Spy Against What Nation: ");
X			refresh();
X			if((i = get_country())==(-1)) {
X				if (isgod==TRUE) reset_god();
X				return;
X			}
X			if(i==country) {
X				errormsg("What?  You don't even trust yourself?");
X				i=NTOTAL;
X			}
X			if(!(isntn(ntn[i].active))) {
X				errormsg("You can't spy against them");
X				i=NTOTAL;
X			}
X			if( i<NTOTAL && isactive(i)) break;
X		}
X		if(curntn->dstatus[i]!=UNMET) {
X			P_AYLOC = ntn[i].capy;
X			P_AXLOC = ntn[i].capx;
X			mvprintw(LINES-2,0,"The Spy Starts in %s's Capitol (%d,%d)",
X				ntn[i].name,P_AXLOC,P_AYLOC);
X			clrtoeol();
X		} else {
X			clear_bottom(0);
X			mvprintw(LINES-4,0,"You do not yet know where %s is",ntn[i].name);
X			mvaddstr(LINES-3,0,"Have the Spy start from this sector? [y or n]");
X			refresh();
X			if(getch()!='y') {
X				if(isgod==TRUE) reset_god();
X				return;
X			}
X			P_AYLOC = YREAL;
X			P_AXLOC = XREAL;
X			mvprintw(LINES-2,0,"Intelligence indicates that %s lies to the %s",ntn[i].name,
X				  *(directions+compass(P_AXLOC,P_AYLOC,ntn[i].capx,ntn[i].capy)));
X			clrtoeol();
X		}
X		errormsg("");
X		redraw=TRUE;
X	} else {
X		P_AYLOC=YREAL;
X		P_AXLOC=XREAL;
X	}
X	if( newtype == A_SPY || newtype == A_SCOUT ) {
X		P_ASTAT = SCOUT;
X		AADJSTAT;
X	}
X	P_ATYPE=newtype;
X	if(P_ATYPE != A_MERCENARY){
X		sct[XREAL][YREAL].people -= men;
X		SADJCIV;
X	} else {
X		mercgot += men;
X		AADJMERC;
X	}
X	AADJLOC;
X	P_AMOVE=0;
X	AADJMOV;
X	P_ASOLD+=men;
X	AADJMEN;
X	if(P_ASTAT>=NUMSTATUS) {
X		P_ASTAT=ATTACK;
X		AADJSTAT;
X	}
X	curntn->metals -= i_cost;
X	curntn->tgold -= e_cost;
X	makemap(); /* if display 'y' is set, this will show new army */
X	if(isgod==TRUE) reset_god();
X}
X
X/*go through msgfile not rewriting to temp messages you discard*/
X/* then move temp to msgfile*/
Xvoid
Xrmessage()
X{
X	int unlink();
X	FILE *mesgfp;
X	FILE *fptemp;
X	int i;
X	int count,msglen;
X	int contd;
X	int done=FALSE;
X	char tempfile[ 30 ];
X	char mesgfile[ 30 ];
X	char line[80], inpch;
X	char save[50][80];
X
X	/*open file*/
X	sprintf(tempfile,"%s%hd.tmp",msgfile,country);
X	if( (fptemp = fopen(tempfile,"w")) == NULL ) {
X		clear_bottom(0);
X		sprintf(mesgfile,"error: %s open",tempfile);
X		errormsg(mesgfile);
X		redraw=FALSE;
X		makebottom();
X		return;
X	}
X
X	sprintf(mesgfile,"%s%d",msgfile,country);
X	if ((mesgfp=fopen(mesgfile,"r"))==NULL) {
X	        (void) unlink (tempfile) ;
X		clear_bottom(0);
X		errormsg("no messages");
X		makebottom();
X		redraw=FALSE;
X		return;
X	}
X
X	/*read in file a line at at time*/
X	if(fgets(line,80,mesgfp)==NULL) {
X		done=TRUE;
X		redraw=FALSE;
X		clear_bottom(0);
X		errormsg("no messages");
X		makebottom();
X	}
X	if (done==FALSE) clear();
X	while(done==FALSE) {
X		contd=FALSE;
X		msglen=0;
X		count=3;
X		clear();
X		standout();
X		/*print to end of message*/
X		while(contd==FALSE) {
X			if(msglen<50) strcpy(save[msglen],line);
X			if(count==LINES-3) {
X				standout();
X				mvaddstr(LINES-3,(COLS/2)-8,"--- more ---");
X				standend();
X				refresh();
X				getch();
X				clear();
X				count=3;
X			}
X			mvprintw(count,0,"%s",line);
X			standend();
X			count++;
X			msglen++;
X			if(fgets(line,80,mesgfp)==NULL) contd=TRUE;
X			if(strncmp(line,"END",3)==0) contd=TRUE;
X		}
X		standout();
X		mvaddstr(LINES-3,(COLS/2)-22,"HIT ANY KEY TO CONTINUE");
X		mvaddstr(LINES-2,(COLS/2)-22,"HIT RETURN TO DELETE MESSAGE");
X		standend();
X		refresh();
X		inpch=getch();
X		if((inpch!='\n' && inpch!='\r')) {
X			for(i=0;i<msglen;i++) fputs(save[i],fptemp);
X			strcpy(line,"END\n");
X			fputs(line,fptemp);
X		}
X		if(fgets(line,80,mesgfp)==NULL) done=TRUE;
X	}
X	fclose(mesgfp);
X	fclose(fptemp);
X
X	/*IMPLEMENT A MOVE BETWEEN TMP FILE AND REAL FILE HERE*/
X	move_file( tempfile, mesgfile );
X#ifdef SYSMAIL
X	/* increase size to ensure mail check works */
X	conq_mail_size++;
X#endif SYSMAIL
X}
X
Xvoid
Xwmessage()
X{
X	int x,y;
X	int done=FALSE;
X	char ch;
X	char name[NAMELTH+1];
X	int temp=(-1);
X	int linedone;
X	char line[100];
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(1,0,"to post to the news, send to 'news':");
X	mvprintw(2,0,"Enter the name of the country to send to:");
X	refresh();
X	temp=get_country();
X
X	if( temp == (-2) ) {
X		strcpy(name,"news");
X	} else {
X		/* quick return on bad input */
X		if(temp==(-1) || temp>=NTOTAL
X		  || (!isntn(ntn[temp].active) && temp!=0))
X  			return;
X		strcpy(name,ntn[temp].name);	/* find nation name */
X	}
X
X	mailopen( temp );
X
X	move(0,0);
X	clrtoeol();
X	move(1,0);
X	clrtoeol();
X	move(2,0);
X	clrtoeol();
X	standout();
X	if(temp != -2)
X		mvprintw(3,(COLS-25)/2,"message to nation %s",name);
X	else
X		mvprintw(3,(COLS-25)/2,"message to all players");
X	mvprintw(LINES-2,(COLS-35)/2,"end with a return on a new line");
X	standend();
X
X
X	if(temp != -2) {
X		if (country==0)
X		fprintf(fm,"Message to %s from GOD (%s of year %d)\n",name,PSEASON(TURN),YEAR(TURN));
X		else	fprintf(fm,"Message to %s from %s (%s of year %d)\n",name,curntn->name,PSEASON(TURN),YEAR(TURN));
X	} else fprintf(fm,"5.----------\n");
X
X	y=6;
X	x=0;
X	refresh();
X	while(done==FALSE) {
X		linedone=FALSE;
X		ch=' ';
X		/*read line*/
X		while(linedone==FALSE){
X			/* check for delete or backspace */
X			if(ch=='\b' || ch=='\177'){
X				if(x>1) x--;
X				mvaddch(y,x,' ');
X				move(y,x);
X				line[x]=' ';
X				refresh();
X				ch=getch();
X			} else if((ch=='\n')||(ch=='\r')) linedone=TRUE;
X			else if(isprint(ch)&&(x<65)){
X				/*concatonate to end*/
X				line[x]=ch;
X				mvaddch(y,x,ch);
X				x++;
X				refresh();
X				ch=getch();
X			} else if (ch=='') {
X				refresh();
X				ch=getch();
X			} else	ch=getch();
X		}
X		if((ch!='\n')&&(ch!='\r')) {
X			mvaddch(y,x,ch);
X			line[x]=ch;
X			x++;
X		}
X		line[x]='\0';
X
X		/*write to file*/
X		if(x<=1) done=TRUE;
X		else if (temp != -2) fprintf(fm,"%s\n",line);
X		else {
X			if (country!=0) fprintf(fm,"5.%-9s:%s\n",curntn->name,line);
X			else fprintf(fm,"5.God      :%s\n",line);
X		}
X		x=0;
X		y++;
X	}
X	if (temp != -2) mailclose();
X	else {
X		mailok=FALSE;
X		fclose(fm);
X	}
X}
X
X/*strategic move of civilians...once only*/
Xvoid
Xmoveciv()
X{
X	long	people;
X	short	i,j;
X
X	clear_bottom(0);
X	if(sct[XREAL][YREAL].owner!=country){
X		errormsg("you do not own");
X		makebottom();
X		return;
X	}
X	else if(sct[XREAL][YREAL].people==0){
X		errormsg("nobody lives here!!!");
X		makebottom();
X		return;
X	}
X
X	mvprintw(LINES-4,0,"Sector contains %d people [cost 50 per civilian]",sct[XREAL][YREAL].people);
X	mvaddstr(LINES-3,0,"how many people to move?");
X	clrtoeol();
X	refresh();
X	people = get_number();
X	if((people<0)
X	||(people>sct[XREAL][YREAL].people)
X	||(people*50>curntn->tgold)){
X		errormsg("Sorry...Input error or you do not have the gold talons");
X		makebottom();
X		return;
X	}
X
X	mvprintw(LINES-4,0,"sector location is x=%d, y=%d",XREAL,YREAL);
X	clrtoeol();
X	mvaddstr(LINES-3,0,"what x location to move to?");
X	clrtoeol();
X	refresh();
X	i = get_number();
X
X	if((i-(XREAL))>2||(i-(XREAL))<-2) {
X		errormsg("sorry, can only move two sectors");
X		makebottom();
X		return;
X	}
X
X	mvaddstr(LINES-2,0,"what y location to move to?");
X	clrtoeol();
X	refresh();
X	j = get_number();
X	if((j-(YREAL)>2)||((YREAL)-j>2)) {
X		errormsg("sorry, can only move two sectors");
X	}
X	else if(sct[i][j].owner!=country){
X		errormsg("sorry, you dont own it...");
X	}
X	/*need to check move cost > 0 for sector*/
X	else if(movecost[i][j]<0){
X		errormsg("you can't enter there...");
X	}
X	else if ((i!=XREAL)||(j!=YREAL)){
X		curntn->tgold-=50*people;
X		sct[XREAL][YREAL].people-=people;
X		SADJCIV;
X		sct[i][j].people+=people;
X		SADJCIV2;
X	}
X	makebottom();
X}
X
Xint
Xarmygoto()
X{
X	short armynum=0,loop=0;
X	armynum=getselunit();
X	if((armynum<0)||(armynum>MAXARM)) armynum=0;
X	else armynum++;
X	/* move to next army with > 0 soldiers or army not in group */
X	while((armynum < MAXARM) && ((P_ASOLD <= 0) || (P_ASTAT>=NUMSTATUS)))
X		armynum++;
X	if(armynum >= MAXARM)  {
X		armynum=0;
X		if(P_ASOLD <= 0) return(0);
X	}
X	/*move to correct location*/
X	xcurs = P_AXLOC - xoffset;
X	ycurs = P_AYLOC - yoffset;
X	coffmap();
X
X	/*select correct unit*/
X	selector=0;
X	pager=0;
X	while((getselunit() != armynum) && (loop++ < 500)) {
X		selector+=2;
X		if(selector>=10) {
X			selector=0;
X			pager+=1;
X		}
X	}
X	return(1);
X}
X
Xint
Xnavygoto()
X{
X	short nvynum=0,loop=0;
X	nvynum=getselunit()-MAXARM;
X	if((nvynum<0)||(nvynum>MAXNAVY)) nvynum=0;
X	else nvynum++;
X	/* move to next nvy with > 0 soldiers*/
X	while ((nvynum < MAXNAVY) && (P_NMSHP==0) && (P_NWSHP==0)
X	&& (P_NGSHP == 0)) nvynum++;
X	if(nvynum >= MAXNAVY) {
X		nvynum=0;
X		if((P_NMSHP==0)&&(P_NWSHP==0)&&(P_NGSHP == 0)) return(0);
X	}
X	/*move to correct location*/
X	xcurs = P_NXLOC - xoffset;
X	ycurs = P_NYLOC - yoffset;
X	coffmap();
X
X	/*select correct unit*/
X	selector=0;
X	pager=0;
X	while(((getselunit()-MAXARM) != nvynum) && (loop++ < 500)) {
X		selector+=2;
X		if(selector>=10) {
X			selector=0;
X			pager+=1;
X		}
X	}
X	return(1);
X}
END_OF_FILE
if test 32409 -ne `wc -c <'commands.c'`; then
    echo shar: \"'commands.c'\" unpacked with wrong size!
fi
# end of 'commands.c'
fi
if test -f 'nations' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nations'\"
else
echo shar: Extracting \"'nations'\" \(3468 characters\)
sed "s/^X//" >'nations' <<'END_OF_FILE'
X# GAME MASTERS FILE ON NPC NATIONS:  COMPILE TIME ONLY
X#  comments are offset by a # sign in the first column
X#
X#  The following nations will be added to the world when it is created.
X#	This works for up to to MAXNTN nations (but then there is no room
X#	for players) and one nation is placed per MONSTER (see header.h)
X#	sectors.
X#
X# name 		:nations name
X#		:examples include Darboth Ummaya Rugar Jute Atlantis Iberia
X#		:Kuybyshev Avar Grodor Bantanya Fung Codor Delph Macitania
X# leader 	: permitted leaders are "dwarfking","elfking","elfdruid",
X#			"elfwizard","demon","dragon","wizard","priest",
X#			"shadow","king","priestking","wizard","demigod"
X# race   	:Character, ORC='O',ELF='E',DWARF='D',LZARD='L',HUMAN='H'
X#		:BRIGAND='P' BARBARIAN='B'
X# mark		:unique mark for race (ie & or ! or 1 or H...)
X# loc	 	:G,F,R  location (good,fair,random)
X# aplus 	:attack percentage plus (multiples of 10 (ie 10,20,30))
X# dplus		:defence percentage plus (multiples of 10 (ie 10,20,30))
X# maxmove 	:movement rate 
X# gold		:total gold at start
X# mil	 	:total military at start
X# points 	:total point score at start -> civilians are calculated from
X#               : points not allcoated to other things.  See Maxpts.  The
X#               : default is 40 points per nation
X# repro-rate    :reproduction rate of nation (percentage)
X# allignment    :(g)ood, (n)eutral, (e)vil, (i)solationist - for NPC Nations.
X#		:(G)ood, (N)eutral, (E)vil - for PC Nations.
X# x,y		:x and y values - read if you have read in a map to makeworld
X#               : good idea to keep -1s here for now.
X#
X#  THE NATIONS LISTED BELOW ARE CALIBRATED AS FOLLOWS
X#
X# isolationist: 320 	good: 250 	neutral: 320 	evil: 335
X# human: 420		elf: 260	dwarf:  260	orc: 285
X#
X# This represents a world geared to GOOD player nations
X#
X# Npc nations can have classes too (as follows):
X#	NPC	0 	KING	1	EMPEROR	2
X#	WIZARD	3 	PRIEST	4 	PIRATE	5 	TRADER	6
X#	WARLORD	7 	DEMON	8 	DRAGON	9 	SHADOW	10
X# Entering these values assures that class.
X# But leaders are of the appropriate types, as is scoring...
X#
X# format:     (note that offset by a space)
X#
X# name leader race mark loc atk def move gold mil pts repro allign x y class
X#########################################################################
Xargos    The_Ed     H A F 10 10  9  50000  1000 60 8  i -1 -1 1
Xanorian  Anudil     E a F 30 40  8  70000  1500 60 8  g -1 -1 3
Xbobland  Dogon      O B G 20 0   6  12000  1500 70 13 i -1 -1 9
Xdarboth  balrog     O D R 0  0   7  70000  1500 70 12 e -1 -1 8
Xedland   Debbra     H E R 10 15  12 30000  1000 60 8  g -1 -1 1
Xfung     Fungus     E F G 10 40  8  50000  1000 70 8  i -1 -1 1
Xgoldor   Train      D G F 10 15  8  30000  1000 70 8  n -1 -1 2
Xharo     Cesear     H H R 10 10  9  30000  1500 60 7  i -1 -1 1
Xjodoba   Ganalf     H J R 10 10  2  30000  1500 60 8  n -1 -1 3
Xlint     Lynne      E L F 20 30  8  50000  1500 70 10 g -1 -1 3
Xmuldor   Gilur      D M F 10 30  6  160000 1500 70 9  n -1 -1 1
Xnoria    Gloin      D N R 10 30  6  50000  1000 60 8  n -1 -1 1
Xtokus    Sumu       H T R 10 10  8  30000  1000 60 8  e -1 -1 1
Xwoooo    Nastus     O W F 10 10  10 60000  3500 75 13 e -1 -1 10
Xzaos     Dragonus   O Z R 20 0   8  12000  1500 70 14 e -1 -1 9
Xfrika    Frik       D f F 10 10  8  50000  1200 60 10 n -1 -1 1
Xamazon   Diana      E X F 10 10  8  50000  1200 60 10 e -1 -1 2
Xtasman   Obilisk    H t F 10 10  8  50000  1200 60 10 g -1 -1 3
Xsahara   Barbar     H S F 10 10  8  50000  1200 60 10 i -1 -1 4
END_OF_FILE
if test 3468 -ne `wc -c <'nations'`; then
    echo shar: \"'nations'\" unpacked with wrong size!
fi
# end of 'nations'
fi
if test -f 'txt2' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'txt2'\"
else
echo shar: Extracting \"'txt2'\" \(17703 characters\)
sed "s/^X//" >'txt2' <<'END_OF_FILE'
X                       MILITARY AND WAR IN CONQUER
X
XConquer permits both players and the computer to draft a variety
Xof unit types via the 'D'raft command.  Ships can be created via
Xthe 'C'onstruct command.  Units differ in combat ability, movement
Xrate, and costs.  Some unit types have prerequisite powers.  For
Xexample, as detailed on the next two tables, a archer unit requires
Xthe drafting nation to have ARCHER power, and costs 100 talons and 
X100 metal points per soldier to draft.  Archer units move at 1 times
Xthe nations default movement rate, and fight at +10% if they are
Xdefending.  The special list shows that archers gain special combat
Xadvantages in certain circumstances.  In other words, archers cost the 
Xsame as infantry, but fight slightly better (so if you have ARCHER power, 
Xyou will draft Archers, not Infantry).
XEND
X                                UNIT TYPES
X
X                   costs           combat                power
X              enlist maintain  attack defend move  metal prerequisites
X
XMILITIA         $50    $20     -40     -25     0     0
XGOBLIN          $70    $20     -15     -15    x1     80    MI_MONST
XORC             $85    $50      +0      +0    x1     80    MI_MONST
XINFANTRY        $100   $50      +0      +0    x1     100
XSAILOR          $100   $50      +0      +0     0     100
XMARINES         $100   $50      +5      +0     0     100   SAILOR
XARCHER          $100   $50      +0     +10    x1     100   ARCHER
XZOMBIE          $100   $0      -15     -15    x1     100   VAMPIRE
XURUK-HAI        $125   $50      +5      +5    x1     150   AV_MONST
XNINJA           $125   $50     +20      +0    x1     150   NINJA
XPHALANX         $150   $50     +10     +10    x1     150   CAPTAIN
XOLOG-HAI        $180   $75     +15     +15    x1     150   BREEDER+AV_MONST
XLEGION          $180   $75     +20     +20    x1     150   WARLORD
XDRAGOON         $300   $200    +10     +10    x1.5   100   
XMERCENARY       $225   $100      *       *    x1     0
XTROLL           $225   $100    +25     +15    x1     200   MA_MONST
XEND
X                        UNIT TYPES - CONTINUED
X
X                   costs           combat                power
X              enlist maintain  attack defend move  metal prerequisites
X
XELITE           $225   $100    +20     +20  x1.3     200   ARMOR
XLT_CAVALRY      $275   $175    +20     +20  x1.5     100   CAVALRY
XHV_CAVALRY      $450   $225    +30     +30    x2     300   CAVALRY
XCATAPULT        $600   $250    -20     -20   x.5    1000
XSIEGE           $600   $250    -20     -20   x.5    1000
XROC             $600   $250    +20     +30    x1     300   AVIAN
XKNIGHT          $600   $250    +40     +40    x2     600   ARMOR & CAVALRY
XELEPHANT        $600   $250    +50     +50   x.5     600   DERVISH
XGRIFFON         $800   $250    +40     +50  x1.5     400   AVIAN
XSPY           $10000  $2000    -30     -30    x1       0
XSCOUT           $100   $100    -30     -30    x2       0
XEND
X                          ADDITIONAL NOTES ON UNITS
X
XINFANTRY     are the default units. You can't get them if you have any powers 
X             (ARCHER, VAMPIRE, or any MONSTER) which change your default unit.
XDRAGOONS     are cavalry that fight on foot as regular infantry.  They move
X             as cavalry but fight as infantry.
XARCHERS      gain bonuses when fighting cavalry or near fortifcations.  They
X             get an additional +15%*(percent of cavalry/knight opponents)
X             and gain +15% defending & +5% attacking forts/cities... They
X             don't get the bonus vs cavalry if they are in a fort.
XMERCENARIES  are drafted from the world mercenary pool and thus don't deplete 
X             your nations population when hired.  Only 1/2 your troops can
X             be mercenaries.  They must be paid their enlistment cost to 
X             disband them.  They have a tendency to run away from combats if
X             outnumbered.  Mercenary combat bonuses are independent of the
X             drafting nations bonus, and are based on an average worldwide
X             mercenary combat bonus.
XCAVALRY/KNIGHTS get -20% attacking or defending fortress.
X
Xnote.  you can purchase non catapult/seige/knight/elephant units even if 
Xyou have inadequate iron reserves if you pay triple their enlistment cost.
XEND
X                          ADDITIONAL NOTES ON UNITS p.2
X
XSIEGE_ENGINES add +1%/20 men *TO WHOLE COMBAT* attacking fortress (max +30%)
X             siege engines can damage any fortifications they attack.
XCATAPULTS    add +1%/40 men *TO WHOLE COMBAT* in normal combat (max +10%)
X             add +1%/20 men *TO WHOLE COMBAT* when defending castle (max +10%)
X             catapults can damage any fortifications they attack.
XPHALANX &    Phalanx and Legionaries get an additional +10 if in 500+ men units
XLEGIONARY       and get an additional +20 combat bonus if in 1000+ men units
XROC/GRIFFON  units have the ability of flight.
XNINJA        units ignore enemy zones of control
XSAILOR       units may disembark from ships into unowned sectors.
XMARINE       units are the only units that can disembark from ships in another
X             nation's territory.
X             marines also have excellent combat ability while aboard ships.
XZOMBIE       units are just plain dumb.  They don't know how to MARCH, only
X             use half of a forts defenses and cannot even play follow the
X             leader.  But, to the horror of their enemies, they obsorb 33% of
X             the enemy dead into their ranks.
XSPY          units are never captured and start in another nations capitol
XSCOUT        scouts can ignore enemy zones of control.
XEND
X                         POSSIBLE ARMY STATUS
X
XThe following is the list of normally selectable army statuses:
X
XMARCH    :Marching doubles army movement at the expense of combat strength.
X         :   One fifth of national moverate is required to stop marching.
XSCOUT    :Scout and spy units can have scout status, and will, if possible,
X         :   avoid any enemy.  They can move through hostile armies but are
X         :   not able to take unowned land.  They are useful to check out
X         :   the map and to determine the enemy combat strength.
XATTACK   :Armies in this mode can take owned sectors, initiate
X         :   combat, and have they reasonable movement rates.
XDEFEND   :In this mode, can take owned sectors and have good defense
X         :   and movement, but can not initiate combat.
XGARRISON :This mode offers the strongest defense but is used only in YOUR
X         :   Towns, Capitol, and castles.  Garrisons may not move.
XRULE     :This mode is available to leaders within cities.  It means that
X         :   the leader will not participate in battle and may only be
X         :   killed if surrounding troops receive more than 80% of damage.
XSORTIE   :A quick attack from a fortification. See page on CITY COMBAT.
XSIEGE    :An encampment to pin armies in a sector. See page on CITY COMBAT.
XEND
X                         POSSIBLE ARMY STATUS  (page 2)
X
XThe following is the list of specialized statuses:
X
XMILITIA  :Militia units have this status, which indicates that they are
X         :   unable to move but DO get the bonuses of GARRISON troops.
X         :   Militia units are not full time troops, and are intrinsically
X         :   weak in combat.
XFLIGHT	 :Flying units ignore normal movement costs while moving, and can
X         :   cross water.  See the FLIGHT section below.
XMAGDEF   :Magically enhanced DEFEND is normal DEFEND mode with a +30% bonus.
X         :   You get this status by spending spell points via 'w'izardry
XMAGATT   :Magically enhanced ATTACK is normal ATTACK mode with a +30% bonus.
X         :   You get this status by spending spell points via 'w'izardry
XGROUP    :Members of army groups move at the rate of the slowest unit in
X         :   the group.  They gain leader bonuses and have the same
X         :   properties in combat as would an army in attack mode.
XBESIEGED :A troop which is under siege.  See page on CITY COMBAT.
X
XDue to unit reorganization, switching from one status to another consumes
Xone point of movement.  (Only march is unchangable with zero movement.)
XEND
X                      CAPTURING SECTORS AND TAKING COUNTRIES
X
XIt takes armies greater than 75 AND greater than your total civilians/350 to 
Xtake a sector.  You MUST be either at WAR or in JIHAD with the nation you want
Xto take the sector from.  Because leader and monster units are really just a
Xsingle entity per unit, they do not possess enough men to take sectors.
X
XIf one nation captures another nation's Capitol, that Capitol is sacked and
Xall items kept there are transfered to the conquerer:  metal, gold, jewels and
Xa fifth of the food supply.  In addition, the nation will be depleted because
Xit will now lack a Capitol.  That will result in the loss of all monster and
Xmercenary troops and XDEPLETE% of it's regular armies and sectors.  If a nation
Xloses all of it's population and army units, that nation is destroyed.
X
XMercenaries are not drafted from your populace.  15% of all troops 
Xdisbanded become mercenaries and are added to the mercenary soldier pool 
Xfor potential drafting by any nation.  
XEND
X                              FLIGHT
X
XSome avian units have the ability of flight, these units will have a
Xstatus of FLYING automatically set after each update.  Also, magicians
Xwill have the ability to grant flight to individual units.  Flying
Xunits may not be combined with other units, but may be separated as
Xper normal units.
X
XFlying allows a unit to pass over land and water without being stopped
Xby enemy troops.  It also allows allows cheaper travel over most
Xsectors.  The major difference between flying and normal movement is that,
Xwhen a flying unit stops its movement, it will have landed, and its
Xstatus will become DEFEND, prohibiting any further flight.
X
XNOTE: if a FLYING unit runs out of movement over water, it will drown.
XEND
X                        SHIPS AND SHIP COSTS
X
XThere are three types of ships available:
X
X   ship type    cargo/hold      base move     base cost
X
XWarships        combat ships    XWARSPD            XWARSHPCOST
XGalleys         XSHIPHOLD soldiers    XGALSPD            XGALSHPCOST
XMerchants       XSHIPHOLD civilians   XMERSPD            XMERSHPCOST
X
XOf each type, there are three classes of ships:
X
X   ship class   holds           move bonus    cost rate
X
XLight           One             +(2*XSIZESPD)        1 x Base
XMedium          Two             +XSIZESPD            2 x Base
XHeavy           Three           +0            3 x Base
X
XShip maintenance will cost XSHIPMAINT per holding space
Xon each update.
XEND
X                           SHIP INFORMATION
X
X     Ships travel in fleets which may contain up to XNMASK ships of each type
Xand class.  The movement ability of the fleet is determined by the movement
Xability of the slowest member.  It is important to note that it costs 4 move
Xpoints to land a fleet and fleets with light ships may not enter deep water.
X
X     Each ship also has a maximum crew of XSHIPCREW/hold.  If the crew is
Xbelow the maximum, movement will be reduced by the percentage of crew missing
Xis until the ship is repaired in harbor.  (via the 'C'onstruct command)
X
X     Also, ships may be loaded (or unloaded) with armies and civilians via
Xthe 't'ransport command.  Only sailors or marines may be unloaded in
Xunowned sectors and only marines may be unloaded in someone else's land.
XThe maximum transport capability of a fleet is determined by how many
Xholds are in the fleet of the proper type.  So, a fleet with 2 medium
Xmerchants and 1 light galley may carry up to XSHIPHOLD soldiers and 4
X* XSHIPHOLD civilians.  Loading or unloading of a fleet means the
Xfleet loses all remaining movement.  NOTE:  Due to the hazards of the
Xsea, some of the civilians will not survive the trip.
XEND
X                                NOTES ON COMBAT
X
XTowns / Cities / Forts / Capitols result in bloodier battles than normal.  
XBattles in these sectors result in 20% more casualties on both sides (so
Xif there would be 30% casualties, the result is 36% casualties).  Also,
Xspecial tactics may be needed in such sectors. See following page.
X
XYou can expect to take several turns to reduce a large army, especially
Xin a Town or Capitol.  NPC defenders will draft new troops each turn.
X
XCombats calculations are based on an even 1:1 battle, and then the results
Xare adjusted based on the calculated odds of the battle.  First, an initial
Xroll from 0 to 100 is made with probabilities being an even gaussian
Xdistribution.  Then odds are calculated based on the number of men and their
Xcombat strength, with better soldiers having the same weight as more men of
Xpoorer quality. The losses given by the initial combat roll are then
Xadjusted by removing from the percent loss of the side the with the better
Xodds and adding to the percent losses of the side with unfavorable odds.
XEND
X                              CITY COMBAT
X
XIn fortified sectors, such as cities, towns, forts and capitols, armies may
Xperform SORTIES and SIEGES, and may RULE or be BESIEGED.
X
XCities may issue special SORTIE attacks.  These attacks occur as if 20%
Xmore men are in the unit and they are also given an increase of 10% to attack
Xbonus.  If a SORTIE unit is caught by an enemy attack it will fight at a -30%
Xdefensive bonus.  Note: once a SORTIE is sent out, it may not be recalled.
X
XSpecial SORTIE considerations and extra bonuses:
X   ARCHERS and CATAPULTS take only half damage due to attacking from walls.
X   DRAGOONS, LEGIONS and PHALANX gain +5% to attack.
X   LT_CAVALRY and CAVALRY gain +10% to attack.
X   KNIGHTS, ELEPHANTS, and AVIAN units gain +15% to attack.
X   Summoned MONSTERS gain an additional 5% due to shock.
X
XA leader unit within a fortification may decide to RULE.  This unit
Xwill not participate in any combat and may only be damaged if the
Xsurrounding troops suffer 80% casualties.  This is a good way to protect
Xnational leaders from harm within the Capitol.
XEND
X                          CITY COMBAT (page 2)
X
XIf a unit is placed on SIEGE status and there are twice as many units on
Xsiege as there are of the sector owners', any non flying troops will be set
Xto a status of BESIEGED.  BESIEGED units have a movement of zero and may
Xonly have their status changed to SORTIE.  In addition, defensive bonus
Xfor BESIEGED troops is at -20% after addition of fortification bonuses.
X
XAn ideal method of taking a city would be to have four times the troops
Xinside and set half of your troops on SIEGE and half on ATTACK.
X
XSpecial Considerations for SIEGES:
X   SIEGE engines count triple for calculations of sieging troops.
X   MILITIA troops count half for calculations of besieged troops.
X
XThe only method to take an occupied City or Capitol is to be the the only army
Xin the sector when the combat is *over*.  This is VERY difficult, as it should
Xbe.  Fortifications can be damaged in combat by SIEGE ENGINES and CATAPULTS.
XEND
X                          AN EXAMPLE OF COMBAT
X
XA battle occurs in 22,29 (a "good" farm) between your nation "uru" (defender) 
Xand "edland".  They have 339 infantry vs. 100 of your infantry. Your defensive 
Xbonus is +70, their attack bonus is +40. Infantry are +0/+0. A movement bonus 
Xgoes to both sides = 5*(9-movecost)=+40.  Their total bonus is 40+40+=+80. 
XYours is 70+40=110. This leads to dice modifier of 30 in your favor.
XThe roll is 91 which becomes +91-30=61; the defenders base loss is then:
X(61+30)/160*60 = 40% and the attackers base loss is then: (160-(61+30))
X/160*60 = 20%.  Since the odds favor the attacker, there is a (339/10)-10
Xadjustment to the defenders losses, bringing their losses to 63%.
XThe actual loss to each unit is troops * Percent * random / 100, where the 
Xrandom is a random value between 0 and 2.  For you this leads
Xto 84*63*(~1) / 100 = 45 men. for them it leads to 56 men.
XDespite your awful luck at the dice, you still came out quite well.
X
XHowever, because they did cream you, there was a chance that you were
X     forced to retreat, which you did to 21 28.
XEND
X                         MAIL MESSAGE FROM COMBAT
X
XThe following is a mail message you might receive after the combat described
Xon the last page.
X
XBATTLE SUMMARY for sector 22, 29
XYou are on the Defending Side
X edland is attacking with army 17 (type Infantry, men 125, bonus=80)
X edland is attacking with army 23 (type Infantry, men 160, bonus=80)
X uru is defending with army 9 (type Infantry, men 84, bonus=110)
Xattacking soldiers=285 -> attackers percent loss 20%
Xdefending soldiers=84 -> defenders percent loss 63%
XODDS are 339 to 100; ADJUSTED ROLL is 61
XRESULT: Attackers lose 56 men, Defenders lose 45 men
XAdditionally, All defenders retreat to 21 28
XEND
X                             NAVAL COMBAT
X
X        Naval Combat is very similar to army combat, except that capturing
Xof ships is taken into account and fleets within two sectors may
Xparticipate in battle.  Odds are calculated based on the amount of crews
Xfor each ships.  Warship crew is added in on a 1 to 1 basis, while Galleys
Xare at half that, and Merchants are halved again.  Then, any soldiers on
Xboard are added in at half strength except for ARCHERS and SAILORS which
Xare full strength and MARINES which are twice strength.  If a nation has
XSAILOR power, his crews are given a 20% bonus in strength due to better
Xability.
X
X        Finally, if a ship is damaged in combat there is a percent
Xchance based on the odds of combat that that ship will be captured.
XAt 1:1 odds, only a 15% capture chance exists; At 10:1 odds there is a
X60% chance; At >60:1 odds there is a 100% chance; And then if the odds
Xare against the player, 1:10 has only a 1% chance of capturing, and
Xbelow that it drops to 0%.
XEND
XDONE
END_OF_FILE
if test 17703 -ne `wc -c <'txt2'`; then
    echo shar: \"'txt2'\" unpacked with wrong size!
fi
# end of 'txt2'
fi
echo shar: End of archive 6 \(of 14\).
cp /dev/null ark6isdone
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