[comp.sources.games] v06i093: 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 93
Archive-name: conquer4/Part11
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 11 (of 14)."
# Contents:  display.c randeven.c txt5
# Wrapped by billr@saab on Thu Jun 15 15:20:20 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'display.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'display.c'\"
else
echo shar: Extracting \"'display.c'\" \(11950 characters\)
sed "s/^X//" >'display.c' <<'END_OF_FILE'
X/*Print and io subroutines for interactive game*/
X
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 files*/
X#include <ctype.h>
X#include "header.h"
X#include "data.h"
X
X/*offset of upper left hand corner*/
Xextern short xoffset;
Xextern short yoffset;
X/*current cursor postion (relative to 00 in upper corner)*/
X/*	position is 2*x,y*/
Xextern short xcurs;
Xextern short ycurs;
X/*redraw map in this turn if redraw is a 1*/
Xextern short redraw;
X/*display state SEE data.h FOR CURRENT VALUES OF THESE */
Xextern short hilmode;
Xextern short dismode;
Xshort movmode;
X/* nation id of owner*/
Xextern short country;
X
Xstatic char *hasseen;
X
X/* allocate space for the hasseen array based on the actual screen size */
Xvoid
Xinit_hasseen()
X{
X	hasseen = (char *)malloc(((COLS-10)/2) * (LINES-5));
X#ifdef BSD
X	bzero(hasseen,((COLS-10)/2) * (LINES-5));
X#else
X	memset( hasseen, 0, ((COLS-10)/2) * (LINES-5));
X#endif
X	if (hasseen == (char *)NULL) {
X		errormsg("Cannot allocate memory.");
X		bye(FALSE);
X	}
X}
X
X/*make a map*/
Xvoid
Xmakemap()
X{
X	register int x,y;
X
X	for(x=0;x<SCREEN_X_SIZE;x++) for(y=0;y<SCREEN_Y_SIZE;y++)
X	if( HAS_SEEN(x,y) ) {
X		highlight(x,y);
X		see(x,y);
X	}
X	move(ycurs,2*xcurs);
X}
X
Xvoid
Xnewdisplay()
X{
X	mvaddstr(LINES-4,0,"viewing options:  (d)esignation, (r)ace, (M)ove cost, (p)eople, (D)efense");
X	clrtoeol();
X	mvaddstr(LINES-3,0,"   (f)ood, (c)ontour, (v)egetation, (m)etal, (n)ation mark, (j)ewels, (i)tems");
X	clrtoeol();
X	mvaddstr(LINES-2,0,"highlight option: (o)wners, (a)rmy, (y)our Army, move (l)eft, (s)pecial,(x)=none");
X	clrtoeol();
X	mvaddstr(LINES-1,0,"toggle move mode: hit '/'");
X	clrtoeol();
X	standout();
X	mvaddstr(LINES-1,COLS-25,"what display?:");
X	standend();
X	refresh();
X	redraw=TRUE;
X	switch(getch()) {
X	case '/':
X		if( movmode==TRUE ) movmode=FALSE;
X		else movmode=TRUE;
X		break;
X	case 'f':
X		dismode=DI_FOOD;
X		break;
X	case 'v':	/* vegetation map*/
X		dismode=DI_VEGE;
X		break;
X	case 'd':	/* designations map*/
X		movmode=FALSE;
X		dismode=DI_DESI;
X		break;
X	case 'c':	/* contour map of world */
X		dismode=DI_CONT;
X		break;
X	case 'n':	/* nations map*/
X		dismode=DI_NATI;
X		break;
X	case 'r':	/* race map*/
X		dismode=DI_RACE;
X		break;
X	case 'M': /* move cost map */
X		dismode=DI_MOVE;
X		break;
X	case 'D':
X		dismode=DI_DEFE;
X		break;
X	case 'p':
X		dismode=DI_PEOP;
X		break;
X	case 'j':
X		dismode=DI_GOLD;
X		break;
X	case 'm':
X		dismode=DI_METAL;
X		break;
X	case 'i':
X		dismode=DI_ITEMS;
X		break;
X	case 'a':	/* armies hilighted map*/
X		prep(country,FALSE);
X		hilmode=HI_ARMY;
X		break;
X	case 'o':	/* owners hilighted map*/
X		hilmode=HI_OWN;
X		break;
X	case 's':	/* hilight tradegoods */
X		hilmode=HI_GOOD;
X		break;
X	case 'x':	/*no highlighting*/
X		hilmode=HI_NONE;
X		break;
X	case 'y':	/* your armies hilighted map*/
X		prep(country,FALSE);
X		hilmode=HI_YARM;
X		break;
X	case 'l':	/* your armies with moves left hilighted map*/
X		prep(country,FALSE);
X		hilmode=HI_MOVE;
X		break;
X	default:
X		beep();
X		redraw=FALSE;
X	}
X	makebottom();
X}
X
X/*see what is in xy as per display mode*/
X/* also add move cost next to sector */
Xvoid
Xsee(x,y)
X{
X	int armbonus;
X	if((x<0)||(y<0)||(x>=SCREEN_X_SIZE)||(y>=SCREEN_Y_SIZE)
X	||((y+yoffset)>=MAPY)||((x+xoffset)>=MAPX)) return;
X	if(((y+yoffset)<MAPY)&&((x+xoffset)<MAPX)) {
X
X		if((magic(sct[x+xoffset][y+yoffset].owner,THE_VOID)==TRUE)
X		&&((dismode==DI_DEFE)||(dismode==DI_GOLD)||(dismode==DI_METAL)
X			||(dismode==DI_PEOP)||(dismode==DI_FOOD)||(dismode==DI_ITEMS))
X		&&(country!=sct[x+xoffset][y+yoffset].owner)
X		&&(magic(country,NINJA)!=TRUE)
X		&&(country!=0)) {
X			mvaddch(y,2*x,'?');
X		} else {
X			switch(dismode){
X			case DI_FOOD:	/*food */
X				if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
X				mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegetation);
X				else if (tofood( &sct[x+xoffset][y+yoffset],country)<10)
X				mvprintw(y,2*x,"%d",tofood( &sct[x+xoffset][y+yoffset],country));
X				else mvaddch(y,2*x,'+');
X				break;
X			case DI_VEGE: /*vegetation*/
X				mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegetation);
X				break;
X			case DI_DESI: /*designation*/
X				if(sct[x+xoffset][y+yoffset].owner==0){
X					if(tofood( &sct[x+xoffset][y+yoffset],sct[x+xoffset][y+yoffset].owner)!=0) mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
X					else mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegetation);
X				}
X				else if((country==0)
X				||(sct[x+xoffset][y+yoffset].owner==country))
X				mvaddch(y,2*x,sct[x+xoffset][y+yoffset].designation);
X				else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].mark);
X				break;
X			case DI_CONT: /*contour*/
X				mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
X				break;
X			case DI_NATI: /*ownership*/
X				if(sct[x+xoffset][y+yoffset].owner==0)
X					mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
X				else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].mark);
X				break;
X			case DI_RACE: /*race*/
X				if(sct[x+xoffset][y+yoffset].owner==0)
X					mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
X				else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].race);
X				break;
X			case DI_MOVE:	/*movement cost map*/
X				if(movecost[x+xoffset][y+yoffset]>=0) {
X					if(movecost[x+xoffset][y+yoffset]>=10)
X						mvaddch(y,2*x,'+');
X					else mvprintw(y,2*x,"%d",movecost[x+xoffset][y+yoffset]);
X				} else if(sct[x+xoffset][y+yoffset].altitude==WATER)
X					mvaddch(y,2*x,WATER);
X				else
X					mvaddch(y,2*x,'X');
X				break;
X			case DI_DEFE:   /*Defence*/
X				if (sct[x+xoffset][y+yoffset].altitude==WATER)
X					mvaddch(y,2*x,WATER);
X				else if(movecost[x+xoffset][y+yoffset]<0)
X					mvaddch(y,2*x,'X');
X				else {
X
X					/*Racial combat bonus due to terrain (the faster you move the better)*/
X					armbonus=0;
X					armbonus+=5*(9-movecost[x+xoffset][y+yoffset]);
X
X					if(sct[x+xoffset][y+yoffset].altitude==MOUNTAIN)
X						armbonus+=40;
X					else if(sct[x+xoffset][y+yoffset].altitude==HILL)
X						armbonus+=20;
X
X					if(sct[x+xoffset][y+yoffset].vegetation==JUNGLE)
X						armbonus+=30;
X					else if(sct[x+xoffset][y+yoffset].vegetation==FOREST)
X						armbonus+=20;
X					else if(sct[x+xoffset][y+yoffset].vegetation==WOOD)
X						armbonus+=10;
X
X					armbonus+=fort_val(&sct[x+xoffset][y+yoffset]);
X
X					if(armbonus<200) mvprintw(y,2*x,"%d",armbonus/20);
X					else mvaddch(y,2*x,'+');
X				}
X				break;
X			case DI_PEOP:   /*People*/
X				if (sct[x+xoffset][y+yoffset].altitude==WATER)
X					mvaddch(y,2*x,WATER);
X				else if (sct[x+xoffset][y+yoffset].people>=9950)
X					mvaddch(y,2*x,'X');
X				else if (sct[x+xoffset][y+yoffset].people>=4950)
X					mvaddch(y,2*x,'V');
X				else if (sct[x+xoffset][y+yoffset].people>=950)
X					mvaddch(y,2*x,'I');
X				else
X				mvprintw(y,2*x,"%d",(50+sct[x+xoffset][y+yoffset].people)/100);
X				break;
X			case DI_GOLD:  /*Gold*/
X				if (sct[x+xoffset][y+yoffset].altitude==WATER)
X					mvaddch(y,2*x,WATER);
X				else if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
X					mvaddch(y,2*x,'X');
X				else if (tg_ok(country,&sct[x+xoffset][y+yoffset])){
X					if (sct[x+xoffset][y+yoffset].jewels>=10)
X						mvaddch(y,2*x,'+');
X					else
X						mvprintw(y,2*x,"%d",sct[x+xoffset][y+yoffset].jewels);
X				} else mvprintw(y,2*x,"0");
X				break;
X			case DI_METAL:  /*Metal*/
X				if (sct[x+xoffset][y+yoffset].altitude==WATER)
X					mvaddch(y,2*x,WATER);
X				else if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
X					mvaddch(y,2*x,'X');
X				else if (tg_ok(country,&sct[x+xoffset][y+yoffset])){
X					if (sct[x+xoffset][y+yoffset].metal>=10)
X						mvaddch(y,2*x,'+');
X					else
X						mvprintw(y,2*x,"%d",sct[x+xoffset][y+yoffset].metal);
X				} else mvprintw(y,2*x,"0");
X				break;
X			case DI_ITEMS:	/* designations needed for tradegoods */
X				if (sct[x+xoffset][y+yoffset].altitude==WATER)
X					mvaddch(y,2*x,WATER);
X				else if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
X					mvaddch(y,2*x,'X');
X				else if (sct[x+xoffset][y+yoffset].tradegood!=TG_none
X				&& (*(tg_stype+sct[x+xoffset][y+yoffset].tradegood)!='x')
X				&& tg_ok(country,&sct[x+xoffset][y+yoffset]))
X					mvaddch(y,2*x,*(tg_stype+sct[x+xoffset][y+yoffset].tradegood));
X				else mvaddch(y,2*x,'-');
X				break;
X			default:
X				break;
X			}
X		}
X	}
X	else mvaddch(y,2*x,' ');
X
X	if( movmode==TRUE )
X	if(movecost[x+xoffset][y+yoffset]>=10) {
X		mvaddch(y,2*x+1,"+");
X	} else if(movecost[x+xoffset][y+yoffset]>=0) {
X		mvprintw(y,2*x+1,"%d",movecost[x+xoffset][y+yoffset]);
X	}
X}
X
X/*highlight what is in xy as per highlight mode*/
Xvoid
Xhighlight(x,y)
X{
X	int	armynum;
X	if((x<0)||(y<0)||(x>=SCREEN_X_SIZE)||(y>=SCREEN_Y_SIZE)
X	||((y+yoffset)>=MAPY)||((x+xoffset)>=MAPX)) return;
X	standend();
X	switch(hilmode){
X	case HI_MOVE:	/* your armies w/ move left */
X		for(armynum=0;armynum<MAXARM;armynum++)
X			if(( P_ASOLD>0 )
X			&&( P_AMOVE>0 )
X			&&( P_AXLOC==(x+xoffset ))
X			&&( P_AYLOC==(y+yoffset ))) break;
X		if(armynum<MAXARM) standout();
X		break;
X	case HI_YARM:	/* your armies */
X		for(armynum=0;armynum<MAXARM;armynum++)
X			if(( P_ASOLD>0)
X			&&( P_AXLOC==x+xoffset)
X			&&( P_AYLOC==y+yoffset)) break;
X		if(armynum<MAXARM) standout();
X		break;
X	case HI_GOOD:	/* trade goods */
X		if(tg_ok( country, &sct[x+xoffset][y+yoffset])
X		 &&(sct[x+xoffset][y+yoffset].tradegood != TG_none)
X		 &&(magic(sct[x+xoffset][y+yoffset].owner,THE_VOID)!=TRUE
X			|| country==0
X		 	|| country==sct[x+xoffset][y+yoffset].owner
X			|| magic(country,NINJA)==TRUE)
X		 &&(sct[x+xoffset][y+yoffset].altitude!=WATER)) standout();
X		break;
X	case HI_OWN: /* ownership */
X		if(country==0) {
X			if(sct[x+xoffset][y+yoffset].owner!=0)
X				standout();
X		} else if(sct[x+xoffset][y+yoffset].owner==country)
X			standout();
X		break;
X	case HI_ARMY: /* any armies */
X		if(occ[x+xoffset][y+yoffset]!=0) standout();
X		break;
X	default:
X		break;
X	}
X}
X
X/* check if cursor is out of bounds*/
Xvoid
Xcoffmap()
X{
X	if((xcurs<=0)||(ycurs<=0)||(xcurs>=SCREEN_X_SIZE-1)
X	||((ycurs>=SCREEN_Y_SIZE-1))||((XREAL)>=MAPX)
X	||((YREAL)>=MAPY)) offmap();
X
X	if( redraw==TRUE) {
X		clear();
X		makemap();	 /* update map */
X		makebottom();
X		redraw=FALSE;
X	}
X	move(ycurs,2*xcurs);
X	makeside(FALSE);  /*update side*/
X	move(ycurs,2*xcurs);
X	refresh();
X}
X
Xint
Xcanbeseen(x,y)
Xint	x,y;
X{
X	if(!ONMAP(x,y)) return(FALSE);
X	return( (int) HAS_SEEN(x-xoffset,y-yoffset) );
X}
X
X/** CANSEE() fills seen[SCREEN_X_SIZE][SCREEN_Y_SIZE] */
Xvoid
Xwhatcansee()
X{
X	register int x,y;
X	int	i,j;
X	short	armynum,nvynum;
X
X	if((magic(country,KNOWALL)==1)||(country==0)) {
X		for(x=0;x<SCREEN_X_SIZE;x++) for(y=0;y<SCREEN_Y_SIZE;y++)
X			HAS_SEEN(x,y)=TRUE;
X		return;
X	}
X	for(x=0;x<SCREEN_X_SIZE;x++) for(y=0;y<SCREEN_Y_SIZE;y++)
X		HAS_SEEN(x,y)=FALSE;
X
X	for(x=(-LANDSEE);(x<SCREEN_X_SIZE+LANDSEE);x++)
X	for(y=(-LANDSEE);(y<SCREEN_Y_SIZE+LANDSEE);y++)
X	if((ONMAP(x+xoffset,y+yoffset))
X	&&(sct[x+xoffset][y+yoffset].owner==country)){
X		for(i=x-LANDSEE;i<=x+LANDSEE;i++)
X		for(j=y-LANDSEE;j<=y+LANDSEE;j++)
X		if(i>=0 && j>=0 && i<SCREEN_X_SIZE && j<SCREEN_Y_SIZE)
X			HAS_SEEN(i,j)=TRUE;
X	}
X
X	for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X		if((P_NMSHP!=0)||(P_NWSHP!=0)||(P_NGSHP!=0))
X		for(i=P_NXLOC-xoffset-NAVYSEE;i<=P_NXLOC-xoffset+NAVYSEE;i++)
X		for(j=P_NYLOC-yoffset-NAVYSEE;j<=P_NYLOC-yoffset+NAVYSEE;j++)
X		if(i>=0 && j>=0 && i<SCREEN_X_SIZE && j<SCREEN_Y_SIZE)
X			HAS_SEEN(i,j)=TRUE;
X
X	for(armynum=0;armynum<MAXARM;armynum++)
X		if(P_ASOLD>0)
X		for(i=P_AXLOC-xoffset-ARMYSEE;i<=P_AXLOC-xoffset+ARMYSEE;i++)
X		for(j=P_AYLOC-yoffset-ARMYSEE;j<=P_AYLOC-yoffset+ARMYSEE;j++)
X		if(i>=0 && j>=0 && i<SCREEN_X_SIZE && j<SCREEN_Y_SIZE)
X			HAS_SEEN(i,j)=TRUE;
X
X	return;
X}
END_OF_FILE
if test 11950 -ne `wc -c <'display.c'`; then
    echo shar: \"'display.c'\" unpacked with wrong size!
