[comp.sources.games.bugs] --- Fixes for Conquer on 16-bit machines

fortin@zap.UUCP (Denis Fortin) (02/27/88)

Greetings...

	For the past week or so I've toyed with Conquer.  Now getting it
to run on a 16-bit machine (80286) is no small task: there are many
places where integers are assumed to be quite large (most notably, the
power constants, which go up to 2**21 are often stuffed inside ints!).

	In addition, some printfs needed "l"'s added in "%d"'s.

	Anyway, this (rather long) message contains a list of all
the mods I've made (including the fix for the rectangular world).

	WARNING: There is still a problem.  After I run "conquer -x", the
world seems to develop sectors where the number of people is < 0.  This
causes diagnostics when the program starts, so that's most probably a bug 
:-) !  I guess somewhere in update.c there is an int that overflows and
becomes negative.  If I have some time, I'll try to track it down and
report the fix.

	NOTE: Obviously, these are not official fixes.  I assume that Ed
will see this message and consider including them in future releases.

	I'm willing to discuss these fixes by EMail...

							Denis Fortin
							fortin@zap.uucp

Now, here come the diffs:

------------------------------------------------------------------------------
*** cexecute.orig
--- cexecute.c
**************
*** 130,136
  		case CHG_MGK:
  			ntn[country].powers|=long2var;
  			if(ntn[country].powers!=longvar){
! 			printf("\nERROR ON MAGIC READ %ld != %d (or of %d)",longvar,ntn[country].powers,long2var);
  			getchar();
  			}
  			exenewmgk(long2var);
--- 130,136 -----
  		case CHG_MGK:
  			ntn[country].powers|=long2var;
  			if(ntn[country].powers!=longvar){
! 			printf("\nERROR ON MAGIC READ %ld != %ld (or of %ld)",longvar,ntn[country].powers,long2var);
  			getchar();
  			}
  			exenewmgk(long2var);
*** combat.orig
--- combat.c
**************
*** 464,470
  	short armynum,nvynum;
  	int save,i,j;
  	/*set occ to 0*/
! 	for(i=0;i<MAPX;i++) for(j=0;j<MAPX;j++) occ[i][j]=0;
  	save=country;
  	/*set occ to country of occupant army*/
  	for(country=0;country<NTOTAL;country++)
--- 464,470 -----
  	short armynum,nvynum;
  	int save,i,j;
  	/*set occ to 0*/
! 	for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++) occ[i][j]=0;
  	save=country;
  	/*set occ to country of occupant army*/
  	for(country=0;country<NTOTAL;country++)
*** commands.orig
--- commands.c
*** data.orig
--- data.h
**************
*** 216,222
  #define DESTRY 25
  
  #define DESTROY fprintf(fexe,"DESTROY \t%d \t%d \t%hd \t0 \t0 \t%s\n",DESTRY,save,country,"null")
! #define CHGMGK fprintf(fexe,"L_MAGIC \t%d \t%hd \t%ld \t%d \t0 \t%s\n",CHG_MGK,country,ntn[country].powers,x,"null")
  #define I_APLUS fprintf(fexe,"INC_APLUS \t%d \t%hd \t0 \t0 \t0 \t%s\n",INCAPLUS,country,"null")
  #define I_DPLUS fprintf(fexe,"INC_DPLUS \t%d \t%hd \t0 \t0 \t0 \t%s\n",INCDPLUS,country,"null")
  #define AADJSTAT fprintf(fexe,"A_STAT \t%d \t%hd \t%d \t%d \t0 \t%s\n",XASTAT,country,armynum,ntn[country].arm[armynum].stat,"null")
--- 216,222 -----
  #define DESTRY 25
  
  #define DESTROY fprintf(fexe,"DESTROY \t%d \t%d \t%hd \t0 \t0 \t%s\n",DESTRY,save,country,"null")
! #define CHGMGK fprintf(fexe,"L_MAGIC \t%d \t%hd \t%ld \t%ld \t0 \t%s\n",CHG_MGK,country,ntn[country].powers,x,"null")
  #define I_APLUS fprintf(fexe,"INC_APLUS \t%d \t%hd \t0 \t0 \t0 \t%s\n",INCAPLUS,country,"null")
  #define I_DPLUS fprintf(fexe,"INC_DPLUS \t%d \t%hd \t0 \t0 \t0 \t%s\n",INCDPLUS,country,"null")
  #define AADJSTAT fprintf(fexe,"A_STAT \t%d \t%hd \t%d \t%d \t0 \t%s\n",XASTAT,country,armynum,ntn[country].arm[armynum].stat,"null")
**************
*** 236,262
  #define SADJOWN  fprintf(fexe,"S_AOWN \t%d \t%hd \t0 \t%d \t%d \t%s\n",XSAOWN ,country,xcurs+xoffset,ycurs+yoffset,"null")
  #define EADJDIP  fprintf(fexe,"E_ADJ \t%d \t%hd \t%d \t%d \t0 \t%s\n",EDADJ,country,nation,ntn[country].dstatus[nation],"null")
  
! #define	WARRIOR		0x000001
! #define	CAPTAIN		0x000002
! #define	WARLORD		0x000004
! #define	MI_MONST	0x000008
! #define	AV_MONST	0x000010
! #define	MA_MONST	0x000020
! #define	SPY		0x000040
! #define	KNOWALL		0x000080
! #define	DERVISH		0x000100
! #define	DESTROYER	0x000200
! #define	HIDDEN		0x000400
! #define	THE_VOID	0x000800
! #define	ARCHITECT	0x001000
! #define	VAMPIRE		0x002000
! #define	HEALER		0x004000
! #define MINER		0x008000
! #define URBAN		0x010000
! #define STEEL		0x020000
! #define ARCHER		0x040000
! #define CAVALRY		0x080000
! #define BREEDER		0x100000
  
  #define MAXPOWER	21 /* number of powers */
  
--- 236,262 -----
  #define SADJOWN  fprintf(fexe,"S_AOWN \t%d \t%hd \t0 \t%d \t%d \t%s\n",XSAOWN ,country,xcurs+xoffset,ycurs+yoffset,"null")
  #define EADJDIP  fprintf(fexe,"E_ADJ \t%d \t%hd \t%d \t%d \t0 \t%s\n",EDADJ,country,nation,ntn[country].dstatus[nation],"null")
  
! #define	WARRIOR		0x000001L
! #define	CAPTAIN		0x000002L
! #define	WARLORD		0x000004L
! #define	MI_MONST	0x000008L
! #define	AV_MONST	0x000010L
! #define	MA_MONST	0x000020L
! #define	SPY		0x000040L
! #define	KNOWALL		0x000080L
! #define	DERVISH		0x000100L
! #define	DESTROYER	0x000200L
! #define	HIDDEN		0x000400L
! #define	THE_VOID	0x000800L
! #define	ARCHITECT	0x001000L
! #define	VAMPIRE		0x002000L
! #define	HEALER		0x004000L
! #define MINER		0x008000L
! #define URBAN		0x010000L
! #define STEEL		0x020000L
! #define ARCHER		0x040000L
! #define CAVALRY		0x080000L
! #define BREEDER		0x100000L
  
  #define MAXPOWER	21 /* number of powers */
  
*** forms.orig
--- forms.c
**************
*** 122,128
  		}
  		standout();
  		mvaddstr(17,0,"HIT RETURN KEY TO CHANGE STATUS");
! 		mvprintw(18,0,"HIT 'B' KEY TO BRIBE WARRING NPC NATION (%d GOLD/level)",BRIBE);
  		mvaddstr(19,0,"ANY OTHER KEY TO CONTINUE:");
  		standend();
  		refresh();
--- 122,128 -----
  		}
  		standout();
  		mvaddstr(17,0,"HIT RETURN KEY TO CHANGE STATUS");
! 		mvprintw(18,0,"HIT 'B' KEY TO BRIBE WARRING NPC NATION (%ld GOLD/level)",BRIBE);
  		mvaddstr(19,0,"ANY OTHER KEY TO CONTINUE:");
  		standend();
  		refresh();
*** header.orig
--- header.h
**************
*** 71,79
  /*Below taxation rates are in thousand dollars (US 1985) per 100 humans per 
   *point of whatever -- ie 1 person in veg of 9 means produce $70x9=630K
   *thousand dollars */
! #define TAXFOOD		100
! #define TAXIRON		100
! #define TAXGOLD		100
  /*city and capital tax rates based on people only (no multipleier)*/
  #define TAXCAP		1000
  #define TAXCITY		750
--- 71,79 -----
  /*Below taxation rates are in thousand dollars (US 1985) per 100 humans per 
   *point of whatever -- ie 1 person in veg of 9 means produce $70x9=630K
   *thousand dollars */
