billr@saab.CNA.TEK.COM (Bill Randle) (07/20/89)
Submitted-by: Adam Bryant <adb@bu-cs.bu.edu> Posting-number: Volume 7, Issue 54 Archive-name: conquer4/Patch3c 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.03 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.03 X return(Attr); X } X- X /****************************************************************/ X /* ARMYMOVE() */ X /* armymove moves an army... and returns the # of sectors taken */ X--- 217,222 ---- X*************** X*** 227,232 **** X--- 226,234 ---- X int armynum; X { X long sum, where; X+ #ifdef XENIX X+ register int z; X+ #endif /*XENIX*/ X register int x, y; X int i; X long menok; /* enough men in the army? */ X*************** X*** 336,348 **** X if((sct[x][y].designation != DCITY) X &&(sct[x][y].designation != DCAPITOL) X &&(sct[x][y].designation != DTOWN) X! &&(sct[x][y].owner==country)) X attr[x][y] /= 8; X! X if(sct[x][y].owner==0){ X sct[x][y].owner=country; X curntn->popularity++; X attr[x][y]/=8; X takesctr++; X } X X--- 338,362 ---- X if((sct[x][y].designation != DCITY) X &&(sct[x][y].designation != DCAPITOL) X &&(sct[x][y].designation != DTOWN) X! &&(sct[x][y].owner==country)) { X! #ifdef XENIX X! z = attr[x][y]; X! z /= 8; X! attr[x][y] = z; X! #else X attr[x][y] /= 8; X! #endif /*XENIX*/ X! } X if(sct[x][y].owner==0){ X sct[x][y].owner=country; X curntn->popularity++; X+ #ifdef XENIX X+ z = attr[x][y]; X+ z /= 8; X+ attr[x][y] = z; X+ #else X attr[x][y]/=8; X+ #endif /*XENIX*/ X takesctr++; X } X X*************** X*** 476,481 **** X--- 490,496 ---- X } X #endif CHEAT X X+ X /****************************************************************/ X /* UPDEXECS() */ X /* update all nations in a random order */ X*************** X*** 485,492 **** X updexecs() X { X register struct s_sector *sptr; X! register int i, j; X! register int x,y; X int armynum; X int moved,done,loop=0,number=0; X X--- 500,509 ---- X updexecs() X { X register struct s_sector *sptr; X! register int i, j, x, y; X! #ifdef XENIX X! register int z; X! #endif /*XENIX*/ X int armynum; X int moved,done,loop=0,number=0; X X*************** X*** 530,535 **** X--- 547,553 ---- X /*if execute is 0 and PC nation then they did not move*/ X if((execute(TRUE)==0)&&(ispc(curntn->active))){ X printf("\tnation %s did not move\n",curntn->name); X+ #ifdef NPC X #ifdef CMOVE X printf("\tthe computer will move for %s\n",curntn->name); X fprintf(fnews,"1.\tthe computer will move for %s\n",curntn->name); X*************** X*** 536,552 **** X mailopen( country ); X fprintf(fm,"the computer moved for you (%s) in %s of Year %d\n",curntn->name,PSEASON(TURN),YEAR(TURN)); X mailclose(); X! check(); X nationrun(); X! check(); X! #endif CMOVE X } X- #ifdef NPC X- check(); X /* run npc nations */ X if(isnpc(curntn->active)) { X nationrun(); X! check(); X #ifdef ORCTAKE X /*do npc nation magic*/ X if(magic(country,MA_MONST)==TRUE) { X--- 554,569 ---- X mailopen( country ); X fprintf(fm,"the computer moved for you (%s) in %s of Year %d\n",curntn->name,PSEASON(TURN),YEAR(TURN)); X mailclose(); X! check(); X nationrun(); X! check(); X! #endif /*CMOVE*/ X } X /* run npc nations */ X if(isnpc(curntn->active)) { X+ check(); X nationrun(); X! check(); X #ifdef ORCTAKE X /*do npc nation magic*/ X if(magic(country,MA_MONST)==TRUE) { X*************** X*** 560,567 **** X printf("SUCCESSFUL TAKEOVER OF %d by %s",x,curntn->name); X } X #endif ORCTAKE X } X- #endif NPC X X /* is leader killed - put nation into dissarray */ X x = getleader((int)curntn->class) - 1; X--- 577,584 ---- X printf("SUCCESSFUL TAKEOVER OF %d by %s",x,curntn->name); X } X #endif ORCTAKE X+ #endif /*NPC*/ X } X X /* is leader killed - put nation into dissarray */ X x = getleader((int)curntn->class) - 1; X*************** X*** 642,648 **** X if(ONMAP(i,j)){ X if( sct[i][j].owner != country) X continue; X! moved=(sptr->people*attr[i][j]-sct[i][j].people*attr[x][y])/(1+5*(attr[i][j]+attr[x][y])); X if( moved <= 0 ) continue; X X sct[i][j].people += moved; X--- 659,666 ---- X if(ONMAP(i,j)){ X if( sct[i][j].owner != country) X continue; X! moved=(sptr->people*attr[i][j]-sct[i][j].people*attr[x][y]); X! moved /= (1+5*(attr[i][j]+attr[x][y])); X if( moved <= 0 ) continue; X X sct[i][j].people += moved; X*************** X*** 655,661 **** X--- 673,685 ---- X for(country=1;country<NTOTAL;country++) if(isntn(ntn[country].active)){ 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 if(magic(country,SUMMON)==TRUE) { X ntn[country].spellpts+=4; X if(magic(country,WYZARD)==TRUE) X*************** X*** 678,683 **** X--- 702,710 ---- X void X do_lizard() X { X+ #ifdef XENIX X+ register int x; X+ #endif /*XENIX*/ X register int i, j; X int armynum; X X*************** X*** 686,693 **** X for(armynum=0;armynum<MAXARM;armynum++) X if((P_ASOLD>0)) { X P_AMOVE =20; /* just in case god wants to move them */ X! P_ASOLD*=102; /* increase population */ X P_ASOLD/=100; X if(armynum%2==0) { X if(P_ASTAT!=SIEGED) P_ASTAT=GARRISON; X } else { X--- 713,727 ---- X for(armynum=0;armynum<MAXARM;armynum++) X if((P_ASOLD>0)) { X P_AMOVE =20; /* just in case god wants to move them */ X! /* increase population */ X! #ifdef XENIX X! x = P_ASOLD * 102; X! x /= 100; X! P_ASOLD = x; X! #else X! P_ASOLD*=102; X P_ASOLD/=100; X+ #endif /*XENIX*/ X if(armynum%2==0) { X if(P_ASTAT!=SIEGED) P_ASTAT=GARRISON; X } else { X*************** X*** 1333,1340 **** X--- 1367,1381 ---- X } X /*this state can occur if few people live in cities*/ X if(curntn->tfood<0) curntn->tfood=0L; X+ #ifdef XENIX X+ xx = curntn->tfood; X+ xx *= (100-curntn->spoilrate); X+ xx /= 100; X+ curntn->tfood = xx; X+ #else X curntn->tfood *= (100-curntn->spoilrate); X curntn->tfood /= 100; X+ #endif /*XENIX*/ X X if(curntn->tgold>GOLDTHRESH*curntn->jewels){ X /* buy jewels off commodities board */ X*** ocommands.c Tue Jul 18 22:04:40 1989 X--- commands.c Tue Jul 18 22:05:00 1989 X*************** X*** 53,59 **** X &&((desg!=DCAPITOL && sptr->designation==DCITY) X ||sptr->designation==DCAPITOL)) { X if(prtflag) { X! char buf[80]; X sprintf(buf,"Must first burn down city/capitol (designate as '%c')",DRUIN); X errormsg(buf); X } X--- 53,59 ---- X &&((desg!=DCAPITOL && sptr->designation==DCITY) X ||sptr->designation==DCAPITOL)) { X if(prtflag) { X! char buf[LINELTH+1]; X sprintf(buf,"Must first burn down city/capitol (designate as '%c')",DRUIN); X errormsg(buf); X } X*************** X*** 189,196 **** X return; X } X sptr->vegetation=newdes; X! if(tofood(sptr,0)!=0) X! sptr->designation=newdes; X reset_god(); X return; X case 'o': X--- 189,197 ---- X return; X } X sptr->vegetation=newdes; X! if( tofood(sptr,0) < DESFOOD ) X! sptr->designation=DNODESIG; X! else sptr->designation=newdes; X reset_god(); X return; X case 'o': X*************** X*** 445,451 **** X X if (P_NCREW==SHIPCREW) { X errormsg("You may only &^#$! repair damaged fleets!!!"); X- if(isgod==TRUE) reset_god(); X return; X } X clear_bottom(0); X--- 446,451 ---- X*************** X*** 458,463 **** X--- 458,468 ---- X clrtoeol(); X refresh(); X amount = (short) get_number(); X+ if (amount<0) { X+ if(isgod==TRUE) reset_god(); X+ return; X+ } X+ X X /* find cost of repairs on all ships */ X cost = 0; X*************** X*** 600,606 **** X X /*sanity checks*/ X if((amount>N_MASK)) amount=0; X! if (amount==0) X { X if(isgod==TRUE) reset_god(); X return; X--- 605,611 ---- X X /*sanity checks*/ X if((amount>N_MASK)) amount=0; X! if (amount<=0) X { X if(isgod==TRUE) reset_god(); X return; X*************** X*** 1023,1032 **** X int count,msglen; X int contd; X int done=FALSE; X! char tempfile[ 30 ]; X! char mesgfile[ 30 ]; X! char line[80], inpch; X! char save[50][80]; X X /*open file*/ X sprintf(tempfile,"%s%hd.tmp",msgfile,country); X--- 1028,1037 ---- X int count,msglen; X int contd; X int done=FALSE; X! char tempfile[FILELTH]; X! char mesgfile[FILELTH]; X! char line[LINELTH+1], inpch; X! char save[LINELTH][LINELTH+1]; X X /*open file*/ X sprintf(tempfile,"%s%hd.tmp",msgfile,country); X*************** X*** 1050,1056 **** X } X X /*read in file a line at at time*/ X! if(fgets(line,80,mesgfp)==NULL) { X done=TRUE; X redraw=FALSE; X clear_bottom(0); X--- 1055,1061 ---- X } X X /*read in file a line at at time*/ X! if(fgets(line,LINELTH,mesgfp)==NULL) { X done=TRUE; X redraw=FALSE; X clear_bottom(0); X*************** X*** 1066,1072 **** X standout(); X /*print to end of message*/ X while(contd==FALSE) { X! if(msglen<50) strcpy(save[msglen],line); X if(count==LINES-3) { X standout(); X mvaddstr(LINES-3,(COLS/2)-8,"--- more ---"); X--- 1071,1077 ---- X standout(); X /*print to end of message*/ X while(contd==FALSE) { X! if(msglen<LINELTH) strcpy(save[msglen],line); X if(count==LINES-3) { X standout(); X mvaddstr(LINES-3,(COLS/2)-8,"--- more ---"); X*************** X*** 1080,1086 **** X standend(); X count++; X msglen++; X! if(fgets(line,80,mesgfp)==NULL) contd=TRUE; X if(strncmp(line,"END",3)==0) contd=TRUE; X } X standout(); X--- 1085,1091 ---- X standend(); X count++; X msglen++; X! if(fgets(line,LINELTH,mesgfp)==NULL) contd=TRUE; X if(strncmp(line,"END",3)==0) contd=TRUE; X } X standout(); X*************** X*** 1094,1100 **** X strcpy(line,"END\n"); X fputs(line,fptemp); X } X! if(fgets(line,80,mesgfp)==NULL) done=TRUE; X } X fclose(mesgfp); X fclose(fptemp); X--- 1099,1105 ---- X strcpy(line,"END\n"); X fputs(line,fptemp); X } X! if(fgets(line,LINELTH,mesgfp)==NULL) done=TRUE; X } X fclose(mesgfp); X fclose(fptemp); X*************** X*** 1116,1122 **** X char name[NAMELTH+1]; X int temp=(-1); X int linedone; X! char line[100]; X X /*what nation to send to*/ X clear(); X--- 1121,1127 ---- X char name[NAMELTH+1]; X int temp=(-1); X int linedone; X! char line[BIGLTH]; X X /*what nation to send to*/ X clear(); X*************** X*** 1184,1190 **** X refresh(); X ch=getch(); X } else if (ch=='') { X! refresh(); X ch=getch(); X } else ch=getch(); X } X--- 1189,1195 ---- X refresh(); X ch=getch(); X } else if (ch=='') { X! wrefresh(stdscr); X ch=getch(); X } else ch=getch(); X } X*************** X*** 1236,1243 **** X clrtoeol(); X refresh(); X people = get_number(); X! if((people<0) X! ||(people>sct[XREAL][YREAL].people) X ||(people*50>curntn->tgold)){ X errormsg("Sorry...Input error or you do not have the gold talons"); X makebottom(); X--- 1241,1250 ---- X clrtoeol(); X refresh(); X people = get_number(); X! if (people <= 0) { X! return; X! } X! if((people>sct[XREAL][YREAL].people) X ||(people*50>curntn->tgold)){ X errormsg("Sorry...Input error or you do not have the gold talons"); X makebottom(); X*************** X*** 1250,1255 **** X--- 1257,1265 ---- X clrtoeol(); X refresh(); X i = get_number(); X+ if (i < 0) { X+ return; X+ } X X if((i-(XREAL))>2||(i-(XREAL))<-2) { X errormsg("sorry, can only move two sectors"); X*************** X*** 1261,1266 **** X--- 1271,1279 ---- X clrtoeol(); X refresh(); X j = get_number(); X+ if (j < 0) { X+ return; X+ } X if((j-(YREAL)>2)||((YREAL)-j>2)) { X errormsg("sorry, can only move two sectors"); X } X*** oio.c Tue Jul 18 22:04:41 1989 X--- io.c Tue Jul 18 22:05:01 1989 X*************** X*** 73,78 **** X--- 73,96 ---- X } X } X #endif ADMIN X+ #ifdef ADMIN X+ /************************************************************************/ X+ /* PR_DESG() - print designations */ X+ /************************************************************************/ X+ void X+ pr_desg() 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*************** X*** 270,276 **** X int nationid; /*current nation id */ X #ifdef TIMELOG X FILE *timefp, *fopen(); X! char timestr[80]; X #endif /* TIMELOG */ X X printf("Conquer %s.%d: %s of Year %d, Turn %d\n",VERSION,PATCHLEVEL, X--- 288,294 ---- X int nationid; /*current nation id */ X #ifdef TIMELOG X FILE *timefp, *fopen(); X! char timestr[LINELTH+1]; X #endif /* TIMELOG */ X X printf("Conquer %s.%d: %s of Year %d, Turn %d\n",VERSION,PATCHLEVEL, X*************** X*** 284,301 **** X #endif /* TIMELOG */ X printf("id name race class align score talons military civilians sect\n"); X for (nationid=1; nationid<NTOTAL; nationid++) { X! if(!isntn(ntn[nationid].active)) continue; X printf("%2d ",nationid); X printf("%9s ",ntn[nationid].name); X! for(i=1;i<8;i++) X! if(ntn[nationid].race==*(races+i)[0]) X! printf("%6s ",*(races+i)); 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 } X } X #endif CONQUER X--- 302,336 ---- X #endif /* TIMELOG */ X printf("id name race class align score talons military civilians sect\n"); X for (nationid=1; nationid<NTOTAL; nationid++) { X! if(!isactive(ntn[nationid].active)) continue; X printf("%2d ",nationid); X printf("%9s ",ntn[nationid].name); X! /* this check for old 'B' for barbarians; removed eventually */ X! if (ntn[nationid].race=='B') { X! printf("%6s ", "SAVAGE"); X! } else { X! for(i=1;(*(races+i)[0])!='U';i++) X! if(ntn[nationid].race==*(races+i)[0]) 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 } X } X #endif CONQUER X*************** X*** 386,392 **** X readmap() X { X FILE *mapfile; X! char line[128]; X register int x,y; X X /* read in ele.map */ X--- 421,427 ---- X readmap() X { X FILE *mapfile; X! char line[BIGLTH+1]; X register int x,y; X X /* read in ele.map */ X*************** X*** 415,421 **** X } else fprintf(stderr,"reading vegetation map file from %s\n",line ); X y=0; X while( TRUE ) { X! if(fgets( line, 128, mapfile )==NULL) break; X for(x=0;x<MAPX;x++) sct[x][y].vegetation = line[x]; X y++; X if(y>=MAPY) break; X--- 450,456 ---- X } else fprintf(stderr,"reading vegetation map file from %s\n",line ); X y=0; X while( TRUE ) { X! if(fgets( line, BIGLTH, mapfile )==NULL) break; X for(x=0;x<MAPX;x++) sct[x][y].vegetation = line[x]; X y++; X if(y>=MAPY) break; X*** onewhelp.c Tue Jul 18 22:04:43 1989 X--- newhelp.c Tue Jul 18 22:05:01 1989 X*************** X*** 44,49 **** X--- 44,50 ---- X fprintf(fp,"s/XTRADEPCT/%d/g\n",TRADEPCT); X fprintf(fp,"s/XMAXNAVY/%d/g\n",MAXNAVY); X fprintf(fp,"s/XBREAKJIHAD/%ld/g\n",BREAKJIHAD); X+ fprintf(fp,"s/XCONQENV/%s/g\n",ENVIRON_OPTS); X X /* check all the defined options */ X #ifdef OGOD X*************** X*** 74,80 **** X--- 75,87 ---- X #endif X #ifdef NPC X fprintf(fp,"s/XNPC/(True )/g\n"); X+ #ifdef CMOVE X+ fprintf(fp,"s/XCMOVE/(True )/g\n"); X #else X+ fprintf(fp,"s/XCMOVE/(False)/g\n"); X+ #endif X+ #else X+ fprintf(fp,"s/XCMOVE/(False)/g\n"); X fprintf(fp,"s/XNPC/(False)/g\n"); X #endif X #ifdef CHEAT X*************** X*** 81,91 **** X fprintf(fp,"s/XCHEAT/(True )/g\n"); X #else X fprintf(fp,"s/XCHEAT/(False)/g\n"); X- #endif X- #ifdef CMOVE X- fprintf(fp,"s/XCMOVE/(True )/g\n"); X- #else X- fprintf(fp,"s/XCMOVE/(False)/g\n"); X #endif X #ifdef RANEVENT X fprintf(fp,"s/XRANEVENT/(True )/g\n"); X--- 88,93 ---- X*** odata.c Tue Jul 18 22:04:40 1989 X--- data.c Tue Jul 18 22:05:01 1989 X*************** X*** 63,71 **** X "King","Baron","Emperor","Prince","Wizard","Mage", X "Pope","Bishop","Admiral","Captain","Warlord","Lord", X "Demon","Devil","Dragon","Wyrm","Shadow","Nazgul", X! "Spirit", "Assasin", "Efreet", "Gargoyle", "Wraith", X! "Hero", "Centaur", "Giant", "Superhero", "Mummy", X! "Elemental", "Minotaur", "Demon", "Balrog", "Dragon" X }; X X #ifdef CONQUER X--- 63,71 ---- X "King","Baron","Emperor","Prince","Wizard","Mage", X "Pope","Bishop","Admiral","Captain","Warlord","Lord", X "Demon","Devil","Dragon","Wyrm","Shadow","Nazgul", X! "Spirit", "Assasin", "Efreet", "Gargoyl", "Wraith", X! "Hero", "Centaur", "Giant", "Suphero", "Mummy", X! "Elmentl", "Mintaur", "Demon", "Balrog", "Dragon" X }; X X #ifdef CONQUER X*************** X*** 251,260 **** X X #ifdef CONQUER X #ifdef SYSMAIL X! char sysmail[100]; X int sys_mail_status; X #endif SYSMAIL X! char conqmail[100]; X int conq_mail_status; X #endif CONQUER X X--- 251,260 ---- X X #ifdef CONQUER X #ifdef SYSMAIL X! char sysmail[FILELTH]; X int sys_mail_status; X #endif SYSMAIL X! char conqmail[FILELTH]; X int conq_mail_status; X #endif CONQUER X X*** omagic.c Tue Jul 18 22:04:41 1989 X--- magic.c Tue Jul 18 22:05:01 1989 X*************** X*** 185,191 **** X void X domagic() X { X! int count, done=FALSE, loop=0, i,type; X long price,x; X short isgod=0; X if(country==0) { X--- 185,191 ---- X void X domagic() X { X! int county, countx, done=FALSE, loop=0, i,type; X long price,x; X short isgod=0; X if(country==0) { X*************** X*** 196,210 **** X while(done==FALSE){ X done=TRUE; X clear(); X! count=3; X redraw=TRUE; X standout(); X mvprintw(0,(COLS/2)-15,"MAGIC POWERS FOR %s",curntn->name); X! mvprintw(count++,30,"1) %d military powers: %ld jewels", X num_powers(country,M_MIL) ,getmgkcost(M_MIL,country)); X! mvprintw(count++,30,"2) %d civilian powers: %ld jewels", X num_powers(country,M_CIV) ,getmgkcost(M_CIV,country)); X! mvprintw(count++,30,"3) %d magic powers: %ld jewels", X num_powers(country,M_MGK),getmgkcost(M_MGK,country)); X X price = getmgkcost(M_MIL,country); X--- 196,211 ---- X while(done==FALSE){ X done=TRUE; X clear(); X! county=3; X! countx=0; X redraw=TRUE; X standout(); X mvprintw(0,(COLS/2)-15,"MAGIC POWERS FOR %s",curntn->name); X! mvprintw(county++,30,"1) %d military powers: %ld jewels", X num_powers(country,M_MIL) ,getmgkcost(M_MIL,country)); X! mvprintw(county++,30,"2) %d civilian powers: %ld jewels", X num_powers(country,M_CIV) ,getmgkcost(M_CIV,country)); X! mvprintw(county++,30,"3) %d magic powers: %ld jewels", X num_powers(country,M_MGK),getmgkcost(M_MGK,country)); X X price = getmgkcost(M_MIL,country); X*************** X*** 217,243 **** X #endif OGOD X X standend(); X! count=3; X /*print the powers that you have*/ X i=0; X while( powers[i] != 0 ){ X if(magic(country,powers[i])==TRUE) X! mvprintw(count++,0,"you have power %s",*(pwrname+i)); X i++; X } X X! if(count<=7) count=8; X! else count++; X standout(); X! mvprintw(count++,0,"YOU HAVE %ld JEWELS IN YOUR TREASURY",curntn->jewels); X if(price < curntn->jewels){ X! mvaddstr(count++,0,"DO YOU WISH TO BUY A RANDOM NEW POWER (enter y or n):"); X standend(); X refresh(); X- count++; X if(getch()=='y'){ X done=FALSE; X! mvprintw(count++,0,"ENTER SELECTION (1,2,3):"); X refresh(); X type = getch() - '0'; X if(type==M_MIL || type==M_CIV || type==M_MGK){ X--- 218,248 ---- X #endif OGOD X X standend(); X! county=3; X /*print the powers that you have*/ X i=0; X while( powers[i] != 0 ){ X if(magic(country,powers[i])==TRUE) X! mvprintw(county++,countx,"you have power %s",*(pwrname+i)); X i++; X+ if (county > 18) { X+ county=7; X+ countx=40; X+ } X } X X! if(county<=7) county=8; X! else if(countx == 40) county = 20; X! else county++; X standout(); X! mvprintw(county++,0,"YOU HAVE %ld JEWELS IN YOUR TREASURY",curntn->jewels); X if(price < curntn->jewels){ X! mvaddstr(county++,0,"DO YOU WISH TO BUY A RANDOM NEW POWER (enter y or n):"); X standend(); X refresh(); X if(getch()=='y'){ X done=FALSE; X! mvprintw(county++,0,"ENTER SELECTION (1,2,3):"); X refresh(); X type = getch() - '0'; X if(type==M_MIL || type==M_CIV || type==M_MGK){ X*************** X*** 270,280 **** X } X #ifdef ORCTAKE X if((curntn->race==ORC)&&(curntn->jewels>=ORCTAKE)&&(curntn->spellpts>=TAKEPOINTS)) X! done |= orctake(&count); X #endif ORCTAKE X #ifdef OGOD X if (isgod==TRUE) { X! mvaddstr(count++,0,"GOD: REMOVE A MAGIC POWER? (y or n)"); X refresh(); X if (getch()=='y') killmagk(); X } X--- 275,285 ---- X } X #ifdef ORCTAKE X if((curntn->race==ORC)&&(curntn->jewels>=ORCTAKE)&&(curntn->spellpts>=TAKEPOINTS)) X! done |= orctake(&county); X #endif ORCTAKE X #ifdef OGOD X if (isgod==TRUE) { X! mvaddstr(county++,0,"GOD: REMOVE A MAGIC POWER? (y or n)"); X refresh(); X if (getch()=='y') killmagk(); X } X*************** X*** 492,498 **** X int x,count,i,armynum; X long e_cost; X int newtype,s_cost; X! char line[80],ch; X X x=0; X count=LINES-4; X--- 497,503 ---- X int x,count,i,armynum; X long e_cost; X int newtype,s_cost; X! char line[LINELTH+1],ch; X X x=0; X count=LINES-4; X*************** X*** 809,818 **** X /* killmagk: this routine removes a magic power */ X killmagk() X { X! int count,choice,i; X X clear(); X! count=3; X standout(); X mvprintw(0,(COLS/2)-15,"MAGIC POWERS FOR %s",curntn->name); X standend(); X--- 814,824 ---- X /* killmagk: this routine removes a magic power */ X killmagk() X { X! int county,countx,choice,i; X X clear(); X! county=3; X! countx=0; X standout(); X mvprintw(0,(COLS/2)-15,"MAGIC POWERS FOR %s",curntn->name); X standend(); X*************** X*** 819,837 **** X i=0; X while( powers[i] != 0 ){ X if(magic(country,powers[i])==TRUE) { X! mvprintw(count,0,"%d: power %s",i+1,*(pwrname+i)); X! count++; X } X i++; X } X! count++; X standout(); X! mvaddstr(count++,5," Which power to remove? "); X standend(); X refresh(); X choice=get_number(); X! if(choice!=0) { X! mvprintw(count++,0," Remove magic #%d? (y or [n])",choice); X refresh(); X if (getch()=='y') { X if(magic(country,powers[choice-1])) { X--- 825,850 ---- X i=0; X while( powers[i] != 0 ){ X if(magic(country,powers[i])==TRUE) { X! mvprintw(county,countx,"%d: power %s",i+1,*(pwrname+i)); X! county++; X } X i++; X+ if (county > 18) { X+ county = 3; X+ countx = 40; X+ } X } X! if (countx == 40) { X! county = 20; X! } X! else county++; X standout(); X! mvaddstr(county++,5," Which power to remove? "); X standend(); X refresh(); X choice=get_number(); X! if(choice > 0) { X! mvprintw(county++,0," Remove magic #%d? (y or [n])",choice); X refresh(); X if (getch()=='y') { X if(magic(country,powers[choice-1])) { X*************** X*** 855,861 **** X wizardry() X { X int i,xspt,yspt,choice,armynum,s_cost; X! char line[80]; X void dosummon(); X X clear_bottom(0); X--- 868,874 ---- X wizardry() X { X int i,xspt,yspt,choice,armynum,s_cost; X! char line[LINELTH+1]; X void dosummon(); X X clear_bottom(0); X*** omain.c Tue Jul 18 22:04:42 1989 X--- main.c Tue Jul 18 22:05:02 1989 X*************** X*** 21,27 **** X X extern int armornvy; X X! char fison[20]; X char *getpass(); X struct s_sector **sct; X struct s_nation ntn[NTOTAL]; /* player nation stats */ X--- 21,27 ---- X X extern int armornvy; X X! char fison[FILELTH]; X char *getpass(); X struct s_sector **sct; X struct s_nation ntn[NTOTAL]; /* player nation stats */ X*************** X*** 43,48 **** X--- 43,49 ---- X short pager=0; /* pager for selector 0,1,2,3*/ X short country=0; /* nation id of owner*/ X struct s_nation *curntn; X+ short Gaudy=FALSE; X int owneruid; X X FILE *fexe, *fopen(); X*************** X*** 56,63 **** X char **argv; X { X int geteuid(), getuid(), setuid(); X! register int i; X! char name[NAMELTH+1],filename[80]; X void srand(),init_hasseen(); X int getopt(); X char passwd[PASSLTH+1]; X--- 57,64 ---- X char **argv; X { 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*************** X*** 66,88 **** X #ifdef SYSMAIL X extern char sysmail[]; X #endif SYSMAIL X! int sflag=FALSE; X X! char defaultdir[256],tmppass[PASSLTH+1]; X struct passwd *getpwnam(); X owneruid=getuid(); X- strcpy(defaultdir, DEFAULTDIR); X srand((unsigned) time((long *) 0)); X strcpy(name,""); X X /* process the command line arguments */ X! while((i=getopt(argc,argv,"hn:d:s"))!=EOF) switch(i){ X /* process the command line arguments */ X case 'h': /* execute help program*/ X- if (chdir(defaultdir)) { X- printf("unable to change dir to %s\n",defaultdir); X- exit(FAIL); X- } X initscr(); X savetty(); X noecho(); X--- 67,176 ---- 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+ if (getenv(ENVIRON_OPTS)!=NULL) { X+ strncpy(cq_opts, getenv(ENVIRON_OPTS), BIGLTH-1); X+ } X+ if (cq_opts[0] != '\0') { X+ l = strlen(cq_opts); X+ for(i=0; i<l; i++) { X+ switch(cq_opts[i]) { X+ case 'G': X+ /* set Gaudy display */ X+ Gaudy = TRUE; X+ break; X+ case 'N': X+ case 'n': X+ /* check for nation name */ X+ if (strncmp(cq_opts+i+1,"ation=",6)==0) { X+ i += 7; X+ } else if (strncmp(cq_opts+i+1,"ame=",4)==0) { X+ i += 5; X+ } else { X+ fprintf(stderr,"conquer: invalid environment\n"); X+ fprintf(stderr,"\t%s = %s\n",ENVIRON_OPTS,cq_opts); X+ fprintf(stderr,"\texpected <nation=NAME>\n"); X+ exit(FAIL); X+ } X+ if (i<l) { X+ /* grab the nation name */ X+ for (j=0;j<NAMELTH&&j<l-i&&cq_opts[i+j]!=',';j++) { X+ name[j] = cq_opts[i+j]; X+ } X+ name[j]='\0'; X+ X+ /* end the parse properly */ X+ i += j-1; X+ if (j==NAMELTH) { X+ for (;i<l && cq_opts[i]!=',';i++); X+ } X+ } X+ break; X+ case 'D': X+ case 'd': X+ /* check for data directory */ X+ if (strncmp(cq_opts+i+1,"ata=",4)==0) { X+ i += 5; X+ } else if (strncmp(cq_opts+i+1,"atadir=",7)==0) { X+ i += 8; X+ } else if (strncmp(cq_opts+i+1,"irectory=",9)==0) { X+ i += 10; X+ } else if (strncmp(cq_opts+i+1,"ir=",3)==0) { X+ i += 4; X+ } else { X+ fprintf(stderr,"conquer: invalid environment\n"); X+ fprintf(stderr,"\t%s = %s\n",ENVIRON_OPTS,cq_opts); X+ fprintf(stderr,"\texpected <data=NAME>\n"); X+ exit(FAIL); X+ } X+ if (i<l) { X+ /* grab the data directory */ X+ for (j=0; j<l-i && cq_opts[i+j]!=',';j++) { X+ defaultdir[j] = cq_opts[i+j]; X+ } X+ defaultdir[j]='\0'; X+ i += j-1; X+ } X+ break; X+ case ' ': X+ case ',': X+ /* ignore commas and spaces */ X+ break; X+ default: X+ /* complain */ X+ fprintf(stderr,"conquer: invalid environment\n"); X+ fprintf(stderr,"\t%s = %s\n",ENVIRON_OPTS,cq_opts); X+ fprintf(stderr,"\tunexpected option <%c>\n",cq_opts[i]); X+ exit(FAIL); X+ break; X+ } X+ } X+ } X+ X+ /* set the default data directory */ X+ if (defaultdir[0] == '\0') { X+ strcpy(defaultdir, DEFAULTDIR); X+ } X+ if (defaultdir[0] != '/') { X+ strcpy(cq_opts, defaultdir); X+ sprintf(defaultdir, "%s/%s", DEFAULTDIR, cq_opts); 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 savetty(); X noecho(); X*************** X*** 93,98 **** X--- 181,189 ---- X endwin(); X putchar('\n'); X exit(SUCCESS); X+ case 'G': X+ Gaudy = TRUE; X+ break; X case 'd': X if(optarg[0]!='/') { X sprintf(defaultdir, "%s/%s", DEFAULTDIR, optarg); X*************** X*** 107,113 **** X sflag++; X break; X case '?': /* print out command line arguments */ X! printf("Command line format: %s [-hs -d DIR -nNAT]\n",argv[0]); 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--- 198,205 ---- 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*************** X*** 157,171 **** X /* get nation name from command line or by asking user. X * if you fail give name of administrator of game X */ X! if (strlen(name) == 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! printf("sorry -- you can not login as god\n"); X! printf("you need to be logged in as %s\n",LOGIN); X exit(FAIL); X } X strcpy(name,"unowned"); X--- 249,268 ---- X /* get nation name from command line or by asking user. 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*************** X*** 179,187 **** X if(strcmp(name,ntn[i].name)==0) country=i; X X if(country==(-1)) { X! printf("name not found\n"); X! printf("\nfor rules type <conquer -h>"); X! printf("\nfor more information please contact %s\n",OWNER); X return; X } else if(country==0) { X sprintf(filename,"%sadd",isonfile); X--- 276,289 ---- 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*************** X*** 203,211 **** 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 more information on the system please contact %s\n",OWNER); X exit(FAIL); X } X } X--- 305,320 ---- 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*** 241,248 **** X (void) aretheyon(); X } else { X if(curntn->active==INACTIVE) { X! mvprintw(LINES-2,0,"Sorry, for some reason, your country no longer exists."); X! mvprintw(LINES-1,0,"If there is a problem, please contact %s.",OWNER); X beep(); X refresh(); X getch(); X--- 350,364 ---- X (void) aretheyon(); X } else { X if(curntn->active==INACTIVE) { X! mvprintw(LINES-3,0,"Sorry, for some reason, your country no longer exists."); X! mvprintw(LINES-2,0,"If there is a problem, please contact %s.", X! OWNER); X! mvprintw(LINES-1,0,"To re-enter this campaign please send mail to %s", X! LOGIN); X! if (strcmp(LOGIN, ntn[0].leader)!=0) { X! printw(" or %s",ntn[0].leader); X! } X! printw("."); X beep(); X refresh(); X getch(); X*************** X*** 250,256 **** X } X if(aretheyon()==TRUE) { X mvprintw(LINES-2,0,"Sorry, country is already logged in."); X! mvprintw(LINES-1,0,"Please try again later. "); X beep(); X refresh(); X getch(); X--- 366,372 ---- X } X if(aretheyon()==TRUE) { X mvprintw(LINES-2,0,"Sorry, country is already logged in."); X! mvprintw(LINES-1,0,"Please try again later."); X beep(); X refresh(); X getch(); X*************** X*** 374,380 **** X void X parse() X { X! char name[20]; X char passwd[PASSLTH+1]; X int ocountry; X X--- 490,496 ---- X void X parse() X { X! char name[LINELTH+1]; X char passwd[PASSLTH+1]; X int ocountry; X X*************** X*** 512,517 **** X--- 628,645 ---- X curntn->tgold -= MOVECOST; X newspaper(); X break; X+ case 'o': /*pick (crsr up)*/ X+ selector-=2; X+ if(selector<0) { X+ selector=SCRARM*2-2; X+ pager--; X+ } X+ /*move to last army in current sector*/ X+ if (pager<0) { X+ pager=(units_in_sector(XREAL,YREAL,country)-1)/SCRARM; X+ selector=((units_in_sector(XREAL,YREAL,country)-1)%SCRARM)*2; X+ } X+ break; X case 'p': /*pick*/ X selector+=2; X if(selector>=SCRARM*2) { X*************** X*** 614,620 **** X break; X case 'z': /*login as new user */ X #ifdef OGOD X! if (owneruid != (getpwnam(LOGIN))->pw_uid) break; X #endif X clear(); X redraw=TRUE; X--- 742,749 ---- X break; 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*************** X*** 665,671 **** X break; X } X X! if(strcmp(fison,"START")!=0) unlink(fison); X X fclose(fexe); X /* open output for future printing*/ X--- 794,802 ---- X break; 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 /* open output for future printing*/ X*************** X*** 949,955 **** X } X X standout(); X! if((sptr->owner==0)||(ntn[sptr->owner].active==NPC_BARBARIAN)) X mvaddstr(LINES-12,COLS-20,"unowned"); X else mvprintw(LINES-12,COLS-20,"owner: %s",ntn[sptr->owner].name); X standend(); X--- 1080,1086 ---- X } X X standout(); X! if((sptr->owner==0)||(ntn[sptr->owner].active==NPC_SAVAGE)) X mvaddstr(LINES-12,COLS-20,"unowned"); X else mvprintw(LINES-12,COLS-20,"owner: %s",ntn[sptr->owner].name); X standend(); X*************** X*** 1013,1019 **** X { X #ifdef TIMELOG X FILE *timefp, *fopen(); X! char string[80]; X #endif /* TIMELOG */ X X clear(); X--- 1144,1150 ---- X { X #ifdef TIMELOG X FILE *timefp, *fopen(); X! char string[LINELTH+1]; X #endif /* TIMELOG */ X X clear(); X*************** X*** 1082,1088 **** X void X camp_info() X { X! int mercs=0,solds=0,armynum,nvynum; X int numarm=0,numnvy=0,numlead=0; X X clear(); X--- 1213,1219 ---- X void X camp_info() X { X! int mercs=0,solds=0,armynum,nvynum,nontn=0; X int numarm=0,numnvy=0,numlead=0; X X clear(); X*************** X*** 1107,1121 **** X for(nvynum=0;nvynum<MAXNAVY;nvynum++) { X if (P_NWSHP!=0||P_NGSHP!=0||P_NMSHP!=0) numnvy++; X } X X /* global information */ X mvprintw(7,0,"World Map Size............. %dx%d", MAPX, MAPY); X mvprintw(8,0,"Currently Active Nations... %d", WORLDNTN); X! mvprintw(9,0,"Maximum Active Nations..... %d", NTOTAL-1); X! mvprintw(10,0,"Land displacement to meet.. %d", MEETNTN); X mvprintw(11,0,"Maximum Number of Armies... %d", MAXARM); X mvprintw(12,0,"Maximum Number of Navies... %d", MAXNAVY); X! mvprintw(13,0,"Chance of Scout Capture.... %d%%", PFINDSCOUT); X X /* user information */ X mvprintw(7,COLS-40,"Number of Leaders........... %d",numlead); X--- 1238,1256 ---- X for(nvynum=0;nvynum<MAXNAVY;nvynum++) { X if (P_NWSHP!=0||P_NGSHP!=0||P_NMSHP!=0) numnvy++; X } X+ for(armynum=1;armynum<NTOTAL;armynum++) { X+ if (ismonst(ntn[armynum].active)) nontn++; X+ } X X /* global information */ X mvprintw(7,0,"World Map Size............. %dx%d", MAPX, MAPY); X mvprintw(8,0,"Currently Active Nations... %d", WORLDNTN); X! mvprintw(9,0,"Maximum Active Nations..... %d", NTOTAL-nontn-1); X! mvprintw(10,0,"Number of Monster Nations.. %d", nontn); X mvprintw(11,0,"Maximum Number of Armies... %d", MAXARM); X mvprintw(12,0,"Maximum Number of Navies... %d", MAXNAVY); X! mvprintw(13,0,"Land displacement to meet.. %d", MEETNTN); X! mvprintw(14,0,"Chance of Scout Capture.... %d%%", PFINDSCOUT); X X /* user information */ X mvprintw(7,COLS-40,"Number of Leaders........... %d",numlead); X*************** X*** 1124,1129 **** X--- 1259,1272 ---- X mvprintw(10,COLS-40,"Total Soldiers in Nation.... %d",solds); X mvprintw(11,COLS-40,"Current Number of Armies.... %d",numarm); X mvprintw(12,COLS-40,"Current Number of Navies.... %d",numnvy); X+ X+ /* other information */ X+ mvprintw(LINES-6,0,"The Diety: %s", LOGIN); X+ if (strcmp(LOGIN,ntn[0].leader)==0) { X+ mvprintw(LINES-5,0,"The Demi-God: [none]"); X+ } else { X+ mvprintw(LINES-5,0,"The Demi-God: %s", ntn[0].leader); X+ } X X standout(); X mvaddstr(LINES-2,COLS/2-13," HIT ANY KEY TO CONTINUE"); X*** onpc.c Tue Jul 18 22:04:43 1989 X--- npc.c Tue Jul 18 22:05:03 1989 X*************** X*** 88,94 **** X curntn = &ntn[country]; X if( curntn->active==NPC_NOMAD ) do_nomad(); X else if( curntn->active==NPC_PIRATE ) do_pirate(); X! else if( curntn->active==NPC_BARBARIAN ) do_barbarian(); X else if( curntn->active==NPC_LIZARD ) do_lizard(); /* update.c */ X } X } X--- 88,94 ---- X curntn = &ntn[country]; X if( curntn->active==NPC_NOMAD ) do_nomad(); X else if( curntn->active==NPC_PIRATE ) do_pirate(); X! else if( curntn->active==NPC_SAVAGE ) do_savage(); X else if( curntn->active==NPC_LIZARD ) do_lizard(); /* update.c */ X } X } X*************** X*** 155,166 **** X } X X void X! do_barbarian() X { X short armynum; X int x, y; X X! printf("updating barbarian (nation %d)\n",country); X for(armynum=0;armynum<MAXARM;armynum++) if(P_ASOLD>0){ X P_ASTAT=ATTACK; X if(P_ATYPE<MINLEADER) { X--- 155,166 ---- X } X X void X! do_savage() X { X short armynum; X int x, y; X X! printf("updating savage (nation %d)\n",country); X for(armynum=0;armynum<MAXARM;armynum++) if(P_ASOLD>0){ X P_ASTAT=ATTACK; X if(P_ATYPE<MINLEADER) { X*************** X*** 177,184 **** X /*if owned & unoccupied you take & people flee*/ X if( ((sct[x][y].owner == 0) X || (solds_in_sector( x, y, sct[x][y].owner) == 0)) X! && (ntn[sct[x][y].owner].active != NPC_BARBARIAN)) { X! fprintf(fnews,"3.\tbarbarians capture sector %d,%d\n",x,y); X if(P_ATYPE<MINLEADER) { X if(sct[x][y].owner!=0) flee(x,y,1,FALSE); X sct[x][y].owner=country; X--- 177,184 ---- X /*if owned & unoccupied you take & people flee*/ X if( ((sct[x][y].owner == 0) X || (solds_in_sector( x, y, sct[x][y].owner) == 0)) X! && (ntn[sct[x][y].owner].active != NPC_SAVAGE)) { X! fprintf(fnews,"3.\tsavages capture sector %d,%d\n",x,y); X if(P_ATYPE<MINLEADER) { X if(sct[x][y].owner!=0) flee(x,y,1,FALSE); X sct[x][y].owner=country; X*************** X*** 187,193 **** X } X } X } X! /* place a few new Barbarian armies */ X for(armynum=0;armynum<MAXARM;armynum++) if(P_ASOLD<=0){ X x=(rand()%(MAPX-8))+4; X y=(rand()%(MAPY-8))+4; X--- 187,193 ---- X } X } X } 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 y=(rand()%(MAPY-8))+4; X*************** X*** 1125,1131 **** X--- 1125,1135 ---- X void X n_unowned() 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*************** X*** 1152,1158 **** X attr[x][y]+=100; X } X attr[x][y] += 50*tofood(&sct[x][y],country); X! if(!is_habitable(x,y)) attr[x][y] /= 5; X } X } X } X--- 1156,1171 ---- X attr[x][y]+=100; X } X attr[x][y] += 50*tofood(&sct[x][y],country); X! X! if(!is_habitable(x,y)) { X! #ifdef XENIX X! z = attr[x][y]; X! z /= 5; X! attr[x][y] = z; X! #else X! attr[x][y] /= 5; X! #endif /*XENIX*/ X! } X } X } X } X*** onewlogin.h Tue Jul 18 22:04:43 1989 X--- newlogin.h Tue Jul 18 22:05:03 1989 X*************** X*** 1,67 **** X /*conquer : Copyright (c) 1988 by Ed Barlow. */ X- /* initial starting stats */ X X! /*dwarf*/ X! #define NLDGOLD 100000L X! #define NLDFOOD 35000L X! #define NLDJEWEL 15000L X! #define NLDMETAL 15000L X! #define NLDCIVIL 6000L X! #define NLDMILIT 1000L X! #define NLDREPRO 4 X! #define NLDMMOVE 6 X! #define NLDAPLUS 20 X! #define NLDDPLUS 20 X X! /*elf*/ X! #define NLEGOLD 100000L X! #define NLEFOOD 35000L X! #define NLEJEWEL 15000L X! #define NLEMETAL 15000L X! #define NLECIVIL 7000L X! #define NLEMILIT 200L X! #define NLEREPRO 5 X! #define NLEMMOVE 8 X! #define NLEAPLUS 10 X! #define NLEDPLUS 40 X X! /*orc*/ X! #define NLOGOLD 1000L X! #define NLOFOOD 35000L X! #define NLOJEWEL 15000L X! #define NLOMETAL 15000L X! #define NLOCIVIL 6000L X! #define NLOMILIT 2000L X! #define NLOREPRO 8 X! #define NLOMMOVE 6 X! #define NLOAPLUS 0 X! #define NLODPLUS 0 X X! /*human*/ X! #define NLHGOLD 1000L X! #define NLHFOOD 35000L X! #define NLHJEWEL 15000L X! #define NLHMETAL 15000L X! #define NLHCIVIL 6000L X! #define NLHMILIT 1000L X! #define NLHREPRO 5 X! #define NLHMMOVE 10 X! #define NLHAPLUS 15 X! #define NLHDPLUS 10 X X! /* the purchase definitions and/or costs */ X! #define NLPOP 1000L X! #define NLGOLD 100000L X! #define NLLOCCOST 1 X! #define NLSOLD 900L X! #define NLATTACK 10 X! #define NLDEFENCE 10 X! #define NLREPRO_ORC 2 /* repro points per NLREPCOST for orcs */ X! #define NLREPRO 1 /* repro points per NLREPCOST for others */ X! #define NLREPCOST 3 X! #define NLMOVE 2 X! #define NLDBLCOST 1 X! #define NLMAGIC 3 X! /* get NLEADER leaders for NLEADPT points */ X! #define NLEADER 3 X! #define NLEADPT 1 X--- 1,104 ---- X /*conquer : Copyright (c) 1988 by Ed Barlow. */ X X! /*selection defines */ X! #define CH_PEOPLE 0 X! #define CH_TREASURY 1 X! #define CH_LOCATE 2 X! #define CH_SOLDIERS 3 X! #define CH_ATTACK 4 X! #define CH_DEFEND 5 X! #define CH_REPRO 6 X! #define CH_MOVEMENT 7 X! #define CH_MAGIC 8 X! #define CH_LEADERS 9 X! #define CH_RAWGOODS 10 X! /* how many selections there are */ X! #define CH_NUMBER 11 X X! /* location defines */ X! #define NLRANDOM 0 X! #define NLFAIR 1 X! #define NLGOOD 2 X X! /* direction defines */ X! #define ADDITION 0 X! #define SUBTRACTION 1 X X! /* number of units for dwarf nations */ X! #define NLDGOLD 1 X! #define NLDRAW 1 X! #define NLDCIVIL 6 X! #define NLDMILIT 2 X! #define NLDREPRO 4 X! #define NLDMMOVE 6 X! #define NLDAPLUS 20 X! #define NLDDPLUS 20 X X! /* number of units for elf nations */ X! #define NLEGOLD 1 X! #define NLERAW 1 X! #define NLECIVIL 7 X! #define NLEMILIT 1 X! #define NLEREPRO 5 X! #define NLEMMOVE 8 X! #define NLEAPLUS 10 X! #define NLEDPLUS 40 X! X! /* number of units for orc nations */ X! #define NLOGOLD 0 X! #define NLORAW 1 X! #define NLOCIVIL 8 X! #define NLOMILIT 2 X! #define NLOREPRO 8 X! #define NLOMMOVE 6 X! #define NLOAPLUS 0 X! #define NLODPLUS 0 X! X! /* number of units for human nations */ X! #define NLHGOLD 0 X! #define NLHRAW 1 X! #define NLHCIVIL 6 X! #define NLHMILIT 2 X! #define NLHREPRO 5 X! #define NLHMMOVE 10 X! #define NLHAPLUS 20 X! #define NLHDPLUS 10 X! X! /* the following has been placed in the header for clarity in configuration */ X! /* since newlogin.c is the only file to include this file, there should */ X! /* be no problems; even though it is probably not a good idea. */ X! X! /* the minimum/maximum levels for each selection */ X! int Minvalues[]= { 6, 0, 0, 1, 0, 0, 4, 6, 0, 4, 1 }; X! int Maxvalues[]= { 50, 10, 2, 20, 80, 80, 10, 30, 5, MAXARM/2, 10 }; X! X! /* the number of points spent on each selection */ X! int Mcost[]= { 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1 }; X! X! /* the number of units per cost */ X! int Munits[]= { 1, 1, 1, 1, 8, 8, 1, 2, 1, 3, 1 }; X! X! /* The list of corresponding values of each unit */ X! long Mvalues[]= { 1000L, 100000L, 1L, 1000L, 1L, 1L, 1L, X! 1L, 1L, 1L, 30000L }; X! X! /* values for jewels and metal (food is last in array above) */ X! #define NLJEWELS 15000L X! #define NLMETAL 15000L X! X! /* the old definitions */ X! #define ONLPOP 1000L X! #define ONLGOLD 100000L X! #define ONLLOCCOST 1 X! #define ONLSOLD 900L X! #define ONLATTACK 10 X! #define ONLDEFENCE 10 X! #define ONLREPRO_ORC 2 /* repro points per ONLREPCOST for orcs */ X! #define ONLREPRO 1 /* repro points per ONLREPCOST for others */ X! #define ONLREPCOST 3 X! #define ONLMOVE 2 X! #define ONLDBLCOST 1 X! #define ONLMAGIC 3 X! /* get ONLEADER leaders for ONLEADPT points */ X! #define ONLEADER 3 X! #define ONLEADPT 1 X*** otrade.c Tue Jul 18 22:04:45 1989 X--- trade.c Tue Jul 18 22:05:04 1989 X*************** X*** 166,171 **** X--- 166,172 ---- X mvaddstr(count++,0,"What item number do you want to purchase? "); X refresh(); X holdint = get_number(); X+ if (holdint<0) break; X /* check for minor sales */ X if (holdint==GETFOOD || holdint==GETMETAL || holdint==GETJEWL) { X /* strange flow but less control needed */ X*************** X*** 216,221 **** X--- 217,223 ---- X refresh(); X holdlong2 = 0L; X holdlong = (long) get_number(); X+ if (holdlong< 0L) break; X /* check for valid bid */ X switch(type2[holdint]) { X case TDGOLD: X*************** X*** 258,263 **** X--- 260,266 ---- X mvaddstr(count++,0,"What Y position? "); X refresh(); X holdlong2 = (long) get_number(); X+ if (holdlong2 < 0L) break; X if (checkland(BUY,(int)(holdlong),(int)(holdlong2))==NODEAL) { X buysell=NODEAL; X } else if (tofood( &sct[(int)holdlong][(int)holdlong2],natn[holdint]) < lvar2[holdint]) { X*************** X*** 329,334 **** X--- 332,338 ---- X refresh(); X /* find out how much commodities */ X holdlong = (long) get_number(); X+ if (holdlong < 0) return; X extint = 0; X if (holdint< TDLAND && holdlong==0L) X return; X*************** X*** 363,368 **** X--- 367,376 ---- X mvprintw(count++,0,"What Y position? "); X refresh(); X extint = get_number(); X+ if (extint < 0) { X+ buysell=NODEAL; X+ break; X+ } X buysell = checkland(SELL,(int)holdlong,extint); X break; X case TDARMY: X*************** X*** 409,415 **** X ,commodities[holdint2]); X refresh(); X holdlong2 = (long) get_number(); X! if (holdlong2 == 0L) return; X } X X /* make sure what was bid is unusable */ X--- 417,423 ---- X ,commodities[holdint2]); X refresh(); X holdlong2 = (long) get_number(); X! if (holdlong2 <= 0L) return; X } X X /* make sure what was bid is unusable */ X*************** X*** 442,447 **** X--- 450,456 ---- X mvaddstr(count++,0,"What item number to remove? "); X refresh(); X holdint = get_number(); X+ if (holdint < 0) return; X if (holdint==0 || holdint>itemnum) { X tradeerr("Invalid Item Number"); X return; X*************** X*** 572,580 **** X break; X case 'f': X case 'F': X! /* hold=TDFOOD; */ X! /* temporarily not allow */ X! mvaddstr((*count)++,0," Food Trades Suspended"); X break; X case 'i': X case 'I': X--- 581,587 ---- X break; X case 'f': X case 'F': X! hold=TDFOOD; X break; X case 'i': X case 'I': X*************** X*** 594,602 **** X break; X case 's': X case 'S': X! /* hold=TDSHIP; */ X! /* temporarily not allow */ X! mvaddstr((*count)++,0," Ship Trades Suspended"); X break; X default: X break; X--- 601,607 ---- X break; X case 's': X case 'S': X! hold=TDSHIP; X break; X default: X break; X*************** X*** 797,803 **** X { X FILE *fp[2]; X int count; X! char cname[2][12],filename[2][80]; X X sprintf(filename[0],"%s%d",msgfile,cntry1); X sprintf(filename[1],"%s%d",msgfile,cntry2); X--- 802,808 ---- X { X FILE *fp[2]; X int count; X! char cname[2][NAMELTH+1],filename[2][FILELTH]; X X sprintf(filename[0],"%s%d",msgfile,cntry1); X sprintf(filename[1],"%s%d",msgfile,cntry2); X*** ocheck.c Tue Jul 18 22:04:40 1989 X--- check.c Tue Jul 18 22:05:04 1989 X*************** X*** 147,153 **** X X #include <fcntl.h> X #ifdef FILELOCK X! #include <sys/file.h> X #endif FILELOCK X X /* X--- 147,159 ---- X X #include <fcntl.h> X #ifdef FILELOCK X! #ifdef LOCKF X! # include <unistd.h> X! # define do_lock(fd) lockf(fd,F_TLOCK,0) X! #else X! # include <sys/file.h> X! # define do_lock(fd) flock(fd,LOCK_EX|LOCK_NB) X! #endif X #endif FILELOCK X X /* X*************** X*** 165,172 **** X #ifdef FILELOCK X int fd; X X! if ((fd=open(filename,O_CREAT,0600))!=(-1)) { X! if(flock(fd, LOCK_EX|LOCK_NB)==(-1)) { X hold=TRUE; X } X /* remove lock after checking */ X--- 171,178 ---- X #ifdef FILELOCK X int fd; X X! if ((fd=open(filename,O_WRONLY|O_CREAT,0600))!=(-1)) { X! if(do_lock(fd)==(-1)) { X hold=TRUE; X } X /* remove lock after checking */ X*** onavy.c Tue Jul 18 22:04:43 1989 X--- navy.c Tue Jul 18 22:05:04 1989 X*************** X*** 441,447 **** X amount=get_number(); X if(amount > mhold*P_NPEOP) { X errormsg("There are not that many on board"); X! } else { X sct[XREAL][YREAL].people += amount; X P_NPEOP=(unsigned char)((mhold*P_NPEOP-amount)/mhold); X NADJHLD; X--- 441,447 ---- X amount=get_number(); X if(amount > mhold*P_NPEOP) { X errormsg("There are not that many on board"); X! } else if (amount > 0) { X sct[XREAL][YREAL].people += amount; X P_NPEOP=(unsigned char)((mhold*P_NPEOP-amount)/mhold); X NADJHLD; X*************** X*** 469,475 **** X mvaddstr(LINES-2,0,"Load what army?"); X refresh(); X armynum = get_number(); X! if((armynum<0)||(armynum>=MAXARM)||(P_ASOLD<=0) X ||(loadstat(P_ASTAT)==FALSE)) { X errormsg("Invalid Army"); X } else if((P_AXLOC!=XREAL)||(P_AYLOC!=YREAL)) { X--- 469,477 ---- X mvaddstr(LINES-2,0,"Load what army?"); X refresh(); X armynum = get_number(); X! if(armynum<0) { X! ; X! } else if((armynum>=MAXARM)||(P_ASOLD<=0) X ||(loadstat(P_ASTAT)==FALSE)) { X errormsg("Invalid Army"); X } else if((P_AXLOC!=XREAL)||(P_AYLOC!=YREAL)) { X*************** X*** 497,503 **** X errormsg("Not enough room on fleet"); X } else if(sct[XREAL][YREAL].people < amount) { X errormsg("Not enough people in sector"); X! } else { X sct[XREAL][YREAL].people -= amount; X P_NPEOP += (unsigned char)(amount / mhold); X SADJCIV; X--- 499,505 ---- X errormsg("Not enough room on fleet"); X } else if(sct[XREAL][YREAL].people < amount) { X errormsg("Not enough people in sector"); X! } else if (amount > 0) { X sct[XREAL][YREAL].people -= amount; X P_NPEOP += (unsigned char)(amount / mhold); X SADJCIV; X*** otxt0 Tue Jul 18 22:04:45 1989 X--- txt0 Tue Jul 18 22:05:05 1989 X*************** X*** 1,21 **** X CONQUER COMMAND HELP SCREEN X X! MOVEMENT COMMANDS ADMINISTRATION X! 'h': move west 'a': army report 'p': pick item X! 'y': move north-west 'r': redesignate 'd': change display X! 'k': move north 'w': cast spells/summon 'c': administration X! 'u': move north-east 'm': move selected unit '?': help screen X! 'l': move east 'F': go to next fleet 's': score X! 'n': move south-east 'f': fleet report 'B': budget status X! 'j': move south 'Z': move people 2 Sectors 'P': production stats X! 'b': move south-west 'S': diplomacy status 'N': read newspaper X! 'J': scroll south 'Q': quit (saves changes) 'W': write message X! 'K': scroll north 'M': magic 'R': read messages X! 'L': scroll east 'C': construct 'T': trade X! 'H': scroll west 'D': draft 't': transport via ship X! 'G': go to next army 'v': version credits X! 'g': group army report 'I': campaign information X! 'ctrl-L': redraw 'ESC': extra commands X END X CONQUER EXTENDED COMMANDS X X--- 1,24 ---- X CONQUER COMMAND HELP SCREEN X X! SELECTIVE MOVEMENT CIVIL X! 'o': pick previous unit 'h': move west 'r': redesignate X! 'p': pick next unit 'y': move north-west 't': transport via ship X! 'G': go to next army 'k': move north 'C': construct X! 'F': go to next fleet 'u': move north-east 'D': draft armies X! 'm': move selected unit 'l': move east 'Z': move civilians X! 'n': move south-east X! FORMS 'j': move south COMMUNICATIVE X! 'c': administrative 'b': move south-west 'R': read mail messages X! 's': world score list 'J': scroll south 'N': read newspaper X! 'B': budget status 'K': scroll north 'T': trade with players X! 'I': campaign info 'L': scroll east 'W': write mail messages X! 'M': magic screen 'H': scroll west X! 'P': production status MILITARY X! 'S': diplomacy status MISC COMMANDS 'a': army report X! 'q': quit and save 'f': fleet report X! VISUAL 'v': version credits 'g': group army report X! 'd': change display 'Q': quit and save 'w': wizardry commands X! 'cntrl-L': redraw '?': help screens 'ESC': extra commands X END X CONQUER EXTENDED COMMANDS X X*************** X*** 49,62 **** X of gold for your treasury. Also, metals are needed to build ships & armies, X and food is needed to prevent revolts and keep people alive. X X! Command line format: conquer [-hs -nNAT -dDIR] X! -h print this help text X! -s print out scores X! -n NTN run as nation NTN X! -d DIR run on data in directory DIR X! It is suggested that each player set up a shell alias for their game & nation X The game administrator should read documentation on using the conqrun command. X END X CONQUER CURSOR MOVEMENT X X NORTH X--- 52,102 ---- X of gold for your treasury. Also, metals are needed to build ships & armies, X and food is needed to prevent revolts and keep people alive. X X! Command format: conquer [-Ghs -nNAT -dDIR] X! -G highlight name in news (gaudy!) X! -h print this help text X! -s print out scores X! -n NTN run as nation NTN X! -d DIR run on data in directory DIR X! X The game administrator should read documentation on using the conqrun command. X END X+ CONQUER ENVIRONMENT VARIABLES X+ X+ To facilitate the use of conquer, the environment variable X+ XCONQENV has been added to conquer to allow settings of default options X+ to conquer. Just add a line to your .cshrc or .login file with the X+ following format: X+ X+ setenv XCONQENV "G,nation=MyLand,datadir=this_game" X+ X+ If you then type just 'conquer' to enter conquer, it will be SHAR_EOF echo "End of part 3, continue with part 4" echo "4" > s2_seq_.tmp exit 0