fi
# end of 'display.c'
fi
if test -f 'randeven.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'randeven.c'\"
else
echo shar: Extracting \"'randeven.c'\" \(29480 characters\)
sed "s/^X//" >'randeven.c' <<'END_OF_FILE'
X/* Conquer: Copyright (c) 1988 by Edward M Barlow */
X#include	<stdio.h>
X#include	<ctype.h>
X#include	"header.h"
X#include	"data.h"
X
X#ifdef RANEVENT
X#ifdef ADMIN
Xchar	*names[] = {		/* must end in single character name */
X	"groo","brok","vul","poin","srop","hoga","nobi","bonz","gail",
X	"lynn","zorb","theed","urda","X"
X};
X
Xextern FILE *fnews;
Xextern short country;
X
Xchar eventstr[80];
Xint xpos,ypos;		/* saved x and y position */
X
Xchar *randevents[] = {
X/* 0 */  "a military rebellion",
X/* 1 */  "a cult breaks with you",
X/* 2 */  "a province rebels",
X/* 3 */  "an evil wizard sets up",
X/* 4 */  "a tax revolt occurs",
X/* 5 */  "open rebelion flares",
X/* 6 */  "an army revolts",
X/* 7 */  "religions schism",
X/* 8 */  "peasants revolt",
X/* 9 */  "dragons raid",
X/* 10 */ "a famine rages",
X/* 11 */ "a hurricane blows over",
X/* 12 */ "a tornado hits",
X/* 13 */ "a volcano erupts",
X/* 14 */ "a royal wedding occurs",
X/* 15 */ "new alloy discovered",
X/* 16 */ "royal advisor discovered to be spy",
X/* 17 */ "gold strike in one sector",
X/* 18 */ "gold strike in one sector",
X/* 19 */ "gold vein runs out in one goldmine sector",
X/* 20 */ "gold vein runs out in one goldmine sector",
X/* 21 */ "a flood ravishes",
X/* 22 */ "an earthquake quakes",
X/* 23 */ "severe frost destroys crops",
X/* 24 */ "feared dragon killed",
X/* 25 */ "several nomad armies raid",
X/* 26 */ "fire ravishes town",
X/* 27 */ "black plague rages",
X/* 28 */ "pirates raid",
X/* 29 */ "barbarian raid",
X/* 30 */ "wizard grants power",
X/* 31 */ "magic item grants magic power",
X/* 32 */ "ores in one mine run out",
X/* 33 */ "new architect strengthens castle walls",
X/* 34 */ "new ores discovered + 4-10 metal one sector",
X/* 35 */ "skilled diplomacy obtains peace",
X/* 36 */ "powerful magi curses nation",
X/* 37 */ "severe winter hits",
X/* 38 */ "tidal wave -- abandon all coastlands ",
X/* 39 */ "ninja destroy general staff",
X/* 40 */ "general found to be spy",
X/* 41 */ "general prosperity +20% gold",
X/* 42 */ "disease kills 20% of soldiers",
X/* 43 */ "poor conditions kill 20% of soldiers"
X};
X#define MAXRANEVENT 43
X
X/*finds unused nation and sets it up partially*/
Xint
Xfindnew()
X{
X	int newntn=0,nationis;
X	for ( nationis=NTOTAL; nationis >= 1; nationis--)
X		if(ntn[nationis].active == INACTIVE) newntn=nationis;
X	if (newntn == 0) return (0);
X	strcpy(ntn[newntn].leader,"rebel");
X	strcpy(ntn[newntn].passwd,ntn[0].passwd);
X	ntn[newntn].score=0L;
X	ntn[newntn].tsctrs=0;
X	ntn[newntn].active=NEUTRAL_6FREE;
X	return(newntn);
X}
X
X/* returns unused character for nation mark */
Xchar
Xgetnewmark()
X{
X	char tmpchr='A'-1;			/* cap letters first */
X	while (TRUE) {
X		tmpchr++;
X		if( markok( tmpchr, FALSE )) break;
X		if(tmpchr=='Z') tmpchr='a'-1;	/* then small letters */
X		if(tmpchr=='z') break;	/* otherwise it will loop forever */
X	}
X	return(tmpchr);
X}
X
X/* disolve 'percent' of nation 'target; returns index of new nation */
Xint
Xdisolve(percent, target, ispsnt)
Xint target;
Xint percent;
Xint ispsnt;		/* true/false */
X{
X	int new;	/* new nation number */
X	int split;	/* number of sectors split */
X	int defaultx=(-1), defaulty=(-1), realx=(-1), realy=(-1), dist;
X	int i=0,j,armynum,narmynum;
X
X	split =  ntn[target].tsctrs * percent / 100;
X	if((split<=7)&&(!ispsnt)) {
X		strcpy(eventstr,"nation too small->no sectors will be split");
X		return(0);
X	}
X	/* find starting town */
X	if( ispsnt ) {
X		for( new=0; new<NTOTAL; new++ ) {
X			if((ntn[new].race==ntn[target].race )
X			&&( ntn[new].active==NPC_PEASANT )) {
X				printf("\tntn %s peasants of same type as target %d\n",ntn[new].name,target);
X				sprintf(eventstr,"rebellion joins nation %s",ntn[new].name);
X				return(new);
X			}
X		}
X		new = country;
X		country=target;
X		xpos = ypos = (-1);
X		while( i++ < 300 ) {
X			rand_sector();
X			if(sct[xpos][ypos].people>=300) break;
X		} 
X		if( i==300 ) {
X			strcpy(eventstr,"no sectors available");
X			return(0);
X		}
X		printf("TMP peasant centered on %d,%d\n",xpos,ypos);
X		country = new;
X		realx = xpos;
X		realy = ypos;
X	} else for(i=0; i<MAPX; i++) for(j=0; j<MAPY; j++) {
X		if(sct[i][j].owner == target){
X			if((sct[i][j].designation==DCITY)
X		 	||(sct[i][j].designation==DTOWN)
X			||((sct[i][j].people>=2000)&&(sct[i][j].designation!=DCAPITOL))){
X				if( rand()%3 == 0 ) {
X					realx = i;
X					realy = j;
X				} else {
X					defaultx = i;
X					defaulty = j;
X				}
X			} 
X		}
X	}
X	if(realx == (-1)){
X		realx = defaultx;
X		realy = defaulty;
X	}
X	if(realx == (-1)) {
X		strcpy(eventstr,"no cities available");
X		return(0);
X	}
X	if((new=findnew()) == 0) {
X		strcpy(eventstr,"no nations available");
X		return(0);
X	}
X	if(getnewname(new) == 0) {
X		strcpy(eventstr,"no names available");
X		return(0);
X	}
X
X#ifdef HIDELOC
X	sprintf(eventstr,"new nation %s created",ntn[new].name);
X#else
X	sprintf(eventstr,"new nation %s created at %d,%d",ntn[new].name,realx,realy);
X#endif HIDELOC
X	printf("TMP new nation %s created at %d,%d",ntn[new].name,realx,realy);
X	sct[realx][realy].owner=new;
X	ntn[new].capx=realx;
X	ntn[new].capy=realy;
X	sct[realx][realy].designation=DCAPITOL;
X	ntn[new].class=ntn[target].class;
X	ntn[new].race= ntn[target].race;
X	if( !ispsnt ) {
X		ntn[new].tgold= ntn[target].tgold* percent / 100;
X		ntn[new].tfood= ntn[target].tfood* percent / 100;
X		ntn[new].jewels= ntn[target].jewels* percent / 100;
X		ntn[new].metals= ntn[target].metals* percent / 100;
X		ntn[target].tgold -= ntn[new].tgold;
X		ntn[target].tfood -= ntn[new].tfood;
X		ntn[target].jewels -= ntn[new].jewels;
X		ntn[target].metals -= ntn[new].metals;
X	}
X	ntn[new].tciv= ntn[target].tciv* percent / 100;
X	ntn[new].tmil= ntn[target].tmil* percent / 100;
X	ntn[target].tciv -= ntn[new].tciv;
X	ntn[target].tmil -= ntn[new].tmil;
X	ntn[new].repro= ntn[target].repro;
X	ntn[new].maxmove= ntn[target].maxmove;
X	if( ispsnt ) {
X		ntn[new].aplus= ntn[new].dplus= 0;
X	} else {
X		ntn[new].aplus= ntn[target].aplus - 10;
X		ntn[new].dplus= ntn[target].dplus - 10;
X	}
X	ntn[new].location= ntn[target].location;
X	ntn[new].powers= ntn[target].powers;
X	ntn[new].tships= 0;
X	ntn[new].tsctrs = split;
X
X	/* first check first letter of name */
X	if( markok(toupper(ntn[new].name[0]),FALSE) )
X		ntn[new].mark = toupper(ntn[new].name[0]);
X	else
X		ntn[new].mark = getnewmark();
X
X	for ( dist=1 ; dist < 10; dist++) if (split > 0)
X	for (i=realx-dist; i<realx+dist; i++)
X		for (j=realy-dist; j<realy+dist; j++){
X			if(ONMAP(i,j)
X			&&( split>0 )
X			&&( sct[i][j].designation != DCAPITOL )
X			&&( sct[i][j].owner == target)){
X				split--;
X				if( sct[i][j].people > 0 )
X					sct[i][j].owner=new;
X			}
X		}
X
X	narmynum=1;
X	for (armynum=0;armynum<MAXNAVY;armynum++) {
X		ntn[new].nvy[armynum].warships = 0;
X		ntn[new].nvy[armynum].merchant = 0;
X	}
X	if(!ispsnt) for (armynum=narmynum; armynum<MAXARM; armynum++) {
X		ntn[new].arm[armynum].sold = 0;
X		if((ntn[target].arm[armynum].sold>0)
X		&&(sct[ntn[target].arm[armynum].xloc][ntn[target].arm[armynum].yloc].owner==new)){
X			ntn[new].arm[narmynum].sold
X				=ntn[target].arm[armynum].sold;
X			ntn[new].arm[narmynum].unittyp
X				=ntn[target].arm[armynum].unittyp;
X			ntn[new].arm[narmynum].xloc
X				=ntn[target].arm[armynum].xloc;
X			ntn[new].arm[narmynum].yloc
X				=ntn[target].arm[armynum].yloc;
X			ntn[new].arm[narmynum].stat
X				=ntn[target].arm[armynum].stat;
X			ntn[new].arm[narmynum].smove
X				=ntn[target].arm[armynum].smove;
X			ntn[target].arm[armynum].sold = 0;
X			narmynum++;
X		}
X	}
X	if( !ispsnt ) {
X		armynum=0;
X		ntn[new].arm[0].sold = 300;
X		ntn[new].arm[0].unittyp = A_INFANTRY;
X		ntn[new].arm[0].xloc = realx;
X		ntn[new].arm[0].yloc = realy;
X		ntn[new].arm[0].stat = GARRISON;
X		ntn[new].arm[0].smove = 0;
X	}
X	for(dist=0;dist<NTOTAL;dist++) if(dist!=new) {
X		/* create realistic diplomatic status */
X		if( ispsnt || ismonst( ntn[dist].active ) ) {
X			ntn[new].dstatus[dist]=WAR;
X			ntn[dist].dstatus[new]=WAR;
X		} else if(ntn[target].dstatus[dist]==UNMET) {
X			ntn[new].dstatus[dist]=UNMET;
X			ntn[dist].dstatus[new]=UNMET;
X		} else {
X			ntn[new].dstatus[dist]=NEUTRAL;
X			ntn[dist].dstatus[new]=NEUTRAL;
X		}
X	}
X	ntn[new].dstatus[target]=WAR;
X	ntn[target].dstatus[new]=WAR;
X	return(new);
X}
X
X/* get new npc nation name from list at start of this file */
Xint
Xgetnewname(new)
Xint	new;
X{
X	int count,i=0;
X
X	for( i=0;strlen(*(names+i)) > 1;i++ ){
X		for(count=0;count<NTOTAL;count++)
X			if(strcmp(ntn[count].name, *(names+i))==0) break;
X		if( count==NTOTAL ) {
X			strcpy(ntn[new].name,*(names+i));
X			return(1);
X		}
X	}
X	return(0);
X}
X
Xvoid
Xrandomevent()
X{
X	int percent,count, event, newnation, i, j, armynum,x,y;
X	int done,holdval;	/*if 1 then event happened */
X	long longval;
X	long newpower;
X	struct s_sector *sptr;
X
X	printf("Random Events\n");
X
X#ifdef VULCANIZE
X/* have a volcano erupt on the map based on percent chance of PVULCAN */
X	if(rand()%100<PVULCAN) erupt();
X#endif
X
X	/* decide what nations get random event */
X	for(country=0;country<NTOTAL;country++) {
X		curntn = &ntn[country];
X		if(( !isntn(curntn->active))
X		||(curntn->score<=20L)
X		||(curntn->tsctrs<=20))
X			continue;
X
X		/* clear the event string */
X		strcpy(eventstr,"");
X		
X		x = 10*curntn->tax_rate - curntn->popularity- curntn->terror - 3*curntn->charity;
X#ifdef DEBUG
Xprintf("TEMP: %s chance of peasant revolt is %d (tax=%d pop=%d terror=%d)\n",
X		curntn->name, x, curntn->tax_rate, curntn->popularity,
X		curntn->terror );
X#endif DEBUG
X
X		if((rand()%100)<x) {
X			if(rand()%100<PREVOLT){
X				holdval=0;
X				peasant_revolt( &holdval );
X				if( holdval != 0 )
X				wdisaster(country,ntn[holdval].capx,ntn[holdval].capy,0,"peasant revolt");
X				else printf("revolt in %s fails because:\n\t%s\n",curntn->name,eventstr);
X			}
X		} 
X
X		x = 5 * curntn->tax_rate - curntn->prestige;
X#ifdef DEBUG
Xprintf("TEMP: %s chance of revolt is %d (tax=%d prest=%d)\n",
X		curntn->name, x, curntn->tax_rate, curntn->prestige );
X#endif DEBUG
X
X		if(( rand()%100)< x ){
X			if(rand()%100<PREVOLT){
X				event = other_revolt( &holdval );
X				if( event != -1 )
X				wdisaster(country,ntn[holdval].capx,ntn[holdval].capy,0,randevents[event]);
X				else printf("revolt in %s fails because:\n\t%s\n",curntn->name,eventstr);
X			}
X		}
X
X		if( (rand()%100) < PWEATHER )	weather();
X
X		/* clear the event string for other random events */
X		strcpy(eventstr,"");
X
X		/* do truely random events */
X		if((rand()%100)* WORLDSCORE < RANEVENT * WORLDNTN * curntn->score){
X
X		percent=0;
X		event = rand()%(MAXRANEVENT-9) + 9;
X		done=TRUE;
X		xpos = ypos = -1;
X		/* do the event */
X		switch(event) {
X		case 9: /*dragon raid -- lose 30% of food*/
X			strcpy(eventstr,"lose 30% of food");
X			curntn->tfood *= 7L;
X			curntn->tfood /= 10L;
X			break;
X		case 10: /*famine -- food=0 10% starve*/
X			curntn->tfood /= 4L;
X			strcpy(eventstr,"lose 3/4ths of food & 10% starve");
X			for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X			if(sct[i][j].owner==country)
X				sct[i][j].people -= sct[i][j].people / 10;
X			break;
X		case 11: /*hurricane*/
X			sptr = rand_sector();
X			percent = 10 + rand()%20;
X			/* one hex radius */
X			for (x=xpos-1;x<=xpos+1;x++)
X			for (y=ypos-1;y<=ypos+1;y++) if(ONMAP(x,y)) {
X				sptr = &sct[x][y];
X				if( !(ISCITY( sptr->designation ))
X				&& (sptr->designation != DRUIN))
X					sptr->designation = DNODESIG;
X				if (sptr->fortress>=1) sptr->fortress--;
X				reduce(x, y, percent);
X			}
X			break;
X		case 12:
X			/*tornado*/
X			sptr = rand_sector();
X			if( !(ISCITY( sptr->designation ))
X			&& (sptr->designation != DRUIN))
X				sptr->designation = DNODESIG;
X			else {
X				if (sptr->fortress < 2) sptr->fortress = 0;
X				else sptr->fortress -= 2;
X			}
X			percent = 10 + rand()%25;
X			reduce(xpos, ypos, percent);
X			break;
X		case 13:
X			/*volcano -- all flee around one mountain -- 30% die*/
X			holdval=0;		/* holdval is # of mountains */
X			for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X			if(sct[i][j].owner==country && sct[i][j].altitude==MOUNTAIN)
X				holdval++;
X
X			if (holdval > 0) count = (rand()%holdval) + 1;
X			else {
X				done = FALSE;
X				break;
X			}
X
X			sprintf(eventstr,"all flee, 30%% die in 1 sector range");
X			for (xpos=0; count && (xpos<MAPX); xpos++)
X			for (ypos=0;count && (ypos<MAPY); ypos++)
X			if (( sct[xpos][ypos].owner == country)
X			&& (sct[xpos][ypos].altitude == MOUNTAIN)) {
X				count--;
X				if (count == 0) blowup(xpos,ypos);
X			}
X#ifdef HIDELOC
X			/* hide nation of eruption if HIDELOC */
X			done = FALSE;
X#endif HIDELOC
X			break;
X		case 14:
X			/*royal wedding (absorb neighbor nation)*/
X			/*	takeover ( 100, 0 ); */  
X			/* sprintf(eventstr,"absorb neighbor nation %s");*/
X			/* something not right.... */
X			done=FALSE;
X			break;
X		case 15:
X			/*new alloy +10% combat (WARRIOR...)*/
X			if(magic(country,WARRIOR)!=1){
X				curntn->powers|=WARRIOR;
X				exenewmgk(WARRIOR);
X				strcpy(eventstr,"gives WARRIOR power");
X			}
X			else if(magic(country,CAPTAIN)!=1){
X				curntn->powers|=CAPTAIN;
X				exenewmgk(CAPTAIN);
X				strcpy(eventstr,"gives CAPTAIN power");
X			}
X			else if(magic(country,WARLORD)!=1){
X				curntn->powers|=WARLORD;
X				exenewmgk(WARLORD);
X				strcpy(eventstr,"gives WARLORD power");
X			}
X			else {	/* have all three powers... oh well */
X				done=FALSE;
X			}
X			break;
X		case 16:
X			/*royal advisor is spy -- lose power*/
X			/* sprintf(eventstr,"nation loses power %s");*/
X			done=FALSE;
X			break;
X		case 17:
X		case 18:
X			/*gold/jewel strike one sector */
X			holdval = 0;
X			for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X				if((sct[i][j].owner == country)
X				&& (sct[i][j].jewels == 0)
X				&& (is_habitable(i,j))) {
X					holdval++;
X				}
X			if (holdval > 0) count = (rand()%holdval) + 1;
X			else {
X				done = FALSE;
X				break;
X			}
X			for (xpos=0; count && (xpos<MAPX); xpos++)
X			for (ypos=0; count && (ypos<MAPY); ypos++)
X			if(( sct[xpos][ypos].owner == country)
X			&& (sct[xpos][ypos].jewels == 0)
X			&& (is_habitable(xpos,ypos))) {
X				if (count-- <=0) {
X					getjewel( &sct[xpos][ypos] );
X					done=TRUE;
X				}
X			}
X			break;
X		case 19:
X		case 20:
X			/*gold vein runs out one goldmine sector */
X			holdval = 0;
X			for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X			if(( sct[i][j].owner == country)
X			&& (sct[i][j].designation == DGOLDMINE)){
X				holdval+=sct[i][j].jewels;
X			}
X			if (holdval > 0) count = (rand()%holdval) + 1;
X			else count = done = FALSE;
X			if (count == FALSE ) break;
X			for (xpos=0; count && (xpos<MAPX); xpos++)
X			for (ypos=0; count && (ypos<MAPY); ypos++)
X			if(( sct[xpos][ypos].owner == country)
X			&& (sct[xpos][ypos].designation == DGOLDMINE)){
X				count-=sct[xpos][ypos].jewels;
X				if (count<=0) {
X					count=0;
X					done=TRUE;
X					sct[xpos][ypos].designation = DNODESIG;
X					sct[xpos][ypos].tradegood = TG_none;
X					sct[xpos][ypos].jewels = 0;
X				}
X			}
X			break;
X		case 21:
X			/*flood*/
X			done=FALSE;
X			break;
X		case 22:	/*earthquake*/
X			/* get epicenter */
X			sptr = rand_sector();
X			percent = 30+rand()%40;
X			/* 10% damage in 3 sectors, 25 in 1, 50 in */
X			for (x=xpos-3;x<=xpos+3;x++)
X			for (y=ypos-3;y<=ypos+3;y++) if(ONMAP(x,y)) {
X				reduce(x, y, percent/5 );
X			}
X
X			for (x=xpos-1;x<=xpos+1;x++)
X			for (y=ypos-1;y<=ypos+1;y++) if(ONMAP(x,y)) {
X				reduce(x,y,percent/5);	/* ADDITIONAL % */
X				if((rand()%2) == 0)
X					DEVASTATE(x,y);
X			}
X
X			if(sptr->fortress < 2) sptr->fortress = 0;
X			else sptr->fortress -= 2;
X			reduce(xpos, ypos, (percent*3)/5); /* ADDITIONAL % */
X			break;
X		case 23:
X			/*frost -- crops ruined*/
X			done=FALSE;
X			break;
X		case 24:
X			/*dragon killed + 50000 jewels*/
X			longval = rand()%10 * 10000;
X			sprintf(eventstr,"you gain %ld jewels",longval);
X			curntn->jewels+=longval;
X			break;
X		case 25:
X			/*nomad raid -- put large nomad army in area*/
X			for( holdval=1;holdval<NTOTAL;holdval++ )
X				if( ntn[holdval].active==NPC_NOMAD ) break;
X
X			if( holdval==NTOTAL ) break;
X			done=FALSE;
X			if(holdval==NTOTAL) break;
X			for(count=0; count < 100; count++) if(done <= 3){
X			xpos=(rand()%(MAPX-8))+4;
X			ypos=(rand()%(MAPY-8))+4;
X			/* get army number */
X			armynum = -1;
X			for(newpower=0; newpower<MAXARM; newpower++)
X				if (ntn[holdval].arm[newpower].sold == 0)
X					armynum=newpower;
X			if(armynum == -1) done=4;
X			else if((is_habitable(xpos,ypos))
X			&& ( sct[xpos][ypos].owner == country)) {
X				ntn[holdval].arm[armynum].xloc =xpos;
X				ntn[holdval].arm[armynum].yloc =ypos;
X				if(curntn->tmil > 10000)	/* 800-4800 */
X				ntn[holdval].arm[armynum].sold =800+50*(rand()%80);
X				else if(curntn->tmil > 5000) /* 500-2500 */
X				ntn[holdval].arm[armynum].sold =500+50*(rand()%40);
X				else if(curntn->tmil > 1000) /* 400-1400 */
X				ntn[holdval].arm[armynum].sold =400+20*(rand()%50);
X				else	/* 200-600 */
X				ntn[holdval].arm[armynum].sold =200+20*(rand()%20);
X				ntn[holdval].arm[armynum].unittyp = A_LT_CAV;
X				ntn[holdval].arm[armynum].stat =ATTACK;
X				done++;
X			}
X			}
X			done=TRUE;
X			break;
X		case 26:
X			/*town burns -- reduce fort and redesignate*/
X			holdval=0;
X			for (xpos=0; xpos<MAPX; xpos++) 
X			for (ypos=0; ypos<MAPY; ypos++)
X			if(( sct[xpos][ypos].owner == country)
X			&& ( sct[xpos][ypos].designation == DTOWN)){
X				holdval++;
X			}
X			done = FALSE;
X			if (holdval > 0) count = (rand()%holdval) + 1;
X			else	break;
X
X			percent = 25 + rand()%50;
X			for (xpos=0; count && (xpos<MAPX); xpos++)
X			for (ypos=0; count && (ypos<MAPY); ypos++)
X			if(( sct[xpos][ypos].owner == country)
X			&& ( done==FALSE )
X			&& ( sct[xpos][ypos].designation == DTOWN)){
X				count--;
X				if (count<=0) {
X					count=0;
X					sct[xpos][ypos].designation = DNODESIG;
X					reduce(xpos,ypos,percent);
X					done=TRUE;
X					break;
X				}
X			}
X			break;
X		case 27:
X			/*plague -- 40% of populace in cities dies*/
X			strcpy(eventstr,"40% of populace & armies in towns die");
X			for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X			if( sct[i][j].owner == country ){
X				sptr = &sct[i][j];
X				if( ISCITY( sptr->designation )){
X					sct[i][j].people *= 6;
X					sct[i][j].people /= 10;
X				}
X			}
X			for (armynum=0; armynum<MAXARM; armynum++)
X			if((P_ASOLD > 0)&&(P_ATYPE<MINLEADER)){
X				sptr = &sct[P_AXLOC][P_AYLOC];
X				if( ISCITY( sptr->designation )){
X					P_ASOLD *= (6);
X					P_ASOLD /= (10);
X				}
X			}
X			break;
X		case 28: /*pirate raid on harbor*/
X			done=FALSE;
X			break;
X		case 29: /*barbarian raid*/
X			done=FALSE;
X			break;
X		case 30: /*new magician + RANDOM POWER*/
X			/*buy new powers and/or new weapons*/
X			if((newpower=getmagic(M_CIV))!=0L){
X				for(i=S_CIV;i<S_CIV+E_CIV;i++) 
X				if(powers[i]==newpower){
X				sprintf(eventstr,"nation %s gets civilian power %s",curntn->name,pwrname[i]);
X				}
X				exenewmgk(newpower);
X			}
X			else done=FALSE;
X			break;
X		case 31: /*new magic item + RANDOM POWER*/
X			/*buy new powers and/or new weapons*/
X			if((newpower=getmagic(M_MIL))!=0){
X				for(i=S_MIL;i<S_MIL+E_MIL;i++) 
X				if(powers[i]==newpower)
X				sprintf(eventstr,"nation %s gets military power %s",curntn->name,pwrname[i]);
X				exenewmgk(newpower);
X			}
X			else done=FALSE;
X			break;
X		case 32:
X			/* ores run out */
X			holdval=0;
X			for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X			if(( sct[i][j].owner == country)
X			&& (sct[i][j].designation == DMINE)){
X				holdval+= sct[i][j].metal;
X			}
X
X			done = FALSE;
X			if (holdval > 0) count = (rand()%holdval) + 1;
X			else break;
X
X			for (xpos=0; count && (xpos<MAPX); xpos++)
X			for (ypos=0; count && (ypos<MAPY); ypos++)
X			if(( sct[xpos][ypos].owner == country)
X			&& (done == FALSE )
X			&& (sct[xpos][ypos].designation == DMINE)){
X				count-=sct[xpos][ypos].metal;
X				if (count<=0) {
X					sct[xpos][ypos].metal =0;
X					sct[xpos][ypos].tradegood =TG_none;
X					sct[xpos][ypos].designation = DNODESIG;
X					done=TRUE;
X				}
X			}
X			break;
X		case 33:
X			/*new architect strengthens castle walls */
X			for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X				if( sct[i][j].owner == country ){
X					sptr = &sct[i][j];
X					if( ISCITY( sptr->designation ))
X						sct[i][j].fortress += 2;
X				}
X			break;
X		case 34: /* new ores discovered */
X			holdval=0;
X			for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X			if(( sct[i][j].owner == country)
X			&& (is_habitable(i,j))
X			&&(sct[i][j].metal == 0)) holdval++;
X
X			done = FALSE;
X			if (holdval > 0) count = (rand()%holdval)+1;
X			else break;
X
X			for (xpos=0; count && (xpos<MAPX); xpos++)
X			for (ypos=0; count && (ypos<MAPY); ypos++)
X			if(( sct[xpos][ypos].owner == country)
X			&& ( done == FALSE )
X			&& (is_habitable(xpos,ypos))
X			&& (sct[xpos][ypos].metal == 0)){
X				if(count-- <= 0) {
X					getmetal( &(sct[xpos][ypos]) );
X					done=TRUE;
X					break;
X				}
X			}
X			break;
X		case 35:
X			/*new leader sets up peace*/
X			for(newnation=0;newnation<NTOTAL;newnation++) 
X			if(( country!=newnation ) 
X			&&( isntn( ntn[newnation].active ))
X			&&( ntn[newnation].dstatus[country]>NEUTRAL )){
X				ntn[newnation].dstatus[country]=NEUTRAL;
X				curntn->dstatus[newnation]=NEUTRAL;
X			}
X			break;
X		case 36:
X			/*powerful magi curses nation; lose a power*/
X			done=TRUE;
X			i=holdval=0;
X			while( powers[i] != 0 ){
X				if(magic(country,powers[i])==TRUE) holdval++;
X				i++;
X			}
X			if (holdval!=0) holdval = rand()%holdval+1;
X			newpower=0L;
X			for(i=0;powers[i]!=0 && holdval>0;i++) {
X				if (magic(country,powers[i])==TRUE) holdval--;
X				if (holdval==0) {
X					newpower=powers[i];
X					break;
X				}
X			}
X			if(newpower==0L) {
X				done=FALSE;
X				break;
X			}
X			/* upgrade powers */
X			switch(newpower) {
X			case MI_MONST:
X				if(magic(country,AV_MONST)==TRUE) {
X					newpower=AV_MONST;
X					i++;
X				}
X			case AV_MONST:
X				if(magic(country,MA_MONST)==TRUE) {
X					newpower=MA_MONST;
X					i++;
X				}
X				break;
X			case WARRIOR:
X				if(magic(country,CAPTAIN)==TRUE) {
X					newpower=CAPTAIN;
X					i++;
X				}
X			case CAPTAIN:
X				if(magic(country,WARLORD)==TRUE) {
X					newpower=WARLORD;
X					i++;
X				}
X				break;
X			case SUMMON:
X				if(magic(country,WYZARD)==TRUE) {
X					newpower=WYZARD;
X					i++;
X				}
X			case WYZARD:
X				if(magic(country,SORCERER)==TRUE) {
X					newpower=SORCERER;
X					i++;
X				}
X				break;
X			default:
X				break;
X			}
X			/* may not remove racial magics */
X			switch(curntn->race) {
X			case ORC:
X				if(newpower==MI_MONST) done=FALSE;
X				break;
X			case ELF:
X				if(newpower==THE_VOID) done=FALSE;
X				break;
X			case DWARF:
X				if(newpower==MINER) done=FALSE;
X				break;
X			case HUMAN:
X				if(newpower==WARRIOR) done=FALSE;
X				break;
X			}
X			switch(curntn->class) {
X			case C_WIZARD:
X				if(newpower==SUMMON) done=FALSE;
X				break;
X			case C_PRIEST:
X				if(newpower==RELIGION) done=FALSE;
X				break;
X			case C_PIRATE:
X				if(newpower==SAILOR) done=FALSE;
X				break;
X			case C_TRADER:
X				if(newpower==URBAN) done=FALSE;
X				break;
X			case C_WARLORD:
X				if(newpower==WARLORD) done=FALSE;
X				break;
X			case C_DEMON:
X				if(newpower==DESTROYER) done=FALSE;
X				break;
X			case C_DRAGON:
X				if(newpower==MA_MONST) done=FALSE;
X				break;
X			case C_SHADOW:
X				if(newpower==THE_VOID) done=FALSE;
X				break;
X			default:
X				break;
X			}
X			/* remove the magic */
X			if(done==TRUE) {
X				if(magic(country,newpower)==TRUE) {
X					curntn->powers ^= newpower;
X					removemgk(newpower);
X					sprintf(eventstr,"nation %s loses %s power",curntn->name,pwrname[i]);
X				} else {
X					done=FALSE;
X					fprintf(stderr,"ERROR: removing no-magic\n");
X				}
X			}
X			break;
X		case 37:
X			/*severe winter*/
X			done=FALSE;
X			break;
X		case 38:
X			/*tidal wave -- abandon all coastlands */
X			done=FALSE;
X			break;
X		case 39: /*ninja attack paralyzes half your armys P_AMOVE=0*/
X		case 40: /*general found to be spy P_AMOVE=0*/
X 			strcpy(eventstr,"1/2 nations armies are paralyzed");
X			for(armynum=0;armynum<MAXARM;armynum++) if(rand()%2==0)
X				P_AMOVE = 0;
X			break;
X		case 41:
X			/*general prosperity +20% gold*/
X			if (curntn->tgold > 0l) {
X				curntn->tgold += curntn->tgold / 5;
X			}
X			else 
X				curntn->tgold += 50000L;
X			break;
X		case 42:
X		case 43:
X			/*kill 20% of armies*/
X			for (armynum=0; armynum<MAXARM; armynum++)
X				if((P_ASOLD > 0) && (P_ATYPE<MINLEADER)){
X					P_ASOLD *= (8);
X					P_ASOLD /= (10);
X				}
X			break;
X		default:
X			break;
X		}
X		if(done) wdisaster(country,xpos,ypos,percent,randevents[event]);
X		}
X	}
X}
X
X/* print a report to the appropriate places */
Xvoid
Xwdisaster( cntry,xloc,yloc,prcnt,event )
Xint cntry,xloc,yloc,prcnt;
Xchar *event;
X{
X	fprintf(fnews,"1. \t%s in %s\n",event,ntn[cntry].name);
X	printf("\t%s in %s\n",event,ntn[cntry].name);
X
X	/*send a message to the country if it is a PC*/
X	if(ispc(ntn[cntry].active)) {
X		mailopen( cntry );
X		fprintf(fm,"MESSAGE FROM CONQUER\n");
X		fprintf(fm,"An event occurs within your nation (%s)\n",ntn[cntry].name);
X		fprintf(fm,"%s during the %s of Year %d,\n",event,PSEASON(TURN),YEAR(TURN));
X		if(xloc != -1)
X		fprintf(fm," centered around location %d, %d.\n",xloc,yloc);
X		if(prcnt>0) {
X			fprintf(fm,"Damage was estimated at about %d%% in severity.\n",prcnt);
X		}
X	}
X
X	if(strlen(eventstr)>5) {
X#ifdef HIDELOC
X		/* make sure that volcano locations are not revealed */
X		if(strcmp(eventstr,"volcano erupted")!=0)
X#endif HIDELOC
X		fprintf(fnews,"1. \tevent in %s -->%s\n",ntn[cntry].name,eventstr);
X#ifndef HIDELOC
X		if(xloc != -1)
X		fprintf(fnews,"1. \tevent in %s -->centered around location %d, %d.\n",ntn[cntry].name,xloc,yloc);
X#endif HIDELOC
X		printf("\t\t->%s\n",eventstr);
X		if(ispc(ntn[cntry].active))
X			fprintf(fm,"\t%s\n",eventstr);
X	}
X	mailclose();
X}
X
Xint
Xpeasant_revolt(newnation)	/* peasant revolt */
Xint	*newnation;		/* return nation id */
X{
X	register int i,j;
X	int	armynum;
X
X	/* a little cheating for now */
X	if(isnpc( ntn[country].active ) && (rand()%2==0)) {
X		strcpy(eventstr,"npc cheating");
X		return;
X	}
X	if((*newnation=disolve(10, country, TRUE)) == 0 ) return;
X
X	curntn = &ntn[*newnation];	/* beware - curntn & country not same */
X	curntn->active = NPC_PEASANT;
X	curntn->class = 0;
X
X	for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++) {
X		if(( sct[i][j].owner == country)
X		&&( rand()%2==0 ) 
X		&&( sct[i][j].designation != DCAPITOL )
X		&&( sct[i][j].people > 0 )
X		&&( solds_in_sector(i,j,country)==0)){
X			sct[i][j].owner = *newnation;
X			for(armynum=0;armynum<MAXARM;armynum++)
X			if(P_ASOLD == 0) {
X				P_ASOLD = sct[i][j].people/5;
X				P_ATYPE = A_MILITIA;
X				P_ASTAT = MILITIA;
X				P_AXLOC = i;
X				P_AYLOC = j;
X				sct[i][j].people -= P_ASOLD;
X				break;
X			}
X		}
X	}
X	curntn->popularity=99;	/* so it dont happen too often */
X	curntn = &ntn[country];	/* fix above beware comment */
X	return;
X}
Xint
Xother_revolt( new )	/* return reason and new nation number*/
Xint	*new;
X{
X	short	reason = rand()%8;
X	switch( reason ) {
X	case 0: /* general */
X		if((*new=disolve(10, country, FALSE))!=0) return(reason);
X		break;
X	case 1: /* cult */
X		if((*new=disolve(10, country, FALSE))!=0) return(reason);
X		break;
X	case 2: /* general/province defects*/
X		if((*new=disolve(10, country, FALSE))!=0) return(reason);
X		break;
X	case 3: /* evil wizard sets up */
X		if((*new=disolve(10, country, FALSE))!=0) return(reason);
X		break;
X	case 4: /* tax revolt */
X		if((*new=disolve(20, country, FALSE))!=0) return(reason);
X		break;
X	case 5: /* open rebelion */
X		if((*new=disolve(30, country, FALSE))!=0) return(reason);
X		break;
X	case 6: /* general takes over province*/
X		if((*new=disolve(30, country, FALSE))!=0) return(reason);
X		break;
X	case 7: /*religious schism*/
X		if((*new=disolve(30, country, FALSE))!=0) return(reason);
X		break;
X	}
X	return(-1);
X}
X
X#ifdef VULCANIZE
X/*volcano erupts --- causes devastation in surrounding sectors */
Xvoid
Xerupt()
X{
X	int i, j, nvolcanos=0, volhold;
X
X	printf("checking for volcanic eruptions\n");
X	/* count all of the volcanos */
X	for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X		if(sct[i][j].vegetation == VOLCANO) nvolcanos++;
X
X	if(nvolcanos==0) {
X		printf("no volcano's found\n");
X		return;
X	}
X	/* choose a random one to erupt */
X	volhold = rand()%nvolcanos;
X	for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
X	if ( sct[i][j].vegetation == VOLCANO ) {
X		volhold--;
X		if (volhold == 0) blowup(i,j);
X	}
X}
X#endif VULCANIZE
X
X/* blowup a volcano in sector i,j */
Xvoid
Xblowup(i,j)
Xregister int i,j;
X{
X	register int x,y;
X	wdisaster(sct[i][j].owner,i,j,100,"volcano erupted");
X	printf("\tvolcano at %d, %d erupts; devastates surounding area\n",i,j);
X	fprintf(fnews,"1. \tevent in sector %d, %d->volcanic eruption causes devastation\n",i,j);
X	sct[i][j].vegetation = VOLCANO;
X	sct[i][j].jewels = 0;
X	sct[i][j].metal = 0;
X	reduce(i,j,100);
X	DEVASTATE(i,j);
X	sct[i][j].fortress = 0;
X	/* decrease neighboring population and armies 30% */
X	for(x=i-1; x<=i+1; x++) for(y=j-1; y<=j+1; y++)
X	if((ONMAP(x,y))&&(sct[x][y].altitude != WATER)) {
X		reduce(x,y,30);
X		DEVASTATE(i,j);
X		sct[x][y].fortress = 0;
X	}
X}
X
X/** reduce will drop armies & and civilians in sector by percent **/
Xvoid
Xreduce(x,y,percent)
Xint x,y,percent;
X{
X	long temp;	/* used to avoid overflow problems */
X	int armynum,ctry;
X
X	percent = 100 - percent;	/* invert percent so math works */
X
X	/* work on people */
X	temp = sct[x][y].people;
X	temp *= percent;
X	temp /= 100;
X	sct[x][y].people = temp;
X
X	/* work on armies */
X	for(ctry=1;ctry<NTOTAL;ctry++) {
X		for(armynum=0;armynum<MAXARM;armynum++)
X		if((ntn[ctry].arm[armynum].xloc==x)
X		&&(ntn[ctry].arm[armynum].unittyp<MINLEADER)
X		&&(ntn[ctry].arm[armynum].yloc==y)) {
X			temp = ntn[ctry].arm[armynum].sold;
X			temp *= percent;
X			temp /= 100;
X			ntn[ctry].arm[armynum].sold = temp;
X		}
X	}
X}
X
X/* returns pointer to random sector in country */
Xstruct s_sector
X*rand_sector()
X{
X	int count=0;
X	for(xpos=0;xpos<MAPX;xpos++) for(ypos=0;ypos<MAPX;ypos++)
X		if(sct[xpos][ypos].owner == country) count++;
X	count = rand()%count;
X	for(xpos=0;xpos<MAPX;xpos++) for(ypos=0;ypos<MAPX;ypos++){
X		if(sct[xpos][ypos].owner == country) count--;
X		if(count==0) return(&sct[xpos][ypos]);
X	}
X	abrt();
X	return(NULL);	/* stop lint from complaining */
X}
X
Xvoid
Xweather()
X{
X}
X#endif ADMIN
X#endif RANEVENT
END_OF_FILE
if test 29480 -ne `wc -c <'randeven.c'`; then
    echo shar: \"'randeven.c'\" unpacked with wrong size!