! #define TAXFOOD		100L
! #define TAXIRON		100L
! #define TAXGOLD		100L
  /*city and capital tax rates based on people only (no multipleier)*/
  #define TAXCAP		1000L
  #define TAXCITY		750L
**************
*** 75,82
  #define TAXIRON		100
  #define TAXGOLD		100
  /*city and capital tax rates based on people only (no multipleier)*/
! #define TAXCAP		1000
! #define TAXCITY		750
  
  #define SHIPMAINT 	1000	/*ship mainatinance cost*/
  #define SOLDMAINT 	40	/*soldier mainatinance cost*/
--- 75,82 -----
  #define TAXIRON		100L
  #define TAXGOLD		100L
  /*city and capital tax rates based on people only (no multipleier)*/
! #define TAXCAP		1000L
! #define TAXCITY		750L
  
  #define SHIPMAINT 	1000L	/*ship mainatinance cost*/
  #define SOLDMAINT 	40L	/*soldier mainatinance cost*/
**************
*** 78,85
  #define TAXCAP		1000
  #define TAXCITY		750
  
! #define SHIPMAINT 	1000	/*ship mainatinance cost*/
! #define SOLDMAINT 	40	/*soldier mainatinance cost*/
  #define DESCOST		300L	/*cost to redesignatie*/
  				/*this is also the iron cost for cities*/
  #define FORTCOST	1000	/*cost to build a fort point*/
--- 78,85 -----
  #define TAXCAP		1000L
  #define TAXCITY		750L
  
! #define SHIPMAINT 	1000L	/*ship mainatinance cost*/
! #define SOLDMAINT 	40L	/*soldier mainatinance cost*/
  #define DESCOST		300L	/*cost to redesignatie*/
  				/*this is also the iron cost for cities*/
  #define FORTCOST	1000L	/*cost to build a fort point*/
**************
*** 82,91
  #define SOLDMAINT 	40	/*soldier mainatinance cost*/
  #define DESCOST		300L	/*cost to redesignatie*/
  				/*this is also the iron cost for cities*/
! #define FORTCOST	1000	/*cost to build a fort point*/
! #define ENLISTCOST 	90	/*cost to enlist one troop*/
! #define WARSHPCOST 	10000	/*cost to build one warship*/
! #define MERSHPCOST 	20000	/*cost to build one merchant*/
  #define SHIPHOLD  	300	/*number of humans a merchant can hold*/
  #define CITYLIMIT 	8	/*% of ntns people in sector before => city*/
  #define MILRATIO 	5	/*ratio mil:civ for non player countries*/
--- 82,91 -----
  #define SOLDMAINT 	40L	/*soldier mainatinance cost*/
  #define DESCOST		300L	/*cost to redesignatie*/
  				/*this is also the iron cost for cities*/
! #define FORTCOST	1000L	/*cost to build a fort point*/
! #define ENLISTCOST 	90L	/*cost to enlist one troop*/
! #define WARSHPCOST 	10000L	/*cost to build one warship*/
! #define MERSHPCOST 	20000L	/*cost to build one merchant*/
  #define SHIPHOLD  	300	/*number of humans a merchant can hold*/
  #define CITYLIMIT 	8	/*% of ntns people in sector before => city*/
  #define MILRATIO 	5	/*ratio mil:civ for non player countries*/
*** io.orig
--- io.c
**************
*** 496,502
   				printf("	%s",*(races+i));
   		if(ntn[nationid].active>=2) printf("	NPC");
   		else printf("	%s",*(Class+ntn[nationid].class));
!  		printf("	%d	%d	%d	%d	%d",
   			ntn[nationid].score ,ntn[nationid].tgold
   			,ntn[nationid].tmil ,ntn[nationid].tciv
   			,ntn[nationid].tsctrs );
--- 496,502 -----
   				printf("	%s",*(races+i));
   		if(ntn[nationid].active>=2) printf("	NPC");
   		else printf("	%s",*(Class+ntn[nationid].class));
!  		printf("	%d	%ld	%ld	%ld	%d",
   			ntn[nationid].score ,ntn[nationid].tgold
   			,ntn[nationid].tmil ,ntn[nationid].tciv
   			,ntn[nationid].tsctrs );
*** magic.orig
--- magic.c
**************
*** 24,30
  /*do nothing if that player has that power or it is not permitted*/
  /*getmagic() returns the value of the power gained, and stores it in power*/
  
