[comp.sources.games] v08i003: 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 3
Archive-name: conquer4/Patch4c
Patch-To: conquer4: Volume 6, Issue 83-97


#!/bin/sh
# this is part 3 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file patchV4.04 continued
#
CurArch=3
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  	 	if ((fexe=fopen(name,"a"))==NULL) {
X  			beep();
X! 			fprintf(stderr,"error opening %s\n",name);
X  			unlink(fison);
X  			exit(FAIL);
X  	 	}
X  		curntn = &ntn[country];
X  
X! 		fprintf(stderr,"\n");
X  		readdata();
X  		execute(FALSE);
X  
X***************
X*** 847,853 ****
X--- 909,975 ----
X  	}
X  }
X  
X+ #ifdef DEBUG
X  /************************************************************************/
X+ /*	SECT_INFO() - display sector debugging information		*/
X+ /************************************************************************/
X+ void
X+ sect_info()
X+ {
X+ 	int i,j,acnt1=0,acnt2=0,ncnt1=0,ncnt2=0,x,y;
X+ 
X+ 	/* erase prior information */
X+ 	for(i=0;i<LINES-13;i++) {
X+ 		move(i,COLS-21);
X+ 		clrtoeol();
X+ 	}
X+ 	
X+ 	standout();
X+ 	mvaddstr(0,COLS-20,"Sector Information");
X+ 	mvprintw(1,COLS-20,"  x = %2d, y = %2d  ",(int)XREAL,(int)YREAL);
X+ 	standend();
X+ 	
X+ 	/* find units in the sector */
X+ 	for (i=0;i<NTOTAL;i++) if (ntn[i].active != INACTIVE) {
X+ 		x = 0;
X+ 		for (j=0;j<MAXARM;j++) {
X+ 			if (ntn[i].arm[j].sold > 0 && ntn[i].arm[j].xloc == XREAL
X+ 			    && ntn[i].arm[j].yloc == YREAL ) x++;
X+ 		}
X+ 		y = 0;
X+ 		for (j=0;j<MAXNAVY;j++) {
X+ 			if (ntn[i].nvy[j].xloc != XREAL ||
X+ 			    ntn[i].nvy[j].yloc != YREAL ) continue;
X+ 			if (ntn[i].nvy[j].warships!=0 ||
X+ 			    ntn[i].nvy[j].merchant!=0 ||
X+ 			    ntn[i].nvy[j].galleys!=0) y++;
X+ 		}
X+ 		if (i!=country) {
X+ 			acnt2 += x;
X+ 			ncnt2 += y;
X+ 		} else {
X+ 			acnt1 = x;
X+ 			ncnt1 = y;
X+ 		}
X+ 	}
X+ 
X+ 	mvprintw(3,COLS-20,"Own A_Units: %d", acnt1);
X+ 	mvprintw(4,COLS-20,"Own N_Units: %d", ncnt1);
X+ 	mvprintw(5,COLS-20,"Other A_Units: %d", acnt2);
X+ 	mvprintw(6,COLS-20,"Other N_Units: %d", ncnt2);
X+ 
X+ 	mvprintw(8,COLS-20,"Occval: %d", occ[XREAL][YREAL]);
X+ 
X+ 	/* let them look at the information */
X+ 	errormsg("");
X+ 
X+ 	/* fix the display */
X+ 	makeside(FALSE);
X+ 	makebottom();
X+ }
X+ #endif /* DEBUG */
X+ 
X+ /************************************************************************/
X  /*	MAKESIDE() -	make the right hand side display		*/
X  /************************************************************************/
X  void
X***************
X*** 1182,1188 ****
X  	nocrmode();
X  	endwin();
X  	if (fexe!=NULL) fclose(fexe);
X! 	printf("quit & save\n");
X  	exit(SUCCESS);
X  }
X  
X--- 1304,1310 ----
X  	nocrmode();
X  	endwin();
X  	if (fexe!=NULL) fclose(fexe);
X! 	fprintf(stderr,"quit & save\n");
X  	exit(SUCCESS);
X  }
X  
X*** onpc.c	Sun Aug  6 20:55:35 1989
X--- npc.c	Sun Aug  6 20:55:49 1989
X***************
X*** 111,118 ****
X  		}
X  		count=0;
X  		while( TRUE ) {
X! 			x=(int)P_AXLOC+rand()%5-2;
X! 			y=(int)P_AYLOC+rand()%5-2;
X  
X  			if( count++ > 100 ) {
X  				P_ASOLD=0;
X--- 111,118 ----
X  		}
X  		count=0;
X  		while( TRUE ) {
X! 			x=(int)P_AXLOC+rand()%3-1;
X! 			y=(int)P_AYLOC+rand()%3-1;
X  
X  			if( count++ > 100 ) {
X  				P_ASOLD=0;
X***************
X*** 139,144 ****
X--- 139,145 ----
X  			break;
X  		}
X  	}
X+ #ifdef MORE_MONST
X  	/* place a few new Nomad armies */
X  	for(armynum=0;armynum<MAXARM;armynum++) if(P_ASOLD<=0){
X  		if(rand()%4!=0) continue;
X***************
X*** 152,157 ****
X--- 153,159 ----
X  			P_ASTAT=ATTACK;
X  		}
X  	}
X+ #endif /* MORE_MONST */
X  }
X  
X  void
X***************
X*** 187,192 ****
X--- 189,195 ----
X  			}
X  		}
X  	}
X+ #ifdef MORE_MONST
X  	/* place a few new savage armies */
X  	for(armynum=0;armynum<MAXARM;armynum++) if(P_ASOLD<=0){
X  		x=(rand()%(MAPX-8))+4;
X***************
X*** 204,209 ****
X--- 207,213 ----
X  			P_ASTAT=ATTACK;
X  		}
X  	}
X+ #endif /* MORE_MONST */
X  }
X  
X  void
X***************
X*** 251,261 ****
X--- 255,267 ----
X  				P_NYLOC= ntn[x].nvy[y].yloc;
X  			}
X  		}
X+ #ifdef MORE_MONST
X  		if(rand()%15==0) {
X  			/*randomly add one warship to pirate fleet*/
X  			shipsize = rand()%(N_HEAVY-N_LIGHT+1);
X  			(void) NADD_WAR(1);
X  		}
X+ #endif /* MORE_MONST */
X  	}
X  }
X  #endif MONSTER
X***************
X*** 550,555 ****
X--- 556,562 ----
X  		diff=curntn->tmil-(6*ideal/5);
X  		for(armynum=1;done==FALSE && armynum<MAXARM;armynum++){
X  			if((P_ASOLD<=0)
X+ 			||(P_ATYPE==A_ZOMBIE)
X  			||(P_ATYPE==A_MILITIA)
X  			||(P_ATYPE>=MINLEADER)
X  			||(P_ASTAT==ONBOARD)
X***************
X*** 711,717 ****
X  	for(x=1;x<NTOTAL;x++) if( isntn(ntn[x].active) ){
X  		hostile = svhostile;
X  		if(npctype(curntn->active) != npctype(ntn[x].active)) 
X! 			hostile+=20;	/* not same allignment */
X  		friendly = 60-hostile;
X  	     	if( curntn->active==ISOLATIONIST ) friendly -= 20;
X  		/* negate impact of above line on neutrals */
X--- 718,724 ----
X  	for(x=1;x<NTOTAL;x++) if( isntn(ntn[x].active) ){
X  		hostile = svhostile;
X  		if(npctype(curntn->active) != npctype(ntn[x].active)) 
X! 			hostile+=20;	/* not same alignment */
X  		friendly = 60-hostile;
X  	     	if( curntn->active==ISOLATIONIST ) friendly -= 20;
X  		/* negate impact of above line on neutrals */
X***************
X*** 826,832 ****
X  	float	hunger;
X  	long zz;
X  	check();
X! 	prep(country,FALSE);
X  
X  	for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++) attr[x][y]=0;
X  
X--- 833,839 ----
X  	float	hunger;
X  	long zz;
X  	check();
X! 	prep(country,FALSE,FALSE);
X  
X  	for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++) attr[x][y]=0;
X  
X***************
X*** 1079,1085 ****
X  		if(curntn->metals >  3 * METALORE * curntn->tmil*x){
X  			curntn->dplus+=1;
X  			curntn->metals-=METALORE*curntn->tmil*x;
X! 			printf("\tnation %s buys +1 percent defence\n",curntn->name);
X  		}
X  	}
X  	/* don't allow status ATTACK from own city */
X--- 1086,1092 ----
X  		if(curntn->metals >  3 * METALORE * curntn->tmil*x){
X  			curntn->dplus+=1;
X  			curntn->metals-=METALORE*curntn->tmil*x;
X! 			printf("\tnation %s buys +1 percent defense\n",curntn->name);
X  		}
X  	}
X  	/* don't allow status ATTACK from own city */
X***************
X*** 1127,1135 ****
X  {
X  #ifdef XENIX
X  	register int z;
X- #else
X- 	register int x,y;
X  #endif /*XENIX*/
X  
X  	/* around capitol */
X  	for(x=(int)curntn->capx-4;x<=(int)curntn->capx+4;x++){
X--- 1134,1141 ----
X  {
X  #ifdef XENIX
X  	register int z;
X  #endif /*XENIX*/
X+ 	register int x,y;
X  
X  	/* around capitol */
X  	for(x=(int)curntn->capx-4;x<=(int)curntn->capx+4;x++){
X*** ocheck.c	Sun Aug  6 20:55:33 1989
X--- check.c	Sun Aug  6 20:55:50 1989
X***************
X*** 55,61 ****
X  				__file__,__line__,country,i,a->xloc,a->yloc);
X  				a->sold = 0;
X  			}
X! 			if( sct[a->xloc][a->yloc].altitude==WATER ) {
X  				fprintf( stderr, "file %s: line %d: nation[%d] army[%d] loc=%d,%d (water) men=%d\n",
X  				__file__,__line__,country,i,a->xloc,a->yloc,a->sold);
X  				a->sold = 0;
X--- 55,61 ----
X  				__file__,__line__,country,i,a->xloc,a->yloc);
X  				a->sold = 0;
X  			}
X! 			if( a->stat != ONBOARD && sct[a->xloc][a->yloc].altitude==WATER ) {
X  				fprintf( stderr, "file %s: line %d: nation[%d] army[%d] loc=%d,%d (water) men=%d\n",
X  				__file__,__line__,country,i,a->xloc,a->yloc,a->sold);
X  				a->sold = 0;
X***************
X*** 63,69 ****
X  		} /* for */
X  
X  		for( i = 0; i < NTOTAL; i++ ) {
X! 			if( nptr->dstatus[i] > JIHAD ) {
X  				fprintf( stderr, "file %s: line %d: nation[%d] diplomatic status with %d = %d\n",
X  					__file__, __line__, country, i, nptr->dstatus[i] );
X  				nptr->dstatus[i] = WAR;
X--- 63,76 ----
X  		} /* for */
X  
X  		for( i = 0; i < NTOTAL; i++ ) {
X! 			if( ntn[i].active >= NPC_PEASANT ) {
X! 				if ( nptr->dstatus[i] != WAR ) {
X! 					nptr->dstatus[i] = WAR;
X! 				}
X! 				if ( ntn[i].dstatus[country] != WAR ) {
X! 					ntn[i].dstatus[country] = WAR;
X! 				}
X! 			} if( nptr->dstatus[i] > JIHAD ) {
X  				fprintf( stderr, "file %s: line %d: nation[%d] diplomatic status with %d = %d\n",
X  					__file__, __line__, country, i, nptr->dstatus[i] );
X  				nptr->dstatus[i] = WAR;
X*** otxt0	Sun Aug  6 20:55:35 1989
X--- txt0	Sun Aug  6 20:55:50 1989
X***************
X*** 89,98 ****
X  promoted to demi-god status.
X  
X        The demi-god may perform all of the godly functions for his world,
X! including updates and nation alterations.  But alas he is only watching
X! over the world and is not it's owner, so he may not create a new world or
X! cause the destruction of the world he watches.  The demi-god for each
X! world is indicated in the campaign information display ('I').
X  
X        Perhaps god is looking for people to run his worlds.  Send mail
X  to XLOGIN and you may find out.
X--- 89,99 ----
X  promoted to demi-god status.
X  
X        The demi-god may perform all of the godly functions for his world,
X! including updates and nation alterations.  He may even rebuild the current
X! world from the beginning, if god grants him that power.  The only definite
X! restrictions are that he may not create a completely new world or effect any
X! world, other than his own.  The demi-god for each world is indicated
X! in the campaign information display ('I').
X  
X        Perhaps god is looking for people to run his worlds.  Send mail
X  to XLOGIN and you may find out.
X*** otxt1	Sun Aug  6 20:55:35 1989
X--- txt1	Sun Aug  6 20:55:50 1989
X***************
X*** 137,161 ****
X  END
X                              VIEWING THE WORLD
X  
X! When you log in, you will notice that you can only see a part of the
X! world.  You must discover the world by getting certain magical powers,
X! by taking land, or by moving armies and navies.  The use of SCOUT armies
X! is intended for this purpose.
X  
X  The 'd' command allows you to change what you see on the map.  You can
X  alter the information in the sector and can  change the type of sectors that
X! are highlighted as follows:
X  
X! viewing options:  (d)esignation, (r)ace, (M)ove cost, (p)eople, (D)efense
X!    (f)ood, (c)ontour, (v)egetation, (m)etal, (n)ation mark, (j)ewels, (i)tems
X! highlight option: (o)wner (a)rmy (y)our Army, move (l)eft, (s)pecial, (x)=none
X! toggle move mode: hit '/'
X  
X! Move mode ('/' toggle) will display both the current display as well as
X! the move cost for each sector along side.
X  
X! I have tried to make the use of these options clear and self explanatory.
X! Roman numerals (for population...) indicate thousands of people.
X  END
X                          COMMERCE AND TRADING
X  
X--- 137,202 ----
X  END
X                              VIEWING THE WORLD
X  
X! When you first log in, you will notice that you can only see a portion of the
X! entire world.  Your range of vision is determined by the magic powers you
X! possess and the location of your sectors and armies.  Scouts are useful to
X! expand the amount of land you can view.
X  
X  The 'd' command allows you to change what you see on the map.  You can
X  alter the information in the sector and can  change the type of sectors that
X! are highlighted.  See the next two sections for the list of possible display
X! and hightlight options.
X  
X! Normally, the conquer display shows your chosen display option with blank
X! spaces to the right to space out the map nicely.  But, you may also use the
X! area thus provided to show a secondary display.  This secondary display may
X! be turned on and off using the '/' display selection.  Also, you may
X! distinguish between what to display in the primary or secondary display by
X! prefacing your selection with either a '1' or '2'.   If neither is chosen,
X! then the primary display is set to the selected option, while the secondary
X! display is turned off.
X! END
X!                             DISPLAY OPTIONS
X  
X! This section describes the possible display options proceeded by their
X! associated keystroke:
X  
X!  (d)  designation:  show your designations and other nation's marks.
X!  (r)  race:  show race of owned sectors (Human, Orc, Elf, Dwarf, Lizard, etc.)
X!  (M)  move cost:  show the cost in movement points to move into a sector.
X!  (p)  people:  show how many people live in a sector; arabic numbers indicate
X!         the amount in hundreds, while 'I', 'V' and 'X' are used to indicate
X!         at least one thousand, five thousand, and ten thousand respectively.
X!  (D)  defense:  show the relative defensive strength of a sector.  Both sector
X!         terrain and sector fortifications are taken into account.
X!  (f)  food:  display relative food production ability of a sector.
X!  (c)  contour:  display the elevation symbol of each sector.
X!  (v)  vegetation:  display the vegetation symbol of each sector.
X!  (m)  metal:  show the relative metal production ability of a sector.
X!  (n)  nation mark:  display the national mark for all owned sectors.
X!  (j)  jewels:  show the relative jewel production ability of a sector.
X!  (i)  items:  display the designation neccesary to take advantage of the
X!         special item in a sector.
X! END
X!                          HIGHLIGHT OPTIONS
X! 
X! This section describes the possible modes of highlighting proceeded by the
X! keystroke used to select each:
X! 
X!  (o)  owned:  highlight all sectors owned by your country.
X!  (a)  army:  highlight all sectors containing army units.
X!  (y)  your army:  hightlight all sectors containing at least on of your
X!         army units.
X!  (l)  moves left:  hightlight any sectors containing one of your armies with
X!         movement points remaining.
X!  (s)  special:  highlight any sector containing a special item visable to
X!         your nation.
X!  (x)  none:  do not highlight any sectors.
X! 
X!    In general, the most useful displays are the production displays (food,
X! metal, and jewels), and the most useful highlights are the army highlight
X! (to show where your enemies are), and the moves left highlight (to indicate
X! those units which may still be moved onto your enemies).
X  END
X                          COMMERCE AND TRADING
X  
X*** otxt4	Sun Aug  6 20:55:36 1989
X--- txt4	Sun Aug  6 20:55:51 1989
X***************
X*** 57,63 ****
X  ZCHURCH   add to your nations popularity and patriotism
X  
X  sector redesignation requires food ability of XDESFOOD (not forts/stockades).
X! Stockade, City, Town, & Fort defences work for defenders with garrison status.
X  END
X                           MINE ABILITY & WEALTH
X  
X--- 57,63 ----
X  ZCHURCH   add to your nations popularity and patriotism
X  
X  sector redesignation requires food ability of XDESFOOD (not forts/stockades).
X! Stockade, City, Town, & Fort defenses work for defenders with garrison status.
X  END
X                           MINE ABILITY & WEALTH
X  
X*** otxt5	Sun Aug  6 20:55:36 1989
X--- txt5	Sun Aug  6 20:55:51 1989
X***************
X*** 17,23 ****
X  demon    1      0       1     0    1     0      5     0   4    O     DESTROYER
X  dragon   0      0       0    10   20     0      0     0   4    O     MA_MONST
X  shadow   1      0       0     0    0     5      0     0   2    O     VOID
X! NPC      1      1       0     0    1     1      1     0   0    HDEO  None
X  END
X                                 ADDITIONAL SCORING
X  
X--- 17,23 ----
X  demon    1      0       1     0    1     0      5     0   4    O     DESTROYER
X  dragon   0      0       0    10   20     0      0     0   4    O     MA_MONST
X  shadow   1      0       0     0    0     5      0     0   2    O     VOID
X! monster  1      1       0     0    1     1      1     0   0    HDEO  None
X  END
X                                 ADDITIONAL SCORING
X  
X*** oman.pag	Sun Aug  6 20:55:34 1989
X--- man.pag	Sun Aug  6 20:55:51 1989
X***************
X*** 3,12 ****
X  conquer \- multiuser game of strategy
X  .SH SYNOPSIS
X  .B conquer
X! [-hs -nNAT -dDIR]
X  .sp
X  .B conqrun
X! [-maxp -dDIR ]
X  .SH DESCRIPTION
X  .I CONQUER
X  is a multi player computer game designed to run under the UNIX
X--- 3,12 ----
X  conquer \- multiuser game of strategy
X  .SH SYNOPSIS
X  .B conquer
X! [-Ghps -nNAT -dDIR]
X  .sp
X  .B conqrun
X! [-max -dDIR ]
X  .SH DESCRIPTION
X  .I CONQUER
X  is a multi player computer game designed to run under the UNIX
X***************
X*** 21,33 ****
X  and adjusting economic activity, which is primarily geared to the production
X  of gold for your treasury.  Metal is needed, however to build ships & armies,
X  and food is needed to prevent revolts and keep people alive.
X  .SH ON LINE HELP
X  For detailed information, run conquer with the -h option (see below).
X  .SH GAME OPTIONS
X  .B conquer
X! [-hs -nNAT -dDIR]
X  .IP \-h
X! print this help text
X  .IP "\-n NTN"
X  run as nation NTN
X  .IP "\-d DIR"
X--- 21,55 ----
X  and adjusting economic activity, which is primarily geared to the production
X  of gold for your treasury.  Metal is needed, however to build ships & armies,
X  and food is needed to prevent revolts and keep people alive.
X+ .SH ENVIRONMENT
X+ Conquer now supports the environment variable CONQ_OPTS.  This allows
X+ the setting of default values for nation name and data directory.  The
X+ format is as follows:
X+ .sp
X+ .nf
X+ setenv CONQ_OPTS "G,nation=MyLand,datadir=this_game"
X+ .fi
X+ .sp
X+ If you then type just
X+ .I conquer
X+ to enter conquer, it will be equivalent to typing
X+ .I conquer -G -n MyLand -d this_game.
X+ .sp
X+ The data directory and nation settings through the environment are
X+ just defaults and maybe overridden by actually entering a different
X+ option using '-d' or '-n'.  [Note: to specify the default directory,
X+ you may simply specify '-d ""'.]
X+ .sp
X+ The CONQ_OPTS environment variable combined with the use of shell
X+ aliases should allow quick access for players in multiple campaigns.
X+ .fi
X  .SH ON LINE HELP
X  For detailed information, run conquer with the -h option (see below).
X  .SH GAME OPTIONS
X  .B conquer
X! [-Ghps -nNAT -dDIR]
X  .IP \-h
X! display the conquer help files.
X  .IP "\-n NTN"
X  run as nation NTN
X  .IP "\-d DIR"
X***************
X*** 34,58 ****
X  Run on data in directory DIR.  Each game has its own data directory.  The
X  default is set up at compile time and should only be used if only one game
X  is run.
X  .IP \-s
X  print out scores
X  .SH CONTROL OPTIONS
X  .B conqrun
X! [-maxp -dDIR ]
X  .IP \-a     
X  add new player	
X  .IP \-m     
X  make a world
X- .IP \-p     
X- print a map to standard output.	
X  .IP \-x     
X  execute program
X  .IP "\-d DIR  "
X! run on data in directory DIR
X! It is suggested that each player set up an alias for their game & nation.
X! My alias, for example, is
X! .br
X! .I conquer -nMordor -d/usr4/adb/games/conqlib2
X  .SH CURSOR MOVEMENT
X  .nf
X  h: move west
X--- 56,84 ----
X  Run on data in directory DIR.  Each game has its own data directory.  The
X  default is set up at compile time and should only be used if only one game
X  is run.
X+ .IP \-G
X+ Gaudily highlight country name when reading the world news.
X+ .IP \-p
X+ Output a map of the world as visible by a nation.  The map is sent
X+ to the standard output and interactive prompting is done through standard
X+ error.  Therefore, the command:
X+ .I conquer -p > foo
X+ will create a file called foo containing the map.
X  .IP \-s
X  print out scores
X  .SH CONTROL OPTIONS
X  .B conqrun
X! [-max -dDIR ]
X  .IP \-a     
X  add new player	
X  .IP \-m     
X  make a world
X  .IP \-x     
X  execute program
X  .IP "\-d DIR  "
X! run on data in directory DIR.  If DIR does not begin with a '/'
X! character then the directory will be considered a sub directory of the
X! default directory.
X  .SH CURSOR MOVEMENT
X  .nf
X  h: move west
X***************
X*** 101,108 ****
X  move selected unit. The unit will stop when it runs out
X  of move points or runs into an army larger than it.
X  .TP
X  \'p\':
X! .B pick item:
X  allows you to select the next army or navy in the
X  sector.  Other commands will operate on that unit.
X  .TP
X--- 127,139 ----
X  move selected unit. The unit will stop when it runs out
X  of move points or runs into an army larger than it.
X  .TP
X+ \'o\':
X+ .B pick previous item:
X+ allows you to select the previous army or navy in the
X+ sector.  Other commands will operate on that unit.
X+ .TP
X  \'p\':
X! .B pick next item:
X  allows you to select the next army or navy in the
X  sector.  Other commands will operate on that unit.
X  .TP
X***************
X*** 119,125 ****
X  \'t\':
X  .B transport:
X  unload or load a fleet with soldiers or civilians.
X- .bp
X  .TP
X  \'w\':
X  .B wizardry:
X--- 150,155 ----
X***************
X*** 191,206 ****
X  Civilians can move between two of your sectors at a cost
X  of 50 per civilian.  Civilians move naturally in the update.
X  .SH FILES
X! /usr/games/lib/conquerdir/data	datafile for the running game
X  .SH BUGS
X! Probably lots, if you find any please mail them to adb@bucsf
X  .sp
X  1) Security is not as tight as it should be.  People might be able to alter
X  the data of others nations... this is cheating and unacceptable.  
X  .br
X! 2) Naval battles do not work properly.
X  .br
X  3) NPC nations can not build navies or move over water.  God should be
X  sure that all NPC nations have a minimum of 5 sectors to move to.
X  .br
X! 4) No comments about the documentation...  It needs to be updated.
X--- 221,248 ----
X  Civilians can move between two of your sectors at a cost
X  of 50 per civilian.  Civilians move naturally in the update.
X  .SH FILES
X! /usr/games/lib/conquerdir/data	default datafile for the running game
X! .SH MAILING LIST
X! I have established a mailing list to provide a location for discussion
X! of conquer, and for a place where I will bounce my ideas and test
X! patches off of people.  If you would like to be added to the mailing
X! list, send mail to
X! .I conquer-news-request@bu-cs.bu.edu.
X  .SH BUGS
X! Probably lots, if you find any please mail them to either:
X! .br
X! .I adb@bu-cs.bu.edu
X! or
X! .I conquer-bugs@bu-cs.bu.edu.
X  .sp
X  1) Security is not as tight as it should be.  People might be able to alter
X  the data of others nations... this is cheating and unacceptable.  
X  .br
X! 2) Naval battles may not work properly.
X  .br
X  3) NPC nations can not build navies or move over water.  God should be
X  sure that all NPC nations have a minimum of 5 sectors to move to.
X  .br
X! 4) Documentation is becoming too large.  A better method for updating
X! it and reading it should be implemented.  Some sections need sprucing
X! up.
SHAR_EOF
chmod 0644 patchV4.04 || echo "restore of patchV4.04 fails"
sed 's/^X//' << 'SHAR_EOF' > display.c &&
X/*Print and io subroutines for interactive game*/
X
X/*conquer : Copyright (c) 1988 by Ed Barlow.
X *  I spent a long time writing this code & I hope that you respect this.
X *  I give permission to alter the code, but not to copy or redistribute
X *  it without my explicit permission.	If you alter the code,
X *  please document changes and send me a copy, so all can have it.
X *  This code, to the best of my knowledge works well,	 but it is my first
X *  'C' program and should be treated as such.  I disclaim any
X *  responsibility for the codes actions (use at your own risk).	 I guess
X *  I am saying "Happy gaming", and am trying not to get sued in the process.
X *										Ed
X */
X
X/*include files*/
X#include <ctype.h>
X#include "header.h"
X#include "data.h"
X
X/*offset of upper left hand corner*/
Xextern short xoffset;
Xextern short yoffset;
X/*current cursor postion (relative to 00 in upper corner)*/
X/*	position is 2*x,y*/
Xextern short xcurs;
Xextern short ycurs;
X/*redraw map in this turn if redraw is a 1*/
Xextern short redraw;
X/*display state SEE data.h FOR CURRENT VALUES OF THESE */
Xextern short hilmode;
Xextern short dismode;
Xextern short otherdismode;
Xextern short otherhilmode;
X
X/* nation id of owner*/
Xextern short country;
X
Xstatic char *hasseen;
X
X/* allocate space for the hasseen array based on the actual screen size */
Xvoid
Xinit_hasseen()
X{
X	hasseen = (char *)malloc(((COLS-10)/2) * (LINES-5));
X#ifdef BSD
X	bzero(hasseen,((COLS-10)/2) * (LINES-5));
X#else
X	memset( hasseen, 0, ((COLS-10)/2) * (LINES-5));
X#endif
X	if (hasseen == (char *)NULL) {
X		errormsg("Cannot allocate memory.");
X		bye(FALSE);
X	}
X}
X
X/*make a map*/
Xvoid
Xmakemap()
X{
X	register int x,y;
X
X	for(x=0;x<SCREEN_X_SIZE;x++) for(y=0;y<SCREEN_Y_SIZE;y++)
X	if( HAS_SEEN(x,y) ) {
X		highlight(x,y,hilmode);
X		see(x,y);
X	}
X	move(ycurs,2*xcurs);
X}
X
X
Xvoid
Xget_display_mode(dmode,hmode,odmode,ohmode)
X	short *dmode, *hmode, *odmode, *ohmode;
X{
X	short temp;
X	
X	mvaddstr(LINES-4,0,"viewing options:  (d)esignation, (r)ace, (M)ove cost, (p)eople, (D)efense");
X	clrtoeol();
X	mvaddstr(LINES-3,0,"   (f)ood, (c)ontour, (v)egetation, (m)etal, (n)ation mark, (j)ewels, (i)tems");
X	clrtoeol();
X	mvaddstr(LINES-2,0,"highlight option: (o)wned, (a)rmy, (y)our Army, move (l)eft, (s)pecial,(x)=none");
X	clrtoeol();
X	if ( odmode !=NULL) {
X		mvaddstr(LINES-1,0,"Toggle second display: '/'; set display: '1' or '2'");
X	} else {
X		mvprintw(LINES-1,0,"     choose selection for the %s display",
X			(*ohmode == 1) ? "primary" : "secondary");
X	}
X	clrtoeol();
X	standout();
X	mvaddstr(LINES-1,COLS-25,odmode!=NULL?"what display?:":"display?:");
X	standend();
X	refresh();
X	redraw=TRUE;
X	switch(getch()) {
X	case '/':
X		if (odmode !=NULL)
X			*odmode = - *odmode;
X		else
X			goto error;
X		break;
X	case '2':
X		temp = 2;
X		if (odmode !=NULL)
X			get_display_mode(odmode,ohmode,NULL,&temp);
X		else
X			goto error;
X		break;
X	case '1':
X		temp = 1;
X		if (odmode !=NULL)
X			get_display_mode(dmode,hmode,NULL,&temp);
X		else
X			goto error;
X		break;
X	case 'f':
X		*dmode=DI_FOOD;
X		goto changed_display;
X	case 'v':	/* vegetation map*/
X		*dmode=DI_VEGE;
X		goto changed_display;
X	case 'd':	/* designations map*/
X		*dmode=DI_DESI;
X		goto changed_display;
X	case 'c':	/* contour map of world */
X		*dmode=DI_CONT;
X		goto changed_display;
X	case 'n':	/* nations map*/
X		*dmode=DI_NATI;
X		goto changed_display;
X	case 'r':	/* race map*/
X		*dmode=DI_RACE;
X		goto changed_display;
X	case 'M': /* move cost map */
X		*dmode=DI_MOVE;
X		goto changed_display;
X	case 'D':
X		*dmode=DI_DEFE;
X		goto changed_display;
X	case 'p':
X		*dmode=DI_PEOP;
X		goto changed_display;
X	case 'j':
X		*dmode=DI_GOLD;
X		goto changed_display;
X	case 'm':
X		*dmode=DI_METAL;
X		goto changed_display;
X	case 'i':
X		*dmode=DI_ITEMS;
X	changed_display:
X		if ( odmode !=NULL && *odmode > 0) /* just 'd' not 'd1 or 'd2' */
X			*odmode= - *odmode;
X		break;
X	case 'a':	/* armies hilighted map*/
X		prep(country,FALSE);
X		*hmode=HI_ARMY;
X		goto changed_highlight;
X	case 'o':	/* owners hilighted map*/
X		*hmode=HI_OWN;
X		goto changed_highlight;
X	case 's':	/* hilight tradegoods */
X		*hmode=HI_GOOD;
X		goto changed_highlight;
X	case 'x':	/*no highlighting*/
X		*hmode=HI_NONE;
X		goto changed_highlight;
X	case 'y':	/* your armies hilighted map*/
X		prep(country,FALSE);
X		*hmode=HI_YARM;
X		goto changed_highlight;
X	case 'l':	/* your armies with moves left hilighted map*/
X		prep(country,FALSE);
X		*hmode=HI_MOVE;
X	changed_highlight:
X		if ( odmode !=NULL ) /* just 'd' not 'd1 or 'd2' */
X			*ohmode= *hmode;
X		break;
X	default:
X	error:
X		beep();
X		redraw=FALSE;
X	}
X}
X
Xvoid
Xnewdisplay()
X{
X	get_display_mode(&dismode,&hilmode,&otherdismode,&otherhilmode);
X	makebottom();
X}
X
X/*see what is in xy as per display modes*/
Xchar
Xget_display_for(x,y,dmode)
X	int x,y;
X	short dmode;
X{
X	int armbonus;
X
X	char ch= '{';
X	if((magic(sct[x+xoffset][y+yoffset].owner,THE_VOID)==TRUE)
X	   &&((dmode==DI_DEFE)||(dmode==DI_GOLD)||(dmode==DI_METAL)
X		 ||(dmode==DI_PEOP)||(dmode==DI_FOOD)||(dmode==DI_ITEMS))
X	   &&(country!=sct[x+xoffset][y+yoffset].owner)
X	   &&(magic(country,NINJA)!=TRUE)
X	   &&(country!=0)) {
X		ch='?';
X	} else {
X		switch(dmode){
X		case DI_FOOD:	/*food */
X			if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
X				ch=sct[x+xoffset][y+yoffset].vegetation;
X			else if (tofood( &sct[x+xoffset][y+yoffset],country)<10)
X				ch=tofood( &sct[x+xoffset][y+yoffset],country)+'0';
X			else ch='+';
X			break;
X		case DI_VEGE: /*vegetation*/
X			ch=sct[x+xoffset][y+yoffset].vegetation;
X			break;
X		case DI_DESI: /*designation*/
X			if(sct[x+xoffset][y+yoffset].owner==0){
X				if(tofood( &sct[x+xoffset][y+yoffset],sct[x+xoffset][y+yoffset].owner)!=0)
X					ch=sct[x+xoffset][y+yoffset].altitude;
X				else ch=sct[x+xoffset][y+yoffset].vegetation;
X			}
X			else if((country==0)
X				   ||(sct[x+xoffset][y+yoffset].owner==country))
X				ch=sct[x+xoffset][y+yoffset].designation;
X			else ch=ntn[sct[x+xoffset][y+yoffset].owner].mark;
X			break;
X		case DI_CONT: /*contour*/
X			ch=sct[x+xoffset][y+yoffset].altitude;
X			break;
X		case DI_NATI: /*ownership*/
X			if(sct[x+xoffset][y+yoffset].owner==0)
X				ch=sct[x+xoffset][y+yoffset].altitude;
X			else ch=ntn[sct[x+xoffset][y+yoffset].owner].mark;
X			break;
X		case DI_RACE: /*race*/
X			if(sct[x+xoffset][y+yoffset].owner==0)
X				ch=sct[x+xoffset][y+yoffset].altitude;
X			else ch=ntn[sct[x+xoffset][y+yoffset].owner].race;
X			break;
X		case DI_MOVE:	/*movement cost map*/
X			if(movecost[x+xoffset][y+yoffset]>=0) {
X				if(movecost[x+xoffset][y+yoffset]>=10)
X					ch='+';
X				else ch=movecost[x+xoffset][y+yoffset]+'0';
X			} else if(sct[x+xoffset][y+yoffset].altitude==WATER)
X				ch=WATER;
X			else
X				ch='X';
X			break;
X		case DI_DEFE:	 /*Defence*/
X			if (sct[x+xoffset][y+yoffset].altitude==WATER)
X				ch=WATER;
X			else if(movecost[x+xoffset][y+yoffset]<0)
X				ch='X';
X			else {
X				/*Racial combat bonus due to terrain (the faster you move the better)*/
X				armbonus=0;
X				armbonus+=5*(9-movecost[x+xoffset][y+yoffset]);
X				
X				if(sct[x+xoffset][y+yoffset].altitude==MOUNTAIN)
X					armbonus+=40;
X				else if(sct[x+xoffset][y+yoffset].altitude==HILL)
X					armbonus+=20;
X
X				if(sct[x+xoffset][y+yoffset].vegetation==JUNGLE)
X					armbonus+=30;
X				else if(sct[x+xoffset][y+yoffset].vegetation==FOREST)
X					armbonus+=20;
X				else if(sct[x+xoffset][y+yoffset].vegetation==WOOD)
X					armbonus+=10;
X
X				armbonus+=fort_val(&sct[x+xoffset][y+yoffset]);
X				
X				if(armbonus<200) ch=armbonus/20+'0';
X				else ch='+';
X			}
X			break;
X		case DI_PEOP:	 /*People*/
X			if (sct[x+xoffset][y+yoffset].altitude==WATER)
X				ch=WATER;
X			else if (sct[x+xoffset][y+yoffset].people>=9950)
X				ch='X';
X			else if (sct[x+xoffset][y+yoffset].people>=4950)
X				ch='V';
X			else if (sct[x+xoffset][y+yoffset].people>=950)
X				ch='I';
X			else
X				ch=(50+sct[x+xoffset][y+yoffset].people)/100+'0';
X			break;
X		case DI_GOLD:	/*Gold*/
X			if (sct[x+xoffset][y+yoffset].altitude==WATER)
X				ch=WATER;
X			else if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
X				ch='X';
X			else if (tg_ok(country,&sct[x+xoffset][y+yoffset])){
X				if (sct[x+xoffset][y+yoffset].jewels>=10)
X					ch='+';
X				else
X					ch=sct[x+xoffset][y+yoffset].jewels+'0';
X			} else ch='0';
X			break;
X		case DI_METAL:	 /*Metal*/
X			if (sct[x+xoffset][y+yoffset].altitude==WATER)
X				ch=WATER;
X			else if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
X				ch='X';
X			else if (tg_ok(country,&sct[x+xoffset][y+yoffset])){
X				if (sct[x+xoffset][y+yoffset].metal>=10)
X					ch='+';
X				else
X					ch=sct[x+xoffset][y+yoffset].metal+'0';
X			} else ch='0';
X			break;
X		case DI_ITEMS:	/* designations needed for tradegoods */
X			if (sct[x+xoffset][y+yoffset].altitude==WATER)
X				ch=WATER;
X			else if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
X				ch='X';
X			else if (sct[x+xoffset][y+yoffset].tradegood!=TG_none
X			&& (*(tg_stype+sct[x+xoffset][y+yoffset].tradegood)!='x')
X				&& tg_ok(country,&sct[x+xoffset][y+yoffset]))
X				ch= *(tg_stype+sct[x+xoffset][y+yoffset].tradegood);
X			else ch='-';
X			break;
X		default:
X			break;
X		}
X	}
X	return ch;
X}
X
Xvoid
Xsee(x,y)
X{
X	char ch;
X	if((x<0)||(y<0)||(x>=SCREEN_X_SIZE)||(y>=SCREEN_Y_SIZE)
X	||((y+yoffset)>=MAPY)||((x+xoffset)>=MAPX)) return;
X	if(((y+yoffset)<MAPY)&&((x+xoffset)<MAPX)) {
X		ch=get_display_for(x,y,dismode);
X		mvaddch(y,2*x,ch);
X		if ( otherdismode > 0 ) {
X			highlight(x,y,otherhilmode);
X			ch=get_display_for(x,y,otherdismode,otherhilmode);
X			mvaddch(y,2*x+1,ch);
X		}
X	}
X	else {
X		mvaddch(y,2*x,' ');
X		mvaddch(y,2*x+1,' ');
X	}
X}
X
X/*highlight what is in xy as per highlight mode*/
Xvoid
Xhighlight(x,y,hmode)
X	short hmode;
X{
X	int	armynum;
X	if((x<0)||(y<0)||(x>=SCREEN_X_SIZE)||(y>=SCREEN_Y_SIZE)
X	||((y+yoffset)>=MAPY)||((x+xoffset)>=MAPX)) return;
X	standend();
X	switch(hmode){
X	case HI_MOVE:	/* your armies w/ move left */
X		for(armynum=0;armynum<MAXARM;armynum++)
X			if(( P_ASOLD != 0 )
X			&&( P_AMOVE != 0 )
X			&&( P_AXLOC==(x+xoffset ))
X			&&( P_AYLOC==(y+yoffset ))) break;
X		if(armynum<MAXARM) standout();
X		break;
X	case HI_YARM:	/* your armies */
X		for(armynum=0;armynum<MAXARM;armynum++)
X			if(( P_ASOLD != 0)
X			&&( P_AXLOC==x+xoffset)
X			&&( P_AYLOC==y+yoffset)) break;
X		if(armynum<MAXARM) standout();
X		break;
X	case HI_GOOD:	/* trade goods */
X		if(tg_ok( country, &sct[x+xoffset][y+yoffset])
X		   &&(sct[x+xoffset][y+yoffset].tradegood != TG_none)
X		   &&(magic(sct[x+xoffset][y+yoffset].owner,THE_VOID)!=TRUE
X		    || country==0
X		    || country==sct[x+xoffset][y+yoffset].owner
X		    || magic(country,NINJA)==TRUE)
X		   &&(sct[x+xoffset][y+yoffset].altitude!=WATER)) standout();
X		break;
X	case HI_OWN: /* ownership */
X		if(country==0) {
X			if(sct[x+xoffset][y+yoffset].owner!=0)
X				standout();
X		} else if(sct[x+xoffset][y+yoffset].owner==country)
X			standout();
X		break;
X	case HI_ARMY: /* any armies */
X		if(occ[x+xoffset][y+yoffset]!=0) standout();
X		break;
X	default:
X		break;
X	}
X}
X
X/* check if cursor is out of bounds*/
Xvoid
Xcoffmap()
X{
X	if((xcurs<=0)||(ycurs<=0)||(xcurs>=SCREEN_X_SIZE-1)
X	||((ycurs>=SCREEN_Y_SIZE-1))||((XREAL)>=MAPX)
X	 ||((YREAL)>=MAPY)) offmap();
X	
X	if( redraw==TRUE) {
X		clear();
X		makemap();	 /* update map */
X		makebottom();
X		redraw=FALSE;
X	}
X	move(ycurs,2*xcurs);
X	makeside(FALSE);  /*update side*/
X	move(ycurs,2*xcurs);
X	refresh();
X}
X
Xint
Xcanbeseen(x,y)
Xint	x,y;
X{
X	if(!ONMAP(x,y)) return(FALSE);
X	return( (int) HAS_SEEN(x-xoffset,y-yoffset) );
X}
X
X/** CANSEE() fills seen[SCREEN_X_SIZE][SCREEN_Y_SIZE] */
Xvoid
Xwhatcansee()
X{
X	register int x,y;
X	int	i,j;
X	short	armynum,nvynum;
X
X	if((magic(country,KNOWALL)==TRUE)||(country==0)) {
X		for(x=0;x<SCREEN_X_SIZE;x++) for(y=0;y<SCREEN_Y_SIZE;y++)
X			HAS_SEEN(x,y)=TRUE;
X		return;
X	}
X	for(x=0;x<SCREEN_X_SIZE;x++) for(y=0;y<SCREEN_Y_SIZE;y++)
X		HAS_SEEN(x,y)=FALSE;
X
X	for(x=(-LANDSEE);(x<SCREEN_X_SIZE+LANDSEE);x++)
X	for(y=(-LANDSEE);(y<SCREEN_Y_SIZE+LANDSEE);y++)
X	if((ONMAP(x+xoffset,y+yoffset))
X	&&(sct[x+xoffset][y+yoffset].owner==country)){
X		for(i=x-LANDSEE;i<=x+LANDSEE;i++)
X		for(j=y-LANDSEE;j<=y+LANDSEE;j++)
X		if(i>=0 && j>=0 && i<SCREEN_X_SIZE && j<SCREEN_Y_SIZE)
X			if (ONMAP(i+xoffset,j+yoffset))
X				HAS_SEEN(i,j)=TRUE;
X	}
X
X	for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X	if((P_NMSHP!=0)||(P_NWSHP!=0)||(P_NGSHP!=0))
X		for(i=(int)P_NXLOC-xoffset-NAVYSEE;i<=(int)P_NXLOC-xoffset+NAVYSEE;i++)
X		for(j=(int)P_NYLOC-yoffset-NAVYSEE;j<=(int)P_NYLOC-yoffset+NAVYSEE;j++)
X			if(ONMAP(i+xoffset,j+yoffset) && i>=0 && j>=0
X			&& i<SCREEN_X_SIZE && j<SCREEN_Y_SIZE)
X				HAS_SEEN(i,j)=TRUE;
X
X	for(armynum=0;armynum<MAXARM;armynum++)
X		if(P_ASOLD>0)
X		for(i=(int)P_AXLOC-xoffset-ARMYSEE;i<=(int)P_AXLOC-xoffset+ARMYSEE;i++)
X		for(j=(int)P_AYLOC-yoffset-ARMYSEE;j<=(int)P_AYLOC-yoffset+ARMYSEE;j++)
X		if(ONMAP(i+xoffset,j+yoffset) && i>=0 && j>=0
X		&& i<SCREEN_X_SIZE && j<SCREEN_Y_SIZE)
X			HAS_SEEN(i,j)=TRUE;
X
X	return;
X}
SHAR_EOF
chmod 0644 display.c || echo "restore of display.c fails"
rm -f s2_seq_.tmp
echo "You have unpacked the last part"
exit 0