billr@saab.CNA.TEK.COM (Bill Randle) (12/22/89)
Submitted-by: Adam Bryant <adb@cs.bu.edu> Posting-number: Volume 8, Issue 77 Archive-name: conquer4/Patch7b Patch-To: conquer4: Volume 6, Issue 83-96 #!/bin/sh # this is part 2 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file patchV4.7 continued # CurArch=2 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file patchV4.7" sed 's/^X//' << 'SHAR_EOF' >> patchV4.7 X! if (stat(tmp_mail_name,&fst)==0) { X! long now; X! now = time(0); X! if (now - fst.st_mtime < TIME_DEAD) { X! if (to>=0 && to<NTOTAL) { X! sprintf(line,"Someone is already mailing Nation %s... try again later.", ntn[to].name); X! errormsg(line); X! } X! return(-1); X! } else { X! /* remove useless file */ X! unlink(tmp_mail_name); X! } X } X #endif /*CONQUER*/ X #ifdef ADMIN X*************** X*** 1504,1516 **** X return(-1); X } X mailok=to; X } X X void X mailclose(to) X { X- char line[BIGLTH]; X- X if(mailok==DONEMAIL) return; X X if(to >= 0) { X--- 1531,1542 ---- X return(-1); X } X mailok=to; X+ return(0); X } X X void X mailclose(to) X { X if(mailok==DONEMAIL) return; X X if(to >= 0) { X*************** X*** 1520,1525 **** X--- 1546,1552 ---- X X #ifdef CONQUER X if((to!=ABORTMAIL)&&(to==mailok)) { X+ char line[BIGLTH]; X if (to==NEWSMAIL) { X /* send to the current newspaper */ X sprintf(line,"cat %s >> news%d",tmp_mail_name,TURN-1); X*************** X*** 1788,1795 **** X } X X #ifdef CONQUER X- #include <sys/types.h> X- #include <sys/stat.h> X extern short xcurs; X extern short ycurs; X off_t conq_mail_size=0; X--- 1815,1820 ---- X*** oreports.c Tue Dec 12 21:19:37 1989 X--- reports.c Tue Dec 12 21:20:07 1989 X*************** X*** 299,305 **** X { X short armynum,nvynum; X long numship=0L,costsold=0L,numsold=0L; X! long nummonst=0L,costmonst=0L,money,chty; X int isgod=FALSE; X X if(country==0) { X--- 299,305 ---- X { X short armynum,nvynum; X long numship=0L,costsold=0L,numsold=0L; X! long nummonst=0L,costmonst=0L,money,chty,infmoney; X int isgod=FALSE; X X if(country==0) { X*************** X*** 330,368 **** X numship+=flthold(nvynum); X X standout(); X! mvprintw(3,0, "nation name is......%s",curntn->name); X standend(); X! mvprintw(4,0, "starting treasury..$%ld",startgold); X! mvprintw(5,0, "number of sectors...%d",spread.sectors); X if(curntn->tfood<2*curntn->tciv) standout(); X! mvprintw(7,0, "granary holds.....%8ld",curntn->tfood); X standend(); X! mvprintw(8,0, "jewels owned......%8ld",curntn->jewels); X! mvprintw(9,0, "metal ore owned...%8ld",curntn->metals); X! mvprintw(3,COLS-50, "%8ld people in gold mines.%8ld",spread.ingold,spread.revjewels); X! mvprintw(4,COLS-50, "%8ld people in mines......%8ld",spread.inmetal,spread.revmetal); X! mvprintw(5,COLS-50, "%8ld people in farms......%8ld",spread.infarm,spread.revfood); X! mvprintw(6,COLS-50,"%8ld people in cities.....%8ld",spread.incap,spread.revcap); X! mvprintw(7,COLS-50,"%8ld people in towns......%8ld",spread.incity,spread.revcity); X! mvprintw(8,COLS-50, "%8ld people elsewhere.....%8ld",spread.inothr,spread.revothr); X standout(); X! mvprintw(9,COLS-50,"%8ld people INCOME........%8ld",spread.civilians,spread.gold - curntn->tgold); X standend(); X! mvprintw(11,COLS-50,"%8ld troops...............%8ld",numsold,costsold); X! mvprintw(12,COLS-50,"%8ld monsters.............%8ld",nummonst,costmonst); X X! mvprintw(13,COLS-50,"%8ld ship holds @ %4d....%8ld",numship,SHIPMAINT,numship*SHIPMAINT); X! mvprintw(14,COLS-50,"other expenses this turn......%8ld",startgold-curntn->tgold); X standout(); X money=costmonst+costsold+(numship*SHIPMAINT)+startgold-curntn->tgold; X! mvprintw(15,COLS-50,"TOTAL EXPENSES................%8ld",money); X! money=spread.gold - curntn->tgold - money; /* net income */ X standend(); X! mvprintw(17,COLS-50,"NET INCOME....................%8ld",money); X chty = max((money*(long)curntn->charity)/100L,0L); X! mvprintw(16,COLS-50,"CHARITY.......................%8ld",chty); X standout(); X! mvprintw(18,COLS-50,"NEXT SEASON'S TREASURY........%8ld",(startgold + money-chty)); X X mvaddstr(LINES-3,(COLS/2)-15,"HIT 'P' TO SEE PRODUCTION SCREEN"); X mvaddstr(LINES-2,(COLS/2)-15,"HIT 'C' FOR CHANGE NATION SCREEN"); X--- 330,375 ---- X numship+=flthold(nvynum); X X standout(); X! mvprintw(2,0, "nation name is......%s",curntn->name); X standend(); X! mvprintw(3,0, "starting treasury..$%ld",startgold); X! mvprintw(4,0, "number of sectors...%d",spread.sectors); X if(curntn->tfood<2*curntn->tciv) standout(); X! mvprintw(6,0, "granary holds.....%8ld",curntn->tfood); X standend(); X! mvprintw(7,0, "jewels owned......%8ld",curntn->jewels); X! mvprintw(8,0, "metal ore owned...%8ld",curntn->metals); X! mvprintw(2,COLS-50, "%8ld people in gold mines.%8ld",spread.ingold,spread.revjewels); X! mvprintw(3,COLS-50, "%8ld people in mines......%8ld",spread.inmetal,spread.revmetal); X! mvprintw(4,COLS-50, "%8ld people in farms......%8ld",spread.infarm,spread.revfood); X! mvprintw(5,COLS-50,"%8ld people in cities.....%8ld",spread.incap,spread.revcap); X! mvprintw(6,COLS-50,"%8ld people in towns......%8ld",spread.incity,spread.revcity); X! mvprintw(7,COLS-50, "%8ld people elsewhere.....%8ld",spread.inothr,spread.revothr); X standout(); X! mvprintw(8,COLS-50,"%8ld people INCOME........%8ld",spread.civilians,spread.gold - curntn->tgold); X standend(); X! mvprintw(10,COLS-50,"%8ld troops...............%8ld",numsold,costsold); X! mvprintw(11,COLS-50,"%8ld monsters.............%8ld",nummonst,costmonst); X X! mvprintw(12,COLS-50,"%8ld ship holds @ %4d....%8ld",numship,SHIPMAINT,numship*SHIPMAINT); X! mvprintw(13,COLS-50,"other expenses this turn......%8ld",startgold-curntn->tgold); X standout(); X money=costmonst+costsold+(numship*SHIPMAINT)+startgold-curntn->tgold; X! mvprintw(14,COLS-50,"TOTAL EXPENSES................%8ld",money); X standend(); X! money=spread.gold - curntn->tgold - money; /* net income */ X chty = max((money*(long)curntn->charity)/100L,0L); X! mvprintw(15,COLS-50,"CHARITY.......................%8ld",chty); X! mvprintw(16,COLS-50,"NET INCOME....................%8ld",money); X! infmoney = startgold + money - chty; X! if (infmoney > 1000000L) { X! infmoney = (long)(infmoney / (100.0+(float)curntn->inflation/4.0)) * 100L; X! } else { X! infmoney= (long) (infmoney * 100L) / (100.0 + (float) curntn->inflation/4.0); X! } X! mvprintw(17,COLS-50,"LOSS DUE TO INFLATION.........%8ld",(startgold + money-chty)-infmoney); X standout(); X! mvprintw(18,COLS-50,"NEXT SEASON'S TREASURY........%8ld",infmoney); X X mvaddstr(LINES-3,(COLS/2)-15,"HIT 'P' TO SEE PRODUCTION SCREEN"); X mvaddstr(LINES-2,(COLS/2)-15,"HIT 'C' FOR CHANGE NATION SCREEN"); X*************** X*** 644,650 **** X NADJGAL; X NADJCRW; X NADJHLD; X! if(P_NMOVE>curntn->nvy[newnavy].smove) X curntn->nvy[newnavy].smove=P_NMOVE; X P_NMOVE=0; X NADJMOV; X--- 651,657 ---- X NADJGAL; X NADJCRW; X NADJHLD; X! if(P_NMOVE<curntn->nvy[newnavy].smove) X curntn->nvy[newnavy].smove=P_NMOVE; X P_NMOVE=0; X NADJMOV; X*** ocombat.c Tue Dec 12 21:19:34 1989 X--- combat.c Tue Dec 12 21:20:08 1989 X*************** X*** 633,640 **** X if((ntn[UOWNER(k)].arm[unit[k]].unittyp >= MINLEADER) X &&( ntn[UOWNER(k)].arm[unit[k]].sold == 0)) X fprintf(fm," (killed)\n"); X! else if((ntn[owner[k]].arm[unit[k]].unittyp == A_MILITIA) X! &&( ntn[owner[k]].arm[unit[k]].sold == 0)) X fprintf(fm," (disbanded)\n"); X else fputc('\n',fm); X } X--- 633,640 ---- X if((ntn[UOWNER(k)].arm[unit[k]].unittyp >= MINLEADER) X &&( ntn[UOWNER(k)].arm[unit[k]].sold == 0)) X fprintf(fm," (killed)\n"); X! else if((ntn[UOWNER(k)].arm[unit[k]].unittyp == A_MILITIA) X! &&( ntn[UOWNER(k)].arm[unit[k]].sold == 0)) X fprintf(fm," (disbanded)\n"); X else fputc('\n',fm); X } X*** omove.c Tue Dec 12 21:19:36 1989 X--- move.c Tue Dec 12 21:20:08 1989 X*************** X*** 276,286 **** X } else X if(((sct[XREAL][YREAL].designation==DTOWN) X ||(sct[XREAL][YREAL].designation==DCAPITOL) X! ||(sct[XREAL][YREAL].designation==DCITY))){ X /* harbor */ X! if(P_NMOVE>=4) P_NMOVE-=4; X else { X! errormsg("You need 4 move points for that"); X valid=FALSE; X xcurs=oldxcurs; X ycurs=oldycurs; X--- 276,289 ---- X } else X if(((sct[XREAL][YREAL].designation==DTOWN) X ||(sct[XREAL][YREAL].designation==DCAPITOL) X! ||(sct[XREAL][YREAL].designation==DCITY)) X! &&(sct[XREAL][YREAL].owner==country X! ||(ntn[SOWN].dstatus[country]!=UNMET&& X! ntn[SOWN].dstatus[country]<=NEUTRAL))) { X /* harbor */ X! if(P_NMOVE>=3) P_NMOVE-=3; X else { X! errormsg("You need 3 move points for that"); X valid=FALSE; X xcurs=oldxcurs; X ycurs=oldycurs; X*************** X*** 326,333 **** X P_NMOVE -= abs( movecost[XREAL][YREAL] ); X } X X! if(P_NMOVE==0) X! done=TRUE; X X } else if(armornvy==AORN){ X errormsg("ERROR - NOT ARMY OR NAVY"); X--- 329,335 ---- X P_NMOVE -= abs( movecost[XREAL][YREAL] ); X } X X! if(P_NMOVE==0) done=TRUE; X X } else if(armornvy==AORN){ X errormsg("ERROR - NOT ARMY OR NAVY"); X*************** X*** 474,479 **** X--- 476,494 ---- X /* if (other owner and unoccupied) or (no owner) you take*/ X if(((P_ATYPE<MINLEADER)||(P_ASTAT==GENERAL)) X &&(P_ASOLD>0)){ X+ /*calc enemy soldiers */ X+ total=0; X+ for(Tnation=0;Tnation<NTOTAL;Tnation++) X+ if(Tnation!=country) X+ for(Tarmynum=0;Tarmynum<MAXARM;Tarmynum++) X+ if((ntn[Tnation].arm[Tarmynum].sold>0) X+ &&(ntn[Tnation].arm[Tarmynum].xloc==XREAL) X+ &&(ntn[Tnation].arm[Tarmynum].yloc==YREAL) X+ &&((curntn->dstatus[Tnation]>=HOSTILE) X+ ||(ntn[Tnation].dstatus[country]>=HOSTILE)) X+ &&(ntn[Tnation].arm[Tarmynum].stat!=SCOUT) X+ &&(ntn[Tnation].arm[Tarmynum].unittyp!=A_NINJA)) X+ total+=ntn[Tnation].arm[Tarmynum].sold; X if((groupmen>=TAKESECTOR)&&(SOWN==0 )){ X mvaddstr(LINES-2,0,"Taking Unowned Sector"); X clrtoeol(); X*************** X*** 573,581 **** X refresh(); X getch(); X } X- whatcansee(); X redraw=DONE; X prep(country,FALSE); X makemap(); X armornvy=AORN; X pager=0; X--- 588,598 ---- X refresh(); X getch(); X } X redraw=DONE; X prep(country,FALSE); X+ whatcansee(); X+ move(0,0); X+ clrtobot(); X makemap(); X armornvy=AORN; X pager=0; X*** oupdate.c Tue Dec 12 21:19:38 1989 X--- update.c Tue Dec 12 21:20:09 1989 X*************** X*** 12,20 **** X X #include <ctype.h> X #ifndef XENIX X #include <sys/file.h> X #else X! #include <unistd.h> X #endif X #include "header.h" X #include "data.h" X--- 12,21 ---- X X #include <ctype.h> X #ifndef XENIX X+ #include <sys/types.h> X #include <sys/file.h> X #else X! #include <unistd.h> X #endif X #include "header.h" X #include "data.h" X*************** X*** 120,126 **** X { X register struct s_sector *sptr = &sct[x][y]; X int designation; X! int Attr = 1; X X designation=sptr->designation; X if(sptr->tradegood != TG_none X--- 121,127 ---- X { X register struct s_sector *sptr = &sct[x][y]; X int designation; X! int Attr = 0; X X designation=sptr->designation; X if(sptr->tradegood != TG_none X*************** X*** 134,140 **** X if(sptr->jewels>=6) Attr+=GOLDATTR*sptr->jewels*2; X else Attr+=GOLDATTR*sptr->jewels; X } else if(designation==DFARM){ X! if(ntn[sptr->owner].tfood <= ntn[sptr->owner].eatrate*(ntn[sptr->owner].tciv*11)/250) X Attr+=50*FARMATTR; X else Attr+=tofood(sptr,sptr->owner)*FARMATTR; X } X--- 135,141 ---- X if(sptr->jewels>=6) Attr+=GOLDATTR*sptr->jewels*2; X else Attr+=GOLDATTR*sptr->jewels; X } else if(designation==DFARM){ X! if(ntn[sptr->owner].tfood*250 <= ntn[sptr->owner].eatrate*(ntn[sptr->owner].tciv*11)) X Attr+=50*FARMATTR; X else Attr+=tofood(sptr,sptr->owner)*FARMATTR; X } X*************** X*** 149,157 **** X X switch(race){ X case DWARF: X! if((designation==DGOLDMINE)&&(sptr->jewels>=4)) X Attr += DGOLDATTR; X! else if((designation==DMINE)&&(sptr->metal>=4)) X Attr += DMINEATTR; X else if(designation==DTOWN) Attr += DTOWNATTR; X else if(designation==DCITY) Attr += DCITYATTR; X--- 150,158 ---- X X switch(race){ X case DWARF: X! if((designation==DGOLDMINE)&&(sptr->jewels>3)) X Attr += DGOLDATTR; X! else if((designation==DMINE)&&(sptr->metal>3)) X Attr += DMINEATTR; X else if(designation==DTOWN) Attr += DTOWNATTR; X else if(designation==DCITY) Attr += DCITYATTR; X*************** X*** 166,174 **** X else Attr=0; X break; X case ELF: X! if((designation==DGOLDMINE)&&(sptr->jewels>=4)) X Attr += EGOLDATTR; X! else if((designation==DMINE)&&(sptr->metal>=4)) X Attr += EMINEATTR; X else if(designation==DTOWN) Attr += ECITYATTR; X else if(designation==DCITY) Attr += ECITYATTR; X--- 167,175 ---- X else Attr=0; X break; X case ELF: X! if((designation==DGOLDMINE)&&(sptr->jewels>3)) X Attr += EGOLDATTR; X! else if((designation==DMINE)&&(sptr->metal>3)) X Attr += EMINEATTR; X else if(designation==DTOWN) Attr += ECITYATTR; X else if(designation==DCITY) Attr += ECITYATTR; X*************** X*** 183,191 **** X else Attr=0; X break; X case HUMAN: X! if((designation==DGOLDMINE)&&(sptr->jewels>=4)) X Attr += HGOLDATTR; X! else if((designation==DMINE)&&(sptr->metal>=4)) X Attr += HMINEATTR; X else if(designation==DTOWN) Attr += HCITYATTR; X else if(designation==DCITY) Attr += HCITYATTR; X--- 184,192 ---- X else Attr=0; X break; X case HUMAN: X! if((designation==DGOLDMINE)&&(sptr->jewels>3)) X Attr += HGOLDATTR; X! else if((designation==DMINE)&&(sptr->metal>3)) X Attr += HMINEATTR; X else if(designation==DTOWN) Attr += HCITYATTR; X else if(designation==DCITY) Attr += HCITYATTR; X*************** X*** 200,208 **** X else Attr=0; X break; X case ORC: X! if((designation==DGOLDMINE)&&(sptr->jewels>=4)) X Attr += OGOLDATTR; X! else if((designation==DMINE)&&(sptr->metal>=4)) X Attr += OMINEATTR; X else if(designation==DTOWN) Attr += OCITYATTR; X else if(designation==DCITY) Attr += OCITYATTR; X--- 201,209 ---- X else Attr=0; X break; X case ORC: X! if((designation==DGOLDMINE)&&(sptr->jewels>3)) X Attr += OGOLDATTR; X! else if((designation==DMINE)&&(sptr->metal>3)) X Attr += OMINEATTR; X else if(designation==DTOWN) Attr += OCITYATTR; X else if(designation==DCITY) Attr += OCITYATTR; X*************** X*** 240,247 **** X int leadflag=FALSE; /* leader w/o group */ X int takesctr=FALSE; /* takesctr is # unowned sctrs*/ X X! if(P_ASTAT>=NUMSTATUS) return(takesctr); X! if(P_AMOVE==0) return(takesctr); X X /* if leader w/o a group, set leadflag */ X if((P_ATYPE>=MINLEADER)&&(P_ATYPE<MINMONSTER)&&(P_ASTAT!=GENERAL)) { X--- 241,247 ---- X int leadflag=FALSE; /* leader w/o group */ X int takesctr=FALSE; /* takesctr is # unowned sctrs*/ X X! if(P_ASTAT>=NUMSTATUS || P_AMOVE==0) return(takesctr); X X /* if leader w/o a group, set leadflag */ X if((P_ATYPE>=MINLEADER)&&(P_ATYPE<MINMONSTER)&&(P_ASTAT!=GENERAL)) { X*************** X*** 264,270 **** X &&( curntn->arm[i].stat!=GARRISON ) X &&( curntn->arm[i].stat!=TRADED ) X &&( curntn->arm[i].stat<NUMSTATUS )) X! sum+=curntn->arm[i].sold; X } else { /* not leader w/o group */ X /* use menok as a temp vbl now == men in army */ X menok=0; X--- 264,270 ---- X &&( curntn->arm[i].stat!=GARRISON ) X &&( curntn->arm[i].stat!=TRADED ) X &&( curntn->arm[i].stat<NUMSTATUS )) X! sum += curntn->arm[i].sold; X } else { /* not leader w/o group */ X /* use menok as a temp vbl now == men in army */ X menok=0; X*************** X*** 302,312 **** X &&( curntn->arm[x].stat!=ONBOARD ) X &&( curntn->arm[x].stat!=TRADED ) X &&( curntn->arm[x].stat<NUMSTATUS )){ X! where-=curntn->arm[x].sold; X! if(where > 0) continue; X! P_AXLOC=curntn->arm[x].xloc; X! P_AYLOC=curntn->arm[x].yloc; X! break; X } X if(x!=MAXARM) for(x=0;x<MAXARM;x++) { X if((curntn->arm[x].unittyp<MINLEADER ) X--- 302,312 ---- X &&( curntn->arm[x].stat!=ONBOARD ) X &&( curntn->arm[x].stat!=TRADED ) X &&( curntn->arm[x].stat<NUMSTATUS )){ X! if ((where-=curntn->arm[x].sold) <= 0) { X! P_AXLOC=curntn->arm[x].xloc; X! P_AYLOC=curntn->arm[x].yloc; X! break; X! } X } X if(x!=MAXARM) for(x=0;x<MAXARM;x++) { X if((curntn->arm[x].unittyp<MINLEADER ) X*************** X*** 425,431 **** X score() X { X int x; X! printf("\nupdating nations scores\n"); X for(x=1;x<NTOTAL;x++) if(isntn(ntn[x].active)) X ntn[x].score += score_one(x); X } X--- 425,431 ---- X score() X { X int x; X! printf("\nUpdating nation's scores\n"); X for(x=1;x<NTOTAL;x++) if(isntn(ntn[x].active)) X ntn[x].score += score_one(x); X } X*************** X*** 435,443 **** X /* CHEAT() */ X /* this routine cheats in favor of npc nations */ X /* */ X! /* I pride this code... it needs not to cheat to play a good */ X! /* game. This routine is the only cheating that it will do, */ X! /* and it is fairly minor. */ X /****************************************************************/ X void X cheat() X--- 435,443 ---- X /* CHEAT() */ X /* this routine cheats in favor of npc nations */ X /* */ X! /* I take pride in this code... it needs not to cheat to play a */ X! /* good game. This routine is the only cheating that it will */ X! /* do, and it is fairly minor. */ X /****************************************************************/ X void X cheat() X*************** X*** 529,535 **** X #endif /*XENIX*/ X int armynum; X int moved,done,loop=0,number=0; X! X int execed[NTOTAL]; X X check(); X--- 529,535 ---- X #endif /*XENIX*/ X int armynum; X int moved,done,loop=0,number=0; X! void move_people(); X int execed[NTOTAL]; X X check(); X*************** X*** 576,582 **** X fprintf(fnews,"1.\tthe computer will move for %s\n",curntn->name); X if (mailopen( country )!=(-1)) { X fprintf(fm,"Message to %s from CONQUER\n\n",curntn->name); X! fprintf(fm,"The computer moved for you in the %s of Year %d\n",curntn->name,PSEASON(TURN),YEAR(TURN)); X mailclose(country); X } X check(); X--- 576,582 ---- X fprintf(fnews,"1.\tthe computer will move for %s\n",curntn->name); X if (mailopen( country )!=(-1)) { X fprintf(fm,"Message to %s from CONQUER\n\n",curntn->name); X! fprintf(fm,"The computer moved for you in the %s of Year %d\n",PSEASON(TURN),YEAR(TURN)); X mailclose(country); X } X check(); X*************** X*** 670,704 **** X for(x=(int)curntn->capx-2;x<=(int)curntn->capx+2;x++) X for(y=(int)curntn->capy-2;y<=(int)curntn->capy+2;y++) X if((ONMAP(x,y))&&(attr[x][y]>0)) attr[x][y]+=20; X X- /*MOVE CIVILIANS based on the ratio of attractivenesses X- * X- * EQUILIBRIUM(1) = A1/(A1+A2) * (P1+P2) X- * EQUILIBRIUM(2) = A2/(A1+A2) * (P1+P2) X- * MOVE 1/5 of way to equilibrium each turn X- * DELTA(1) = (EQUILIBRIUM(1)-P1)/5 = (A1P2-P1A2)/5(A1+A2) X- * DELTA(2) = (EQUILIBRIUM(2)-P2)/5 = (A2P1-P2A1)/5(A1+A2) = -DELTA(1) X- * ij is refered to as 1, xy as 2 X- * NOTE AM ADDING 1 to divisor to prevent floating exception errors X- */ X- for(x=0; x<MAPX; x++ ) for(y=0; y<MAPY; y++) { X- X- sptr = &sct[x][y]; X- if( sptr->owner != country ) continue; X- if( sptr->people == 0 ) continue; X- X- for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++) 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- sptr->people -= moved; X- } /* for */ X- } /* for */ X } /* for */ X X /*zero out all recalculated values; do not clear god */ X--- 670,677 ---- X for(x=(int)curntn->capx-2;x<=(int)curntn->capx+2;x++) X for(y=(int)curntn->capy-2;y<=(int)curntn->capy+2;y++) X if((ONMAP(x,y))&&(attr[x][y]>0)) attr[x][y]+=20; X+ move_people(); X X } /* for */ X X /*zero out all recalculated values; do not clear god */ X*************** X*** 810,816 **** X printf("distributing captured sectors\n"); X X /*look for any areas where armies alone in sector*/ X! prep(0,FALSE); X X for(country=1;country<NTOTAL;country++) X if(ntn[country].active!=INACTIVE){ X--- 783,789 ---- X printf("distributing captured sectors\n"); X X /*look for any areas where armies alone in sector*/ X! prep(0,-1); X X for(country=1;country<NTOTAL;country++) X if(ntn[country].active!=INACTIVE){ X*************** X*** 818,824 **** X for(armynum=0;armynum<MAXARM;armynum++) X /* cheat in favor of npcs as the create army routines assume 75 man armies */ X if(P_ATYPE<MINLEADER) { X! if((ispc(curntn->active)&&(P_ASOLD>TAKESECTOR)) X ||((isnotpc(curntn->active))&&(P_ASOLD>75))){ X /* may not capture land while on a fleet */ X if(P_ASTAT==ONBOARD) continue; X--- 791,797 ---- X for(armynum=0;armynum<MAXARM;armynum++) X /* cheat in favor of npcs as the create army routines assume 75 man armies */ X if(P_ATYPE<MINLEADER) { X! if((ispc(curntn->active)&&(P_ASOLD>=TAKESECTOR)) X ||((isnotpc(curntn->active))&&(P_ASOLD>75))){ X /* may not capture land while on a fleet */ X if(P_ASTAT==ONBOARD) continue; X*************** X*** 873,879 **** X if (ispc(curntn->active)) { X if(mailopen(country)!=(-1)) { X fprintf(fm,"Message from Conquer\n\n"); X! fprintf(fm,"\tYour Scouting Unit %d was captured\n"); X fprintf(fm,"\t by %s military in sector %d,%d\n", X ntn[occval].name,(int)P_AXLOC,(int)P_AYLOC); X mailclose(country); X--- 846,852 ---- X if (ispc(curntn->active)) { X if(mailopen(country)!=(-1)) { X fprintf(fm,"Message from Conquer\n\n"); X! fprintf(fm,"\tYour Scouting Unit %d was captured\n",armynum); X fprintf(fm,"\t by %s military in sector %d,%d\n", X ntn[occval].name,(int)P_AXLOC,(int)P_AYLOC); X mailclose(country); X*************** X*** 1009,1020 **** X X printf("depleting nation %s\n",curntn->name); X deplete(country); X- printf("TEMP: done depleting\n"); X } X X spreadsheet(country); X if ((int)curntn->popularity-2*curntn->inflation < (int)MAXTGVAL) { X! curntn->popularity = min(0,(int)(curntn->popularity-2*curntn->inflation)); X } else curntn->popularity = (char) MAXTGVAL; X curntn->tsctrs = spread.sectors; X curntn->tciv=spread.civilians; X--- 982,992 ---- X X printf("depleting nation %s\n",curntn->name); X deplete(country); X } X X spreadsheet(country); X if ((int)curntn->popularity-2*curntn->inflation < (int)MAXTGVAL) { X! curntn->popularity = max(0,(int)(curntn->popularity-2*curntn->inflation)); X } else curntn->popularity = (char) MAXTGVAL; X curntn->tsctrs = spread.sectors; X curntn->tciv=spread.civilians; X*************** X*** 1024,1034 **** X charity=((spread.gold-curntn->tgold)*curntn->charity)/100; X X if(charity < 0) charity = 0; X if(curntn->tciv > 0) charity /= curntn->tciv; X else charity = 0; X X- curntn->tgold = spread.gold - charity; X- X /* calculate poverty base */ X if (curntn->tgold < 0L) { X curntn->poverty = 95; X--- 996,1006 ---- X charity=((spread.gold-curntn->tgold)*curntn->charity)/100; X X if(charity < 0) charity = 0; X+ curntn->tgold = spread.gold - charity; X+ X if(curntn->tciv > 0) charity /= curntn->tciv; X else charity = 0; X X /* calculate poverty base */ X if (curntn->tgold < 0L) { X curntn->poverty = 95; X*************** X*** 1070,1078 **** X /* plus maybe an adjustment for jewel production as a ratio */ X /* for whatever is produced by the country. */ X X! /* use charity here for gold lost to inflation */ X! charity = (curntn->tgold * curntn->inflation )/100; X! curntn->tgold -= charity; X curntn->metals=spread.metal; X curntn->jewels=spread.jewels; X } X--- 1042,1057 ---- X /* plus maybe an adjustment for jewel production as a ratio */ X /* for whatever is produced by the country. */ X X! /* now find new total gold talons in nations*/ X! if (curntn->tgold > 1000000L) { X! curntn->tgold = (long)(curntn->tgold / X! (100.0+(float)curntn->inflation/4.0)) * 100L; X! } else { X! curntn->tgold = (long) (curntn->tgold * 100L) / X! (100.0 + (float) curntn->inflation/4.0); X! } X! X! /* provide goods production */ X curntn->metals=spread.metal; X curntn->jewels=spread.jewels; X } X*************** X*** 1375,1380 **** X--- 1354,1360 ---- X register struct s_sector *sptr; X register int x,y; X long xx; X+ float tempflt; X long dead; X X fprintf(fnews,"2\tWORLD ECONOMY & DECLARATIONS OF WAR\n"); X*************** X*** 1423,1451 **** 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 xx=curntn->tgold-GOLDTHRESH*curntn->jewels; X if (ispc(country)) { X if (mailopen(country)!=(-1)) { X fprintf(fm,"Message from Conquer\n\n"); X! fprintf(fm,"Gold imbalance forced your treasury to purchase"); X! fprintf(fm,"%ld jewels for %ld gold talons to compensate\n", X! xx*GODJEWL/GODPRICE,xx); X mailclose(country); X } X } X! curntn->jewels += (xx*GODJEWL/GODPRICE); X curntn->tgold -= xx; X } X X--- 1403,1424 ---- X } X /*this state can occur if few people live in cities*/ X if(curntn->tfood<0) curntn->tfood=0L; X! tempflt = (float) curntn->tfood * (100-curntn->spoilrate); X! curntn->tfood = (long) (tempflt / 100.0); X X! if(curntn->tgold > GOLDTHRESH*curntn->jewels){ X /* buy jewels off commodities board */ X xx=curntn->tgold-GOLDTHRESH*curntn->jewels; X if (ispc(country)) { X if (mailopen(country)!=(-1)) { X fprintf(fm,"Message from Conquer\n\n"); X! fprintf(fm,"Gold imbalance forced your treasury to purchase\n"); X! fprintf(fm,"%ld jewels for %ld gold talons to compensate.\n", X! xx/GODPRICE*GODJEWL,xx); X mailclose(country); X } X } X! curntn->jewels += (xx/GODPRICE*GODJEWL); X curntn->tgold -= xx; X } X X*************** X*** 1549,1552 **** X--- 1522,1582 ---- X break; X } X } X+ } X+ X+ /* MOVE CIVILIANS based on the ratio of attractivenesses X+ * X+ * EQUILIBRIUM(1) = A1 / (A1 + A2) * (P1 + P2) X+ * EQUILIBRIUM(2) = A2 / (A1 + A2) * (P1 + P2) X+ * MOVE 1/5 of way to equilibrium each turn X+ * DELTA(1) = (EQUILIBRIUM(1) - P1) / 5 =(A1P2 - P1A2) / 5(A1 + A2) X+ * DELTA(2) = (EQUILIBRIUM(2) - P2) / 5 =(A2P1 - P2A1) / 5(A1 + A2) = -DELTA(1) X+ * (i, j) is refered to as 1, (x, y) as 2 X+ */ X+ void X+ move_people() X+ { X+ register struct s_sector *sptr; X+ register int i, j, x, y; X+ int moved, t_attr; X+ long **newpop, *curpop; X+ X+ newpop = (long **) m2alloc(MAPX, MAPY, sizeof(long)); X+ X+ for (x = 0; x < MAPX; x++) X+ for (y = 0; y < MAPY; y++) X+ if (sct[x][y].owner == country) X+ newpop[x][y] = sct[x][y].people; X+ else newpop[x][y] = 0; X+ X+ for (x = 0; x < MAPX; x++) X+ for (y = 0; y < MAPY; y++) { X+ sptr = &sct[x][y]; X+ if ((sptr->owner == country) && (sptr->people != 0)) { X+ X+ for (t_attr = 0, i = x - 2; i < x + 3; i++) X+ for (j = y - 2; j < y + 3; j++) X+ if ((ONMAP(i, j)) && (sct[i][j].owner == country)) X+ t_attr += attr[i][j]; X+ X+ if (t_attr > 0) { X+ t_attr *= 5; X+ curpop = &newpop[x][y]; X+ for (i = x - 2; i < x + 3; i++) X+ for (j = y - 2; j < y + 3; j++) X+ if ((ONMAP(i, j)) && (sct[i][j].owner == country)) { X+ moved = sptr->people * attr[i][j]; X+ if (moved > 0) { X+ moved /= t_attr; X+ *curpop -= moved; X+ newpop[i][j] += moved; X+ } X+ } X+ } X+ } X+ } X+ for (x = 0; x < MAPX; x++) X+ for (y = 0; y < MAPY; y++) X+ if (sct[x][y].owner == country) X+ sct[x][y].people = newpop[x][y]; X } X*** ocommands.c Tue Dec 12 21:19:34 1989 X--- commands.c Tue Dec 12 21:20:09 1989 X*************** X*** 13,22 **** X #include "header.h" X #include "data.h" X #include <ctype.h> X! X! #ifdef SYSMAIL X #include <sys/types.h> X! #endif SYSMAIL X extern long conq_mail_size; X X extern FILE *fexe; /*execute file pointer*/ X--- 13,23 ---- X #include "header.h" X #include "data.h" X #include <ctype.h> X! #ifdef CONQUER X #include <sys/types.h> X! #include <sys/stat.h> X! #endif /*CONQUER*/ X! X extern long conq_mail_size; X X extern FILE *fexe; /*execute file pointer*/ X*************** X*** 93,108 **** X } X } X X- /* have this for now... may be too harsh */ X- if (desg==DMILL || desg==DGRANARY) { X- if((sptr->tradegood != TG_none) X- &&(*(tg_stype + sptr->tradegood) != DFARM) X- &&(*(tg_stype + sptr->tradegood) != 'x')) { X- if(prtflag) errormsg("You can't have one of those here!"); X- return(FALSE); X- } X- } X- X if (desg==DUNIVERSITY || desg==DLUMBERYD) { X if((sptr->tradegood != TG_none) X &&(*(tg_stype + sptr->tradegood) != desg) X--- 94,99 ---- X*************** X*** 149,155 **** X curntn= &ntn[country]; X X clear_bottom(0); X! mvaddstr(LINES-4,0,"SUPER USER: CHANGE (v)egetation, (e)levation, (d)esig, (o)wner, (t)radegood"); X refresh(); X switch(getch()){ X case 'd': X--- 140,146 ---- X curntn= &ntn[country]; X X clear_bottom(0); X! mvaddstr(LINES-4,0,"SUPER USER: CHANGE (v)eg, (e)lev, (d)esig, (o)wner, (p)op, (t)radegood"); X refresh(); X switch(getch()){ X case 'd': X*************** X*** 190,197 **** 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--- 181,188 ---- X } X sptr->vegetation=newdes; X if( tofood(sptr,0) < DESFOOD ) X! sptr->designation=newdes; X! else sptr->designation=DNODESIG; X reset_god(); X return; X case 'o': X*************** X*** 201,206 **** X--- 192,208 ---- X if (x<NTOTAL) sptr->owner=x; X reset_god(); X return; X+ case 'p': X+ if (sptr->altitude == WATER) { X+ errormsg("Trying to build a colony of mermen?"); X+ reset_god(); X+ return; X+ } X+ mvaddstr(LINES-3,7,"new population for sector: "); X+ refresh(); X+ sptr->people = (long) get_number(); X+ reset_god(); X+ return; X case 't': X x=TRUE; X while(x==TRUE) { X*************** X*** 635,641 **** X return; X } X X! if( sct[XREAL][YREAL].people < amount * SHIPCREW ){ X errormsg("NOT ENOUGH CIVILIANS IN SECTOR"); X if(isgod==TRUE) reset_god(); X return; X--- 637,643 ---- X return; X } X X! if( sct[XREAL][YREAL].people < amount * (shipsize+1) * SHIPCREW ){ X errormsg("NOT ENOUGH CIVILIANS IN SECTOR"); X if(isgod==TRUE) reset_god(); X return; X*************** X*** 699,711 **** X /* construct fortification points*/ X else if(type=='f'){ X /* can only go into debt as much as the nation has jewels */ X! if ((curntn->tgold - cost) >= ((-1)*10*curntn->jewels)) { X mvprintw(LINES-2,5,"you build +%d%% fort points for %ld gold",armbonus,cost); X curntn->tgold-=cost; X sct[XREAL][YREAL].fortress++; X INCFORT; X errormsg(""); X! } else errormsg("you are broke"); X } X else errormsg("invalid input error"); X X--- 701,715 ---- X /* construct fortification points*/ X else if(type=='f'){ X /* can only go into debt as much as the nation has jewels */ X! if (sct[XREAL][YREAL].fortress>11) { X! errormsg("That sector is as impregnable as you can make it"); X! } else if ((curntn->tgold - cost) >= ((-1)*10*curntn->jewels)) { X mvprintw(LINES-2,5,"you build +%d%% fort points for %ld gold",armbonus,cost); X curntn->tgold-=cost; X sct[XREAL][YREAL].fortress++; X INCFORT; X errormsg(""); X! } else errormsg("you may not spend that much"); X } X else errormsg("invalid input error"); X X*************** X*** 1038,1043 **** X--- 1042,1048 ---- X char mesgfile[FILELTH]; X char line[LINELTH+1], inpch; X char save[LINELTH][LINELTH+1]; X+ struct stat fst; X X /*open file; used in mailopen() as well */ X sprintf(tempfile,"%s%hd.tmp",msgfile,country); X*************** X*** 1062,1075 **** X X /* check for people sending mail */ X sprintf(line,"send.%s%hd",msgfile,country); X! if (access(line,00)==0) { X! /* someone is sending mail to the country */ X! (void) unlink (tempfile) ; X! clear_bottom(0); X! errormsg("Someone is sending you mail... please wait."); X! makebottom(); X! redraw=DONE; X! return; X } X X /*read in file a line at at time*/ X--- 1067,1087 ---- X X /* check for people sending mail */ X sprintf(line,"send.%s%hd",msgfile,country); X! if (stat(line,&fst)==0) { X! long now; X! now = time(0); X! if (now - fst.st_mtime < TIME_DEAD) { X! /* someone is sending mail to the country */ X! (void) unlink (tempfile) ; X! clear_bottom(0); X! errormsg("Someone is sending you mail... please wait."); X! makebottom(); X! redraw=DONE; X! return; X! } else { X! /* remove useless file */ X! (void) unlink(line); X! } X } X X /*read in file a line at at time*/ X*************** X*** 1142,1151 **** X char line[BIGLTH]; X X /*what nation to send to*/ X! clear(); X! mvaddstr(0,0,"To send a message to the administrator, send to 'god';"); X! mvaddstr(1,0,"To post to the news, send to 'news':"); X! mvaddstr(2,0,"Enter the name of the country to send to: "); X refresh(); X temp=get_country(); X X--- 1154,1162 ---- X char line[BIGLTH]; X X /*what nation to send to*/ X! clear_bottom(0); X! mvaddstr(LINES-4,0,"The Conquer Administrator is 'god'; To send to the News use 'news';"); X! mvaddstr(LINES-3,0,"Send mail to what nation? "); X refresh(); X temp=get_country(); X X*************** X*** 1153,1168 **** X strcpy(name,"news"); X } else { X /* quick return on bad input */ X! if(temp==(-1) || temp>=NTOTAL X! || (!isntn(ntn[temp].active) && temp!=0)) X! return; X strcpy(name,ntn[temp].name); /* find nation name */ X } X X if(mailopen( temp )==(-1)) { X return; X } X! X X if(temp != -2) { X if (country==0) X--- 1164,1182 ---- X strcpy(name,"news"); X } else { X /* quick return on bad input */ X! if(temp==(-1) || temp>=NTOTAL X! || (!isntn(ntn[temp].active) && temp!=0)) { X! makebottom(); X! return; X! } X strcpy(name,ntn[temp].name); /* find nation name */ X } X X if(mailopen( temp )==(-1)) { X+ makebottom(); X return; X } X! redraw=FULL; X X if(temp != -2) { X if (country==0) X*** oio.c Tue Dec 12 21:19:35 1989 X--- io.c Tue Dec 12 21:20:09 1989 X*************** X*** 306,311 **** X--- 306,312 ---- X } /* readdata() */ X X #ifdef CONQUER X+ #ifdef XYZZY X /************************************************************************/ X /* OFFMAP() deal if cursor is off the map */ X /************************************************************************/ X*************** X*** 324,330 **** X xcurs+=15; X } X } X! else if(xcurs >= (COLS-23)/2){ X if(XREAL<MAPX) { X redraw=PART; X xoffset+=15; X--- 325,331 ---- X xcurs+=15; X } X } X! else if(xcurs >= SCREEN_X_SIZE-1){ X if(XREAL<MAPX) { X redraw=PART; X xoffset+=15; X*************** X*** 340,346 **** X xoffset += xcurs; X xcurs=0; X } X! else if(xcurs >= (COLS-23)/2) { X redraw=PART; X xoffset+=15; X xcurs-=15; X--- 341,347 ---- X xoffset += xcurs; X xcurs=0; X } X! else if(xcurs >= SCREEN_X_SIZE-1) { X redraw=PART; X xoffset+=15; X xcurs-=15; X*************** X*** 380,385 **** X--- 381,387 ---- X } X whatcansee(); X } X+ #endif /* XYZZY */ X X /************************************************************************/ X /* CENTERMAP() - redraws screen so that cursor is centered */ X*** omagic.c Tue Dec 12 21:19:35 1989 X--- magic.c Tue Dec 12 21:20:10 1989 X*************** X*** 591,609 **** X clear(); X } X if(magic(country,MA_MONST)==TRUE) { X! mvprintw((*count)++,0," You have a 10 percent chance for %ld Jewels take over other orcs",ORCTAKE); X chance=10; X } else if(magic(country,AV_MONST)==TRUE) { X! mvprintw((*count)++,0," You have a 6 percent chance for %ld Jewels take over other orcs",ORCTAKE); X chance=6; X } else if(magic(country,MI_MONST)==TRUE){ X! mvprintw((*count)++,0," You have a 3 percent chance for %ld Jewels to take over other orcs",ORCTAKE); X chance=3; X } X if(chance==0) return(TRUE); X X! mvaddstr((*count)++,0,"DO YOU WISH TO TAKE OVER AN ORC NPC NATION"); X! mvaddstr((*count)++,0,"target cant be unmet, hostile, war, or jihad (enter y or n):"); X refresh(); X if(getch()=='y'){ X done=FALSE; X--- 591,609 ---- X clear(); X } X if(magic(country,MA_MONST)==TRUE) { X! mvprintw((*count)++,0,"You have a 10 percent chance for %ld Jewels take over other orcs",ORCTAKE); X chance=10; X } else if(magic(country,AV_MONST)==TRUE) { X! mvprintw((*count)++,0,"You have a 6 percent chance for %ld Jewels take over other orcs",ORCTAKE); X chance=6; X } else if(magic(country,MI_MONST)==TRUE){ X! mvprintw((*count)++,0,"You have a 3 percent chance for %ld Jewels to take over other orcs",ORCTAKE); X chance=3; X } X if(chance==0) return(TRUE); X X! mvaddstr((*count)++,0," Target can't be Unmet, Hostile, War, or Jihad"); X! mvaddstr((*count)++,0,"DO YOU WISH TO TAKE OVER AN ORC NPC NATION: [ny]"); X refresh(); X if(getch()=='y'){ X done=FALSE; X*************** X*** 620,633 **** X curntn->spellpts-=s_cost; X EDECSPL; X if(( takeover(chance,i)) !=0 ) X! mvprintw((*count)++,0," Successful: %d",i); X else { X! mvaddstr((*count)++,0," Failed: Nation becomes more hostile"); X curntn->dstatus[i]++; X EADJDIP(country,i); X } X } X- else mvaddstr((*count)++,0," Wrong Race"); X } X return(done); X } X--- 620,636 ---- X curntn->spellpts-=s_cost; X EDECSPL; X if(( takeover(chance,i)) !=0 ) X! mvprintw((*count)++,0," Successful: %d",i); X else { X! mvaddstr((*count)++,0," Failed: Nation becomes more hostile"); X curntn->dstatus[i]++; X EADJDIP(country,i); X } X+ } else { X+ if (ntn[i].race==ORC) X+ mvaddstr((*count)++,0," Wrong Race"); X+ else mvaddstr((*count)++,0," That Nation is Outside Your Influence"); X } X } X return(done); X } X*************** X*** 828,834 **** X county=3; X countx=0; X standout(); X! mvaddstr(0,0,"Do you wish to (A)dd or (R)emove a power? "); X refresh(); X while (done==FALSE) { X done=TRUE; X--- 831,838 ---- X county=3; X countx=0; X standout(); X! mvaddstr(0,0,"Do you wish to (A)dd or (R)emove a power?"); X! clrtoeol(); X refresh(); X while (done==FALSE) { X done=TRUE; X*************** X*** 870,878 **** X } X else county++; X standout(); X! if (remove) mvaddstr(county++,0,"Which power to remove? "); X! else mvaddstr(county++,0,"Which power to add? "); X standend(); X refresh(); X choice=get_number(); X if(choice > 0 && choice <= MAXPOWER) { X--- 874,883 ---- X } X else county++; X standout(); X! if (remove) mvaddstr(county++,0,"Which power to remove?"); X! else mvaddstr(county++,0,"Which power to add?"); X standend(); X+ addch(' '); X refresh(); X choice=get_number(); X if(choice > 0 && choice <= MAXPOWER) { X*************** X*** 888,895 **** X else exenewmgk(powers[choice-1]); X } X } else { X! if (remove) mvaddstr(county++,0," The nation doesn't have that power."); X! else mvaddstr(county++,0," The nation already has that power."); X } X } X mvaddstr(county++,0,"Do you wish to add or remove another power?"); X--- 893,900 ---- X else exenewmgk(powers[choice-1]); X } X } else { X! if (remove) mvaddstr(county++,0,"The nation doesn't have that power."); X! else mvaddstr(county++,0,"The nation already has that power."); X } X } X mvaddstr(county++,0,"Do you wish to add or remove another power?"); X*** odisplay.c Tue Dec 12 21:19:34 1989 X--- display.c Tue Dec 12 21:20:10 1989 X*************** X*** 3,15 **** X /*conquer : Copyright (c) 1988 by Ed Barlow. X * I spent a long time writing this code & I hope that you respect this. X * I give permission to alter the code, but not to copy or redistribute X! * it without my explicit permission. If you alter the code, X * please document changes and send me a copy, so all can have it. X! * This code, to the best of my knowledge works well, but it is my first X * 'C' program and should be treated as such. I disclaim any X! * responsibility for the codes actions (use at your own risk). I guess X * I am saying "Happy gaming", and am trying not to get sued in the process. X! * Ed X */ X X /*include files*/ X--- 3,15 ---- X /*conquer : Copyright (c) 1988 by Ed Barlow. X * I spent a long time writing this code & I hope that you respect this. X * I give permission to alter the code, but not to copy or redistribute X! * it without my explicit permission. If you alter the code, X * please document changes and send me a copy, so all can have it. X! * This code, to the best of my knowledge works well, but it is my first X * 'C' program and should be treated as such. I disclaim any X! * responsibility for the codes actions (use at your own risk). I guess X * I am saying "Happy gaming", and am trying not to get sued in the process. X! * Ed X */ X X /*include files*/ X*************** X*** 410,416 **** X { X if((xcurs<=0)||(ycurs<=0)||(xcurs>=SCREEN_X_SIZE-1) X ||((ycurs>=SCREEN_Y_SIZE-1))||((XREAL)>=MAPX) X! ||((YREAL)>=MAPY)) offmap(); X X if(redraw!=DONE) { X if (redraw==FULL) { X--- 410,419 ---- X { X if((xcurs<=0)||(ycurs<=0)||(xcurs>=SCREEN_X_SIZE-1) X ||((ycurs>=SCREEN_Y_SIZE-1))||((XREAL)>=MAPX) X! ||((YREAL)>=MAPY)) { X! centermap(); X! redraw=PART; X! } X X if(redraw!=DONE) { X if (redraw==FULL) { X*** omain.c Tue Dec 12 21:19:35 1989 X--- main.c Tue Dec 12 21:20:11 1989 X*************** X*** 282,288 **** X #endif OGOD X country=(-1); X for(i=0;i<NTOTAL;i++) X! if(strcmp(name,ntn[i].name)==0) country=i; X X if(country==(-1)) { X fprintf(stderr,"Sorry, name <%s> not found\n",name); X--- 282,291 ---- X #endif OGOD X country=(-1); X for(i=0;i<NTOTAL;i++) X! if(strcmp(name,ntn[i].name)==0) { X! country=i; X! break; X! } X X if(country==(-1)) { X fprintf(stderr,"Sorry, name <%s> not found\n",name); X*************** X*** 778,784 **** X return(TRUE); X break; X case 'W': /*message*/ X- redraw=FULL; X curntn->tgold -= MOVECOST; X wmessage(); X break; X--- 781,786 ---- X*************** X*** 818,825 **** X if ((owneruid != (getpwnam(LOGIN))->pw_uid ) && X ((pwent=getpwnam(ntn[0].leader))==NULL || owneruid != pwent->pw_uid )) break; X #endif X! clear(); X! redraw=FULL; X if(country != 0) { X fprintf(fexe,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n", X XNAGOLD ,country,curntn->tgold,"null"); X--- 820,826 ---- X if ((owneruid != (getpwnam(LOGIN))->pw_uid ) && X ((pwent=getpwnam(ntn[0].leader))==NULL || owneruid != pwent->pw_uid )) break; X #endif X! clear_bottom(0); X if(country != 0) { X fprintf(fexe,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n", X XNAGOLD ,country,curntn->tgold,"null"); X*************** X*** 828,837 **** X fprintf(fexe,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n", X XNARGOLD ,country,curntn->jewels,"null"); X } else X! mvaddstr(0,0,"SUPER-USER: YOUR CHANGES WILL NOT BE SAVED IF YOU DO THIS!!!"); X standout(); X! mvaddstr(2,0,"change login to: "); X standend(); X refresh(); X X ocountry=country; X--- 829,839 ---- X fprintf(fexe,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n", X XNARGOLD ,country,curntn->jewels,"null"); X } else X! mvaddstr(LINES-4,0,"SUPER-USER: YOUR CHANGES WILL NOT BE SAVED IF YOU DO THIS!!!"); X standout(); X! mvaddstr(LINES-3,0,"Change login to:"); X standend(); X+ addch(' '); X refresh(); X X ocountry=country; X*************** X*** 841,869 **** X if( country==(-1) || country>=NTOTAL X || ( !isactive(ntn[country].active) && country!=0 )) { X country=ocountry; X! errormsg("invalid country"); X break; X } X if(country==ocountry){ X! errormsg("same country"); X break; X } X X /*get password*/ X! mvaddstr(2,0,"what is your nations password:"); X refresh(); X! getstr(passwd); X strcpy(name,crypt(passwd,SALT)); X! if((strncmp(name,curntn->passwd,PASSLTH)!=0) X &&(strncmp(name,ntn[0].passwd,PASSLTH)!=0)){ X! errormsg("sorry: password invalid"); X country=ocountry; X break; X } X if(aretheyon()==TRUE) { X! errormsg("sorry: country is already logged in."); X! refresh(); X country=ocountry; X break; X } X X--- 843,875 ---- X if( country==(-1) || country>=NTOTAL X || ( !isactive(ntn[country].active) && country!=0 )) { X country=ocountry; X! makebottom(); X break; X } X if(country==ocountry){ X! errormsg("What? You are already logged into that nation."); X! makebottom(); X break; X } X X /*get password*/ X! clear_bottom(0); X! mvaddstr(LINES-4,0,"What is your Nation's Password: "); X refresh(); X! (void) get_pass(passwd); X strcpy(name,crypt(passwd,SALT)); X! X! if((strncmp(name,ntn[country].passwd,PASSLTH)!=0) X &&(strncmp(name,ntn[0].passwd,PASSLTH)!=0)){ X! errormsg("Sorry, Password Invalid."); X country=ocountry; X+ makebottom(); X break; X } X if(aretheyon()==TRUE) { X! errormsg("Sorry, that Nation is already logged in."); X country=ocountry; X+ makebottom(); X break; X } X X*************** X*** 886,891 **** X--- 892,898 ---- X fprintf(stderr,"\n"); X roads_this_turn=0; X terror_adj=0; X+ move(LINES-3,0); X readdata(); X execute(FALSE); X X*************** X*** 901,907 **** X } X xoffset = yoffset = 0; X centermap(); X! redraw=PART; X break; X case '?': /*display help screen*/ X redraw=PART; X--- 908,914 ---- X } X xoffset = yoffset = 0; X centermap(); X! redraw=FULL; X break; X case '?': /*display help screen*/ X redraw=PART; X*** onpc.c Tue Dec 12 21:19:36 1989 X--- npc.c Tue Dec 12 21:20:11 1989 X*************** X*** 129,134 **** X--- 129,250 ---- X else if( curntn->active==NPC_SAVAGE ) do_savage(); X else if( curntn->active==NPC_LIZARD ) do_lizard(); /* update.c */ X } X+ #ifdef MORE_MONST X+ { X+ int neededtroops; X+ int actualtroops; X+ int savages,nomads; X+ int i,x,y; X+ int nomad_space=1, savage_space=1; X+ X+ for(i=1;i<NTOTAL;i++) X+ switch(ntn[i].active) X+ { X+ case NPC_SAVAGE: X+ savages=i; X+ break; X+ case NPC_NOMAD: X+ nomads=i; X+ break; X+ } X+ X+ /* neededarmies is an estimete of X+ * the desired military strength of savages X+ * and nomads. The proportions are based on X+ * npc.c routines. yeuch. X+ */ X+ X+ neededtroops= ((NUMSECTS)/MONSTER)*( /* number of armies */ X+ (5.0/12)*450 + /* nomads */ X+ (1.0/4)*250 ); /* savages */ X+ X+ X+ actualtroops=0; X+ for(i=0;i<MAXARM;i++) X+ { X+ if (ntn[nomads].arm[i].sold > 0) X+ actualtroops += ntn[nomads].arm[i].sold; X+ if (ntn[savages].arm[i].sold > 0) X+ actualtroops += ntn[savages].arm[i].sold; X+ } X+ X+ #ifdef DEBUG X+ printf("monsters: need %d have %d\n",neededtroops,actualtroops); X+ #endif DEBUG X+ X+ neededtroops= neededtroops-actualtroops; X+ X+ while(neededtroops>0&& (nomad_space||savage_space)) SHAR_EOF echo "End of part 2" echo "File patchV4.7 is continued in part 3" echo "3" > s2_seq_.tmp exit 0