! getmagic()
  {
  int newpower;
    	newpower=1<<rand()%MAXPOWER;
--- 24,30 -----
  /*do nothing if that player has that power or it is not permitted*/
  /*getmagic() returns the value of the power gained, and stores it in power*/
  
! long getmagic()
  {
  long newpower;
    	newpower=1L<<rand()%MAXPOWER;
**************
*** 26,37
  
  getmagic()
  {
! int newpower;
!   	newpower=1<<rand()%MAXPOWER;
! 	switch(newpower){
! 	case WARRIOR:
! 	case CAPTAIN:
! 	case WARLORD:
  		if(magic(country,WARRIOR)!=1){
  			ntn[country].powers|=WARRIOR;
  			return(WARRIOR);
--- 26,37 -----
  
  long getmagic()
  {
! long newpower;
!   	newpower=1L<<rand()%MAXPOWER;
! 
! 	if ((newpower == WARRIOR) ||
! 	    (newpower == CAPTAIN) ||
! 	    (newpower == WARLORD)) {
  		if(magic(country,WARRIOR)!=1){
  			ntn[country].powers|=WARRIOR;
  			return(WARRIOR);
**************
*** 44,53
  			ntn[country].powers|=WARLORD;
  			return(WARLORD);
  		}
! 		break;
! 	case MI_MONST:
! 	case AV_MONST:
! 	case MA_MONST:
  		if(ntn[country].race!=ORC) return(0);
  		if(magic(country,MI_MONST)!=1){
  			ntn[country].powers|=MI_MONST;
--- 44,52 -----
  			ntn[country].powers|=WARLORD;
  			return(WARLORD);
  		}
! 	} else if ((newpower == MI_MONST) ||
! 		   (newpower == AV_MONST) ||
! 		   (newpower == MA_MONST)) {
  		if(ntn[country].race!=ORC) return(0);
  		if(magic(country,MI_MONST)!=1){
  			ntn[country].powers|=MI_MONST;
**************
*** 61,77
  			ntn[country].powers|=MA_MONST;
  			return(MA_MONST);
  		}
! 		break;
! 	case SPY:
! 	case KNOWALL:
! 	case DERVISH:
! 	case HIDDEN:
! 	case ARCHITECT:
! 	case URBAN:
! 	case THE_VOID:
! 	case HEALER:
! 	case ARCHER:
! 	case CAVALRY:
  		if(magic(country,newpower)==1) return(0);
  		ntn[country].powers|=newpower;
  		return(newpower);
--- 60,75 -----
  			ntn[country].powers|=MA_MONST;
  			return(MA_MONST);
  		}
! 	} else if ((newpower == SPY)      ||
! 		   (newpower == KNOWALL)  ||
! 		   (newpower == DERVISH)  ||
! 		   (newpower == HIDDEN)   ||
! 		   (newpower == ARCHITECT)||
! 		   (newpower == URBAN)    ||
! 		   (newpower == THE_VOID) ||
! 		   (newpower == HEALER)   ||
! 		   (newpower == ARCHER)   ||
! 		   (newpower == CAVALRY)) {
  		if(magic(country,newpower)==1) return(0);
  		ntn[country].powers|=newpower;
  		return(newpower);
**************
*** 75,81
  		if(magic(country,newpower)==1) return(0);
  		ntn[country].powers|=newpower;
  		return(newpower);
! 	case DESTROYER:
  		if((ntn[country].race!=ELF)&&(magic(country,DESTROYER)!=1)){
  			ntn[country].powers|=DESTROYER;
  			return(DESTROYER);
--- 73,79 -----
  		if(magic(country,newpower)==1) return(0);
  		ntn[country].powers|=newpower;
  		return(newpower);
! 	} else if (newpower == DESTROYER) {
  		if((ntn[country].race!=ELF)&&(magic(country,DESTROYER)!=1)){
  			ntn[country].powers|=DESTROYER;
  			return(DESTROYER);
**************
*** 80,87
  			ntn[country].powers|=DESTROYER;
  			return(DESTROYER);
  		}
! 		break;
! 	case VAMPIRE:
  		if((ntn[country].race!=ELF)&&(magic(country,VAMPIRE)!=1)){
  			ntn[country].powers|=VAMPIRE;
  			return(VAMPIRE);
--- 78,84 -----
  			ntn[country].powers|=DESTROYER;
  			return(DESTROYER);
  		}
! 	} else if (newpower == VAMPIRE) {
  		if((ntn[country].race!=ELF)&&(magic(country,VAMPIRE)!=1)){
  			ntn[country].powers|=VAMPIRE;
  			return(VAMPIRE);
**************
*** 86,93
  			ntn[country].powers|=VAMPIRE;
  			return(VAMPIRE);
  		}
! 		break;
! 	case MINER:
  		if((ntn[country].race!=ELF)&&(ntn[country].race!=DWARF)&&(magic(country,MINER)!=1)){
  			ntn[country].powers|=MINER;
  			return(MINER);
--- 83,89 -----
  			ntn[country].powers|=VAMPIRE;
  			return(VAMPIRE);
  		}
! 	} else if (newpower == MINER) {
  		if((ntn[country].race!=ELF)&&(ntn[country].race!=DWARF)&&(magic(country,MINER)!=1)){
  			ntn[country].powers|=MINER;
  			return(MINER);
**************
*** 92,99
  			ntn[country].powers|=MINER;
  			return(MINER);
  		}
! 		break;
! 	case STEEL:
  		if(magic(country,STEEL)==1) return(0);
  		if(magic(country,MINER)!=1) return(0);
  		ntn[country].powers|=STEEL;
--- 88,94 -----
  			ntn[country].powers|=MINER;
  			return(MINER);
  		}
! 	} else if (newpower == STEEL) {
  		if(magic(country,STEEL)==1) return(0);
  		if(magic(country,MINER)!=1) return(0);
  		ntn[country].powers|=STEEL;
**************
*** 98,104
  		if(magic(country,MINER)!=1) return(0);
  		ntn[country].powers|=STEEL;
  		return(STEEL);
! 	case BREEDER:
  		if(magic(country,BREEDER)==1) return(0);
  		if(ntn[country].race!=ORC) return(0);
  		ntn[country].powers|=BREEDER;
--- 93,99 -----
  		if(magic(country,MINER)!=1) return(0);
  		ntn[country].powers|=STEEL;
  		return(STEEL);
! 	} else if (newpower == BREEDER) {
  		if(magic(country,BREEDER)==1) return(0);
  		if(ntn[country].race!=ORC) return(0);
  		ntn[country].powers|=BREEDER;
**************
*** 103,109
  		if(ntn[country].race!=ORC) return(0);
  		ntn[country].powers|=BREEDER;
  		return(BREEDER);
! 	}
  	return(0);
  }
  
--- 98,104 -----
  		if(ntn[country].race!=ORC) return(0);
  		ntn[country].powers|=BREEDER;
  		return(BREEDER);
! 	} 
  	return(0);
  }
  
**************
*** 111,116
  domagic()
  {
    	int x, count, done=0, loop=0, i, chance;
  	long price;
  	short isgod=0;
  	if(country==0) {
--- 106,112 -----
  domagic()
  {
    	int x, count, done=0, loop=0, i, chance;
+ 	long xx;
  	long price;
  	short isgod=0;
  	if(country==0) {
**************
*** 207,213
  				i=get_number();
  				if(ntn[i].race==ORC){
  					ntn[country].jewels-=100000L;
! 					if(i=takeover(chance,i)==1)
  		 			mvprintw(count++,0," Successful: %d",i);
  				}
  		 		else mvaddstr(count++,0,"  Wrong Race");
--- 203,209 -----
  				i=get_number();
  				if(ntn[i].race==ORC){
  					ntn[country].jewels-=100000L;
! 					if((i=takeover(chance,i))==1)
  		 			mvprintw(count++,0," Successful: %d",i);
  				}
  		 		else mvaddstr(count++,0,"  Wrong Race");
**************
*** 223,229
  			if(getch()=='y'){
  				done=0;
  				loop = 0;
! 				while(loop++ < 500) if((x=getmagic())!=0){
  					ntn[country].jewels -= price;
  					CHGMGK;
  					exenewmgk(x);
--- 219,225 -----
  			if(getch()=='y'){
  				done=0;
  				loop = 0;
! 				while(loop++ < 500) if((xx=getmagic())!=0){
  					ntn[country].jewels -= price;
  					CHGMGK;
  					exenewmgk(xx);
**************
*** 226,232
  				while(loop++ < 500) if((x=getmagic())!=0){
  					ntn[country].jewels -= price;
  					CHGMGK;
! 					exenewmgk(x);
  					refresh();
  					break;
  				}
--- 222,228 -----
  				while(loop++ < 500) if((xx=getmagic())!=0){
  					ntn[country].jewels -= price;
  					CHGMGK;
! 					exenewmgk(xx);
  					refresh();
  					break;
  				}
**************
*** 283,288
  
  /*execute new magic*/
  exenewmgk(newpower)
  {
  	short x,y;
  	switch(newpower){
--- 279,285 -----
  
  /*execute new magic*/
  exenewmgk(newpower)
+ long newpower;
  {
  	short x,y;
  
**************
*** 285,292
  exenewmgk(newpower)
  {
  	short x,y;
! 	switch(newpower){
! 		case WARRIOR:
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
  			break;
--- 282,289 -----
  long newpower;
  {
  	short x,y;
! 
! 	if (newpower == WARRIOR) {
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
  	} else if (newpower == CAPTAIN) {
**************
*** 289,296
  		case WARRIOR:
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
! 			break;
! 		case CAPTAIN:
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
  			break;
--- 286,292 -----
  	if (newpower == WARRIOR) {
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
! 	} else if (newpower == CAPTAIN) {
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
  	} else if (newpower == WARLORD) {
**************
*** 293,300
  		case CAPTAIN:
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
! 			break;
! 		case WARLORD:
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
  			break;
--- 289,295 -----
  	} else if (newpower == CAPTAIN) {
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
! 	} else if (newpower == WARLORD) {
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
  	} else if (newpower == HEALER) {
**************
*** 297,304
  		case WARLORD:
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
! 			break;
! 		case HEALER:
  			if(ntn[country].race==ORC) {
  				if(ntn[country].repro<=11)
  					ntn[country].repro+=2;
--- 292,298 -----
  	} else if (newpower == WARLORD) {
  			ntn[country].aplus+=10;
  			ntn[country].dplus+=10;
! 	} else if (newpower == HEALER) {
  			if(ntn[country].race==ORC) {
  				if(ntn[country].repro<=11)
  					ntn[country].repro+=2;
**************
*** 314,321
  			else if(ntn[country].repro>=10){
  				ntn[country].dplus+=10;
  			}
! 			break;
! 		case DESTROYER:
  			for(x=ntn[country].capx-3;x<=ntn[country].capx+3;x++) {
  				for(y=ntn[country].capy-3;y<=ntn[country].capy+3;y++){
  					if((ONMAP)
--- 308,314 -----
  			else if(ntn[country].repro>=10){
  				ntn[country].dplus+=10;
  			}
! 	} else if (newpower == DESTROYER) {
  			for(x=ntn[country].capx-3;x<=ntn[country].capx+3;x++) {
  				for(y=ntn[country].capy-3;y<=ntn[country].capy+3;y++){
  					if((ONMAP)
**************
*** 327,334
  				}
  			}
    			updmove(ntn[country].race);
! 			break;
! 		case DERVISH:
    			updmove(ntn[country].race);
    			break;
  		case MI_MONST:
--- 320,326 -----
  				}
  			}
    			updmove(ntn[country].race);
! 	} else if (newpower == DERVISH) {
    			updmove(ntn[country].race);
  	} else if ((newpower == MI_MONST)  ||
  		   (newpower == AV_MONST)  ||
**************
*** 330,347
  			break;
  		case DERVISH:
    			updmove(ntn[country].race);
!   			break;
! 		case MI_MONST:
! 		case AV_MONST:
! 		case MA_MONST:
! 		case SPY:
! 		case KNOWALL:
! 		case HIDDEN:
! 		case THE_VOID:
! 		case ARCHITECT:
! 		case MINER:
! 			break;
! 		case VAMPIRE:
  			ntn[country].aplus-=35;
  			ntn[country].dplus-=35;
  			ntn[country].maxmove-=2;
--- 322,338 -----
    			updmove(ntn[country].race);
  	} else if (newpower == DERVISH) {
    			updmove(ntn[country].race);
! 	} else if ((newpower == MI_MONST)  ||
! 		   (newpower == AV_MONST)  ||
! 		   (newpower == MA_MONST)  ||
! 		   (newpower == SPY)       ||
! 		   (newpower == KNOWALL)   ||
! 		   (newpower == HIDDEN)    ||
! 		   (newpower == THE_VOID)  ||
! 		   (newpower == ARCHITECT) ||
! 		   (newpower == MINER))     {
! 			;
! 	} else if (newpower == VAMPIRE) {
  			ntn[country].aplus-=35;
  			ntn[country].dplus-=35;
  			ntn[country].maxmove-=2;
**************
*** 345,352
  			ntn[country].aplus-=35;
  			ntn[country].dplus-=35;
  			ntn[country].maxmove-=2;
! 			break;
! 		case URBAN:
  			if(ntn[country].race==ORC) {
  				ntn[country].repro+=3;
  				if(ntn[country].repro>=13){
--- 336,342 -----
  			ntn[country].aplus-=35;
  			ntn[country].dplus-=35;
  			ntn[country].maxmove-=2;
! 	} else if (newpower == URBAN) {
  			if(ntn[country].race==ORC) {
  				ntn[country].repro+=3;
  				if(ntn[country].repro>=13){
**************
*** 361,370
  				ntn[country].maxmove+=2*(ntn[country].repro-9);
  				ntn[country].repro=12;
  			}
! 			break;
! 		case STEEL:
! 			break;
! 		case ARCHER:
  			ntn[country].dplus+=10;
  			break;
  		case CAVALRY:
--- 351,359 -----
  				ntn[country].maxmove+=2*(ntn[country].repro-9);
  				ntn[country].repro=12;
  			}
! 	} else if (newpower == STEEL) {
! 			;
! 	} else if (newpower == ARCHER) {
  			ntn[country].dplus+=10;
  	} else if (newpower == CAVALRY) {
  			ntn[country].aplus+=10;
**************
*** 366,373
  			break;
  		case ARCHER:
  			ntn[country].dplus+=10;
! 			break;
! 		case CAVALRY:
  			ntn[country].aplus+=10;
  			ntn[country].maxmove+=6;
  			break;
--- 355,361 -----
  			;
  	} else if (newpower == ARCHER) {
  			ntn[country].dplus+=10;
! 	} else if (newpower == CAVALRY) {
  			ntn[country].aplus+=10;
  			ntn[country].maxmove+=6;
  	} else if (newpower == BREEDER) {
**************
*** 370,377
  		case CAVALRY:
  			ntn[country].aplus+=10;
  			ntn[country].maxmove+=6;
! 			break;
! 		case BREEDER:
  			ntn[country].repro+=3;
  			ntn[country].dplus-=10;
  			ntn[country].dplus-=10;
--- 358,364 -----
  	} else if (newpower == CAVALRY) {
  			ntn[country].aplus+=10;
  			ntn[country].maxmove+=6;
! 	} else if (newpower == BREEDER) {
  			ntn[country].repro+=3;
  			ntn[country].dplus-=10;
  			ntn[country].dplus-=10;
**************
*** 375,380
  			ntn[country].repro+=3;
  			ntn[country].dplus-=10;
  			ntn[country].dplus-=10;
- 			break;
  	}
  }
--- 362,366 -----
  			ntn[country].repro+=3;
  			ntn[country].dplus-=10;
  			ntn[country].dplus-=10;
  	}
  }
*** main.orig
--- main.c
**************
*** 18,23
  #include <fcntl.h>
  #include  <pwd.h>
  
  /*initialization data*/
  /*Movement costs*/
  char *ele=       "#^%-~";
--- 18,27 -----
  #include <fcntl.h>
  #include  <pwd.h>
  
+ /* Sigh.  Why doesn't C check force you to declare functions before using
+    them?  This is sooo FORTRANish!					  */
+ char	*getpass();	/* Always declare (char *) fcts for 16-bit CPUs   */
+ 
  /*initialization data*/
  /*Movement costs*/
  char *ele=       "#^%-~";
*** makeworld.orig
--- makeworld.c
**************
*** 45,51
  	char newstring[40];
  
  	/*abort if datafile currently exists*/
! 	if(tempfd=open(datafile,0)!=-1) {
  		printf("ABORTING: File %s exists\n",datafile);
  		printf("\tthis means that a game is in progress. To proceed, you must remove \n");
  		printf("\tthe existing data file. This will, of course, destroy that game.\n\n");
--- 45,51 -----
  	char newstring[40];
  
  	/*abort if datafile currently exists*/
! 	if((tempfd=open(datafile,0))!=-1) {
  		printf("ABORTING: File %s exists\n",datafile);
  		printf("\tthis means that a game is in progress. To proceed, you must remove \n");
  		printf("\tthe existing data file. This will, of course, destroy that game.\n\n");
**************
*** 573,579
  			sct[x][y].fortress = 5+rand()%5;
  			sct[x][y].gold = 15+rand()%20;
  			for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
! 				if(i>=0&&j>=0&&i<MAPX&&j<MAPX)
  					if(sct[i][j].altitude!=WATER)
  						sct[i][j].owner = NLIZARD;
  			AMOVE=0;
--- 573,579 -----
  			sct[x][y].fortress = 5+rand()%5;
  			sct[x][y].gold = 15+rand()%20;
  			for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
! 				if(i>=0&&j>=0&&i<MAPX&&j<MAPY)
  					if(sct[i][j].altitude!=WATER)
  						sct[i][j].owner = NLIZARD;
  			AMOVE=0;
**************
*** 580,586
  			AXLOC=x;
  			AYLOC=y;
  			ASTAT=GARRISON;
! 			ASOLD=750+100*rand()%10;
  			armynum++;
  			AMOVE=8;
  			AXLOC=x;
--- 580,586 -----
  			AXLOC=x;
  			AYLOC=y;
  			ASTAT=GARRISON;
! 			ASOLD=750+100*(rand()%10);
  			armynum++;
  			AMOVE=8;
  			AXLOC=x;
**************
*** 586,592
  			AXLOC=x;
  			AYLOC=y;
  			ASTAT=ATTACK;
! 			ASOLD=750+100*rand()%10;
  			armynum++;
  		}
  	}
--- 586,592 -----
  			AXLOC=x;
  			AYLOC=y;
  			ASTAT=ATTACK;
! 			ASOLD=750+100*(rand()%10);
  			armynum++;
  		}
  	}
**************
*** 676,682
  				AXLOC=x;
  				AYLOC=y;
  				ASTAT=ATTACK;
! 				ASOLD=200+100*rand()%10;
  				if(armynum<MAXARM-1) armynum++;
  			}
  			else {
--- 676,682 -----
  				AXLOC=x;
  				AYLOC=y;
  				ASTAT=ATTACK;
! 				ASOLD=200+100*(rand()%10);
  				if(armynum<MAXARM-1) armynum++;
  			}
  			else {
**************
*** 684,690
  				ntn[NNOMAD].arm[army2num].xloc=x;
  				ntn[NNOMAD].arm[army2num].yloc=y;
  				ntn[NNOMAD].arm[army2num].stat=ATTACK;
! 				ntn[NNOMAD].arm[army2num].sold=100+100*rand()%15;
  				if(army2num<MAXARM-1) army2num++;
  			}
  		}
--- 684,690 -----
  				ntn[NNOMAD].arm[army2num].xloc=x;
  				ntn[NNOMAD].arm[army2num].yloc=y;
  				ntn[NNOMAD].arm[army2num].stat=ATTACK;
! 				ntn[NNOMAD].arm[army2num].sold=100+100*(rand()%15);
  				if(army2num<MAXARM-1) army2num++;
  			}
  		}
*** misc.orig
--- misc.c
**************
*** 7,13
  char    *memset();
  #endif
  
! int	powers[] = {
  	WARRIOR,
  	CAPTAIN,
  	WARLORD,
--- 7,13 -----
  char    *memset();
  #endif
  
! long	powers[] = {
  	WARRIOR,
  	CAPTAIN,
  	WARLORD,
*** move.orig
--- move.c
**************
*** 621,627
  		} /* switch */
  	} /* for */
  
! 	for(x=0;x<MAPX;x++) for(y=0;y<MAPX;y++){
  		sptr = &sct[x][y];
  
  		if(race==GOD) movecost[x][y] = 0;
--- 621,627 -----
  		} /* switch */
  	} /* for */
  
! 	for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++){
  		sptr = &sct[x][y];
  
  		if(race==GOD) movecost[x][y] = 0;
*** newlogin.orig
--- newlogin.c
**************
*** 29,35
  	int temp;
  	int more=0; 	/*0 if add another player*/
  	int loop;
! 	int x;
  	char tempo[8];
  	char passwd[8];
  	register i;
--- 29,35 -----
  	int temp;
  	int more=0; 	/*0 if add another player*/
  	int loop;
! 	long x, getmagic();
  	char tempo[8];
  	char passwd[8];
  	register i;
*** npc.orig
--- npc.c
**************
*** 26,31
  {
  	int armynum,price;
  	int x,y,i,z;
  
  	prep();
  
--- 26,32 -----
  {
  	int armynum,price;
  	int x,y,i,z;
+ 	long zz, getmagic();
  
  	prep();
  
**************
*** 162,170
  	for(armynum=1; armynum<num_powers(country); armynum++ ) price <<= 1;
  
  	if(ntn[country].jewels > 2 * price) {
! 		if((z=getmagic())!=0){
! 			fprintf(fnews,"2.\tnation %s gets magic power number %d\n",ntn[country].name,z);
! 			exenewmgk(z);
  			ntn[country].jewels-=price;
  		}
  		else if((z=getmagic())!=0){
--- 163,171 -----
  	for(armynum=1; armynum<num_powers(country); armynum++ ) price <<= 1;
  
  	if(ntn[country].jewels > 2 * price) {
! 		if((zz=getmagic())!=0){
! 			fprintf(fnews,"2.\tnation %s gets magic power number %ld\n",ntn[country].name,zz);
! 			exenewmgk(zz);
  			ntn[country].jewels-=price;
  		}
  		else if((zz=getmagic())!=0){
**************
*** 167,175
  			exenewmgk(z);
  			ntn[country].jewels-=price;
  		}
! 		else if((z=getmagic())!=0){
! 			fprintf(fnews,"2.\tnation %s gets magic power number %d\n",ntn[country].name,z);
! 			exenewmgk(z);
  			ntn[country].jewels-=price;
  		}
  		else if((z=getmagic())!=0){
--- 168,176 -----
  			exenewmgk(zz);
  			ntn[country].jewels-=price;
  		}
! 		else if((zz=getmagic())!=0){
! 			fprintf(fnews,"2.\tnation %s gets magic power number %ld\n",ntn[country].name,zz);
! 			exenewmgk(zz);
  			ntn[country].jewels-=price;
  		}
  		else if((zz=getmagic())!=0){
**************
*** 172,180
  			exenewmgk(z);
  			ntn[country].jewels-=price;
  		}
! 		else if((z=getmagic())!=0){
! 			fprintf(fnews,"2.\tnation %s gets magic power number %d\n",ntn[country].name,z);
! 			exenewmgk(z);
  			ntn[country].jewels-=price;
  		}
  	}
--- 173,181 -----
  			exenewmgk(zz);
  			ntn[country].jewels-=price;
  		}
! 		else if((zz=getmagic())!=0){
! 			fprintf(fnews,"2.\tnation %s gets magic power number %ld\n",ntn[country].name,zz);
! 			exenewmgk(zz);
  			ntn[country].jewels-=price;
  		}
  	}
**************
*** 245,251
  		for(armie=1;armie<MAXARM;armie++){
  			if(ntn[nation].arm[armie].sold > 0) {
  
! 				attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/10;
  
  			if((ntn[nation].arm[armie].xloc<=ntn[country].capx+2)
  			&&(ntn[nation].arm[armie].yloc<=ntn[country].capy+2)
--- 246,253 -----
  		for(armie=1;armie<MAXARM;armie++){
  			if(ntn[nation].arm[armie].sold > 0) {
  
! 				attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc] =
! 				attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/10;
  
  			if((ntn[nation].arm[armie].xloc<=ntn[country].capx+2)
  			&&(ntn[nation].arm[armie].yloc<=ntn[country].capy+2)
**************
*** 251,257
  			&&(ntn[nation].arm[armie].yloc<=ntn[country].capy+2)
  			&&(ntn[nation].arm[armie].xloc>=ntn[country].capx-2)
  			&&(ntn[nation].arm[armie].yloc>=ntn[country].capy-2)){
! 				attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/5;
  				if((rand()%3==0)
  				&&(ntn[country].dstatus[nation]<WAR))
  					ntn[country].dstatus[nation]++;
--- 253,260 -----
  			&&(ntn[nation].arm[armie].yloc<=ntn[country].capy+2)
  			&&(ntn[nation].arm[armie].xloc>=ntn[country].capx-2)
  			&&(ntn[nation].arm[armie].yloc>=ntn[country].capy-2)){
! 				attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc] =
! 				attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/5;
  				if((rand()%3==0)
  				&&(ntn[country].dstatus[nation]<WAR))
  					ntn[country].dstatus[nation]++;
**************
*** 260,266
  					if(ntn[country].dstatus[nation]==WAR)
  					ntn[country].dstatus[nation]=JIHAD;
  					if(ntn[nation].arm[armie].sold>2*ntn[country].arm[0].sold){
! 						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/2;
  					}
  					else attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/5;
  				}
--- 263,270 -----
  					if(ntn[country].dstatus[nation]==WAR)
  					ntn[country].dstatus[nation]=JIHAD;
  					if(ntn[nation].arm[armie].sold>2*ntn[country].arm[0].sold){
! 						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc] =
! 						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/2;
  					}
  					else attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc] =
  					     attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/5;
**************
*** 262,268
  					if(ntn[nation].arm[armie].sold>2*ntn[country].arm[0].sold){
  						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/2;
  					}
! 					else attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/5;
  				}
  				}
  			}
--- 266,273 -----
  						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc] =
  						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/2;
  					}
! 					else attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc] =
! 					     attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/5;
  				}
  				}
  			}
**************
*** 337,343
  		for(armie=1;armie<MAXARM;armie++) 
  		if(ntn[nation].arm[armie].sold > 0) {
  
! 			attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/10;
  
  			if((ntn[nation].arm[armie].xloc<=ntn[country].capx+2)
  			&&(ntn[nation].arm[armie].yloc<=ntn[country].capy+2)
--- 342,349 -----
  		for(armie=1;armie<MAXARM;armie++) 
  		if(ntn[nation].arm[armie].sold > 0) {
  
! 			attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]=
! 			attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/10;
  
  			if((ntn[nation].arm[armie].xloc<=ntn[country].capx+2)
  			&&(ntn[nation].arm[armie].yloc<=ntn[country].capy+2)
**************
*** 343,349
  			&&(ntn[nation].arm[armie].yloc<=ntn[country].capy+2)
  			&&(ntn[nation].arm[armie].xloc>=ntn[country].capx-2)
  			&&(ntn[nation].arm[armie].yloc>=ntn[country].capy-2)){
! 				attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/5;
  				if((rand()%3==0)
  				&&(ntn[country].dstatus[nation]<WAR))
  					ntn[country].dstatus[nation]++;
--- 349,356 -----
  			&&(ntn[nation].arm[armie].yloc<=ntn[country].capy+2)
  			&&(ntn[nation].arm[armie].xloc>=ntn[country].capx-2)
  			&&(ntn[nation].arm[armie].yloc>=ntn[country].capy-2)){
! 				attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]=
! 				attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/5;
  				if((rand()%3==0)
  				&&(ntn[country].dstatus[nation]<WAR))
  					ntn[country].dstatus[nation]++;
**************
*** 352,358
  					if(ntn[country].dstatus[nation]==WAR)
  					ntn[country].dstatus[nation]=JIHAD;
  					if(ntn[nation].arm[armie].sold>2*ntn[country].arm[0].sold){
! 						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/2;
  					}
  					else attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/5;
  				}
--- 359,366 -----
  					if(ntn[country].dstatus[nation]==WAR)
  					ntn[country].dstatus[nation]=JIHAD;
  					if(ntn[nation].arm[armie].sold>2*ntn[country].arm[0].sold){
! 						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]=
! 						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/2;
  					}
  					else attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]=
  					     attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/5;
**************
*** 354,360
  					if(ntn[nation].arm[armie].sold>2*ntn[country].arm[0].sold){
  						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/2;
  					}
! 					else attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+=ntn[nation].arm[armie].sold/5;
  				}
  			}
  		}
--- 362,369 -----
  						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]=
  						attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/2;
  					}
! 					else attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]=
! 					     attr[ntn[nation].arm[armie].xloc][ntn[nation].arm[armie].yloc]+ntn[nation].arm[armie].sold/5;
  				}
  			}
  		}