fi
# end of 'randeven.c'
fi
if test -f 'txt5' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'txt5'\"
else
echo shar: Extracting \"'txt5'\" \(12333 characters\)
sed "s/^X//" >'txt5' <<'END_OF_FILE'
X                           SCORING & CHARACTER CLASSES
X
XEach nation has a types (class), which is chosen when it it is created, and
Xwhich determines how Victory points are received.  Some classes start with
Xpowers and have a starting cost. Warlord/Monster powers get all prerequisite
Xpowers, and thus starting cost can varies.
X
X         Per   1000   1000  100K  100K  100K  Magic  10  Start
X       Sector People Troops Gold Jewels Metal Power Ship Cost  Races Powers
Xking     1      1       2     3    0     0      0     0   0    HDE   None
Xempire   1.5    0       0     1    1     0      0     0   0    HDE   None
Xwizard   0      2       1     0    3     5      7     0   6    HE    SUMMON
Xpriest   1      1       0     0    3     0      3     0   3    H     RELIGION
Xpirate   0      0       5     0   10    10      1     5   3    HOD   SAILOR
Xtrader   1      1       0     0    1     1      1     8   3    HE    URBAN
Xwarlord  1      1       2     0    1     1      1     0   *    HOD   WARLORD
Xdemon    1      0       1     0    1     0      5     0   6    O     DESTROYER
Xdragon   0      0       0    10   20     0      0     0   6    O     MA_MONST
Xshadow   1      0       0     0    0     5      0     0   3    O     VOID
XNPC      1      1       0     0    1     1      1     0   0    HDEO  None
XEND
X                               ADDITIONAL SCORING
X
XNations can get points by having large values in their important national
Xattributes.  This bonus to scoring is calculated as follows.
X
Xking     ( Popularity   +  Prestige   -  Poverty      ) / 10
Xempire   ( Power        +  Prestige   -  Poverty      ) / 10
Xwizard   ( Knowledge    +  Power      -  50           ) / 10
Xpriest   ( Wealth       +  Terror     -  Poverty      ) / 10
Xpirate   ( Reputation   +  Wealth     -  50           ) / 10
Xtrader   ( Wealth       +  Prestige   -  Tax Rate * 5 ) / 10
Xwarlord  ( Reputation   +  Prestige   -  50           ) / 10
Xdemon    ( Knowledge    +  Terror     -  50           ) / 10
Xdragon   ( Wealth       +  Terror     -  50           ) / 10
Xshadow   ( Power        +  Terror     -  50           ) / 10
XEND
X                               LEADERS
X
XLeader units represent individual leaders and may not be merged or joined
Xwith other leader units.
X
XLeaders are born (randomly created), not summoned or drafted.  A new
Xleader will be placed in the owning players capitol.  Leader types
Xare created based on a nations class based on the table on the next page.
XThey can move at double speed and ignore enemy zones of control.  They
Xcan not, however, capture land.  They work by the same rules that magic
Xmonsters do... if they take damage in combat, there is a percent chance 
Xthat they will be killed.  A leader is required to be in the same sector
Xfor an army to move at full movement rate (if no leader is present, the
Xunit can move only half as far).  Leaders are the foundations of army
Xgroups, and armies in a group move at +2 sectors per turn, and fight
Xat +20% in all combats.
XEND
X                                LEADERS STATS
X
XNation     # Start  % Born   Nation  combat  combat   Minor  combat  combat
XClass      Leaders   Year    Leader  bonus  strength  Leader bonus strength
X                             Name                     Name
X
Xtrader     1/4        50     KING      +30    100     BARON    +20   50
Xking       1/4        50     KING      +30    100     BARON    +20   50
Xempire     1/4        50     EMPEROR   +30    100     PRINCE   +20   50
Xwizard     1/4        25     WIZARD    +30    250     MAGI     +20   50
Xpriest     1/6        25     APOSTLE   +30    100     BISHOP   +20   50
Xpirate     1/6        25     ADMIRAL   +30    100     CAPTAIN  +20   50
Xwarlord    1/6        25     WARLORD   +30    250     LORD     +20   100
Xdemon      1/6        25     DEMON     +50    250     DEVIL    +20   50
Xdragon     1/6        2      DRAGON    +50    500     WYRM     +40   100
Xshadow     1/6        2      SHADOW    +50    250     NAZGUL   +40   120
XNPC        1/4        50     KING      +30    100     BARON    +20   50
XEND
X                        LOSING YOUR NATIONAL LEADER
X
XIf you lose your nations leader, your nation is thrown into chaos.  None of
Xyour armies can move for the turn (this works for npcs too).  There is a
X30% chance per turn that your nation is restored to normalcy (a new leader
Xascends to the throne... and you get your nations leader back).  This
Xis a disaster to your country and is designed to knock you out of the
Xgame for a few turns (after all - losing your king is a BIG deal).  Minor
Xleaders are reborn at a good clip, but you should guard them because they
Xare important to your ability to wage war.
X
XNote that birth rates given on the last table are per year (not per turn).
XEND
X                          EXOTIC TRADE GOODS
X  
XSpecial products, or exotic trade goods, are another way to customize
Xyour nation.  Many sectors have the ability to produce these goods...
Xit is your choice to redesignate these sectors so as to be able to use
Xthem.  The goods in a sector are listed as "special: ?????" on the
Xright hand side of the screen.  There are 5 levels of exotic trade
Xgoods. Each requires prerequisite values in the nation attribute they
Xshall effect. If you don't have the prerequisite, you don't even know
Xthat the good exists (surprise).
X  
XExotic Trade Goods are distributed to sectors at the beginning of the
Xgame, and don't change.  Each sector has XTRADEPCT% chance of having an
Xexotic trade good.  Goods are random distributed based on the goods
Xvalue (a value 5 good occurs 1/5th as often as value 1 good).  Any
Xsector can have any good except:
X
Xcorn,fruit - food value > 6                   fish - next to water
Xtimber,pine,oak - wood/forest
X
XThey add ( value * sect_pop / 1000) to your nations attributes as follows:
XEND
X                        WHAT GOODS EXIST          pg. 1
X
XThere are approximately 60 different trade goods.  They affects specific 
Xnational attributes WHEN the sector they are in has the correct designation.  
XThe following lists the value, designation needed, and nation attribute 
Xchanged for each trade good.  Thus, an wool sector designated as a farm 
Xproduces 3 points of popularity.  Special display and redesignation options
Xwill help you redesignate sectors to use the tradegood you desire.
X
Xpopularity     fur(1,any),wool(3,farm),beer(3,farm),cloth(3,farm),wine(5,farm)
Xcommunications mules(1,town),horses(5,town),pigeons(7,town),griffons(9,town)
Xspoilrate      pottery(1,town),salt(3,mine),timber(1,lumberyard),
X               granite(1,mine),pine(3,lumberyd),oak(5,lumberyd),nails(7,town)
Xknowledge      papyrus(3,town),math(4,university),library(5,university),
X               drama(6,city),paper(7,town),literature(7,city),
X               law(8,city),philosophy(9,city)
XEND
X                          WHAT GOODS EXIST          pg. 2
X
Xfarm            irrigation(1,farm),oxen(2,farm),plows(3,farm)
Xmagic           mercury(5,mine),guild(7,town)
Xspell points    magic stones(9,special)
Xhealth          herbs(3,any),medicine(7,town)
Xterror          torture(5,city),prison(7,city)
X
XThe following trade goods add directly to a sectors food value:
X       corn(1,farm),fish(1,farm),sugar(3,farm),honey(3,farm),fruit(3,farm)
XEND
X                          NATION ATTRIBUTES          pg. 1
X
XAll nation attributes range from 0 to 100 except for eatrate, spoilrate,
Xand communications.  The base figures stated below are just that.  These 
Xvalues may be modified by random events and by trade goods.
X
Xtax rate     Each player can control their tax rate.  This number directly
X                impacts your revenue, but lowers your governments popularity 
X                and increases the chances of a revolt.  Anything over
X                15% pretty much lose you the game when your nation revolts.
Xprestige     National prestige.  Lowers chance of military revolts.
Xpopularity   Modifies the chance of peasant revolts.  You get one added
X             point of popularity for each sector you take.
Xpower        Relative power of your nation.
XEND
X                          NATION ATTRIBUTES          pg. 2
X
Xcommunications  Effects leader range ( to keep units at full movement ).
Xwealth          How wealthy is your nation
Xeatrate         How much food each civilian can eat each turn.  This is
X                a value in terms of food per civilian person.  
Xstorerate       How much food per civilian you can store each turn.
Xknowledge       Knowledge of the arts and sciences in your nation.
Xfarm ability    How good are you at farming.
Xmine ability    How good are you at mining.
Xpoverty         Percent of the nation that cant eat, live, or be merry.  
Xterror          How scared people are of you. Lowers chance of revolts.
Xreputation      How well liked is your nation.
XEND
X                FORMULAE USED FOR NATION ATTRIBUTES          pg. 1
X
XThe formulae used to compute national attributes are listed on the next
Xpage.  Values are stored in an unsigned character (0 to 256).  One real
Xpoint of communications range is gained for each 50 points of
Xcommunications, and one point of eatrate and store rate are gained per 25
Xpoints.  Other variables are normal.  Aggressiveness (see below) is gained
Xwhen you change diplomatic status, and become more hostile to a nation than
Xthey are with you.  Thus, if you are neutral with phonos, and they are
Xhostile to you, you lose nothing by going hostile with them, but accrue 1
Xpoint of aggressiveness by going to war with them, and 2 by going on a
Xjihad.  Aggressiveness points accrue doubled when against a nation of the
Xsame race as you.
X  
X# STARTING VALUES
Xreputation = prestige = 50         knowledge = mine ability = farm ability=10
Xeatrate     = 1.00                 tax rate=10%              poverty = 95%
XEND
X                FORMULAE USED FOR NATION ATTRIBUTES          pg. 2
X
Xterror      = 200*military/civilians + 200*mercenaries/military        max=100
Xpower       = 2*( % of worlds score + % of worlds military )           max=100
Xreputation  = reputation + rand(8) - 2 per point of aggressiveness     max=100
Xprestige    = ( old prestige + power + wealth ) / 3 + tradegoods       max=100
Xtax_rate    = user definable parameter
Xcommunicate = (townfolk/1000 + cityfolk/333 + tradegoods/50
X               + MONEY/(5000*sctrs))/50                                max=4
Xfarm ability= sum (sector people*foodvalue)*10/civilians + tradegoods  max=100
Xmine ability= see special section below
Xeat rate    = eatrate + food remaining/(5*population) + tradegoods/25  min=1
Xspoil rate  = 30-(grainaries+cities+3*capitols)/sectors-tradegoods/25  min=1
Xpopularity  = (old popularity + charity modifier + wealth + 10*eatrate 
X              + tradegoods +2*clerics ) /2                             max=100
Xknowledge   = cityfolk/333 + scholars/333 + townfolk/1000 + tradegoods max=100
XEND
X                FORMULAE USED FOR NATION ATTRIBUTES          pg. 3
X
Xpoverty     : is funny.  You can give charity to the poor to lower the poverty
X              rate but the equilibrium level with no charity will be about
X              100-wealth/4.  Charity is a user paramter, which indicates the
X              percent of your NET income to go to the poor.  Giving twice your
X              population in talons will reduce poverty by one.
XEND
X                ADDITIONAL MODIFIERS TO NATIONAL ATTRIBUTES
X
XMAGIC POWERS ADD OR SUBTRACT 10 FROM POWERS AS FOLLOWS:
X        SLAVER.....terror      ARCHITECT..storerate
X        RELIGION...popularity  URBAN......-popularity 
X        DEMOCRACY..-terror     ROADS......communication
X        KNOWALL....knowledge   DESTROYER..terror
X        VAMPIRE....terror      
X
XCLASSES ADD 30 TO POWERS AS FOLLOWS:
X        kingdom....popularity    dragon.....terror        
X        wizard.....knowledge     priest.....popularity
X        pirate.....terror        shadow.....terror
X        warlord....prestige      demon......terror
XEND
X                                REVOLTS
X
XRevolts are the worst thing that can happen to your nation.  Revolts
Xoccur based on the following formulae:
X
Xprobability of peasant revolt  = 10*tax_rate - popularity - terror - 3*charity
Xprobability of military revolt = 5*tax_rate - prestige
X
XRevolts only occur when a nation has more than 20 sectors and a
Xscore > 20.  To prevent abuse of this "charity" the maximum tax_rate
Xbefore this time is 10%.
XEND
XDONE
END_OF_FILE
if test 12333 -ne `wc -c <'txt5'`; then
    echo shar: \"'txt5'\" unpacked with wrong size!
fi
# end of 'txt5'
fi
echo shar: End of archive 11 \(of 14\).
cp /dev/null ark11isdone
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