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

billr@saab.CNA.TEK.COM (Bill Randle) (12/22/89)

Submitted-by: Adam Bryant <adb@cs.bu.edu>
Posting-number: Volume 8, Issue 76
Archive-name: conquer4/Patch7a
Patch-To: conquer4: Volume 6, Issue 83-96


 [[              Patchlevel 7 for Conquer Version 4
 Highlight Enhancements:
       - display improvements; many sub-screens are more consistent,
           and compact.
       - bug fixes; there are many more bug fixes in this patch than
           in prior ones, as I put bug fixing ahead of enhancement.
       - some restrictions changed; the trade screen now shows only
           items up for trade by known nations, and granaries and
           mills are now possible in any sector.
       - fixed up a good deal of the npc code, including some major
           segmentation fault bugs.
       - inflation is slightly adjusted and is now displayed in the
           budget report.
  As always, all of the changes are summarized in the notes.v4 file.
  Conquer is available for anonymous ftp at cs.bu.edu (128.197.2.1)
adam bryant (adb@cs.bu.edu)]]

#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  patchV4.7
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
echo "x - extracting patchV4.7 (Text)"
sed 's/^X//' << 'SHAR_EOF' > patchV4.7 &&
X*** opatchlevel.h	Tue Dec 12 21:19:37 1989
X--- patchlevel.h	Tue Dec 12 21:20:03 1989
X***************
X*** 1 ****
X! #define PATCHLEVEL	6
X--- 1 ----
X! #define PATCHLEVEL	7
X*** onotes.v4	Tue Dec 12 21:19:36 1989
X--- notes.v4	Tue Dec 12 21:20:04 1989
X***************
X*** 236,245 ****
X--- 236,300 ----
X  181. altered the god_mgk() display routine a little.
X  182. added in a limit of 16% to charity creeping for democracy.
X  183. added a check for a line with a period on it to end mail.
X+ ===4.0 patch number six released => 4.6 =================================
X+ 184. fixed bug in checking of sector population in construction of ships.
X+ 185. fixed bug with reversed if statement in god vegetation redesignation.
X+ 186. adjusted get_god routine to display prompt at bottom of screen only.
X+ 187. adjusted lizard fortress creation routine to increase gold and fort value.
X+ 188. fixed some display bugs with the god_magk() routines.
X+ 189. made spoilrate calculation floating point to avoid overflow.
X+ 190. fixed a bug with checking of password for 'z' command.
X+ 191. made the "DESTROY NATION" message in forms.c not clear screen.
X+ 192. made sure that WYZARD was not removable in random events.
X+ 193. fixed bug with randevent.c calculation of sector locations [D. Brooks]
X+ 194. implemented check to assure that MORE_MONST isn't too strong [R. Caley]
X+ 195. made sure god could destroy of monster nations in forms.c.
X+ 196. moved the 'z' command to the bottom portion of the screen.
X+ 197. fixed bug with get_nname(); accidently allowed up to NAMELTH+1 chars.
X+ 198. adjusted bottom of diplomacy screen to be more like other screens.
X+ 199. made the 'W' prompt appear at the bottom of the screen.
X+ 200. combat.c [636,637]: owner[k] -> UOWNER(k).  [Ken Dalka]
X+ 201. added a break to the nation name detection in main.c [Brad Isley]
X+ 202. fixed mistype of '<' to '>' reports.c (647) [Richard Kennaway]
X+ 203. adjusted calculation of attack bonus cost to avoid overflow [R. Kennaway]
X+ 204. fixed bug in printing nation name, update.c (579) [R. Kennaway]
X+ 205. adjusted output in wdisaster().  [R. Kennaway]
X+ 206. implemented check for limit of 12 in fortification. [should be #define]
X+ 207. removed a number of local variable declarations of country in misc.c.
X+ 208. allow changing of status of other nation is non-unmet.
X+ 209. added the option to change population for god in (r)edesignate command.
X+ 210. added time check on mail lock files to avoid old files lying around.
X+ 211. added ability for god to change combat statuses of nations.	
X+ 212. added time check to lock files as well, (thrice mail lock death time).
X+ 213. fixed bug in prep so that ships do not protect sectors from capture.
X+ 214. fixed overflow bug in GOLDTHRESH jewel purchase during update.
X+ 215. added new method for calculation of MORE_MONSTers (R. Caley)
X+ 216. for the 100th time, made sure that volcano victims are not revealed.
X+ 217. more adjustments to make sure sector locations are correct in randeven.c.
X+ 218. removed restrictions on mill and granary redesignating.
X+ 219. fixed spelling of "rebelion" to "rebellion" in two places in randeven.c.
X+ 220. changed inflation to be a yearly rate (where did I leave my head?).
X+ 221. adjusted offmap() in io.c to be consistent with coffmap().
X+ 222. putzed around in npc.c trying to catch a bug.
X+ 223. recenter new display upon going off screen.
X+ 224. update.c[821]: ">" to ">=" take with exact number of men. [Dave Flowers]
X+ 225. update.c[1017]: "min(" to "max(" (woops!! major typo) [Dave F.]
X+ 226. trade.c: altered visibility of items for sale. [Dave F.]
X+ 227. misc.c[498]: fixed overflow on gold scoring [Kenneth J Dalka]
X+ 228. adjusted inflation calculation in update.c and reports.c.
X+ 229. added the inflation estimation to the budget report.
X+ 230. fixed bug with division of charity by population. [Dave F.]
X+ 231. prevent passage of fleets through hostile cities.
X+ 232. added some checks in npc.c for ownership in drafting in some sectors.
X+ 233. removed destruction of troops on peaks, now that flight is possible.
X+ 234. changed to min zero in attractiveness, now drift will no longer occur
X+ 	for sectors with "zero" attractiveness.  [Dave F.]
X  
X  -------------------------------------------------------------------------
X  | 2.0 POSSIBLE SHORT-TERM ENHANCEMENTS/FIXES FOR CONQUER V5             |
X  -------------------------------------------------------------------------
X+ o allow god to alter more nation status values... combat bonus, score,
X+ 	other things.
X  o new functions:
X  	- status_value() = returns base values of attack.defend,etc.
X  	- sect_movecost() = returns move cost for given unit in given sector.
X*** odata.h	Tue Dec 12 21:19:34 1989
X--- data.h	Tue Dec 12 21:20:05 1989
X***************
X*** 3,8 ****
X--- 3,9 ----
X  /*--------I DO NOT BELIEVE IT IS NECESSARY TO ALTER THIS FILE----------------*/
X  #define	FAIL	1		/* fail return to shell			*/
X  #define	SUCCESS	0		/* successful return to shell		*/
X+ #define TIME_DEAD	3600	/* number of seconds for file aging	*/
X  #define	BIG	500000000L	/* BIGGER THAN ANYTHING SHOULD BE	*/
X  				/* this is used to protect against overflow */
X  #define	SCRARM	((LINES-14)/2)	/* number of armies to fit on screen	*/
X***************
X*** 203,209 ****
X  	long	people;			/* civilians in sector		*/
X  	short	i_people;		/* initial civilians in sector	*/
X  	unsigned char	jewels;		/* jewel production ability	*/
X! 	unsigned char	fortress;	/* fortification level (0 to 9)	*/
X  	unsigned char	metal;		/* metal produced by sector	*/
X  	unsigned char	tradegood;	/* exotic trade goods in sector	*/
X  	/* unsigned char	region;		/* index of region	*/
X--- 204,210 ----
X  	long	people;			/* civilians in sector		*/
X  	short	i_people;		/* initial civilians in sector	*/
X  	unsigned char	jewels;		/* jewel production ability	*/
X! 	unsigned char	fortress;	/* fortification level; 0 to 12	*/
X  	unsigned char	metal;		/* metal produced by sector	*/
X  	unsigned char	tradegood;	/* exotic trade goods in sector	*/
X  	/* unsigned char	region;		/* index of region	*/
X*** omakeworl.c	Tue Dec 12 21:19:35 1989
X--- makeworl.c	Tue Dec 12 21:20:06 1989
X***************
X*** 1015,1024 ****
X  			nlizards--;
X  			sct[x][y].designation = DFORT;
X  			sct[x][y].metal = 0;
X! 			sct[x][y].jewels = 8 + (i=rand()%20);
X  			sct[x][y].tradegood = TG_platinum;
X  			/* make fortificaton consistant with gold */
X! 			sct[x][y].fortress = 5+i/4;
X  			for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
X  				if((ONMAP(i,j))&&(sct[i][j].altitude!=WATER))
X  					sct[i][j].owner = country;
X--- 1015,1024 ----
X  			nlizards--;
X  			sct[x][y].designation = DFORT;
X  			sct[x][y].metal = 0;
X! 			sct[x][y].jewels = 8 + (i=rand()%30);
X  			sct[x][y].tradegood = TG_platinum;
X  			/* make fortificaton consistant with gold */
X! 			sct[x][y].fortress = 6+i/5;
X  			for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
X  				if((ONMAP(i,j))&&(sct[i][j].altitude!=WATER))
X  					sct[i][j].owner = country;
X*** orandeven.c	Tue Dec 12 21:19:37 1989
X--- randeven.c	Tue Dec 12 21:20:06 1989
X***************
X*** 23,29 ****
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--- 23,29 ----
X  /* 2 */  "a province rebels",
X  /* 3 */  "an evil wizard sets up",
X  /* 4 */  "a tax revolt occurs",
X! /* 5 */  "open rebellion flares",
X  /* 6 */  "an army revolts",
X  /* 7 */  "religions schism",
X  /* 8 */  "peasants revolt",
X***************
X*** 493,498 ****
X--- 493,501 ----
X  					done=TRUE;
X  				}
X  			}
X+ 			/* decrement to contain proper value */
X+ 			xpos--;
X+ 			ypos--;
X  			break;
X  		case 19:
X  		case 20:
X***************
X*** 519,524 ****
X--- 522,530 ----
X  					sct[xpos][ypos].jewels = 0;
X  				}
X  			}
X+ 			/* decrement to contain proper value */
X+ 			xpos--;
X+ 			ypos--;
X  			break;
X  		case 21:
X  			/*flood*/
X***************
X*** 622,627 ****
X--- 628,636 ----
X  				}
X  			}
X  			break;
X+ 			/* decrement to contain proper value */
X+ 			xpos--;
X+ 			ypos--;
X  		case 27:
X  			/*plague -- 40% of populace in cities dies*/
X  			strcpy(eventstr,"40% of populace & armies in towns die");
X***************
X*** 695,700 ****
X--- 704,712 ----
X  					done=TRUE;
X  				}
X  			}
X+ 			/* decrement to contain proper value */
X+ 			xpos--;
X+ 			ypos--;
X  			break;
X  		case 33:
X  			/*new architect strengthens castle walls */
X***************
X*** 728,736 ****
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--- 740,751 ----
X  					break;
X  				}
X  			}
X+ 			/* decrement to contain proper value */
X+ 			xpos--;
X+ 			ypos--;
X  			break;
X  		case 35:
X! 			/*diplomat sets up peace*/
X  			for(newnation=0;newnation<NTOTAL;newnation++) 
X  			if(( country!=newnation ) 
X  			&&( isntn( ntn[newnation].active ))
X***************
X*** 816,821 ****
X--- 831,837 ----
X  			switch(curntn->class) {
X  			case C_WIZARD:
X  				if(newpower==SUMMON) done=FALSE;
X+ 				if(newpower==WYZARD) done=FALSE;
X  				break;
X  			case C_PRIEST:
X  				if(newpower==RELIGION) done=FALSE;
X***************
X*** 918,924 ****
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--- 934,940 ----
X  	if(strlen(eventstr)>5) {
X  #ifdef HIDELOC
X  		/* make sure that volcano locations are not revealed */
X! 		if(strcmp(eventstr,"all flee, 30%% die in 1 sector range")!=0)
X  #endif HIDELOC
X  		fprintf(fnews,"1. \tevent in %s -->%s\n",ntn[cntry].name,eventstr);
X  #ifndef HIDELOC
X***************
X*** 994,1000 ****
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--- 1010,1016 ----
X  	case 4: /* tax revolt */
X  		if((*new=disolve(20, country, FALSE))!=0) return(reason);
X  		break;
X! 	case 5: /* open rebellion */
X  		if((*new=disolve(30, country, FALSE))!=0) return(reason);
X  		break;
X  	case 6: /* general takes over province*/
X*** ocexecute.c	Tue Dec 12 21:19:34 1989
X--- cexecute.c	Tue Dec 12 21:20:07 1989
X***************
X*** 293,313 ****
X  	}
X  	/*close file*/
X  	fclose(fexe);
X- 	/*send a message to God*/
X- 	if(mailopen( 0 )!=(-1)) {
X- 		fprintf(fm,"WARNING: Nation %s hungup on me.\n",curntn->name);
X- 		mailclose(0);
X- 	}
X  
X- 	/* remove the lock file */
X- 	unlink(fison);
X  	/* remove any existing mail reading/writing file */
X  	if (mailok!=DONEMAIL) {
X  		extern char tmp_mail_name[];
X  		unlink(tmp_mail_name);
X  	}
X  	sprintf(line,"%s%hd.tmp",msgfile,country);
X  	unlink(line);
X  	/* exit program */
X  	exit(FAIL);
X  }
X--- 293,316 ----
X  	}
X  	/*close file*/
X  	fclose(fexe);
X  
X  	/* remove any existing mail reading/writing file */
X  	if (mailok!=DONEMAIL) {
X  		extern char tmp_mail_name[];
X  		unlink(tmp_mail_name);
X  	}
X+ 
X+ 	/* remove the lock file */
X+ 	unlink(fison);
X  	sprintf(line,"%s%hd.tmp",msgfile,country);
X  	unlink(line);
X+ 
X+ 	/*send a message to God*/
X+ 	if(mailopen( 0 )!=(-1)) {
X+ 		fprintf(fm,"WARNING: Nation %s hungup on me.\n",curntn->name);
X+ 		mailclose(0);
X+ 	}
X+ 
X  	/* exit program */
X  	exit(FAIL);
X  }
X*** oforms.c	Tue Dec 12 21:19:35 1989
X--- forms.c	Tue Dec 12 21:20:07 1989
X***************
X*** 185,193 ****
X  
X  		/* display options */
X  		standout();
X! 		mvaddstr(LINES-7,0,"HIT RETURN KEY TO CHANGE STATUS; HIT SPACE IF DONE");
X! 		mvprintw(LINES-6,0,"HIT 'B' KEY TO BRIBE NPC NATION (cost=$%ld per 1000 Mil.)",BRIBE);
X! 		mvaddstr(LINES-5,0,"ANY OTHER KEY TO CONTINUE:");
X  		standend();
X  		refresh();
X  		k=getch();
X--- 185,193 ----
X  
X  		/* display options */
X  		standout();
X! 		mvaddstr(LINES-7,COLS/2-26,"HIT RETURN KEY TO CHANGE STATUS; HIT SPACE IF DONE");
X! 		mvprintw(LINES-6,COLS/2-31,"HIT 'B' KEY TO BRIBE NPC NATION (cost=$%ld per 1000 Mil.)",BRIBE);
X! 		mvaddstr(LINES-5,COLS/2-21,"HIT ANY OTHER KEY TO SCROLL NATIONS LIST");
X  		standend();
X  		refresh();
X  		k=getch();
X***************
X*** 219,230 ****
X  			if((nation<=0)
X  			||(nation>=NTOTAL)
X  			||(!isnpc(ntn[nation].active))){
X! 				errormsg("NOT NON PLAYER COUNTRY");
X  				if(isgod==TRUE) reset_god();
X  				return;
X  			}
X! 			if(ntn[country].dstatus[nation]==UNMET){
X! 				errormsg("YOU HAVE NOT MET COUNTRY");
X  				if(isgod==TRUE) reset_god();
X  				return;
X  			}
X--- 219,230 ----
X  			if((nation<=0)
X  			||(nation>=NTOTAL)
X  			||(!isnpc(ntn[nation].active))){
X! 				errormsg("That nation is not a Non-Player Country");
X  				if(isgod==TRUE) reset_god();
X  				return;
X  			}
X! 			if(ntn[nation].dstatus[country]==UNMET){
X! 				errormsg("They have no knowledge that you exist");
X  				if(isgod==TRUE) reset_god();
X  				return;
X  			}
X***************
X*** 233,239 ****
X  			    ||(ntn[nation].dstatus[country]==JIHAD)
X  			    ||(ntn[nation].dstatus[country]==UNMET)
X  			    ||(ntn[nation].dstatus[country]==TREATY))){
X! 				errormsg("Sorry, you can't bribe them");
X  				return;
X  			}
X  
X--- 233,239 ----
X  			    ||(ntn[nation].dstatus[country]==JIHAD)
X  			    ||(ntn[nation].dstatus[country]==UNMET)
X  			    ||(ntn[nation].dstatus[country]==TREATY))){
X! 				errormsg("Sorry, you cannot bribe them");
X  				return;
X  			}
X  
X***************
X*** 286,292 ****
X  			getch();
X  			if(isgod==TRUE) reset_god();
X  			return;
X! 		} else if (isgod==FALSE && curntn->dstatus[nation]==UNMET) {
X  			errormsg("Sorry, you have not met that nation yet.");
X  			if(isgod==TRUE) reset_god();
X  			return;
X--- 286,293 ----
X  			getch();
X  			if(isgod==TRUE) reset_god();
X  			return;
X! 		} else if (isgod==FALSE && curntn->dstatus[nation]==UNMET
X! 		&& ntn[nation].dstatus[country]==UNMET) {
X  			errormsg("Sorry, you have not met that nation yet.");
X  			if(isgod==TRUE) reset_god();
X  			return;
X***************
X*** 481,488 ****
X  	standout();
X  	mvaddstr(LINES-6,COLS/2-26,"HIT 'B' FOR BUDGET SCREEN, 'P' FOR PRODUCTION SCREEN");
X  	mvaddstr(LINES-5,COLS/2-25,"1) NAME 2) PASSWD 3) TAX RATE 4) CHARITY 5) TERROR");
X! 	if(magic(country,VAMPIRE)!=1)
X! 		mvaddstr(LINES-4,COLS/2-21,"6) ADD TO COMBAT BONUS");
X  	else	mvaddstr(LINES-4,COLS/2-22,"CANT ADD TO COMBAT BONUS");
X  	addstr(" 7) TOGGLE PC <-> NPC");
X  
X--- 482,489 ----
X  	standout();
X  	mvaddstr(LINES-6,COLS/2-26,"HIT 'B' FOR BUDGET SCREEN, 'P' FOR PRODUCTION SCREEN");
X  	mvaddstr(LINES-5,COLS/2-25,"1) NAME 2) PASSWD 3) TAX RATE 4) CHARITY 5) TERROR");
X! 	if(magic(country,VAMPIRE)!=1 || isgod==TRUE)
X! 		mvaddstr(LINES-4,COLS/2-21,"6) ADJUST TO COMBAT BONUS");
X  	else	mvaddstr(LINES-4,COLS/2-22,"CANT ADD TO COMBAT BONUS");
X  	addstr(" 7) TOGGLE PC <-> NPC");
X  
X***************
X*** 618,623 ****
X--- 619,642 ----
X  		}
X  		break;
X  	case '6':	/* combat bonus */
X+ #ifdef OGOD
X+ 		if(isgod==TRUE) {
X+ 			mvaddstr(LINES-2,0,"SUPER-USER: Change (A)ttack or (D)efense Bonus? ");
X+ 			refresh();
X+ 			if ((intval=getch())=='A' || intval=='a')  {
X+ 				mvaddstr(LINES-1,0,"Enter new value for Attack Bonus: ");
X+ 				refresh();
X+ 				curntn->aplus = get_number();
X+ 				if (curntn->aplus < 0) curntn->aplus = 0;
X+ 			} else if (intval=='d' || intval == 'D') {
X+ 				mvaddstr(LINES-1,0,"Enter new value for Defense Bonus: ");
X+ 				refresh();
X+ 				curntn->dplus = get_number();
X+ 				if (curntn->dplus < 0) curntn->dplus = 0;
X+ 			}
X+ 			break;
X+ 		}
X+ #endif /*OGOD*/
X  		if(magic(country,VAMPIRE)==1) {
X  			errormsg("VAMPIRES CAN'T ADD TO COMBAT BONUS");
X  			break;
X***************
X*** 630,637 ****
X  		for(armynum=0;armynum<MAXARM;armynum++)
X  			if((P_ASOLD>0)&&(P_ATYPE<MINLEADER)) men+=P_ASOLD;
X  		men = max( men, 1500);
X! 		armynum = max( curntn->aplus-intval, 10 );
X! 		cost = METALORE*men*armynum*armynum/100;
X  		if( curntn->race == ORC) cost*=3;
X  		mvprintw(LINES-1,0,"Do You Wish Spend %ld Metal On Attack (enter y or n):",cost);
X  		refresh();
X--- 649,656 ----
X  		for(armynum=0;armynum<MAXARM;armynum++)
X  			if((P_ASOLD>0)&&(P_ATYPE<MINLEADER)) men+=P_ASOLD;
X  		men = max( men, 1500);
X! 		armynum = max( curntn->aplus-intval, 10 ) / 10;
X! 		cost = METALORE*men*armynum*armynum;
X  		if( curntn->race == ORC) cost*=3;
X  		mvprintw(LINES-1,0,"Do You Wish Spend %ld Metal On Attack (enter y or n):",cost);
X  		refresh();
X***************
X*** 671,678 ****
X  		break;
X  	case '8':
X  		if(isgod==TRUE){
X! 			clear();
X  			mvaddstr(LINES-1,0,"DO YOU WANT TO DESTROY THIS NATION (y or n)");
X  			refresh();
X  
X  			if(getch()=='y') {
X--- 690,698 ----
X  		break;
X  	case '8':
X  		if(isgod==TRUE){
X! 			standout();
X  			mvaddstr(LINES-1,0,"DO YOU WANT TO DESTROY THIS NATION (y or n)");
X+ 			standend();
X  			refresh();
X  
X  			if(getch()=='y') {
X*** omisc.c	Tue Dec 12 21:19:36 1989
X--- misc.c	Tue Dec 12 21:20:07 1989
X***************
X*** 1,11 ****
X  /* Conquer: Copyright (c) 1988 by Edward M Barlow */
X  #include	<ctype.h>
X  #include	<stdio.h>
X  #include	"header.h"
X  #include	"data.h"
X  
X  extern FILE *fnews;
X! extern short country;
X  
X  extern char *HVegcost, *OVegcost, *EVegcost, *DVegcost, *FVegcost;
X  extern char *HElecost, *OElecost, *EElecost, *DElecost, *FElecost;
X--- 1,15 ----
X  /* Conquer: Copyright (c) 1988 by Edward M Barlow */
X  #include	<ctype.h>
X  #include	<stdio.h>
X+ #ifdef CONQUER
X+ #include	<sys/types.h>
X+ #include	<sys/stat.h>
X+ #endif /*CONQUER*/
X  #include	"header.h"
X  #include	"data.h"
X  
X  extern FILE *fnews;
X! extern short country,redraw;
X  
X  extern char *HVegcost, *OVegcost, *EVegcost, *DVegcost, *FVegcost;
X  extern char *HElecost, *OElecost, *EElecost, *DElecost, *FElecost;
X***************
X*** 431,442 ****
X   */
X  
X  long
X! solds_in_sector( x, y, country )
X  int	x;
X  int	y;
X! int	country;
X  {
X! 	register struct s_nation	*nptr = &ntn[country];
X  	register int	j;
X  	long	total = 0;
X  
X--- 435,446 ----
X   */
X  
X  long
X! solds_in_sector( x, y, nation )
X  int	x;
X  int	y;
X! int	nation;
X  {
X! 	register struct s_nation	*nptr = &ntn[nation];
X  	register int	j;
X  	long	total = 0;
X  
X***************
X*** 480,489 ****
X  };
X  
X  long
X! score_one( country )
X! int	country;
X  {
X! 	struct	s_nation	*nptr = &ntn[ country ];
X  	long	total = 0;
X  	int	bonus;
X  	struct	wght	*wght = &weights[ nptr->class ];
X--- 484,493 ----
X  };
X  
X  long
X! score_one( nation )
X! int	nation;
X  {
X! 	struct	s_nation	*nptr = &ntn[ nation ];
X  	long	total = 0;
X  	int	bonus;
X  	struct	wght	*wght = &weights[ nptr->class ];
X***************
X*** 491,533 ****
X  	total += wght->sectors * nptr->tsctrs / 2L;
X  	total += wght->civilians * nptr->tciv / 1000L;
X  	total += wght->soldiers * nptr->tmil / 1000L;
X! 	if(nptr->tgold > 0 ) total += wght->gold * nptr->tgold / 100000L;
X  	total += wght->jewels * nptr->jewels / 100000L;
X  	total += wght->metal * nptr->metals / 100000L;
X! 	total += wght->magics * num_powers(country,M_MIL);
X! 	total += wght->magics * num_powers(country,M_CIV);
X! 	total += wght->magics * num_powers(country,M_MGK);
X  	total += wght->ships * nptr->tships / 10L;
X  	switch( nptr->class ) {
X  	case 	C_KING:
X! 			bonus=(curntn->popularity+curntn->prestige-curntn->poverty);
X  			break;
X  	case	C_EMPEROR:
X! 			bonus=(curntn->power+curntn->prestige-curntn->poverty);
X  			break;
X  	case	C_WIZARD:
X! 			bonus=(curntn->knowledge+curntn->power-50);
X  			break;
X  	case	C_PRIEST:
X! 			bonus=(curntn->wealth+curntn->terror-curntn->poverty);
X  			break;
X  	case	C_PIRATE:
X! 			bonus=(curntn->reputation+curntn->wealth-50);
X  			break;
X  	case	C_TRADER:
X! 			bonus=(curntn->wealth+curntn->prestige-curntn->tax_rate*5);
X  			break;
X  	case	C_WARLORD:
X! 			bonus=(curntn->reputation+curntn->prestige-50);
X  			break;
X  	case	C_DEMON	:
X! 			bonus=(curntn->knowledge+curntn->terror-50);
X  			break;
X  	case	C_DRAGON:
X! 			bonus=(curntn->wealth+curntn->terror-50);
X  			break;
X  	case	C_SHADOW:
X! 			bonus=(curntn->power+curntn->terror-50);
X  			break;
X  	default:	bonus=0;
X  	}
X--- 495,537 ----
X  	total += wght->sectors * nptr->tsctrs / 2L;
X  	total += wght->civilians * nptr->tciv / 1000L;
X  	total += wght->soldiers * nptr->tmil / 1000L;
X! 	if(nptr->tgold > 0 ) total += wght->gold * (nptr->tgold / 100000L);
X  	total += wght->jewels * nptr->jewels / 100000L;
X  	total += wght->metal * nptr->metals / 100000L;
X! 	total += wght->magics * num_powers(nation,M_MIL);
X! 	total += wght->magics * num_powers(nation,M_CIV);
X! 	total += wght->magics * num_powers(nation,M_MGK);
X  	total += wght->ships * nptr->tships / 10L;
X  	switch( nptr->class ) {
X  	case 	C_KING:
X! 			bonus=(nptr->popularity+nptr->prestige-nptr->poverty);
X  			break;
X  	case	C_EMPEROR:
X! 			bonus=(nptr->power+nptr->prestige-nptr->poverty);
X  			break;
X  	case	C_WIZARD:
X! 			bonus=(nptr->knowledge+nptr->power-50);
X  			break;
X  	case	C_PRIEST:
X! 			bonus=(nptr->wealth+nptr->terror-nptr->poverty);
X  			break;
X  	case	C_PIRATE:
X! 			bonus=(nptr->reputation+nptr->wealth-50);
X  			break;
X  	case	C_TRADER:
X! 			bonus=(nptr->wealth+nptr->prestige-nptr->tax_rate*5);
X  			break;
X  	case	C_WARLORD:
X! 			bonus=(nptr->reputation+nptr->prestige-50);
X  			break;
X  	case	C_DEMON	:
X! 			bonus=(nptr->knowledge+nptr->terror-50);
X  			break;
X  	case	C_DRAGON:
X! 			bonus=(nptr->wealth+nptr->terror-50);
X  			break;
X  	case	C_SHADOW:
X! 			bonus=(nptr->power+nptr->terror-50);
X  			break;
X  	default:	bonus=0;
X  	}
X***************
X*** 564,585 ****
X  
X  #ifdef CONQUER
X  int
X! units_in_sector(x,y,country)
X  int	x;
X  int	y;
X  {
X  	int count=0, armynum, nvynum;
X  	for(armynum=0;armynum<MAXARM;armynum++)
X! 		if((ASOLD>0)&&(AXLOC==x)&&(AYLOC==y)) count++;
X  	for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X! 		if(((NWSHP+NMSHP+NGSHP)!=0)&&(NXLOC==x)&&(NYLOC==y)) count++;
X  	return(count);
X  }
X  #endif CONQUER
X  
X  int
X! num_powers(country,type)
X! int country,type;
X  {
X  	int	count_magic=0;
X  	int	try;
X--- 568,595 ----
X  
X  #ifdef CONQUER
X  int
X! units_in_sector(x,y,nation)
X  int	x;
X  int	y;
X  {
X  	int count=0, armynum, nvynum;
X+ 	struct	s_nation  *nptr = curntn;
X+ 
X+ 	curntn = &ntn[nation];
X  	for(armynum=0;armynum<MAXARM;armynum++)
X! 		if((P_ASOLD>0)&&(P_AXLOC==x)&&(P_AYLOC==y)) count++;
X  	for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X! 		if(((P_NWSHP+P_NMSHP+P_NGSHP)!=0)&&
X! 		(P_NXLOC==x)&&(P_NYLOC==y)) count++;
X! 
X! 	curntn = nptr;
X  	return(count);
X  }
X  #endif CONQUER
X  
X  int
X! num_powers(nation,type)
X! int nation,type;
X  {
X  	int	count_magic=0;
X  	int	try;
X***************
X*** 602,612 ****
X  			end=E_MGK;
X  			break;
X  		default:
X! 			printf("fatal error in num_powers");
X  			abrt();
X  	}
X  	for( try = start; try < start+end; try++ )
X! 		if( magic(country, powers[try] ) == 1 ) count_magic++;
X  	return(count_magic);
X  }
X  
X--- 612,622 ----
X  			end=E_MGK;
X  			break;
X  		default:
X! 			fprintf(stderr,"fatal error in num_powers");
X  			abrt();
X  	}
X  	for( try = start; try < start+end; try++ )
X! 		if( magic(nation, powers[try] ) == 1 ) count_magic++;
X  	return(count_magic);
X  }
X  
X***************
X*** 650,657 ****
X  
X  /* returns cost of magic power - returns -1 if invalid */
X  long
X! getmgkcost(type,country)
X! int type, country;
X  {
X  	int i;
X  	long cost;
X--- 660,667 ----
X  
X  /* returns cost of magic power - returns -1 if invalid */
X  long
X! getmgkcost(type,nation)
X! int type, nation;
X  {
X  	int i;
X  	long cost;
X***************
X*** 659,684 ****
X  	int npowers;
X  	switch(type) {
X  	case M_MGK:
X! 		if(ntn[country].race==DWARF)		base=DWFMAGIC;
X! 		else if(ntn[country].race==HUMAN)	base=HUMMAGIC;
X! 		else if(ntn[country].race==ORC)		base=ORCMAGIC;
X! 		npowers=num_powers(country,M_CIV)+num_powers(country,M_MIL)+1
X! 		+2*num_powers(country,M_MGK);
X  		npowers/=2;
X  		break;
X  	case M_CIV:
X! 		if(ntn[country].race==DWARF)		base=DWFCIVIL;
X! 		else if(ntn[country].race==HUMAN)	base=HUMCIVIL;
X! 		else if(ntn[country].race==ORC)		base=ORCCIVIL;
X! 		npowers=num_powers(country,M_MGK)+num_powers(country,M_MIL)+1
X! 		+2*num_powers(country,M_CIV);
X  		npowers/=2;
X  		break;
X  	case M_MIL:
X! 		if(ntn[country].race==DWARF)		base=DWFMILIT;
X! 		else if(ntn[country].race==ORC)		base=ORCMILIT;
X! 		npowers=num_powers(country,M_CIV)+num_powers(country,M_MGK)+1
X! 		+2*num_powers(country,M_MIL);
X  		npowers/=2;
X  		break;
X  	default:
X--- 669,694 ----
X  	int npowers;
X  	switch(type) {
X  	case M_MGK:
X! 		if(ntn[nation].race==DWARF)		base=DWFMAGIC;
X! 		else if(ntn[nation].race==HUMAN)	base=HUMMAGIC;
X! 		else if(ntn[nation].race==ORC)		base=ORCMAGIC;
X! 		npowers=num_powers(nation,M_CIV)+num_powers(nation,M_MIL)+1
X! 		+2*num_powers(nation,M_MGK);
X  		npowers/=2;
X  		break;
X  	case M_CIV:
X! 		if(ntn[nation].race==DWARF)		base=DWFCIVIL;
X! 		else if(ntn[nation].race==HUMAN)	base=HUMCIVIL;
X! 		else if(ntn[nation].race==ORC)		base=ORCCIVIL;
X! 		npowers=num_powers(nation,M_MGK)+num_powers(nation,M_MIL)+1
X! 		+2*num_powers(nation,M_CIV);
X  		npowers/=2;
X  		break;
X  	case M_MIL:
X! 		if(ntn[nation].race==DWARF)		base=DWFMILIT;
X! 		else if(ntn[nation].race==ORC)		base=ORCMILIT;
X! 		npowers=num_powers(nation,M_CIV)+num_powers(nation,M_MGK)+1
X! 		+2*num_powers(nation,M_MIL);
X  		npowers/=2;
X  		break;
X  	default:
X***************
X*** 704,714 ****
X  
X  /* set up occ[][] for country.
X   * if leader==true, only for leader sectors plus ntn.communicatins range
X!  * if shipchk==true, include ships on the sector search
X   */
X  void
X! prep(country,leader)
X! int country,leader;
X  {
X  	short armynum,nvynum;
X  	int save,i,j,x,y,start,end,com;
X--- 714,724 ----
X  
X  /* set up occ[][] for country.
X   * if leader==true, only for leader sectors plus ntn.communicatins range
X!  * if leader==(-1), do not include ships on the sector search
X   */
X  void
X! prep(nation,leader)
X! int nation,leader;
X  {
X  	short armynum,nvynum;
X  	int save,i,j,x,y,start,end,com;
X***************
X*** 716,723 ****
X  	/*set occ to 0*/
X  	for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++) occ[i][j]=0;
X  
X! 	save=country;
X! 	if(leader) {
X  		/* only do the given country */
X  		start=save;
X  		end=save+1;
X--- 726,733 ----
X  	/*set occ to 0*/
X  	for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++) occ[i][j]=0;
X  
X! 	save=nation;
X! 	if(leader==TRUE) {
X  		/* only do the given country */
X  		start=save;
X  		end=save+1;
X***************
X*** 728,737 ****
X  	}
X  
X  	/*set occ to country of occupant army*/
X! 	for(country=start;country<end;country++) if(ntn[country].active!=INACTIVE) {
X! 		curntn = &ntn[country];
X  		for(armynum=0;armynum<MAXARM;armynum++){
X! 			if( leader ) {
X  				if((P_ATYPE<MINLEADER)
X  				||(P_ATYPE>=MINMONSTER)
X  				||(P_ASOLD<=0)) continue;
X--- 738,747 ----
X  	}
X  
X  	/*set occ to country of occupant army*/
X! 	for(nation=start;nation<end;nation++) if(ntn[nation].active!=INACTIVE) {
X! 		curntn = &ntn[nation];
X  		for(armynum=0;armynum<MAXARM;armynum++){
X! 			if( leader==TRUE ) {
X  				if((P_ATYPE<MINLEADER)
X  				||(P_ATYPE>=MINMONSTER)
X  				||(P_ASOLD<=0)) continue;
X***************
X*** 740,786 ****
X  				com = P_NTNCOM; /* do communications radius */
X  				for(x=i-com;x<=i+com;x++)
X  				for(y=j-com;y<=j+com;y++)
X! 					if(ONMAP(x,y)) occ[x][y]=country;
X  			} else if((P_ASOLD>0)&&(P_ASTAT!=SCOUT)){
X  				i=P_AXLOC;
X  				j=P_AYLOC;
X! 				if((occ[i][j]== 0)||(occ[i][j]== country))
X! 					occ[i][j]= country;
X  				else occ[i][j]= NTOTAL;
X  			}
X  		}
X! 		if( !leader ) for(nvynum=0;nvynum<MAXNAVY;nvynum++){
X  			if((P_NWSHP!=0)||(P_NGSHP!=0)||(P_NMSHP!=0)){
X  				i=P_NXLOC;
X  				j=P_NYLOC;
X! 				if((occ[i][j]== 0)||(occ[i][j]== country))
X! 					occ[i][j]= country;
X  				else occ[i][j]= NTOTAL;
X  			}
X  		}
X  	}
X  
X! 	country=save;
X! 	curntn = &ntn[country];
X  }
X  
X  #ifdef ADMIN
X  /*routine to depelete a nation without a capitol */
X  void
X! deplete(country)
X! int country;
X  {
X  	struct s_nation *saventn=curntn;
X  	int i,j,x,y,armynum;
X  
X! 	x = ntn[country].capx;
X! 	y = ntn[country].capy;
X! 	if((sct[x][y].designation==DCAPITOL)&&((sct[x][y].owner==country)
X  	||(sct[x][y].owner==0)||(!isntn(ntn[sct[x][y].owner].active))))
X  		return;
X  
X! 	curntn = &ntn[country];
X! 	fprintf(fnews,"1.\tNation %s is depleted by the lack of a Capitol\n",ntn[country].name);
X  
X  	for(armynum=0;armynum<MAXARM;armynum++) if (P_ASOLD>0) {
X  		/* first disband PDEPLETE% of the military */
X--- 750,796 ----
X  				com = P_NTNCOM; /* do communications radius */
X  				for(x=i-com;x<=i+com;x++)
X  				for(y=j-com;y<=j+com;y++)
X! 					if(ONMAP(x,y)) occ[x][y]=nation;
X  			} else if((P_ASOLD>0)&&(P_ASTAT!=SCOUT)){
X  				i=P_AXLOC;
X  				j=P_AYLOC;
X! 				if((occ[i][j]== 0)||(occ[i][j]== nation))
X! 					occ[i][j]= nation;
X  				else occ[i][j]= NTOTAL;
X  			}
X  		}
X! 		if( leader==FALSE ) for(nvynum=0;nvynum<MAXNAVY;nvynum++){
X  			if((P_NWSHP!=0)||(P_NGSHP!=0)||(P_NMSHP!=0)){
X  				i=P_NXLOC;
X  				j=P_NYLOC;
X! 				if((occ[i][j]== 0)||(occ[i][j]== nation))
X! 					occ[i][j]= nation;
X  				else occ[i][j]= NTOTAL;
X  			}
X  		}
X  	}
X  
X! 	nation=save;
X! 	curntn = &ntn[nation];
X  }
X  
X  #ifdef ADMIN
X  /*routine to depelete a nation without a capitol */
X  void
X! deplete(nation)
X! int nation;
X  {
X  	struct s_nation *saventn=curntn;
X  	int i,j,x,y,armynum;
X  
X! 	x = ntn[nation].capx;
X! 	y = ntn[nation].capy;
X! 	if((sct[x][y].designation==DCAPITOL)&&((sct[x][y].owner==nation)
X  	||(sct[x][y].owner==0)||(!isntn(ntn[sct[x][y].owner].active))))
X  		return;
X  
X! 	curntn = &ntn[nation];
X! 	fprintf(fnews,"1.\tNation %s is depleted by the lack of a Capitol\n",ntn[nation].name);
X  
X  	for(armynum=0;armynum<MAXARM;armynum++) if (P_ASOLD>0) {
X  		/* first disband PDEPLETE% of the military */
X***************
X*** 788,802 ****
X  		(rand()%100<PDEPLETE||P_ATYPE==A_MERCENARY)) {
X  			if(P_ATYPE==A_MERCENARY) {
X  				MERCMEN += P_ASOLD;
X! 			} else if(ntn[sct[AXLOC][AYLOC].owner].race==ntn[country].race) {
X  				sct[P_AXLOC][P_AYLOC].people += P_ASOLD;
X  			}
X  			P_ASOLD=0;
X  			if(ispc(curntn->active)) {
X! 				if (mailopen(country)!=(-1)) {
X  					fprintf(fm,"Message to %s from Conquer\n\n",curntn->name);
X  					fprintf(fm,"\tYour %s Army %d disperses into the population\n",*(unittype+(P_ATYPE%UTYPE)),armynum);
X! 					mailclose(country);
X  				}
X  			}
X  		} else if(P_ATYPE>=MINMONSTER) {
X--- 798,812 ----
X  		(rand()%100<PDEPLETE||P_ATYPE==A_MERCENARY)) {
X  			if(P_ATYPE==A_MERCENARY) {
X  				MERCMEN += P_ASOLD;
X! 			} else if(ntn[sct[AXLOC][AYLOC].owner].race==ntn[nation].race) {
X  				sct[P_AXLOC][P_AYLOC].people += P_ASOLD;
X  			}
X  			P_ASOLD=0;
X  			if(ispc(curntn->active)) {
X! 				if (mailopen(nation)!=(-1)) {
X  					fprintf(fm,"Message to %s from Conquer\n\n",curntn->name);
X  					fprintf(fm,"\tYour %s Army %d disperses into the population\n",*(unittype+(P_ATYPE%UTYPE)),armynum);
X! 					mailclose(nation);
X  				}
X  			}
X  		} else if(P_ATYPE>=MINMONSTER) {
X***************
X*** 803,812 ****
X  			/* disbanding of ALL monsters should take place */
X  			P_ASOLD=0;
X  			if(ispc(curntn->active)) {
X! 				if (mailopen(country)!=(-1)) {
X  					fprintf(fm,"Message to %s from Conquer\n\n",curntn->name);
X  					fprintf(fm,"\tYour %s (unit %d) leaves due to the loss of your jewels.\n",*(unittype+(P_ATYPE%UTYPE)),armynum);
X! 					mailclose(country);
X  				}
X  			}
X  		}
X--- 813,822 ----
X  			/* disbanding of ALL monsters should take place */
X  			P_ASOLD=0;
X  			if(ispc(curntn->active)) {
X! 				if (mailopen(nation)!=(-1)) {
X  					fprintf(fm,"Message to %s from Conquer\n\n",curntn->name);
X  					fprintf(fm,"\tYour %s (unit %d) leaves due to the loss of your jewels.\n",*(unittype+(P_ATYPE%UTYPE)),armynum);
X! 					mailclose(nation);
X  				}
X  			}
X  		}
X***************
X*** 815,827 ****
X  	/* check for sectors breaking away -- not capx, capy */
X  	if(ispc(curntn->active)) {
X  		/* create a summarized mail message of sectors effected */
X! 		if (mailopen(country)!=(1)) {
X  			fprintf(fm,"Message to %s from Conquer\n\n",curntn->name);
X  			fprintf(fm,"Riots and Rebellion flourish:\n");
X  		}
X  	}
X  	for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++)
X! 	if(sct[i][j].owner==country && (i!=x || j!=y) ) {
X  		if(rand()%100 < PDEPLETE && sct[x][y].people>0) {
X  			if(rand()%100 < PDEPLETE) {
X  				/* sector riots */
X--- 825,837 ----
X  	/* check for sectors breaking away -- not capx, capy */
X  	if(ispc(curntn->active)) {
X  		/* create a summarized mail message of sectors effected */
X! 		if (mailopen(nation)!=(1)) {
X  			fprintf(fm,"Message to %s from Conquer\n\n",curntn->name);
X  			fprintf(fm,"Riots and Rebellion flourish:\n");
X  		}
X  	}
X  	for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++)
X! 	if(sct[i][j].owner==nation && (i!=x || j!=y) ) {
X  		if(rand()%100 < PDEPLETE && sct[x][y].people>0) {
X  			if(rand()%100 < PDEPLETE) {
X  				/* sector riots */
X***************
X*** 844,852 ****
X  		}
X  	}
X  	if(ispc(curntn->active)) {
X! 		mailclose(country);
X  	} else if(isnpc(curntn->active)) {
X! 		if(sct[curntn->capx][curntn->capy].owner==country) {
X  			/* reset capitol for npcs */
X  			sct[curntn->capx][curntn->capy].designation=DCAPITOL;
X  			if(sct[curntn->capx][curntn->capy].fortress<1)
X--- 854,862 ----
X  		}
X  	}
X  	if(ispc(curntn->active)) {
X! 		mailclose(nation);
X  	} else if(isnpc(curntn->active)) {
X! 		if(sct[curntn->capx][curntn->capy].owner==nation) {
X  			/* reset capitol for npcs */
X  			sct[curntn->capx][curntn->capy].designation=DCAPITOL;
X  			if(sct[curntn->capx][curntn->capy].fortress<1)
X***************
X*** 860,880 ****
X  
X  /*routine to sack a nation's captiol */
X  void
X! sackem(country)
X! 	int country;
X  {
X  	struct s_nation *saventn=curntn;
X  	int x,y,i,j,foundcap,nation;
X  
X  	/* hail the conquerer */
X! 	curntn = &ntn[country];
X  	x = curntn->capx;
X  	y = curntn->capy;
X  	nation = sct[x][y].owner;
X! 	if(nation==country || nation==0) return;
X  
X  	/* advertise */
X! 	fprintf(fnews,"1.\tCapitol of %s sacked by %s\n",ntn[country].name,ntn[nation].name);
X  
X  	/* first give all prizes to the conquerer */
X  	if(curntn->tgold > 0) {			/* all gold */
X--- 870,890 ----
X  
X  /*routine to sack a nation's captiol */
X  void
X! sackem(cntry)
X! 	int cntry;
X  {
X  	struct s_nation *saventn=curntn;
X  	int x,y,i,j,foundcap,nation;
X  
X  	/* hail the conquerer */
X! 	curntn = &ntn[cntry];
X  	x = curntn->capx;
X  	y = curntn->capy;
X  	nation = sct[x][y].owner;
X! 	if(nation==cntry || nation==0) return;
X  
X  	/* advertise */
X! 	fprintf(fnews,"1.\tCapitol of %s sacked by %s\n",ntn[cntry].name,ntn[nation].name);
X  
X  	/* first give all prizes to the conquerer */
X  	if(curntn->tgold > 0) {			/* all gold */
X***************
X*** 894,900 ****
X  			sct[x][y].designation = DCITY;
X  		} else {
X  			DEVASTATE(x,y);
X! 			sct[x][y].owner=country;
X  		}
X  	}
X  
X--- 904,910 ----
X  			sct[x][y].designation = DCITY;
X  		} else {
X  			DEVASTATE(x,y);
X! 			sct[x][y].owner=cntry;
X  		}
X  	}
X  
X***************
X*** 902,908 ****
X  	/* sacking does not occur next update for same sacking.   */
X  	foundcap=FALSE;
X  	for(i=0;foundcap==FALSE && i<MAPX;i++)
X! 	for(j=0;foundcap==FALSE && j<MAPY;j++) if(sct[i][j].owner==country) {
X  		if(sct[i][j].designation==DCITY) {
X  			x = i; y = j;
X  			foundcap=TRUE;
X--- 912,918 ----
X  	/* sacking does not occur next update for same sacking.   */
X  	foundcap=FALSE;
X  	for(i=0;foundcap==FALSE && i<MAPX;i++)
X! 	for(j=0;foundcap==FALSE && j<MAPY;j++) if(sct[i][j].owner==cntry) {
X  		if(sct[i][j].designation==DCITY) {
X  			x = i; y = j;
X  			foundcap=TRUE;
X***************
X*** 918,930 ****
X  	if ((x!=curntn->capx)||(y!=curntn->capy)) {
X  		/* assign new pseudo capitol */
X  		if(ispc(curntn->active)) {
X! 			if(mailopen(country)!=(-1)) {
X! 			fprintf(fm,"Message to %s from Conquer\n\n",ntn[country].name);
X  			fprintf(fm,"\tYour Capitol at sector location %d,%d\n",curntn->capx,curntn->capy);
X  			fprintf(fm,"\t was overrun by nation %s.\n\n",ntn[nation].name);
X  			fprintf(fm,"\tA temporary headquarters is now in sector %d,%d,\n",x,y);
X  			fprintf(fm,"\t but designation of a new Capitol is recommended.\n");
X! 			mailclose(country);
X  			}
X  		}
X  		curntn->capx=x;
X--- 928,940 ----
X  	if ((x!=curntn->capx)||(y!=curntn->capy)) {
X  		/* assign new pseudo capitol */
X  		if(ispc(curntn->active)) {
X! 			if(mailopen(cntry)!=(-1)) {
X! 			fprintf(fm,"Message to %s from Conquer\n\n",ntn[cntry].name);
X  			fprintf(fm,"\tYour Capitol at sector location %d,%d\n",curntn->capx,curntn->capy);
X  			fprintf(fm,"\t was overrun by nation %s.\n\n",ntn[nation].name);
X  			fprintf(fm,"\tA temporary headquarters is now in sector %d,%d,\n",x,y);
X  			fprintf(fm,"\t but designation of a new Capitol is recommended.\n");
X! 			mailclose(cntry);
X  			}
X  		}
X  		curntn->capx=x;
X***************
X*** 932,944 ****
X  	} else {
X  		/* no new capitol assignment */
X  		if(ispc(curntn->active)) {
X! 			if(mailopen(country)!=(-1)) {
X! 			fprintf(fm,"Message to %s from Conquer\n\n",ntn[country].name);
X  			fprintf(fm,"\tYour Capitol at sector location %d,%d\n",curntn->capx,curntn->capy);
X  			fprintf(fm,"\t was overrun by nation %s.\n\n",ntn[nation].name);
X  			fprintf(fm,"\tNo other land remains.  The destruction\n");
X  			fprintf(fm,"\t of your nation seems imminent.\n");
X! 			mailclose(country);
X  			}
X  		}
X  	}
X--- 942,954 ----
X  	} else {
X  		/* no new capitol assignment */
X  		if(ispc(curntn->active)) {
X! 			if(mailopen(cntry)!=(-1)) {
X! 			fprintf(fm,"Message to %s from Conquer\n\n",ntn[cntry].name);
X  			fprintf(fm,"\tYour Capitol at sector location %d,%d\n",curntn->capx,curntn->capy);
X  			fprintf(fm,"\t was overrun by nation %s.\n\n",ntn[nation].name);
X  			fprintf(fm,"\tNo other land remains.  The destruction\n");
X  			fprintf(fm,"\t of your nation seems imminent.\n");
X! 			mailclose(cntry);
X  			}
X  		}
X  	}
X***************
X*** 949,956 ****
X  
X  /*destroy nation--special case if capitol not owned by other nation*/
X  void
X! destroy(country)
X! int country;
X  {
X  	short armynum, nvynum;
X  	int i, x, y;
X--- 959,966 ----
X  
X  /*destroy nation--special case if capitol not owned by other nation*/
X  void
X! destroy(cntry)
X! int cntry;
X  {
X  	short armynum, nvynum;
X  	int i, x, y;
X***************
X*** 957,976 ****
X  	char buf[LINELTH];
X  	struct s_nation	*nptr;
X  
X! 	nptr = &ntn[country];
X! 	if( ismonst(nptr->active) ) return;
X  	if( !isactive(nptr->active) ) return;
X! 	fprintf(fnews,"1.\tNation %s was destroyed ",nptr->name);
X! 	if(country!=sct[nptr->capx][nptr->capy].owner){
X! 		fprintf(fnews,"(their capitol is now owned by %s)\n",ntn[sct[nptr->capx][nptr->capy].owner].name);
X! 		/*get +5% to combat skill*/
X! 		ntn[sct[nptr->capx][nptr->capy].owner].aplus+=5;
X  	}
X- 	else fprintf(fnews,"(they owned their capitol)\n");
X  
X  	nptr->active=INACTIVE;
X  	nptr->score=0;
X! 	sprintf(buf,"%s%d",msgfile,country);
X  	unlink(buf);
X  
X  	for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) {
X--- 967,988 ----
X  	char buf[LINELTH];
X  	struct s_nation	*nptr;
X  
X! 	nptr = &ntn[cntry];
X  	if( !isactive(nptr->active) ) return;
X! 
X! 	if( !ismonst(nptr->active) ) {
X! 		fprintf(fnews,"1.\tNation %s was destroyed ",nptr->name);
X! 		if(cntry!=sct[nptr->capx][nptr->capy].owner){
X! 			fprintf(fnews,"(their capitol is now owned by %s)\n",ntn[sct[nptr->capx][nptr->capy].owner].name);
X! 			/*get +5% to combat skill*/
X! 			ntn[sct[nptr->capx][nptr->capy].owner].aplus+=5;
X! 		}
X! 		else fprintf(fnews,"(they owned their capitol)\n");
X  	}
X  
X  	nptr->active=INACTIVE;
X  	nptr->score=0;
X! 	sprintf(buf,"%s%d",msgfile,cntry);
X  	unlink(buf);
X  
X  	for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) {
X***************
X*** 985,1000 ****
X  	}
X  	for(i=0;i<NTOTAL;i++) {
X  		if (ntn[i].active < NPC_PEASANT ) {
X! 			ntn[i].dstatus[country]=UNMET;
X  			nptr->dstatus[i]=UNMET;
X  		} else {
X! 			ntn[i].dstatus[country]=WAR;
X  			nptr->dstatus[i]=WAR;
X  		}
X  	}
X  	
X  	/*if take them you get their gold*/
X! 	if(country!=sct[nptr->capx][nptr->capy].owner){
X  		if(nptr->tgold>0) ntn[sct[nptr->capx][nptr->capy].owner].tgold+=nptr->tgold;
X  		if(nptr->jewels>0) ntn[sct[nptr->capx][nptr->capy].owner].jewels+=nptr->jewels;
X  		if(nptr->metals>0) ntn[sct[nptr->capx][nptr->capy].owner].metals+=nptr->metals;
X--- 997,1012 ----
X  	}
X  	for(i=0;i<NTOTAL;i++) {
X  		if (ntn[i].active < NPC_PEASANT ) {
X! 			ntn[i].dstatus[cntry]=UNMET;
X  			nptr->dstatus[i]=UNMET;
X  		} else {
X! 			ntn[i].dstatus[cntry]=WAR;
X  			nptr->dstatus[i]=WAR;
X  		}
X  	}
X  	
X  	/*if take them you get their gold*/
X! 	if(cntry!=sct[nptr->capx][nptr->capy].owner){
X  		if(nptr->tgold>0) ntn[sct[nptr->capx][nptr->capy].owner].tgold+=nptr->tgold;
X  		if(nptr->jewels>0) ntn[sct[nptr->capx][nptr->capy].owner].jewels+=nptr->jewels;
X  		if(nptr->metals>0) ntn[sct[nptr->capx][nptr->capy].owner].metals+=nptr->metals;
X***************
X*** 1003,1011 ****
X  	}
X  
X  	/*if god destroys then kill all population*/
X! 	if(country==sct[nptr->capx][nptr->capy].owner){
X  		for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++)
X! 		if(sct[x][y].owner==country) {
X  			sct[x][y].people=0;
X  			sct[x][y].owner=0;
X  			sct[x][y].designation=DNODESIG;
X--- 1015,1023 ----
X  	}
X  
X  	/*if god destroys then kill all population*/
X! 	if(cntry==sct[nptr->capx][nptr->capy].owner){
X  		for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++)
X! 		if(sct[x][y].owner==cntry) {
X  			sct[x][y].people=0;
X  			sct[x][y].owner=0;
X  			sct[x][y].designation=DNODESIG;
X***************
X*** 1014,1020 ****
X  	/*slowly take over and all people flee*/
X  	else if(ntn[sct[nptr->capx][nptr->capy].owner].race!=nptr->race){
X  		for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++)
X! 		if(sct[x][y].owner==country) {
X  			/*all kinds of refugees to neighboring countries*/
X  			flee(x,y,TRUE,FALSE);
X  			sct[x][y].people=0;
X--- 1026,1032 ----
X  	/*slowly take over and all people flee*/
X  	else if(ntn[sct[nptr->capx][nptr->capy].owner].race!=nptr->race){
X  		for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++)
X! 		if(sct[x][y].owner==cntry) {
X  			/*all kinds of refugees to neighboring countries*/
X  			flee(x,y,TRUE,FALSE);
X  			sct[x][y].people=0;
X***************
X*** 1027,1033 ****
X  	/*else same race, so give all land to conqueror*/
X  	else {
X  		for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++)
X! 		if(sct[x][y].owner==country){
X  			sct[x][y].owner=sct[nptr->capx][nptr->capy].owner;
X  			if( !ISCITY( sct[x][y].designation )) {
X  			if(tofood( &sct[x][y],0)<DESFOOD)
X--- 1039,1045 ----
X  	/*else same race, so give all land to conqueror*/
X  	else {
X  		for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++)
X! 		if(sct[x][y].owner==cntry){
X  			sct[x][y].owner=sct[nptr->capx][nptr->capy].owner;
X  			if( !ISCITY( sct[x][y].designation )) {
X  			if(tofood( &sct[x][y],0)<DESFOOD)
X***************
X*** 1036,1042 ****
X  			}
X  		}
X  	}
X- 	return;
X  }
X  
X  #define ALPHA_SIZE	128
X--- 1048,1053 ----
X***************
X*** 1044,1051 ****
X  /*movecost contains movement cost unless water  -1 or unenterable land (-2)*/
X  /* if water and not ajacent to land will cost -4*/
X  void
X! updmove(race,country)
X! int country;
X  char race;
X  {
X  	register struct s_sector	*sptr;
X--- 1055,1062 ----
X  /*movecost contains movement cost unless water  -1 or unenterable land (-2)*/
X  /* if water and not ajacent to land will cost -4*/
X  void
X! updmove(race,cntry)
X! int cntry;
X  char race;
X  {
X  	register struct s_sector	*sptr;
X***************
X*** 1077,1083 ****
X  		} /* switch */
X  	} /* for */
X  
X! 	if((magic(country,DERVISH)==1) ||(magic(country,DESTROYER)==1)) {
X  		veg_cost[ ICE ] = 1;
X  		veg_cost[ DESERT ] = 1;
X  	}
X--- 1088,1094 ----
X  		} /* switch */
X  	} /* for */
X  
X! 	if((magic(cntry,DERVISH)==1) ||(magic(cntry,DESTROYER)==1)) {
X  		veg_cost[ ICE ] = 1;
X  		veg_cost[ DESERT ] = 1;
X  	}
X***************
X*** 1337,1343 ****
X  	while(!done) {
X  		ch=getch();
X  		if (isprint(ch)) {
X! 			if (count<NAMELTH+1) {
X  				/* only input displayable characters */
X  				addch(ch);
X  				refresh();
X--- 1348,1354 ----
X  	while(!done) {
X  		ch=getch();
X  		if (isprint(ch)) {
X! 			if (count<NAMELTH) {
X  				/* only input displayable characters */
X  				addch(ch);
X  				refresh();
X***************
X*** 1391,1401 ****
X  		for (i=0;i<l;i++) {
X  			ch=name[i];
X  			if(ch < '0' || ch > '9' ) {
X! 				getyx(stdscr,i,l);
X! 				mvprintw(i+1,0,"Invalid Nation <%s> -- hit any key",name);
X! 				clrtoeol();
X! 				refresh();
X! 				getch();
X  				return(NTOTAL);
X  			} else {
X  				hold *= 10;
X--- 1402,1408 ----
X  		for (i=0;i<l;i++) {
X  			ch=name[i];
X  			if(ch < '0' || ch > '9' ) {
X! 				errormsg("There is no nation by that name.");
X  				return(NTOTAL);
X  			} else {
X  				hold *= 10;
X***************
X*** 1408,1425 ****
X  	return(hold);
X  }
X  
X- extern short country;
X  /* finds a nation for god to be, returns 1 on failure */
X  int
X  get_god()
X  {
X! 	clear();
X! 	mvaddstr(0,0,"SUPER USER; FOR WHAT NATION: ");
X  	refresh();
X  
X  	/* return on no entry or bad entry */
X  	if ((country=get_country())==(-1) || country==NTOTAL) {
X  		country = 0;
X  		return(1);
X  	}
X  
X--- 1415,1433 ----
X  	return(hold);
X  }
X  
X  /* finds a nation for god to be, returns 1 on failure */
X  int
X  get_god()
X  {
X! 	clear_bottom(0);
X! 	mvaddstr(LINES-4,0,"Super User; For what nation? ");
X  	refresh();
X  
X  	/* return on no entry or bad entry */
X  	if ((country=get_country())==(-1) || country==NTOTAL) {
X  		country = 0;
X+ 		redraw=DONE;
X+ 		makebottom();
X  		return(1);
X  	}
X  
X***************
X*** 1468,1495 ****
X  int
X  mailopen(to)
X  {
X  	char	line[LINELTH];
X  	if(mailok != DONEMAIL) mailclose(ABORTMAIL);
X  
X  	if (to != NEWSMAIL) {
X  #ifdef CONQUER
X  		/* check if the player is currently reading messages */
X  		sprintf(line,"%s%hd.tmp",msgfile,to);
X! 		if (access(line,00)==0) {
X! 			if (to>0 && to<NTOTAL) {
X! 				sprintf(line,"Nation %s is reading their mail... try again later.", ntn[to].name);
X! 				errormsg(line);
X  			}
X- 			return(-1);
X  		}
X  
X  		/* otherwise continue; checking for others */
X  		/* this file name is also used in rmessages() */
X  		sprintf(tmp_mail_name,"send.%s%hd",msgfile,to);
X! 		if (access(tmp_mail_name,00)==0) {
X! 			if (to>=0 && to<NTOTAL)
X! 			errormsg("Someone is already sending mail to Nation %s... try again later.", ntn[to].name);
X! 			return(-1);
X  		}
X  #endif /*CONQUER*/
X  #ifdef ADMIN
X--- 1476,1522 ----
X  int
X  mailopen(to)
X  {
X+ #ifdef CONQUER
X  	char	line[LINELTH];
X+ #endif /*CONQUER*/
X  	if(mailok != DONEMAIL) mailclose(ABORTMAIL);
X  
X  	if (to != NEWSMAIL) {
X  #ifdef CONQUER
X+ 		struct stat fst;
X  		/* check if the player is currently reading messages */
X  		sprintf(line,"%s%hd.tmp",msgfile,to);
X! 		if (stat(line,&fst)==0) {
X! 			long now;
X! 			now = time(0);
X! 			if (now - fst.st_mtime < TIME_DEAD) {
X! 				if (to>=0 && to<NTOTAL) {
X! 					sprintf(line,"Nation %s is reading their mail... try again later.", ntn[to].name);
X! 					errormsg(line);
X! 				}
X! 				return(-1);
X! 			} else {
X! 				/* remove useless file */
X! 				unlink(line);
X  			}
X  		}
X  
X  		/* otherwise continue; checking for others */
X  		/* this file name is also used in rmessages() */
X  		sprintf(tmp_mail_name,"send.%s%hd",msgfile,to);
SHAR_EOF
echo "End of part 1"
echo "File patchV4.7 is continued in part 2"
echo "2" > s2_seq_.tmp
exit 0