**************
*** 504,510
  	ntn[country].active=0;
  	for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) {
  		if(ntn[sct[AXLOC][AYLOC].owner].race==ntn[country].race)
! 			sct[AXLOC][AYLOC].people+=ASOLD;
  		ASOLD=0;
  	}
  	for(nvynum=0;nvynum<MAXNAVY;nvynum++) {
--- 513,520 -----
  	ntn[country].active=0;
  	for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) {
  		if(ntn[sct[AXLOC][AYLOC].owner].race==ntn[country].race)
! 			sct[AXLOC][AYLOC].people=
! 			sct[AXLOC][AYLOC].people+ASOLD;
  		ASOLD=0;
  	}
  	for(nvynum=0;nvynum<MAXNAVY;nvynum++) {
**************
*** 518,527
  
  	/*if take them you get their gold*/
  	if(country!=sct[ntn[country].capx][ntn[country].capy].owner){
! 		if(ntn[country].tgold>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].tgold+=ntn[country].tgold;
! 		if(ntn[country].jewels>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].jewels+=ntn[country].jewels;
! 		if(ntn[country].tiron>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].tiron+=ntn[country].tiron;
! 		if(ntn[country].tfood>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].tfood+=ntn[country].tfood;
  	}
  
  	/*if god destroys then kill all population*/
--- 528,541 -----
  
  	/*if take them you get their gold*/
  	if(country!=sct[ntn[country].capx][ntn[country].capy].owner){
! 		if(ntn[country].tgold>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].tgold=
! 					 ntn[sct[ntn[country].capx][ntn[country].capy].owner].tgold+ntn[country].tgold;
! 		if(ntn[country].jewels>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].jewels=
! 					  ntn[sct[ntn[country].capx][ntn[country].capy].owner].jewels+ntn[country].jewels;
! 		if(ntn[country].tiron>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].tiron=
! 					 ntn[sct[ntn[country].capx][ntn[country].capy].owner].tiron+ntn[country].tiron;
! 		if(ntn[country].tfood>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].tfood=
! 					 ntn[sct[ntn[country].capx][ntn[country].capy].owner].tfood+ntn[country].tfood;
  	}
  
  	/*if god destroys then kill all population*/
**************
*** 590,596
  		if((rand()%4==0)&&(is_habitable(x,y))) {
  			AXLOC=x;
  			AYLOC=y;
! 			ASOLD=100+100*rand()%10;
  			ASTAT=ATTACK;
  		}
  	}
