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

billr@saab.CNA.TEK.COM (Bill Randle) (08/07/89)

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


#!/bin/sh
# this is part 2 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patchV4.04 continued
#
CurArch=2
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
sed 's/^X//' << 'SHAR_EOF' >> patchV4.04
X+ 					mvprintw(ypos+10,xpos,"%ld",ntn[nationid].tciv);
X+ 					mvprintw(ypos+11,xpos,"%d",ntn[nationid].tsctrs);
X+ 				}
X+ #else
X  				mvprintw(ypos+7,xpos,"%ld",ntn[nationid].tgold);
X  				mvprintw(ypos+8,xpos,"%ld",ntn[nationid].tmil);
X  				mvprintw(ypos+9,xpos,"%ld",ntn[nationid].tciv);
X***************
X*** 88,93 ****
X--- 110,116 ----
X  				if(isnpc(ntn[nationid].active))
X  					mvprintw(ypos+11,xpos,"Yes");
X  				else mvprintw(ypos+11,xpos,"No");
X+ #endif /* NOSCORE */
X  				count++;
X  				if(count<MAXINSCR && count%MAXINROW==0) {
X  					ypos+=RPT_LINES;
X***************
X*** 356,362 ****
X  	short armynum;
X  	char passwd[PASSLTH+1];
X  	short isgod=FALSE;
X- 	FILE *fp;
X  #ifdef OGOD
X  	FILE *ftmp;
X  #endif OGOD
X--- 379,384 ----
X***************
X*** 366,378 ****
X  		isgod=TRUE;
X  		if (get_god()) return;
X  	}
X! 	fp=fopen("temp","w");
X! 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X  	clear();
X  	standout();
X  	mvaddstr(0,(COLS/2)-10,"NATION STATS SUMMARY");
X  	mvprintw(3,0,"nation name is %s",curntn->name);
X! 	mvprintw(4,0,"allignment is %s",allignment[npctype(curntn->active)]);
X  	if (isgod==TRUE)
X  		mvprintw(5,0,"active is %d",curntn->active);
X  	mvprintw(6,0,"tax_rate...... %2d%%",curntn->tax_rate);
X--- 388,402 ----
X  		isgod=TRUE;
X  		if (get_god()) return;
X  	}
X!  
X! 	/* continuous loop */
X! 	while(1) {
X  	clear();
X  	standout();
X  	mvaddstr(0,(COLS/2)-10,"NATION STATS SUMMARY");
X  	mvprintw(3,0,"nation name is %s",curntn->name);
X! 	mvprintw(4,0,"alignment is %s",alignment[npctype(curntn->active)]);
X! 
X  	if (isgod==TRUE)
X  		mvprintw(5,0,"active is %d",curntn->active);
X  	mvprintw(6,0,"tax_rate...... %2d%%",curntn->tax_rate);
X***************
X*** 393,433 ****
X  		addstr(" (NPC)");
X  	else	addstr(" (MON)");
X  	mvprintw(14,0,"nations mark is...%c ",curntn->mark);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X  	for(i=1;i<8;i++) if(curntn->race==*(races+i)[0]){
X  		mvprintw(15,0, "nation race is....%s  ",*(races+i));
X  		break;
X  	}
X  
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X  	mvprintw(3,COLS/2-12, "terror........ %3d",curntn->terror);
X  	mvprintw(4,COLS/2-12, "popularity.... %3d",curntn->popularity);
X  	mvprintw(5,COLS/2-12, "prestige...... %3d",curntn->prestige);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X- 	fflush( fp );
X  	mvprintw(6,COLS/2-12, "knowledge..... %3d",curntn->knowledge);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X- 	fflush( fp );
X  	temp = P_EATRATE;
X  	mvprintw(7,COLS/2-12, "eatrate.......%3.2f",temp);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X- 	fflush( fp );
X  	mvprintw(8,COLS/2-12, "wealth........ %3d",curntn->wealth);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X- 	fflush( fp );
X  	mvprintw(9,COLS/2-12,"charity....... %2d%%",curntn->charity);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X- 	fflush( fp );
X  	mvprintw(10,COLS/2-12,"communication.%3.2f",(float) P_NTNCOM);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X  	mvprintw(11,COLS/2-12,"reputation.... %3d",curntn->reputation);
X  	mvprintw(12,COLS/2-12,"spoilrate.....%3d%%",curntn->spoilrate);
X  	mvprintw(13,COLS/2-12,"farm ability.. %3d",curntn->farm_ability);
X  	mvprintw(14,COLS/2-12,"mine ability.. %3d",curntn->mine_ability);
X  	mvprintw(15,COLS/2-12,"poverty rate.. %2d%%",curntn->poverty);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X  	mvprintw(16,COLS/2-12,"power......... %3d",curntn->power);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X  
X  	if (country!=0) {
X  		mvprintw(12,0,"leader is %s",curntn->leader);
X--- 417,442 ----
X***************
X*** 442,448 ****
X  		mvprintw(4,COLS-30, "mercs defense bonus...+%2d%%",MERCDEF);
X  		mvprintw(12,COLS-30,"total mercs.......%8ld",MERCMEN);
X  	}
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X  
X    	mvprintw(5,COLS-30, "maximum move rate.......%2d",curntn->maxmove);
X    	mvprintw(6,COLS-30, "reproduction rate......%2d%%",curntn->repro);
X--- 451,456 ----
X***************
X*** 450,456 ****
X  
X  	mvprintw(9,COLS-30,"jewels ..........$%8ld",curntn->jewels);
X  	mvprintw(10,COLS-30,"metal & minerals..%8ld",curntn->metals);
X- 	fprintf(fp,"LINE %d FILE %s\n",__LINE__,__FILE__);
X  	if(curntn->tfood<2*curntn->tciv) standout();
X  	mvprintw(11,COLS-30,"food in granary...%8ld",curntn->tfood);
X  	standend();
X--- 458,463 ----
X***************
X*** 479,535 ****
X  	switch(getch()){
X  	case '1': /*get name*/
X  		clear();
X! 		mvaddstr(0,0,"what name would you like:");
X  		clrtoeol();
X  		refresh();
X  		get_nname(string);
X  		if((strlen(string)<=1)||(strlen(string)>NAMELTH)){
X! 			errormsg("invalid name");
X! 			if(isgod==TRUE) reset_god();
X! 			return;
X  		}
X  		/*check if already used*/
X  		else for(i=1;i<(country-1);i++){
X  			if((strcmp(ntn[i].name,string)==0)&&(i!=country)) {
X! 				errormsg("name already used");
X! 				if(isgod==TRUE) reset_god();
X! 				fclose(fp); return;
X  			}
X  		}
X! 		errormsg("new name can be used following next update");
X  		strcpy(curntn->name,string);
X  		ECHGNAME;
X  		break;
X  	case '2': /*change password */
X  		clear();
X  		if(isgod!=TRUE){
X! 			mvaddstr(0,0,"what is your current password:");
X  			refresh();
X! 			gets(command);
X  			strncpy(passwd,crypt(command,SALT),PASSLTH);
X  			if((strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)
X! 			    &&(strncmp(passwd,curntn->passwd,PASSLTH)!=0)){
X! 				errormsg("invalid password");
X! 				fclose(fp); return;
X  			}
X  		}
X! 		mvaddstr(2,0,"what is your new password:");
X  		refresh();
X! 		gets(command);
X! 		if((strlen(command)>PASSLTH)||(strlen(command)<2)) {
X! 			errormsg("invalid new password");
X! 			if(isgod==TRUE) reset_god();
X! 			fclose(fp); return;
X  		}
X  		strncpy(passwd,command,PASSLTH);
X! 		mvaddstr(4,0,"reenter your new password:");
X  		refresh();
X! 		gets(command);
X  		if(strncmp(passwd,command,PASSLTH)!=0) {
X! 			if(isgod==TRUE) reset_god();
X! 			fclose(fp); return;
X  		}
X! 		errormsg("new password can be used following next update");
X  		strncpy(curntn->passwd,crypt(command,SALT),PASSLTH);
X  		ECHGPAS;
X  		break;
X--- 486,544 ----
X  	switch(getch()){
X  	case '1': /*get name*/
X  		clear();
X! 		mvaddstr(0,0,"What name would you like:");
X  		clrtoeol();
X  		refresh();
X  		get_nname(string);
X  		if((strlen(string)<=1)||(strlen(string)>NAMELTH)){
X! 			errormsg("Invalid name length");
X! 			break;
X  		}
X  		/*check if already used*/
X  		else for(i=1;i<(country-1);i++){
X  			if((strcmp(ntn[i].name,string)==0)&&(i!=country)) {
X! 				errormsg("Name already used");
X! 				break;
X  			}
X  		}
X! 		errormsg("New name can be used following next update");
X  		strcpy(curntn->name,string);
X  		ECHGNAME;
X  		break;
X  	case '2': /*change password */
X  		clear();
X+ 		/* minimum password length setting */
X+ 		if (country != 0) intval=2;
X+ 		else intval=4;
X  		if(isgod!=TRUE){
X! 			mvaddstr(0,0,"What is your current password:");
X  			refresh();
X! 			(void) get_pass(command);
X  			strncpy(passwd,crypt(command,SALT),PASSLTH);
X  			if((strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)
X! 			&&(strncmp(passwd,curntn->passwd,PASSLTH)!=0)){
X! 				break;
X  			}
X  		}
X! 		mvaddstr(2,0,"What is your new password:");
X  		refresh();
X! 		i = get_pass(command);
X! 		if (i<intval) {
X! 			errormsg("Password too short");
X! 			break;
X! 		} if (i>PASSLTH) {
X! 			errormsg("Password too long");
X! 			break;
X  		}
X  		strncpy(passwd,command,PASSLTH);
X! 		mvaddstr(4,0,"Reenter your new password:");
X  		refresh();
X! 		(void) get_pass(command);
X  		if(strncmp(passwd,command,PASSLTH)!=0) {
X! 			errormsg("Invalid password match; Password unchanged");
X! 			break;
X  		}
X! 		errormsg("New password can be used following next update");
X  		strncpy(curntn->passwd,crypt(command,SALT),PASSLTH);
X  		ECHGPAS;
X  		break;
X***************
X*** 640,653 ****
X  		}
X  		break;
X  	case '7':
X! 		if( startgold != curntn->tgold ) {
X! 			errormsg("Sorry: you have already made some moves this turn!");
X! 			break;
X! 		} else if(ispc(curntn->active)) {
X  			errormsg("Note: you get no mail while playing as an NPC!");
X  			curntn->active *= 4;
X! 		} else if(isnpc(curntn->active))
X  			curntn->active /= 4;
X  		NADJNTN;
X  		break;
X  	case '8':
X--- 649,661 ----
X  		}
X  		break;
X  	case '7':
X! 		if(ispc(curntn->active)) {
X  			errormsg("Note: you get no mail while playing as an NPC!");
X  			curntn->active *= 4;
X! 		} else if(isnpc(curntn->active)) {
X! 			errormsg("Okay.... you have now come back to reality.");
X  			curntn->active /= 4;
X+ 		}
X  		NADJNTN;
X  		break;
X  	case '8':
X***************
X*** 680,686 ****
X  				beep();
X  				errormsg("error opening country's file");
X  				reset_god();
X! 				fclose(fp); return;
X  			}
X  			/* adjust commodities */
X  			mvaddstr(LINES-2,0,"CHANGE: 1) Gold 2) Jewels 3) Iron 4) Food ?");
X--- 688,694 ----
X  				beep();
X  				errormsg("error opening country's file");
X  				reset_god();
X! 				return;
X  			}
X  			/* adjust commodities */
X  			mvaddstr(LINES-2,0,"CHANGE: 1) Gold 2) Jewels 3) Iron 4) Food ?");
X***************
X*** 725,753 ****
X  		if(isgod==TRUE) {
X  			mvaddstr(LINES-2,0,"ENTER CONQUER SUPER-USER PASSWORD:");
X  			refresh();
X! 			getstr(string);
X  			strcpy(passwd,crypt(string,SALT));
X  			if(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0) break;
X  			mvaddstr(LINES-1,0,"PROMOTE WHAT USER TO DEMI-GOD? ");
X  			refresh();
X  			get_nname(string);
X! 			if (strlen(string)!=0) {
X  				strncpy(ntn[0].leader,string,LEADERLTH);
X  			}
X  		}
X  		break;
X  	case 'p':
X! 	case 'P': produce(); fclose(fp); return;
X  	case 'b':
X! 	case 'B': budget(); fclose(fp); return;
X  	default:
X  		if(isgod==TRUE) reset_god();
X- 		fclose(fp);
X  		return;
X  	}
X! 	if(isgod==TRUE) reset_god();
X! 	fclose(fp);
X! 	change();
X  }
X  
X  void
X--- 733,764 ----
X  		if(isgod==TRUE) {
X  			mvaddstr(LINES-2,0,"ENTER CONQUER SUPER-USER PASSWORD:");
X  			refresh();
X! 			(void) get_pass(string);
X  			strcpy(passwd,crypt(string,SALT));
X  			if(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0) break;
X  			mvaddstr(LINES-1,0,"PROMOTE WHAT USER TO DEMI-GOD? ");
X  			refresh();
X  			get_nname(string);
X! 			if (strlen(string)!=0 && getpwnam(string)!=NULL) {
X  				strncpy(ntn[0].leader,string,LEADERLTH);
X  			}
X  		}
X  		break;
X  	case 'p':
X! 	case 'P': 
X! 		produce();
X! 		if (isgod==TRUE) reset_god();
X! 		return;
X  	case 'b':
X! 	case 'B':
X! 		budget();
X! 		if(isgod==TRUE) reset_god();
X! 		return;
X  	default:
X  		if(isgod==TRUE) reset_god();
X  		return;
X  	}
X! 	} /* end of continuous loop */
X  }
X  
X  void
X*** omisc.c	Sun Aug  6 20:55:34 1989
X--- misc.c	Sun Aug  6 20:55:43 1989
X***************
X*** 206,212 ****
X  			*/
X  			/* BUG: should engage if army is hostile but does not own sector */
X  			/* BUG: take into account THE_VOID, HIDDEN, and NINJA */
X- 			/* BUG: NEUTRAL does not allow to pass */
X  			if( (own = sct[x][y].owner) > 0 &&
X  			ntn[own].dstatus[moving_country] >= WAR &&
X  			x != bx && y != by &&
X--- 206,211 ----
X***************
X*** 214,219 ****
X--- 213,226 ----
X  				continue;	/* at war with the owner, may not pass */
X  			}
X  
X+ 			if( own > 0 &&
X+ 			ntn[moving_country].dstatus[own] < WAR &&
X+ 			ntn[own].dstatus[moving_country] > ALLIED &&
X+ 			ntn[own].dstatus[moving_country] < WAR) {
X+ 				/* not at war with owner & owner is neutral,no passing*/
X+ 				continue;
X+ 			}
X+ 
X  			level++;
X  			if( land_2reachp( x, y, new_mp ) ) {
X  				level--;
X***************
X*** 693,699 ****
X  }
X  
X  /* set up occ[][] for country.
X!    if leader==true, only for leader sectors plus ntn.communicatins range */
X  void
X  prep(country,leader)
X  int country,leader;
X--- 700,708 ----
X  }
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*** 722,728 ****
X  			if( leader ) {
X  				if((P_ATYPE<MINLEADER)
X  				||(P_ATYPE>=MINMONSTER)
X! 				||(P_ASOLD==0)) continue;
X  				i=P_AXLOC;
X  				j=P_AYLOC;
X  				com = P_NTNCOM; /* do communications radius */
X--- 731,737 ----
X  			if( leader ) {
X  				if((P_ATYPE<MINLEADER)
X  				||(P_ATYPE>=MINMONSTER)
X! 				||(P_ASOLD<=0)) continue;
X  				i=P_AXLOC;
X  				j=P_AYLOC;
X  				com = P_NTNCOM; /* do communications radius */
X***************
X*** 967,981 ****
X  		NGSHP=0;
X  	}
X  	for(i=0;i<NTOTAL;i++) {
X! 		ntn[i].dstatus[country]=UNMET;
X! 		nptr->dstatus[i]=UNMET;
X  	}
X- #ifdef MONSTER
X- 	for(i=NTOTAL-4;i<NTOTAL;i++) {
X- 	        ntn[i].dstatus[country]=WAR;
X- 		nptr->dstatus[i]=WAR;
X- 	}
X- #endif
X  	
X  	/*if take them you get their gold*/
X  	if(country!=sct[nptr->capx][nptr->capy].owner){
X--- 976,989 ----
X  		NGSHP=0;
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*** oreports.c	Sun Aug  6 20:55:35 1989
X--- reports.c	Sun Aug  6 20:55:43 1989
X***************
X*** 297,303 ****
X  {
X  	short armynum,nvynum;
X  	long numship=0L,costsold=0L,numsold=0L;
X! 	long nummonst=0L,costmonst=0L,money;
X  	int isgod=FALSE;
X  
X  	if(country==0) {
X--- 297,303 ----
X  {
X  	short armynum,nvynum;
X  	long numship=0L,costsold=0L,numsold=0L;
X! 	long nummonst=0L,costmonst=0L,money,chty;
X  	int isgod=FALSE;
X  
X  	if(country==0) {
X***************
X*** 357,365 ****
X  	money=spread.gold - curntn->tgold - money;	/* net income */
X  	standend();
X  	mvprintw(17,COLS-50,"NET INCOME....................%8ld",money);
X! 	mvprintw(16,COLS-50,"CHARITY.......................%8ld",max((money*(long)curntn->charity)/100L,0L));
X  	standout();
X! 	mvprintw(18,COLS-50,"NEXT SEASON'S TREASURY........%8ld",(startgold + money)*(100L-(long)curntn->charity)/100L);
X  
X  	mvaddstr(LINES-3,(COLS/2)-15,"HIT 'P' TO SEE PRODUCTION SCREEN");
X  	mvaddstr(LINES-2,(COLS/2)-15,"HIT 'C' FOR CHANGE NATION SCREEN");
X--- 357,366 ----
X  	money=spread.gold - curntn->tgold - money;	/* net income */
X  	standend();
X  	mvprintw(17,COLS-50,"NET INCOME....................%8ld",money);
X! 	chty = max((money*(long)curntn->charity)/100L,0L);
X! 	mvprintw(16,COLS-50,"CHARITY.......................%8ld",chty);
X  	standout();
X! 	mvprintw(18,COLS-50,"NEXT SEASON'S TREASURY........%8ld",(startgold + money-chty));
X  
X  	mvaddstr(LINES-3,(COLS/2)-15,"HIT 'P' TO SEE PRODUCTION SCREEN");
X  	mvaddstr(LINES-2,(COLS/2)-15,"HIT 'C' FOR CHANGE NATION SCREEN");
X***************
X*** 694,699 ****
X--- 695,701 ----
X  					NADJMER;
X  					NADJGAL;
X  					NADJHLD;
X+ 					NADJLOC;
X  					break;
X  				} else if(P_NARMY!=MAXARM) {
X  					errormsg("Army must be unloaded before Navy is divided");
X***************
X*** 738,743 ****
X--- 740,746 ----
X  				NADJMER;
X  				NADJGAL;
X  				NADJHLD;
X+ 				NADJLOC;
X  				break;
X  			case '3':
X  				/* DISBAND NAVY */
X*** omove.c	Sun Aug  6 20:55:34 1989
X--- move.c	Sun Aug  6 20:55:47 1989
X***************
X*** 506,511 ****
X--- 506,512 ----
X  					flee(XREAL,YREAL,0,FALSE);
X  				}
X  				mvprintw(LINES-2,0,"TAKING SECTOR");
X+ 				clrtoeol();
X  				refresh();
X  				sleep(2);
X  				SOWN=country;
X*** oupdate.c	Sun Aug  6 20:55:36 1989
X--- update.c	Sun Aug  6 20:55:48 1989
X***************
X*** 308,313 ****
X--- 308,314 ----
X  			&&( curntn->arm[x].stat!=SIEGED )
X  			&&( curntn->arm[x].stat!=ONBOARD )
X  			&&( curntn->arm[x].stat!=TRADED )
X+ 			&&( curntn->arm[x].unittyp!=A_ZOMBIE )
X  			&&( P_AXLOC==curntn->arm[x].xloc )
X  			&&( P_AYLOC==curntn->arm[x].yloc )){
X  				curntn->arm[x].stat=NUMSTATUS+armynum;
X***************
X*** 674,682 ****
X  		ntn[country].tships=0;
X  		ntn[country].tmil=0;
X  #ifdef XENIX
X! 		z = ntn[country].spellpts;
X! 		z /= 2;
X! 		ntn[country].spellpts = z;
X  #else
X  		if(rand()%4==0) ntn[country].spellpts/=2;
X  #endif /*XENIX*/
X--- 675,685 ----
X  		ntn[country].tships=0;
X  		ntn[country].tmil=0;
X  #ifdef XENIX
X! 		if (rand()%4 == 0) {
X! 			z = ntn[country].spellpts;
X! 			z /= 2;
X! 			ntn[country].spellpts = z;
X! 		}
X  #else
X  		if(rand()%4==0) ntn[country].spellpts/=2;
X  #endif /*XENIX*/
X***************
X*** 790,796 ****
X  				if(P_ASTAT==ONBOARD) continue;
X  				/* may not capture water */
X  				if(sct[P_AXLOC][P_AYLOC].altitude==WATER) {
X! 					printf("Nation %s Army %d in Water\n",curntn->name,armynum);
X  					continue;
X  				}
X  				if(occ[P_AXLOC][P_AYLOC] != country) continue;
X--- 793,799 ----
X  				if(P_ASTAT==ONBOARD) continue;
X  				/* may not capture water */
X  				if(sct[P_AXLOC][P_AYLOC].altitude==WATER) {
X! 					fprintf(stderr,"Nation %s Army %d in Water\n",curntn->name,armynum);
X  					continue;
X  				}
X  				if(occ[P_AXLOC][P_AYLOC] != country) continue;
X***************
X*** 799,822 ****
X  					sptr->owner=country;
X  					curntn->popularity++;
X  				} else if((sptr->owner!=country)
X! 				&&(curntn->dstatus[sptr->owner]>=WAR)
X! 				&&(occ[P_AXLOC][P_AYLOC]==country)){
X! 
X! 					if((sptr->owner!=0)
X! 					&&(ntn[sptr->owner].race!=curntn->race))
X  						if(magic(country,SLAVER)==TRUE){
X  							flee(P_AXLOC,P_AYLOC,1,TRUE);
X! 						}else{
X  							flee(P_AXLOC,P_AYLOC,1,FALSE);
X  						}
X  
X! 				if((isntn( curntn->active ))
X! 				&&(isntn( ntn[sptr->owner].active)))
X  #ifdef HIDELOC
X! 					fprintf(fnews,"3.\tarea captured by %s from %s\n",curntn->name,ntn[sptr->owner].name);
X  #else
X! 					fprintf(fnews,"3.\tarea %d,%d captured by %s from %s\n",P_AXLOC,P_AYLOC,curntn->name,ntn[sptr->owner].name);
X  #endif HIDELOC
X  					sptr->owner=country;
X  					curntn->popularity++;
X  				}
X--- 802,823 ----
X  					sptr->owner=country;
X  					curntn->popularity++;
X  				} else if((sptr->owner!=country)
X! 				&&(curntn->dstatus[sptr->owner]>=WAR)) {
X! 					if(ntn[sptr->owner].race!=curntn->race)
X  						if(magic(country,SLAVER)==TRUE){
X  							flee(P_AXLOC,P_AYLOC,1,TRUE);
X! 						} else {
X  							flee(P_AXLOC,P_AYLOC,1,FALSE);
X  						}
X  
X! 					if((isntn( curntn->active ))
X! 					   &&(isntn( ntn[sptr->owner].active))) {
X  #ifdef HIDELOC
X! 						fprintf(fnews,"3.\tarea captured by %s from %s\n",curntn->name,ntn[sptr->owner].name);
X  #else
X! 						fprintf(fnews,"3.\tarea %d,%d captured by %s from %s\n",P_AXLOC,P_AYLOC,curntn->name,ntn[sptr->owner].name);
X  #endif HIDELOC
X+ 					}
X  					sptr->owner=country;
X  					curntn->popularity++;
X  				}
X***************
X*** 987,997 ****
X  			/* take out for charity */
X  			charity=((spread.gold-curntn->tgold)*curntn->charity)/100;
X  
X! 			if(charity > 0) curntn->tgold = spread.gold - charity;
X! 			else curntn->tgold = spread.gold;
X  			if(curntn->tciv > 0) charity /= curntn->tciv;
X  			else charity = 0;
X  
X  			/* give them some benefit of the doubt */
X  			curntn->popularity += 5*charity;
X  			if(curntn->poverty < (charity+1)/2 )
X--- 988,999 ----
X  			/* take out for charity */
X  			charity=((spread.gold-curntn->tgold)*curntn->charity)/100;
X  
X! 			if(charity > 0) charity = 0;
X  			if(curntn->tciv > 0) charity /= curntn->tciv;
X  			else charity = 0;
X  
X+ 			curntn->tgold = spread.gold - charity;
X+ 
X  			/* give them some benefit of the doubt */
X  			curntn->popularity += 5*charity;
X  			if(curntn->poverty < (charity+1)/2 )
X***************
X*** 1053,1059 ****
X  
X  		dissarray=TRUE;
X  		for(armynum=0;armynum<MAXARM;armynum++)
X! 			if (P_ATYPE==(getleader(curntn->class)-1)) {
X  				dissarray=FALSE;
X  				break;
X  			}
X--- 1055,1061 ----
X  
X  		dissarray=TRUE;
X  		for(armynum=0;armynum<MAXARM;armynum++)
X! 			if (P_ATYPE==(getleader(curntn->class)-1) && P_ASOLD>0) {
X  				dissarray=FALSE;
X  				break;
X  			}
X*** oio.c	Sun Aug  6 20:55:34 1989
X--- io.c	Sun Aug  6 20:55:48 1989
X***************
X*** 34,46 ****
X  void
X  getspace()
X  {
X  	sct = (struct s_sector **) m2alloc(MAPX,MAPY,sizeof(struct s_sector));
X  	occ = (char **) m2alloc(MAPX,MAPY,sizeof(char));
X  	movecost = (short **) m2alloc(MAPX,MAPY,sizeof(short));
X  }
X  
X! #ifdef ADMIN
X  /************************************************************************/
X  /*	PRINTELE() - print a sector.altitude map 			*/
X  /************************************************************************/
X  void
X--- 34,108 ----
X  void
X  getspace()
X  {
X+ 	if (sct != NULL) free(sct);
X  	sct = (struct s_sector **) m2alloc(MAPX,MAPY,sizeof(struct s_sector));
X+ 	if (occ != NULL) free(occ);
X  	occ = (char **) m2alloc(MAPX,MAPY,sizeof(char));
X+ 	if (movecost != NULL) free(movecost);
X  	movecost = (short **) m2alloc(MAPX,MAPY,sizeof(short));
X  }
X  
X! #ifdef CONQUER
X! char **mapseen;
X! 
X  /************************************************************************/
X+ /*	MAPPREP() - initialize map with what can be seen by nation.	*/
X+ /************************************************************************/
X+ void
X+ mapprep()
X+ {
X+ 	int armynum, nvynum;
X+ 	int x,y,i,j;
X+ 
X+ 	/* get space for map */
X+ 	mapseen = (char **) m2alloc(MAPX,MAPY,sizeof(char));
X+ 
X+ 	/* initialize the array */
X+ 	if (country==0 || magic(country,KNOWALL)==TRUE) {
X+ 		armynum = TRUE;
X+ 	} else {
X+ 		armynum = FALSE;
X+ 	}
X+ 	for (x=0;x<MAPX;x++) for(y=0;y<MAPY;y++) {
X+ 		mapseen[x][y] = armynum;
X+ 	}
X+ 
X+ 	/* done for all knowing */
X+ 	if (country==0 || magic(country,KNOWALL)==TRUE) return;
X+ 
X+ 	/* add all visible sectors from owned land */
X+ 	for(x = 0; x < MAPX; x++)
X+ 	for(y = 0; y < MAPY; y++)
X+ 	if(sct[x][y].owner==country){
X+ 		for(i=x-LANDSEE;i<=x+LANDSEE;i++)
X+ 		for(j=y-LANDSEE;j<=y+LANDSEE;j++)
X+ 		if (ONMAP(i,j)) {
X+ 			mapseen[i][j]=TRUE;
X+ 		}
X+ 	}
X+ 
X+ 	/* now add all visible sections from armies */
X+ 	for(armynum=0;armynum<MAXARM;armynum++)
X+ 	if(P_ASOLD>0) {
X+ 		for(i=(int)P_AXLOC-ARMYSEE;i<=(int)P_AXLOC+ARMYSEE;i++)
X+ 		for(j=(int)P_AYLOC-ARMYSEE;j<=(int)P_AYLOC+ARMYSEE;j++)
X+ 		if (ONMAP(i,j)) {
X+ 			mapseen[i][j]=TRUE;
X+ 		}
X+ 	}
X+ 
X+ 	/* now add sectors visible by navy */
X+ 	for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X+ 	if((P_NMSHP!=0)||(P_NWSHP!=0)||(P_NGSHP!=0)) {
X+ 		for(i=(int)P_NXLOC-NAVYSEE;i<=(int)P_NXLOC+NAVYSEE;i++)
X+ 		for(j=(int)P_NYLOC-NAVYSEE;j<=(int)P_NYLOC+NAVYSEE;j++)
X+ 		if (ONMAP(i,j)) {
X+ 			mapseen[i][j]=TRUE;
X+ 		}
X+ 	}
X+ }
X+ 
X+ /************************************************************************/
X  /*	PRINTELE() - print a sector.altitude map 			*/
X  /************************************************************************/
X  void
X***************
X*** 48,60 ****
X  {
X  	register int X, Y;
X  	fprintf(stderr,"doing print of altitude\n");
X  	for(Y=0;Y<MAPY;Y++) {
X! 		for(X=0;X<MAPX;X++) putc(sct[X][Y].altitude,stdout);
X  		putc('\n',stdout);
X  	}
X  }
X! #endif ADMIN
X! #ifdef ADMIN
X  /************************************************************************/
X  /*	PR_NTNS() - print nation marks					*/
X  /************************************************************************/
X--- 110,131 ----
X  {
X  	register int X, Y;
X  	fprintf(stderr,"doing print of altitude\n");
X+ 	if (country == 0) {
X+ 		printf("Conquer %s.%d: Altitude Map of the World on Turn %d\n",
X+ 			VERSION, PATCHLEVEL, TURN);
X+ 	} else {
X+ 		printf("Conquer %s.%d: Altitude Map for Nation %s on Turn %d\n",
X+ 			VERSION, PATCHLEVEL, curntn->name, TURN);
X+ 	}
X  	for(Y=0;Y<MAPY;Y++) {
X! 		for(X=0;X<MAPX;X++) {
X! 			if(mapseen[X][Y]==TRUE) putc(sct[X][Y].altitude,stdout);
X! 			else putc(' ',stdout);
X! 		}
X  		putc('\n',stdout);
X  	}
X  }
X! 
X  /************************************************************************/
X  /*	PR_NTNS() - print nation marks					*/
X  /************************************************************************/
X***************
X*** 63,79 ****
X  {
X  	register int X, Y;
X  	fprintf(stderr,"doing print of nations\n");
X  	for(Y=0;Y<MAPY;Y++) {
X  		for(X=0;X<MAPX;X++) {
X! 			if(sct[X][Y].owner==0)
X! 				putc(sct[X][Y].altitude,stdout);
X! 			else putc(ntn[sct[X][Y].owner].mark,stdout);
X  		}
X  		putc('\n',stdout);
X  	}
X  }
X! #endif ADMIN
X! #ifdef ADMIN
X  /************************************************************************/
X  /*	PR_DESG() - print designations					*/
X  /************************************************************************/
X--- 134,158 ----
X  {
X  	register int X, Y;
X  	fprintf(stderr,"doing print of nations\n");
X+ 	if (country == 0) {
X+ 		printf("Conquer %s.%d: Nation Map of the World on Turn %d\n",
X+ 			VERSION, PATCHLEVEL, TURN);
X+ 	} else {
X+ 		printf("Conquer %s.%d: Nation Map for Nation %s on Turn %d\n",
X+ 			VERSION, PATCHLEVEL, curntn->name, TURN);
X+ 	}
X  	for(Y=0;Y<MAPY;Y++) {
X  		for(X=0;X<MAPX;X++) {
X! 			if(mapseen[X][Y]==TRUE) {
X! 				if(sct[X][Y].owner==0)
X! 					putc(sct[X][Y].altitude,stdout);
X! 				else putc(ntn[sct[X][Y].owner].mark,stdout);
X! 			} else putc(' ',stdout);
X  		}
X  		putc('\n',stdout);
X  	}
X  }
X! 
X  /************************************************************************/
X  /*	PR_DESG() - print designations					*/
X  /************************************************************************/
X***************
X*** 82,98 ****
X  {
X  	register int X, Y;
X  	fprintf(stderr,"doing print of designations\n");
X  	for(Y=0;Y<MAPY;Y++) {
X  		for(X=0;X<MAPX;X++) {
X! 		    putc(sct[X][Y].designation,stdout);
X! 			
X  		}
X  		putc('\n',stdout);
X  	}
X  }
X- #endif ADMIN
X  
X  /************************************************************************/
X  /*	WRITEDATA() - write data to datafile 				*/
X  /*	trashes/creates datafile in the process				*/
X  /************************************************************************/
X--- 161,215 ----
X  {
X  	register int X, Y;
X  	fprintf(stderr,"doing print of designations\n");
X+ 	if (country == 0) {
X+ 		printf("Conquer %s.%d: Designation Map of the World on Turn %d\n",
X+ 			VERSION, PATCHLEVEL, TURN);
X+ 	} else {
X+ 		printf("Conquer %s.%d: Designation Map for Nation %s on Turn %d\n",
X+ 			VERSION, PATCHLEVEL, curntn->name, TURN);
X+ 	}
X  	for(Y=0;Y<MAPY;Y++) {
X  		for(X=0;X<MAPX;X++) {
X! 			if (mapseen[X][Y]==TRUE) {
X! 				if (country==0 || magic(sct[X][Y].owner,NINJA)==TRUE
X! 				    || magic(sct[X][Y].owner,THE_VOID)!=TRUE) {
X! 					if(sct[X][Y].designation==DNODESIG)
X! 						putc(sct[X][Y].altitude,stdout);
X! 					else putc(sct[X][Y].designation,stdout);
X! 				} else putc('?',stdout);
X! 			} else putc(' ',stdout);
X  		}
X  		putc('\n',stdout);
X  	}
X  }
X  
X  /************************************************************************/
X+ /*	PRINTVEG() -	print a vegetation map subroutine		*/
X+ /************************************************************************/
X+ void
X+ printveg()
X+ {
X+ 	register int X, Y;
X+ 	fprintf(stderr,"doing print of vegetation\n");
X+ 	if (country == 0) {
X+ 		printf("Conquer %s.%d: Vegetation Map of the World on Turn %d\n",
X+ 			VERSION, PATCHLEVEL, TURN);
X+ 	} else {
X+ 		printf("Conquer %s.%d: Vegetation Map for Nation %s on Turn %d\n",
X+ 			VERSION, PATCHLEVEL, curntn->name, TURN);
X+ 	}
X+ 	for(Y=0;Y<MAPY;Y++) {
X+ 		for(X=0;X<MAPX;X++) {
X+ 			if(mapseen[X][Y]==TRUE) {
X+ 				putc(sct[X][Y].vegetation,stdout);
X+ 			} else putc(' ',stdout);
X+ 		}
X+ 		putc('\n',stdout);
X+ 	}
X+ }
X+ #endif CONQUER
X+ 
X+ /************************************************************************/
X  /*	WRITEDATA() - write data to datafile 				*/
X  /*	trashes/creates datafile in the process				*/
X  /************************************************************************/
X***************
X*** 186,206 ****
X  	close(fd);
X  } /* readdata() */
X  
X- #ifdef ADMIN
X- /************************************************************************/
X- /*	PRINTVEG() -	print a vegetation map subroutine		*/
X- /************************************************************************/
X- void
X- printveg()
X- {
X- 	register int X, Y;
X- 	fprintf(stderr,"doing print of vegetation\n");
X- 	for(Y=0;Y<MAPY;Y++) {
X- 		for(X=0;X<MAPX;X++) putc(sct[X][Y].vegetation,stdout);
X- 		putc('\n',stdout);
X- 	}
X- }
X- #endif ADMIN
X  #ifdef CONQUER
X  /************************************************************************/
X  /*	OFFMAP()	deal if cursor is off the map			*/
X--- 303,308 ----
X***************
X*** 276,283 ****
X  	}
X  	whatcansee();
X  }
X! #endif CONQUER
X! #ifdef CONQUER
X  /************************************************************************/
X  /*	PRINTSCORE()	- like it says					*/
X  /************************************************************************/
X--- 378,384 ----
X  	}
X  	whatcansee();
X  }
X! 
X  /************************************************************************/
X  /*	PRINTSCORE()	- like it says					*/
X  /************************************************************************/
X***************
X*** 314,333 ****
X  					printf("%6s ",*(races+i));
X  		}
X  
X  		if (isntn(ntn[nationid].active)) {
X! 			printf("%8s ",*(Class+ntn[nationid].class));
X! 			printf(" %7s ",allignment[npctype(ntn[nationid].active)]);
X  			printf("%6ld  %8ld %8ld   %8ld %4d\n",
X  				  ntn[nationid].score ,ntn[nationid].tgold
X  				  ,ntn[nationid].tmil ,ntn[nationid].tciv
X  				  ,ntn[nationid].tsctrs );
X  		} else {
X- 			if (ispeasant(ntn[nationid].active)) {
X- 				printf("%8s  %7s ","Peasant","Neutral");
X- 				/* info not kept track of yet */
X- 			} else {
X- 				printf("%8s  %7s ","Monster","Other");
X- 			}
X  			printf("%6s  %8s %8s   %8s %4s\n",
X  				  "---","-----","----","-----","--");
X  		}
X--- 415,433 ----
X  					printf("%6s ",*(races+i));
X  		}
X  
X+ 		printf("%8s ",*(Class+ntn[nationid].class));
X+ 		printf(" %7s ",alignment[npctype(ntn[nationid].active)]);
X  		if (isntn(ntn[nationid].active)) {
X! #ifdef NOSCORE
X! 			printf("%6ld  %8s %8s   %8s %4s\n",
X! 				  ntn[nationid].score ,"-----","----" ,"-----","--");
X! #else
X  			printf("%6ld  %8ld %8ld   %8ld %4d\n",
X  				  ntn[nationid].score ,ntn[nationid].tgold
X  				  ,ntn[nationid].tmil ,ntn[nationid].tciv
X  				  ,ntn[nationid].tsctrs );
X+ #endif /* NOSCORE */
X  		} else {
X  			printf("%6s  %8s %8s   %8s %4s\n",
X  				  "---","-----","----","-----","--");
X  		}
X***************
X*** 485,488 ****
X--- 585,627 ----
X  			baseaddr[j] = baseaddr[j-1] + entrysize;
X  	}
X  	return(baseaddr);
X+ }
X+ 
X+ /* If the string entered is too long, then a truncated */
X+ /* string is returned.  Length entered is returned.    */
X+ int
X+ get_pass(str)
X+ 	char *str;
X+ {
X+ 	char ch;
X+ 	int done=FALSE,count=0;
X+ 
X+ 	while(done==FALSE) {
X+ 		ch = getch();
X+ 		if (ch=='\b' || ch=='\177') {
X+ 			/* delete any entered characters */
X+ 			if (count > 0) {
X+ 				count--;
X+ 			}
X+ 		} else if (ch=='\025') {
X+ 			/* make sure that ^U works */
X+ 			count=0;
X+ 		} else if (ch=='\n' || ch=='\r') {
X+ 			done = TRUE;
X+ 		} else if (ch != '\0') {
X+ 			/* add any other character to the string */
X+ 			if (count < PASSLTH) {
X+ 				/* don't try adding too many */
X+ 				str[count]= ch;
X+ 			}
X+ 			count++;
X+ 		}
X+ 	}
X+ 	/* truncate too long a password and end others properly */
X+ 	if (count > PASSLTH) {
X+ 		str[PASSLTH] = '\0';
X+ 	} else {
X+ 		str[count] = '\0';
X+ 	}
X+ 	return(count);
X  }
X*** onewhelp.c	Sun Aug  6 20:55:34 1989
X--- newhelp.c	Sun Aug  6 20:55:48 1989
X***************
X*** 198,204 ****
X--- 198,206 ----
X  	fprintf(fp,"s/XTOMANYPEOPLE/%d/g\n",TOMANYPEOPLE);
X  	fprintf(fp,"s/XABSMAXPEOPLE/%d/g\n",ABSMAXPEOPLE);
X  	fprintf(fp,"s/XFINDPERCENT/%d/g\n",FINDPERCENT);
X+ #ifdef ORCTAKE
X  	fprintf(fp,"s/XTAKEPRICE/%d/g\n",ORCTAKE);
X+ #endif ORCTAKE
X  
X  	fprintf(fp,"s/XTGATTR/%d/g\n",TGATTR);
X  	fprintf(fp,"s/XOTHRATTR/%d/g\n",OTHRATTR);
X*** odata.c	Sun Aug  6 20:55:34 1989
X--- data.c	Sun Aug  6 20:55:48 1989
X***************
X*** 51,59 ****
X  
X  char *directions[]= { "here", "north", "northeast", "east", "southeast",
X  	"south", "southwest", "west", "northwest"};
X! char *Class[]= { "NPC", "king", "emperor", "wizard", "priest", "pirate",
X  "trader", "warlord", "demon", "dragon", "shadow"};
X! char *allignment[]= { "","Good","Neutral","Evil","Other" };
X  
X  char *unittype[]= {
X  "Militia", "Goblins", "Orcs", "Infantry", "Sailors", "Marines", "Archers",
X--- 51,59 ----
X  
X  char *directions[]= { "here", "north", "northeast", "east", "southeast",
X  	"south", "southwest", "west", "northwest"};
X! char *Class[]= { "monster", "king", "emperor", "wizard", "priest", "pirate",
X  "trader", "warlord", "demon", "dragon", "shadow"};
X! char *alignment[]= { "Other","Good","Neutral","Evil","Other" };
X  
X  char *unittype[]= {
X  "Militia", "Goblins", "Orcs", "Infantry", "Sailors", "Marines", "Archers",
X*** onewlogin.c	Sun Aug  6 20:55:35 1989
X--- newlogin.c	Sun Aug  6 20:55:49 1989
X***************
X*** 253,260 ****
X  	}
X  
X  	/* now show the extras for the Raw Materials */
X! 	printw(", %ld jewels", amount*NLJEWELS/Mvalues[CH_RAWGOODS]);
X! 	printw(", and %ld metal.", amount*NLMETAL/Mvalues[CH_RAWGOODS]);
X  }
X  
X  /* show the current amount for country item */
X--- 253,262 ----
X  	}
X  
X  	/* now show the extras for the Raw Materials */
X! 	printw(", %ld jewels", (long) (amount *
X! 		((float)NLJEWELS/Mvalues[CH_RAWGOODS])));
X! 	printw(", and %ld metal.", (long) (amount *
X! 		((float)NLMETAL/Mvalues[CH_RAWGOODS])));
X  }
X  
X  /* show the current amount for country item */
X***************
X*** 277,297 ****
X  	line++;
X  
X  	/* now show the extras for the Raw Materials */
X! 	if (NLJEWELS==NLMETAL) {
X! 		sprintf(tempc,"%ld jewels & metal",
X! 			   spent[CH_RAWGOODS]*NLJEWELS);
X! 		mvprintw(line,0,"%38s",tempc);
X! 		mvprintw(line,COLS/2+10,"%ld jewels & metal",NLJEWELS);
X! 	} else {
X! 		sprintf(tempc,"%ld jewels",
X! 			   spent[CH_RAWGOODS]*NLJEWELS);
X! 		mvprintw(line,0,"%38s",tempc);
X! 		mvprintw(line++,COLS/2+10,"%ld jewels",NLJEWELS);
X! 		sprintf(tempc,"%ld metal",
X! 			   spent[CH_RAWGOODS]*NLMETAL);
X! 		mvprintw(line,0,"%38s",tempc);
X! 		mvprintw(line,COLS/2+10,"%ld metals",NLMETAL);
X! 	}
X  }
X  
X  /* convert the stored information into the nation statistics */
X--- 279,299 ----
X  	line++;
X  
X  	/* now show the extras for the Raw Materials */
X! #if NLJEWELS==NLMETAL
X! 	sprintf(tempc,"%ld jewels & metal",
X! 		   spent[CH_RAWGOODS]*NLJEWELS);
X! 	mvprintw(line,0,"%38s",tempc);
X! 	mvprintw(line,COLS/2+10,"%ld jewels & metal",NLJEWELS);
X! #else
X! 	sprintf(tempc,"%ld jewels",
X! 		   spent[CH_RAWGOODS]*NLJEWELS);
X! 	mvprintw(line,0,"%38s",tempc);
X! 	mvprintw(line++,COLS/2+10,"%ld jewels",NLJEWELS);
X! 	nsprintf(tempc,"%ld metal",
X! 		    spent[CH_RAWGOODS]*NLMETAL);
X! 	mvprintw(line,0,"%38s",tempc);
X! 	mvprintw(line,COLS/2+10,"%ld metals",NLMETAL);
X! #endif
X  }
X  
X  /* convert the stored information into the nation statistics */
X***************
X*** 347,353 ****
X  	int temp,ypos,xpos;
X  	int more=TRUE;	/*0 if add another player*/
X  	long x;
X! 	char tempc[LINELTH],strin[LINELTH+1];
X  	char passwd[PASSLTH+1];
X  	register i;
X  
X--- 349,355 ----
X  	int temp,ypos,xpos;
X  	int more=TRUE;	/*0 if add another player*/
X  	long x;
X! 	char tempc[LINELTH];
X  	char passwd[PASSLTH+1];
X  	register i;
X  
X***************
X*** 432,449 ****
X  			mvprintw(2,0,"Enter National Password: ");
X  			clrtoeol();
X  			refresh();
X! 			gets(tempc);
X! 			if((strlen(tempc)<2)||(strlen(tempc)>PASSLTH)) {
X! 				newerror("Invalid Password Length");
X  				continue;
X  			}
X  			mvprintw(2,0,"Reenter National Password: ");
X  			clrtoeol();
X  			refresh();
X! 			gets(passwd);
X  
X! 			if((strlen(tempc)<2)||(strlen(tempc)>PASSLTH)
X! 			   ||(strncmp(passwd,tempc,PASSLTH)!=0)){
X  				newerror("Invalid Password Match");
X  			} else valid=TRUE;
X  		}
X--- 434,453 ----
X  			mvprintw(2,0,"Enter National Password: ");
X  			clrtoeol();
X  			refresh();
X! 			i = get_pass(tempc);
X! 			if (i < 2) {
X! 				newerror("Password Too Short");
X  				continue;
X+ 			} else if (i > PASSLTH) {
X+ 				newerror("Password Too Long");
X+ 				continue;
X  			}
X  			mvprintw(2,0,"Reenter National Password: ");
X  			clrtoeol();
X  			refresh();
X! 			i = get_pass(passwd);
X  
X! 			if((i<2)||(i>PASSLTH)||(strncmp(passwd,tempc,PASSLTH)!=0)){
X  				newerror("Invalid Password Match");
X  			} else valid=TRUE;
X  		}
X***************
X*** 595,601 ****
X  				break;
X  			}
X  		}
X! 		mvprintw(2,COLS/2,"Alignment: %s", allignment[curntn->active]);
X  		clrtoeol();
X  
X  
X--- 599,605 ----
X  				break;
X  			}
X  		}
X! 		mvprintw(2,COLS/2,"Alignment: %s", alignment[curntn->active]);
X  		clrtoeol();
X  
X  
X***************
X*** 1044,1050 ****
X  				}
X  				if(is_habitable(x,y)) placed=1;
X  				/*important that no countries near*/
X! 				for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++){
X  				if((isntn(ntn[sct[i][j].owner].active))
X  					&&(sct[i][j].owner!=0)) placed=0;
X  				}
X--- 1048,1054 ----
X  				}
X  				if(is_habitable(x,y)) placed=1;
X  				/*important that no countries near*/
X! 				for(i=x-4;i<=x+4;i++) for(j=y-4;j<=y+4;j++){
X  				if((isntn(ntn[sct[i][j].owner].active))
X  					&&(sct[i][j].owner!=0)) placed=0;
X  				}
X***************
X*** 1148,1153 ****
X--- 1152,1158 ----
X  		else if (curntn->location==FAIR) t=1;
X  		else if (curntn->location==GREAT) t=2;
X  		else {
X+ 			if (ispc(curntn->active))
X  			newerror("Error in finding placement");
X  			t=0;
X  		}
X***************
X*** 1168,1177 ****
X  				sct[i][j].people=people;
X  				sct[x][y].people-=people;
X  			}
X  	}
X  	else {
X! 		if(curntn->location==OOPS) newerror("MAJOR ERROR IN PLACEMENT");
X! 		else if(curntn->location==RANDOM) {
X  			newerror("Random Place Failed, trying to place again");
X  			curntn->location=OOPS;
X  			place(-1,-1);
X--- 1173,1193 ----
X  				sct[i][j].people=people;
X  				sct[x][y].people-=people;
X  			}
X+ 		/* make sure status is set properly */
X+ 		for(i=0;i<NTOTAL;i++) {
X+ 			if (ntn[i].active < NPC_PEASANT) {
X+ 				ntn[i].dstatus[country]=UNMET;
X+ 				ntn[country].dstatus[i]=UNMET;
X+ 			} else {
X+ 				ntn[i].dstatus[country]=WAR;
X+ 				ntn[country].dstatus[i]=WAR;
X+ 			}
X+ 		}
X  	}
X  	else {
X! 		if(curntn->location==OOPS) {
X! 			newerror("MAJOR ERROR IN PLACEMENT");
X! 		} else if(curntn->location==RANDOM) {
X  			newerror("Random Place Failed, trying to place again");
X  			curntn->location=OOPS;
X  			place(-1,-1);
X***************
X*** 1292,1298 ****
X  
X  	/* extra points for starting late */
X  	points -= (float) (TURN-1) / LATESTART;
X! 	if( (TURN-1)/LATESTART > 0.0 ) {
X  		sprintf(temp,"%.1f points added for starting late",
X  			   (float) (TURN-1) / LATESTART);
X  		newerror(temp);
X--- 1308,1314 ----
X  
X  	/* extra points for starting late */
X  	points -= (float) (TURN-1) / LATESTART;
X! 	if( (float)(TURN-1)/LATESTART > 0.0 ) {
X  		sprintf(temp,"%.1f points added for starting late",
X  			   (float) (TURN-1) / LATESTART);
X  		newerror(temp);
X*** omain.c	Sun Aug  6 20:55:34 1989
X--- main.c	Sun Aug  6 20:55:49 1989
X***************
X*** 39,44 ****
X--- 39,46 ----
X  int	done=FALSE;	/* if TRUE: you are done	*/
X  short	hilmode=HI_OWN;	/* hilight mode */
X  short	dismode=DI_DESI;/* display mode			*/
X+ short	otherdismode= -(DI_MOVE);
X+ short	otherhilmode= HI_OWN;
X  short	selector=0;	/* selector (y vbl) for which army/navy... is "picked"*/
X  short	pager=0;	/* pager for selector 0,1,2,3*/
X  short	country=0;	/* nation id of owner*/
X***************
X*** 59,65 ****
X  	int geteuid(), getuid(), setuid();
X  	register int i,j;
X  	char name[NAMELTH+1],filename[FILELTH];
X! 	void srand(),init_hasseen();
X  	int getopt();
X  	char passwd[PASSLTH+1];
X  	long time();
X--- 61,67 ----
X  	int geteuid(), getuid(), setuid();
X  	register int i,j;
X  	char name[NAMELTH+1],filename[FILELTH];
X! 	void srand(),init_hasseen(),mapprep();
X  	int getopt();
X  	char passwd[PASSLTH+1];
X  	long time();
X***************
X*** 67,81 ****
X  #ifdef SYSMAIL
X  	extern char sysmail[];
X  #endif SYSMAIL
X! 	int sflag=FALSE,l;
X  
X  	char defaultdir[BIGLTH],tmppass[PASSLTH+1];
X  	char cq_opts[BIGLTH];
X! 	struct passwd *getpwnam();
X  
X  	owneruid=getuid();
X  	srand((unsigned) time((long *) 0));
X  	strcpy(name,"");
X  	strcpy(cq_opts,"");
X  
X  	/* check conquer options */
X--- 69,84 ----
X  #ifdef SYSMAIL
X  	extern char sysmail[];
X  #endif SYSMAIL
X! 	int sflag=FALSE,pflag=FALSE,l;
X  
X  	char defaultdir[BIGLTH],tmppass[PASSLTH+1];
X  	char cq_opts[BIGLTH];
X! 	struct passwd *getpwnam(), *pwent;
X  
X  	owneruid=getuid();
X  	srand((unsigned) time((long *) 0));
X  	strcpy(name,"");
X+ 	strcpy(defaultdir,"");
X  	strcpy(cq_opts,"");
X  
X  	/* check conquer options */
X***************
X*** 168,174 ****
X  	}
X  
X  	/* process the command line arguments */
X! 	while((i=getopt(argc,argv,"hGn:d:s"))!=EOF) switch(i){
X  	/* process the command line arguments */
X  	case 'h': /* execute help program*/
X  		initscr();
X--- 171,177 ----
X  	}
X  
X  	/* process the command line arguments */
X! 	while((i=getopt(argc,argv,"Ghpn:d:s"))!=EOF) switch(i){
X  	/* process the command line arguments */
X  	case 'h': /* execute help program*/
X  		initscr();
X***************
X*** 181,186 ****
X--- 184,192 ----
X  		endwin();
X  		putchar('\n');
X  		exit(SUCCESS);
X+ 	case 'p': /* print the map*/
X+ 		pflag++;
X+ 		break;
X  	case 'G':
X  		Gaudy = TRUE;
X  		break;
X***************
X*** 198,209 ****
X  		sflag++;
X  		break;
X  	case '?': /*  print out command line arguments */
X! 		printf("Command line format: %s [-Ghs -d DIR -nNAT]\n",argv[0]);
X! 		printf("\t-G       gaudily highlight nation in news\n");
X! 		printf("\t-n NAT   play as nation NAT\n");
X! 		printf("\t-h       print help text\n");
X! 		printf("\t-d DIR   to use play different game\n");
X! 		printf("\t-s       print scores\n");
X  		exit(SUCCESS);
X  	};
X  
X--- 204,216 ----
X  		sflag++;
X  		break;
X  	case '?': /*  print out command line arguments */
X! 		fprintf(stderr,"Command line format: %s [-Ghps -d DIR -nNAT]\n",argv[0]);
X! 		fprintf(stderr,"\t-n NAT   play as nation NAT\n");
X! 		fprintf(stderr,"\t-d DIR   to use play different game\n");
X! 		fprintf(stderr,"\t-G       gaudily highlight nation in news\n");
X! 		fprintf(stderr,"\t-h       print help text\n");
X! 		fprintf(stderr,"\t-p       print a map\n");
X! 		fprintf(stderr,"\t-s       print scores\n");
X  		exit(SUCCESS);
X  	};
X  
X***************
X*** 211,217 ****
X  	 * dir where the files are kept and do some work.
X  	 */
X  	if (chdir(defaultdir)) {
X! 		printf("unable to change dir to %s\n",defaultdir);
X  		exit(FAIL);
X  	}
X  
X--- 218,224 ----
X  	 * dir where the files are kept and do some work.
X  	 */
X  	if (chdir(defaultdir)) {
X! 		fprintf(stderr,"unable to change dir to %s\n",defaultdir);
X  		exit(FAIL);
X  	}
X  
X***************
X*** 218,223 ****
X--- 225,231 ----
X  	readdata();				/* read data*/
X  	verifydata( __FILE__, __LINE__ );	/* verify data */
X  
X+ 	/* now print the scores */
X  	if(sflag){
X  		printscore();
X  		exit(SUCCESS);
X***************
X*** 233,247 ****
X  		(void) setuid (geteuid ()) ;
X  	}
X  
X! 	/* at this stage must be a normal interactive game */
X  
X- 	printf("conquer %s.%d: Copyright (c) 1988 by Edward M Barlow\n",VERSION,PATCHLEVEL);
X- 
X  	/* check for update in progress */
X  	sprintf(filename,"%sup",isonfile);
X  	if(check_lock(filename,FALSE)==TRUE) {
X! 		printf("Conquer is updating\n");
X! 		printf("Please try again later.\n");
X  		exit(FAIL);
X  	}
X  
X--- 241,253 ----
X  		(void) setuid (geteuid ()) ;
X  	}
X  
X! 	fprintf(stderr,"conquer %s.%d: Copyright (c) 1988 by Edward M Barlow\n",VERSION,PATCHLEVEL);
X  
X  	/* check for update in progress */
X  	sprintf(filename,"%sup",isonfile);
X  	if(check_lock(filename,FALSE)==TRUE) {
X! 		fprintf(stderr,"Conquer is updating\n");
X! 		fprintf(stderr,"Please try again later.\n");
X  		exit(FAIL);
X  	}
X  
X***************
X*** 250,268 ****
X  	*     if you fail give name of administrator of game
X  	*/
X  	if (name[0] == '\0') {
X! 		printf("what nation would you like to be: ");
X  		gets(name);
X  	}
X  #ifdef OGOD
X  	if(strcmp(name,"god")==0 || strcmp(name,"unowned")==0) {
X  		if ((owneruid != (getpwnam(LOGIN))->pw_uid ) &&
X! 		    (owneruid != (getpwnam(ntn[0].leader))->pw_uid )) {
X! 			printf("Sorry -- you can not login as god\n");
X! 			printf("you need to be logged in as %s",LOGIN);
X  			if (strcmp(LOGIN, ntn[0].leader)!=0) {
X! 				printf(" or %s",ntn[0].leader);
X  			}
X! 			printf("\n");
X  			exit(FAIL);
X  		}
X  		strcpy(name,"unowned");
X--- 256,277 ----
X  	*     if you fail give name of administrator of game
X  	*/
X  	if (name[0] == '\0') {
X! 		if (pflag != FALSE)
X! 			fprintf(stderr,"Display map for what nation: ");
X! 		else fprintf(stderr,"What nation would you like to be: ");
X  		gets(name);
X  	}
X  #ifdef OGOD
X  	if(strcmp(name,"god")==0 || strcmp(name,"unowned")==0) {
X  		if ((owneruid != (getpwnam(LOGIN))->pw_uid ) &&
X! 		  ((pwent=getpwnam(ntn[0].leader)) == NULL ||
X! 		  owneruid != pwent->pw_uid )) {
X! 			fprintf(stderr,"Sorry -- you can not login as god\n");
X! 			fprintf(stderr,"you need to be logged in as %s",LOGIN);
X  			if (strcmp(LOGIN, ntn[0].leader)!=0) {
X! 				fprintf(stderr," or %s",ntn[0].leader);
X  			}
X! 			fprintf(stderr,"\n");
X  			exit(FAIL);
X  		}
X  		strcpy(name,"unowned");
X***************
X*** 276,295 ****
X  		if(strcmp(name,ntn[i].name)==0) country=i;
X  
X  	if(country==(-1)) {
X! 		printf("Sorry, name <%s> not found\n",name);
X! 		printf("\nFor rules type <conquer -h>");
X! 		printf("\nFor information on conquer please contact %s.",OWNER);
X! 		printf("\nTo enter this campaign please send mail to %s", LOGIN);
X  		if (strcmp(LOGIN, ntn[0].leader)!=0) {
X! 			printf(" or %s",ntn[0].leader);
X  		}
X! 		printf(".\n");
X  		return;
X! 	} else if(country==0) {
X  		sprintf(filename,"%sadd",isonfile);
X  		if(check_lock(filename,FALSE)==TRUE) {
X! 			printf("A new player is being added.\n");
X! 			printf("Continue anyway? [y or n]");
X  			while(((i=getchar())!='y')&&(i!='n')) ;
X  			if(i!='y') exit(FAIL);
X  		}
X--- 285,304 ----
X  		if(strcmp(name,ntn[i].name)==0) country=i;
X  
X  	if(country==(-1)) {
X! 		fprintf(stderr,"Sorry, name <%s> not found\n",name);
X! 		fprintf(stderr,"\nFor rules type <conquer -h>");
X! 		fprintf(stderr,"\nFor information on conquer please contact %s.",OWNER);
X! 		fprintf(stderr,"\nTo enter this campaign please send mail to %s", LOGIN);
X  		if (strcmp(LOGIN, ntn[0].leader)!=0) {
X! 			fprintf(stderr," or %s",ntn[0].leader);
X  		}
X! 		fprintf(stderr,".\n");
X  		return;
X! 	} else if(country==0 && !pflag) {
X  		sprintf(filename,"%sadd",isonfile);
X  		if(check_lock(filename,FALSE)==TRUE) {
X! 			fprintf(stderr,"A new player is being added.\n");
X! 			fprintf(stderr,"Continue anyway? [y or n]");
X  			while(((i=getchar())!='y')&&(i!='n')) ;
X  			if(i!='y') exit(FAIL);
X  		}
X***************
X*** 297,324 ****
X  	curntn = &ntn[country];
X  
X  	/*get encrypted password*/
X! 	strncpy(tmppass,getpass("\nwhat is your nation's password:"),PASSLTH);
X  	strncpy(passwd,crypt(tmppass,SALT),PASSLTH);
X  	if((strncmp(passwd,curntn->passwd,PASSLTH)!=0)
X  	&&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
X! 		strncpy(tmppass,getpass("\nerror: reenter your nation's password:"),PASSLTH);
X  		strncpy(passwd,crypt(tmppass,SALT),PASSLTH);
X  		if((strncmp(passwd,curntn->passwd,PASSLTH)!=0)
X  		&&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
X! 			printf("\nSorry:");
X! 			printf("\nFor rules type <conquer -h>");
X! 			printf("\nFor information on conquer please contact %s.",
X  				OWNER);
X! 			printf("\nTo enter this campaign please send mail to %s",
X  				LOGIN);
X  			if (strcmp(LOGIN, ntn[0].leader)!=0) {
X! 				printf(" or %s",ntn[0].leader);
X  			}
X! 			printf(".\n");
X  			exit(FAIL);
X  		}
X  	}
X  
X  	initscr();		/* SET UP THE SCREEN */
X  	/* check terminal size */
X  	if (COLS<80 || LINES<24) {
X--- 306,371 ----
X  	curntn = &ntn[country];
X  
X  	/*get encrypted password*/
X! 	fprintf(stderr,"\nWhat is your Nation's Password: ");
X! 	strncpy(tmppass,getpass(""),PASSLTH);
X  	strncpy(passwd,crypt(tmppass,SALT),PASSLTH);
X  	if((strncmp(passwd,curntn->passwd,PASSLTH)!=0)
X  	&&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
X! 		fprintf(stderr,"\nError: Reenter your Nation's Password: ");
X! 		strncpy(tmppass,getpass(""),PASSLTH);
X  		strncpy(passwd,crypt(tmppass,SALT),PASSLTH);
X  		if((strncmp(passwd,curntn->passwd,PASSLTH)!=0)
X  		&&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) {
X! 			fprintf(stderr,"\nSorry:");
X! 			fprintf(stderr,"\nFor rules type <conquer -h>");
X! 			fprintf(stderr,"\nFor information on conquer please contact %s.",
X  				OWNER);
X! 			fprintf(stderr,"\nTo enter this campaign please send mail to %s",
X  				LOGIN);
X  			if (strcmp(LOGIN, ntn[0].leader)!=0) {
X! 				fprintf(stderr," or %s",ntn[0].leader);
X  			}
X! 			fprintf(stderr,".\n");
X  			exit(FAIL);
X  		}
X  	}
X  
X+ 	/* now print the maps */
X+ 	if (pflag) {	/* print a map of the game */
X+ 		fprintf(stderr,"\nFor convenience, this output is to stderr,\n");
X+ 		fprintf(stderr,"while the maps will be sent to stdout.\n\n");
X+ 		fprintf(stderr,"\tThe valid options are,\n");
X+ 		fprintf(stderr,"\t\t1) altitudes\n\t\t2) vegetations\n");
X+ 		fprintf(stderr,"\t\t3) nations\n");
X+ 		fprintf(stderr,"\t\t4) designations\n\n");
X+ 		fprintf(stderr,"\tWhat type of map? ");
X+ 		scanf("%hd", &dismode);
X+ 		fprintf(stderr,"\n");
X+ 		switch(dismode) {
X+ 		case 1:
X+ 			mapprep();
X+ 			printele();
X+ 			break;
X+ 		case 2:
X+ 			mapprep();
X+ 			printveg();
X+ 			break;
X+ 		case 3:
X+ 			mapprep();
X+ 			pr_ntns();
X+ 			break;
X+ 		case 4:
X+ 			mapprep();
X+ 			pr_desg();
X+ 			break;
X+ 		default:
X+ 			fprintf(stderr,"Invalid Choice\n");
X+ 		     exit(FAIL);
X+ 			break;
X+ 		}
X+ 		exit(SUCCESS);
X+ 	}
X+ 
X  	initscr();		/* SET UP THE SCREEN */
X  	/* check terminal size */
X  	if (COLS<80 || LINES<24) {
X***************
X*** 410,416 ****
X  	signal(SIGTERM,hangup);		/* likewise for cheats!! */
X  
X  	noecho();
X! 	prep(country,FALSE);		/* initialize prep array */
X  	whatcansee();			/* what can they see */
X  
X  	/* initialize mail files */
X--- 457,463 ----
X  	signal(SIGTERM,hangup);		/* likewise for cheats!! */
X  
X  	noecho();
X! 	prep(country,FALSE);	/* initialize prep array */
X  	whatcansee();			/* what can they see */
X  
X  	/* initialize mail files */
X***************
X*** 492,497 ****
X--- 539,548 ----
X  {
X  	char	name[LINELTH+1];
X  	char	passwd[PASSLTH+1];
X+ 	struct passwd *getpwnam(), *pwent;
X+ #ifdef DEBUG
X+ 	void sect_info();
X+ #endif /* DEBUG */
X  	int	ocountry;
X  
X  	switch(getch()) {
X***************
X*** 499,508 ****
X  		ext_cmd( -1 );
X  		curntn->tgold -= MOVECOST;
X  		break;
X! 	case '':	/*redraw the screen*/
X  		whatcansee();	/* what can they see */
X  		redraw=TRUE;
X  		break;
X  	case 'a':	/*army report*/
X  		redraw=TRUE;
X  		armyrpt(0);
X--- 550,567 ----
X  		ext_cmd( -1 );
X  		curntn->tgold -= MOVECOST;
X  		break;
X! 	case '':	/* redraw the screen */
X  		whatcansee();	/* what can they see */
X  		redraw=TRUE;
X  		break;
X+ #ifdef DEBUG
X+ 	case '\t':	/* debugging information for god and demi-god */
X+ 		if ((owneruid != (getpwnam(LOGIN))->pw_uid ) &&
X+ 		    ((pwent=getpwnam(ntn[0].leader))==NULL || owneruid != pwent->pw_uid ))
X+ 			break;
X+ 		sect_info();
X+ 		break;
X+ #endif /* DEBUG */
X  	case 'a':	/*army report*/
X  		redraw=TRUE;
X  		armyrpt(0);
X***************
X*** 607,613 ****
X  		mymove();
X  		curntn->tgold -= MOVECOST;
X  		makebottom();
X! 		prep(country,FALSE);
X  		pager=0;
X  		selector=0;
X  		break;
X--- 666,675 ----
X  		mymove();
X  		curntn->tgold -= MOVECOST;
X  		makebottom();
X! 		prep(country,FALSE,TRUE);
X! 		if (hilmode == HI_ARMY || hilmode == HI_YARM) {
X! 			redraw = TRUE;
X! 		}
X  		pager=0;
X  		selector=0;
X  		break;
X***************
X*** 743,749 ****
X  	case 'z':	/*login as new user */
X  #ifdef OGOD
X  		if ((owneruid != (getpwnam(LOGIN))->pw_uid ) &&
X! 		    (owneruid != (getpwnam(ntn[0].leader))->pw_uid )) break;
X  #endif
X  		clear();
X  		redraw=TRUE;
X--- 805,811 ----
X  	case 'z':	/*login as new user */
X  #ifdef OGOD
X  		if ((owneruid != (getpwnam(LOGIN))->pw_uid ) &&
X! 		    ((pwent=getpwnam(ntn[0].leader))==NULL || owneruid != pwent->pw_uid )) break;
X  #endif
X  		clear();
X  		redraw=TRUE;
X***************
X*** 795,801 ****
X  		}
X  
X  		/* remove old lock file -- new one already made */
X! 		sprintf(fison,"%s%s",isonfile,ocountry);
X  		unlink(fison);
X  
X  		fclose(fexe);
X--- 857,863 ----
X  		}
X  
X  		/* remove old lock file -- new one already made */
X! 		sprintf(fison,"%s%d",isonfile,ocountry);
X  		unlink(fison);
X  
X  		fclose(fexe);
X***************
X*** 803,815 ****
X  	 	sprintf(name,"%s%d",exefile,country);
X  	 	if ((fexe=fopen(name,"a"))==NULL) {
X  			beep();
X! 			printf("error opening %s\n",name);
X  			unlink(fison);
X  			exit(FAIL);
X  	 	}
X  		curntn = &ntn[country];
X  
X! 		printf("\n");
X  		readdata();
X  		execute(FALSE);
X  
X--- 865,877 ----
X  	 	sprintf(name,"%s%d",exefile,country);
SHAR_EOF
echo "End of part 2, continue with part 3"
echo "3" > s2_seq_.tmp
exit 0