--- 604,610 -----
  		if((rand()%4==0)&&(is_habitable(x,y))) {
  			AXLOC=x;
  			AYLOC=y;
! 			ASOLD=100+100*(rand()%10);
  			ASTAT=ATTACK;
  		}
  	}
**************
*** 742,748
  		ntn[country].tmil += ASOLD;
  		ntn[country].tciv -= ASOLD;
  		ntn[country].tgold-=ASOLD*ENLISTCOST;
! 		sct[AXLOC][AYLOC].people-=ASOLD;
  		ASTAT= DEFEND;
  		AMOVE=0;
  		}
--- 756,763 -----
  		ntn[country].tmil += ASOLD;
  		ntn[country].tciv -= ASOLD;
  		ntn[country].tgold-=ASOLD*ENLISTCOST;
! 		sct[AXLOC][AYLOC].people=
! 		sct[AXLOC][AYLOC].people-ASOLD;
  		ASTAT= DEFEND;
  		AMOVE=0;
  		}
**************
*** 760,766
  			&&(rand()%5==0)&&(ASOLD<diff)){
  				/*printf(" eliminate army %d",armynum);*/
  				diff-=ASOLD;
! 				sct[AXLOC][AYLOC].people+=ASOLD;
  				ntn[country].tmil -= ASOLD;
  				ntn[country].tciv += ASOLD;
  				ASOLD=0;
--- 775,782 -----
  			&&(rand()%5==0)&&(ASOLD<diff)){
  				/*printf(" eliminate army %d",armynum);*/
  				diff-=ASOLD;
! 				sct[AXLOC][AYLOC].people=
! 				sct[AXLOC][AYLOC].people+ASOLD;
  				ntn[country].tmil -= ASOLD;
  				ntn[country].tciv += ASOLD;
  				ASOLD=0;
*** randevent.orig
--- randevent.c
**************
*** 188,196
  int
  randomevent()
  {
! int count, totalscore=0, event, newnation, i, j, armynum;
! int done;	/*if 1 then event happened */
! int newpower;
  
  printf("RANDOM HAPPENINGS ARE NOW BEING CHECKED\n");
  for(country=0;country<MAXNTN;country++) if ( ntn[country].active != 0 )
--- 188,196 -----
  int
  randomevent()
  {
! int  count, totalscore=0, event, newnation, i, j, armynum;
! int  done;	/*if 1 then event happened */
! long newpower, getmagic();
  
  printf("RANDOM HAPPENINGS ARE NOW BEING CHECKED\n");
  for(country=0;country<MAXNTN;country++) if ( ntn[country].active != 0 )
**************
*** 233,239
  	case 7:
  	case 8:
  		/*peasant revolt -- lose 40% unsupported sectors*/
! 		if(newnation=disolve(10, country) == 0 ) done=0;
  		if(done==1) for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
  			if(( sct[i][j].owner == country)
  			&&( solds_in_sector(i,j,country)==0))
--- 233,239 -----
  	case 7:
  	case 8:
  		/*peasant revolt -- lose 40% unsupported sectors*/
! 		if((newnation=disolve(10, country)) == 0 ) done=0;
  		if(done==1) for (i=0; i<MAPX; i++) for (j=0; j<MAPY; j++)
  			if(( sct[i][j].owner == country)
  			&&( solds_in_sector(i,j,country)==0))
**************
*** 329,335
  		if((is_habitable(i,j)) && ( sct[i][j].owner == country)) {
   			ntn[NNOMAD].arm[armynum].xloc =i;
   			ntn[NNOMAD].arm[armynum].yloc =j;
! 			ntn[NNOMAD].arm[armynum].sold =300+200*rand()%10;
  			ntn[NNOMAD].arm[armynum].stat =ATTACK;
  			count = 100;
  		}
--- 329,335 -----
  		if((is_habitable(i,j)) && ( sct[i][j].owner == country)) {
   			ntn[NNOMAD].arm[armynum].xloc =i;
   			ntn[NNOMAD].arm[armynum].yloc =j;
! 			ntn[NNOMAD].arm[armynum].sold =300+200*(rand()%10);
  			ntn[NNOMAD].arm[armynum].stat =ATTACK;
  			count = 100;
  		}
**************
*** 360,367
  	case 31: /*new magic item + RANDOM POWER*/
  		/*buy new powers and/or new weapons*/
  		if((newpower=getmagic())!=0){
! 			printf("\tnation %s gets magic power number %d\n",ntn[country].name,newpower);
! 			fprintf(fnews,"1. \tevent in %s -> gets magic power number %d\n", ntn[country].name,newpower);
  			exenewmgk(newpower);
  		}
  		else done=0;
--- 360,367 -----
  	case 31: /*new magic item + RANDOM POWER*/
  		/*buy new powers and/or new weapons*/
  		if((newpower=getmagic())!=0){
! 			printf("\tnation %s gets magic power number %ld\n",ntn[country].name,newpower);
! 			fprintf(fnews,"1. \tevent in %s -> gets magic power number %ld\n", ntn[country].name,newpower);
  			exenewmgk(newpower);
  		}
  		else done=0;
*** reports.orig
--- reports.c
**************
*** 295,301
  	mvaddstr(0,(COLS/2)-10,"NEXT YEARS BUDGET ESTIMATES");
  	standend();
  
! 	for(xsctr=0;xsctr<MAPX;xsctr++) for(ysctr=0;ysctr<MAPX;ysctr++) if(sct[xsctr][ysctr].owner==country) {
  		if(sct[xsctr][ysctr].designation==DFARM){
  			infood+= sct[xsctr][ysctr].people;
  			revfood+=todigit(sct[xsctr][ysctr].vegetation)*sct[xsctr][ysctr].people;
--- 295,301 -----
  	mvaddstr(0,(COLS/2)-10,"NEXT YEARS BUDGET ESTIMATES");
  	standend();
  
! 	for(xsctr=0;xsctr<MAPX;xsctr++) for(ysctr=0;ysctr<MAPY;ysctr++) if(sct[xsctr][ysctr].owner==country) {
  		if(sct[xsctr][ysctr].designation==DFARM){
  			infood+= sct[xsctr][ysctr].people;
  			revfood+=todigit(sct[xsctr][ysctr].vegetation)*sct[xsctr][ysctr].people;
**************
*** 312,322
  		else if(sct[xsctr][ysctr].designation==DCITY)    incity+= sct[xsctr][ysctr].people;
  	}
  
! 	revfood *= TAXFOOD / 100;
! 	reviron *= TAXIRON / 100;
! 	revgold *= TAXGOLD / 100;
! 	revcap = (long) incap * TAXCAP / 100;
! 	revcity = (long) incity * TAXCITY / 100;
  	if( magic(country,ARCHITECT) ) {
  		revcap *= 2;
  		revcity *= 2;
--- 312,322 -----
  		else if(sct[xsctr][ysctr].designation==DCITY)    incity+= sct[xsctr][ysctr].people;
  	}
  
! 	revfood *= TAXFOOD / 100L;
! 	reviron *= TAXIRON / 100L;
! 	revgold *= TAXGOLD / 100L;
! 	revcap = (long) incap * TAXCAP / 100L;
! 	revcity = (long) incity * TAXCITY / 100L;
  	if( magic(country,ARCHITECT) ) {
  		revcap *= 2;
  		revcity *= 2;
**************
*** 341,347
  	mvprintw(10,30,"%5d people in capital:   %8ld",incap,revcap);
  	mvprintw(11,30,"%5d people in cities:    %8ld",incity,revcity);
  	standout();
! 	mvprintw(12,30,"%5ld people TOTAL INCOME: %8ld",ntn[country].tciv,revfood+reviron+revgold+(incap*TAXCAP/100)+(incity*TAXCITY/100));
  	standend();
  
  	if(magic(country,VAMPIRE)!=1) 
--- 341,347 -----
  	mvprintw(10,30,"%5d people in capital:   %8ld",incap,revcap);
  	mvprintw(11,30,"%5d people in cities:    %8ld",incity,revcity);
  	standout();
! 	mvprintw(12,30,"%5ld people TOTAL INCOME: %8ld",ntn[country].tciv,(long) revfood+reviron+revgold+(incap*TAXCAP/100L)+(incity*TAXCITY/100L));
  	standend();
  
  	if(magic(country,VAMPIRE)!=1) 
**************
*** 345,351
  	standend();
  
  	if(magic(country,VAMPIRE)!=1) 
! 	mvprintw(14,30,"%5d troops at %5d each:%8d",expsold,SOLDMAINT,expsold*SOLDMAINT);
  	else
  	mvprintw(14,30,"%5d troops at     0 each:0",expsold);
  	mvprintw(15,30,"%5d ships at %5d each: %8d",expship,SHIPMAINT,expship*SHIPMAINT);
--- 345,351 -----
  	standend();
  
  	if(magic(country,VAMPIRE)!=1) 
! 	mvprintw(14,30,"%5ld troops at %5ld each:%8ld",expsold,SOLDMAINT,expsold*SOLDMAINT);
  	else
  	mvprintw(14,30,"%5d troops at     0 each:0",expsold);
  	mvprintw(15,30,"%5d ships at %5ld each: %8ld",expship,SHIPMAINT,expship*SHIPMAINT);
**************
*** 348,354
  	mvprintw(14,30,"%5d troops at %5d each:%8d",expsold,SOLDMAINT,expsold*SOLDMAINT);
  	else
  	mvprintw(14,30,"%5d troops at     0 each:0",expsold);
! 	mvprintw(15,30,"%5d ships at %5d each: %8d",expship,SHIPMAINT,expship*SHIPMAINT);
  	mvprintw(16,30,"other expenses this turn:  %8ld",startgold-ntn[country].tgold);
  	standout();
  	if(magic(country,VAMPIRE)!=1) {
--- 348,354 -----
  	mvprintw(14,30,"%5ld troops at %5ld each:%8ld",expsold,SOLDMAINT,expsold*SOLDMAINT);
  	else
  	mvprintw(14,30,"%5d troops at     0 each:0",expsold);
! 	mvprintw(15,30,"%5d ships at %5ld each: %8ld",expship,SHIPMAINT,expship*SHIPMAINT);
  	mvprintw(16,30,"other expenses this turn:  %8ld",startgold-ntn[country].tgold);
  	standout();
  	if(magic(country,VAMPIRE)!=1) {
**************
*** 391,397
  	mvaddstr(0,(COLS/2)-20,"NEXT YEARS PRODUCTION ESTIMATES");
  	standend();
  
! 	for(xsctr=0;xsctr<MAPX;xsctr++) for(ysctr=0;ysctr<MAPX;ysctr++) if(sct[xsctr][ysctr].owner==country) {
  		civilians += sct[xsctr][ysctr].people;
  
  		if(sct[xsctr][ysctr].designation==DFARM){
--- 391,397 -----
  	mvaddstr(0,(COLS/2)-20,"NEXT YEARS PRODUCTION ESTIMATES");
  	standend();
  
! 	for(xsctr=0;xsctr<MAPX;xsctr++) for(ysctr=0;ysctr<MAPY;ysctr++) if(sct[xsctr][ysctr].owner==country) {
  		civilians += sct[xsctr][ysctr].people;
  
  		if(sct[xsctr][ysctr].designation==DFARM){
*** update.orig
--- update.c
**************
*** 29,35
  	register int i, j;
  	register int x,y;
  	int moved,armynum,nvynum,done,finis=0, number=0;
! 	int food,iron;
  	char command[80];
  	int execed[MAXNTN];
  	long	city_pop, cap_pop;
--- 29,35 -----
  	register int i, j;
  	register int x,y;
  	int moved,armynum,nvynum,done,finis=0, number=0;
! 	long food,iron,xx;
  	char command[80];
  	int execed[MAXNTN];
  	long	city_pop, cap_pop;
**************
*** 290,296
  		}
  		/*harvest food*/
  		else if(sptr->designation==DFARM) {
! 			food= todigit(sptr->vegetation)*sptr->people;
  			nptr->tfood += food;
  			nptr->tgold += food*TAXFOOD/100;
  		}
--- 290,296 -----
  		}
  		/*harvest food*/
  		else if(sptr->designation==DFARM) {
! 			food= (long) todigit(sptr->vegetation)* (long) sptr->people;
  			nptr->tfood += food;
  			nptr->tgold += food*TAXFOOD/100;
  		}
**************
*** 297,304
  		/*gold mines produce gold*/
  		else if(sptr->designation==DGOLDMINE) {
  			if(magic(sptr->owner,MINER)==1){
! 				nptr->tgold +=  2*sptr->gold * sptr->people * TAXGOLD/100;
! 				nptr->jewels += 2*sptr->gold * sptr->people;
  			}
  			else {
  				nptr->tgold += sptr->gold * sptr->people * TAXGOLD/100;
--- 297,304 -----
  		/*gold mines produce gold*/
  		else if(sptr->designation==DGOLDMINE) {
  			if(magic(sptr->owner,MINER)==1){
! 				nptr->tgold +=  2*sptr->gold * (long) sptr->people * TAXGOLD/100L;
! 				nptr->jewels += 2*sptr->gold * (long) sptr->people;
  			}
  			else {
  				nptr->tgold += sptr->gold * (long) sptr->people * TAXGOLD/100;
**************
*** 301,308
  				nptr->jewels += 2*sptr->gold * sptr->people;
  			}
  			else {
! 				nptr->tgold += sptr->gold * sptr->people * TAXGOLD/100;
! 				nptr->jewels += sptr->gold * sptr->people;
  			}
  		}
  		else if(sptr->designation==DCAPITOL) {
--- 301,308 -----
  				nptr->jewels += 2*sptr->gold * (long) sptr->people;
  			}
  			else {
! 				nptr->tgold += sptr->gold * (long) sptr->people * TAXGOLD/100;
! 				nptr->jewels += sptr->gold * (long) sptr->people;
  			}
  		}
  		else if(sptr->designation==DCAPITOL) {
**************
*** 308,314
  		else if(sptr->designation==DCAPITOL) {
  			if((x!=nptr->capx)&&(y!=nptr->capy)) {
  				cap_pop = 0;
! 				city_pop = 3 * sptr->people;
  				sptr->designation = DCITY;
  			} else {
  				city_pop = 0;
--- 308,314 -----
  		else if(sptr->designation==DCAPITOL) {
  			if((x!=nptr->capx)&&(y!=nptr->capy)) {
  				cap_pop = 0;
! 				city_pop = 3 * (long) sptr->people;
  				sptr->designation = DCITY;
  			} else {
  				city_pop = 0;
**************
*** 316,323
  			}
  
  			if( magic(sptr->owner, ARCHITECT ) ) {
! 				city_pop *= 2;
! 				cap_pop *= 2;
  			}
  
  			nptr->tgold += (long) city_pop * TAXCITY / 100;
--- 316,323 -----
  			}
  
  			if( magic(sptr->owner, ARCHITECT ) ) {
! 				city_pop *= 2L;
! 				cap_pop *= 2L;
  			}
  
  			nptr->tgold += (long) city_pop * TAXCITY / 100L;
**************
*** 320,327
  				cap_pop *= 2;
  			}
  
! 			nptr->tgold += (long) city_pop * TAXCITY / 100;
! 			nptr->tgold += (long) cap_pop * TAXCAP / 100;
  		}
  		else if(sptr->designation==DCITY) {
  			city_pop = sptr->people;
--- 320,327 -----
  				cap_pop *= 2L;
  			}
  
! 			nptr->tgold += (long) city_pop * TAXCITY / 100L;
! 			nptr->tgold += (long) cap_pop * TAXCAP / 100L;
  		}
  		else if(sptr->designation==DCITY) {
  			city_pop = (long) sptr->people;
**************
*** 324,330
  			nptr->tgold += (long) cap_pop * TAXCAP / 100;
  		}
  		else if(sptr->designation==DCITY) {
! 			city_pop = sptr->people;
  			if( magic(sptr->owner, ARCHITECT ) )
  				city_pop *= 2;
  			nptr->tgold += (long) city_pop * TAXCITY / 100;
--- 324,330 -----
  			nptr->tgold += (long) cap_pop * TAXCAP / 100L;
  		}
  		else if(sptr->designation==DCITY) {
! 			city_pop = (long) sptr->people;
  			if( magic(sptr->owner, ARCHITECT ) )
  				city_pop *= 2L;
  			nptr->tgold += (long) city_pop * TAXCITY / 100L;
**************
*** 326,333
  		else if(sptr->designation==DCITY) {
  			city_pop = sptr->people;
  			if( magic(sptr->owner, ARCHITECT ) )
! 				city_pop *= 2;
! 			nptr->tgold += (long) city_pop * TAXCITY / 100;
  		}
  		else if(((magic(country,DERVISH)==1)
  		||(magic(country,DESTROYER)==1))
--- 326,333 -----
  		else if(sptr->designation==DCITY) {
  			city_pop = (long) sptr->people;
  			if( magic(sptr->owner, ARCHITECT ) )
! 				city_pop *= 2L;
! 			nptr->tgold += (long) city_pop * TAXCITY / 100L;
  		}
  		else if(((magic(country,DERVISH)==1)
  		||(magic(country,DESTROYER)==1))
**************
*** 334,340
  		&&((sptr->vegetation==ICE)
  		||(sptr->vegetation==DESERT))
  		&&(sptr->people>0)) {
! 			food=6*sptr->people;
  			nptr->tfood += food;
  			nptr->tgold += food*TAXFOOD/100;
  		}
--- 334,340 -----
  		&&((sptr->vegetation==ICE)
  		||(sptr->vegetation==DESERT))
  		&&(sptr->people>0)) {
! 			food=6L* (long) sptr->people;
  			nptr->tfood += food;
  			nptr->tgold += food*TAXFOOD/100L;
  		}
**************
*** 336,342
  		&&(sptr->people>0)) {
  			food=6*sptr->people;
  			nptr->tfood += food;
! 			nptr->tgold += food*TAXFOOD/100;
  		}
  	}
  
--- 336,342 -----
  		&&(sptr->people>0)) {
  			food=6L* (long) sptr->people;
  			nptr->tfood += food;
! 			nptr->tgold += food*TAXFOOD/100L;
  		}
  	}
  
**************
*** 403,409
  	fprintf(fnews,"2\tSTATUS OF THE WORLDS FOOD SUPPLY\n");
  	for(country=1;country<MAXNTN;country++) if(ntn[country].active!=0){
  		/*soldiers eat  2*/
! 		ntn[country].tfood-=ntn[country].tmil*2;
  		/*civilians eat 1*/
  		ntn[country].tfood-=ntn[country].tciv;
  
--- 403,409 -----
  	fprintf(fnews,"2\tSTATUS OF THE WORLDS FOOD SUPPLY\n");
  	for(country=1;country<MAXNTN;country++) if(ntn[country].active!=0){
  		/*soldiers eat  2*/
! 		ntn[country].tfood-=ntn[country].tmil*2L;
  		/*civilians eat 1*/
  		ntn[country].tfood-=ntn[country].tciv;
  
**************
*** 417,424
  				/*lose one person in city per three food*/
  				/*maximum of 1/3 people in city lost*/
  				if(sptr->people < ntn[country].tfood){
! 					sptr->people+=ntn[country].tfood/3;
! 					ntn[country].tfood=0;
  				}
  				else {
  					ntn[country].tfood+=sptr->people;
--- 417,424 -----
  				/*lose one person in city per three food*/
  				/*maximum of 1/3 people in city lost*/
  				if(sptr->people < ntn[country].tfood){
! 					sptr->people+=((int) ntn[country].tfood/3L);
! 					ntn[country].tfood=0L;
  				}
  				else {
  					ntn[country].tfood+= (long) sptr->people;
**************
*** 421,429
  					ntn[country].tfood=0;
  				}
  				else {
! 					ntn[country].tfood+=sptr->people;
! 					city_pop = sptr->people/3;
! 					sptr->people -= city_pop;
  				}
  				fprintf(fnews,"2.\tfamine hits city at %d,%d in %s.\n",x,y,ntn[country].name);
  				sprintf(command,"%s%d",msgfile,country);
--- 421,429 -----
  					ntn[country].tfood=0L;
  				}
  				else {
! 					ntn[country].tfood+= (long) sptr->people;
! 					city_pop = sptr->people/3L;
! 					sptr->people -= (int) city_pop;
  				}
  				fprintf(fnews,"2.\tfamine hits city at %d,%d in %s.\n",x,y,ntn[country].name);
  				sprintf(command,"%s%d",msgfile,country);
**************
*** 432,438
  				printf("error opening %s\n",command);
  				} else {
  				fprintf(fpmsg,"%s notice from program\n%s\n",ntn[country].name,ntn[country].name);
! 				fprintf(fpmsg,"%s famine hits city at %d,%d in %s.-> %d people reduced by %d\n%s\n",ntn[country].name,x,y,ntn[country].name,sptr->people,city_pop,ntn[country].name);
  				fprintf(fpmsg,"END\n");
  				fclose(fpmsg);
  				}
--- 432,438 -----
  				printf("error opening %s\n",command);
  				} else {
  				fprintf(fpmsg,"%s notice from program\n%s\n",ntn[country].name,ntn[country].name);
! 				fprintf(fpmsg,"%s famine hits city at %d,%d in %s.-> %d people reduced by %ld\n%s\n",ntn[country].name,x,y,ntn[country].name,sptr->people,city_pop,ntn[country].name);
  				fprintf(fpmsg,"END\n");
  				fclose(fpmsg);
  				}
**************
*** 440,446
  		}
  		/*this state can occur if few people live in cities*/
  		if(ntn[country].tfood<0) {
! 			ntn[country].tfood=0;
  		}
  		else if(ntn[country].tfood>FOODTHRESH*ntn[country].tciv) {
  			ntn[country].tgold+=ntn[country].tfood-FOODTHRESH*ntn[country].tciv;
--- 440,446 -----
  		}
  		/*this state can occur if few people live in cities*/
  		if(ntn[country].tfood<0) {
! 			ntn[country].tfood=0L;
  		}
  		else if(ntn[country].tfood>FOODTHRESH*ntn[country].tciv) {
  			ntn[country].tgold+=ntn[country].tfood-(long) FOODTHRESH*ntn[country].tciv;
**************
*** 443,449
  			ntn[country].tfood=0;
  		}
  		else if(ntn[country].tfood>FOODTHRESH*ntn[country].tciv) {
! 			ntn[country].tgold+=ntn[country].tfood-FOODTHRESH*ntn[country].tciv;
  			ntn[country].tfood=FOODTHRESH*ntn[country].tciv;
  		}
  
--- 443,449 -----
  			ntn[country].tfood=0L;
  		}
  		else if(ntn[country].tfood>FOODTHRESH*ntn[country].tciv) {
! 			ntn[country].tgold+=ntn[country].tfood-(long) FOODTHRESH*ntn[country].tciv;
  			ntn[country].tfood=FOODTHRESH*ntn[country].tciv;
  		}
  
**************
*** 448,456
  		}
  
  		if(ntn[country].tgold>GOLDTHRESH*ntn[country].jewels){
! 			x=ntn[country].tgold-GOLDTHRESH*ntn[country].jewels;
! 			ntn[country].jewels += x/GOLDTHRESH;
! 			ntn[country].tgold  -= x;
  		}
  		else if(ntn[country].tgold > JEWELTHRESH * ntn[country].jewels){
  			fprintf(fnews,"3.\tTAX REVOLT IN NATION %s\n",ntn[country].name);
--- 448,456 -----
  		}
  
  		if(ntn[country].tgold>GOLDTHRESH*ntn[country].jewels){
! 			xx=ntn[country].tgold-GOLDTHRESH*ntn[country].jewels;
! 			ntn[country].jewels += xx/GOLDTHRESH;
! 			ntn[country].tgold  -= xx;
  		}
  		else if(ntn[country].tgold > JEWELTHRESH * ntn[country].jewels){
  			fprintf(fnews,"3.\tTAX REVOLT IN NATION %s\n",ntn[country].name);
-- 
Denis Fortin                            | fortin@zap.UUCP
CAE Electronics Ltd                     | philabs!micomvax!zap!fortin
The opinions expressed above are my own | fortin%zap.uucp@uunet.uu.net