billr@saab.CNA.TEK.COM (Bill Randle) (08/23/90)
Submitted-by: Adam Bryant <adb@cs.bu.edu> Posting-number: Volume 11, Issue 26 Archive-name: conquer4/Patch10 Patch-To: conquer4: Volume 6, Issue 83-96 [[Okay, It has been a while since I have sent out or received anything concerning conquer version 4, so I guess it is about time that I post the last few fixes that I have made. The patch is very small, so it just consists of the one file below. The one major thing that it fixes is the infamous password bug which prevented players from entering large passwords. The rest of the patch just handles a few other fixes to the code. The summary of changes is in the nots.v4 file. [Second diff output below] Hopefully, this will tide people over until version 5.x is released in a few months. [It is currently undergoing construction and beta testing... this will be a greatly enhanced version. Anyone interested in helping beta test (people who can use ftp are preferred), should send me mail at adb@cs.bu.edu or conquer-news-request@cs.bu.edu]]] #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: patches10 # Wrapped by billr@saab on Wed Aug 22 11:34:57 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'patches10' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patches10'\" else echo shar: Extracting \"'patches10'\" \(17423 characters\) sed "s/^X//" >'patches10' <<'END_OF_FILE' X*** opatchlevel.h Sat Aug 11 13:02:33 1990 X--- patchlevel.h Sat Aug 11 13:02:44 1990 X*************** X*** 1 **** X! #define PATCHLEVEL 9 X--- 1 ---- X! #define PATCHLEVEL 10 X*** onotes.v4 Sat Aug 11 13:02:33 1990 X--- notes.v4 Sat Aug 11 13:02:44 1990 X*************** X*** 378,383 **** X--- 378,396 ---- X 312. gave god the ability to adjust navy move values. X 313. fixed bug in reporting side during newspaper for naval battles. X 314. gave god the ability to adjust an army status. X+ ===4.0 patch number nine released => 4.9 =============================== X+ 315. adjusted the combat code so a unit must be on attack to attack. X+ 316. "#ifdef __STDC__" to "#ifndef __STDC__" typo fix. [Charles C. Fu] X+ 317. fixed summon documentation for Heros and Superheros. X+ 318. adjusted test stat in tradeit function of trade.c [Charles C. Fu] X+ 319. fixed password length termination bugs. X+ 320. raised the limit of nation destruction to under 250 civs and 50 mil. X+ 321. adjusted method of i_people calculation to improve accounting. [D. Brooks] X+ 322. fixed check on limit in cities [D. Brooks] X+ 323. make nation destruction occur for <100 people and <TAKESECTOR mil. X+ 324. put a 500 men cap on the amount needed to capture a sector. X+ 325. added in a query as to how much purchase should be made from God trades. X+ 326. made sure to close the commerce file before removing it. X X ------------------------------------------------------------------------- X | 2.0 POSSIBLE SHORT-TERM ENHANCEMENTS/FIXES FOR CONQUER V5 | X*** oMakefile Sat Aug 11 13:02:31 1990 X--- Makefile Sat Aug 11 13:02:44 1990 X*************** X*** 177,183 **** X strip $(SORT) X X clobber: X! -$(RM) *.o $(HELPOUT)[0-5] $(PSPROG) $(SORT) $(NULL) X -$(RM) newhelp in$(GAME) in$(SORT) in$(ADMIN) in$(PSPROG) $(NULL) X -$(RM) $(HELPSCR).[12] lint[ag] conquer.doc $(GAME) $(ADMIN) $(NULL) X X--- 177,183 ---- X strip $(SORT) X X clobber: X! -$(RM) *.o $(HELPOUT)[0-5] $(PSPROG) $(SORT) insthelp helpfile $(NULL) X -$(RM) newhelp in$(GAME) in$(SORT) in$(ADMIN) in$(PSPROG) $(NULL) X -$(RM) $(HELPSCR).[12] lint[ag] conquer.doc $(GAME) $(ADMIN) $(NULL) X X*** oheader.h Sat Aug 11 13:02:32 1990 X--- header.h Sat Aug 11 13:02:45 1990 X*************** X*** 154,160 **** X #define LONGTRIP 100 /* navy trip lth for 100% attrition */ X X /* min soldiers to take sector - either 75 or based on your civilians */ X! #define TAKESECTOR max(75,(ntn[country].tciv/350)) X X #define MAXLOSS 60 /* maximum % of men lost in 1:1 battle */ X #define FINDPERCENT 1 /* percent to find gold/metal in sector */ X--- 154,160 ---- X #define LONGTRIP 100 /* navy trip lth for 100% attrition */ X X /* min soldiers to take sector - either 75 or based on your civilians */ X! #define TAKESECTOR min(500,max(75,(ntn[country].tciv/350))) X X #define MAXLOSS 60 /* maximum % of men lost in 1:1 battle */ X #define FINDPERCENT 1 /* percent to find gold/metal in sector */ X*** oadmin.c Sat Aug 11 13:02:31 1990 X--- admin.c Sat Aug 11 13:02:45 1990 X*************** X*** 75,81 **** 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--- 75,81 ---- X X /* check conquer options */ X if (getenv(ENVIRON_OPTS)!=NULL) { X! strncpy(cq_opts, getenv(ENVIRON_OPTS), BIGLTH); X } X if (cq_opts[0] != '\0') { X l = strlen(cq_opts); X*** oextcmds.c Sat Aug 11 13:02:32 1990 X--- extcmds.c Sat Aug 11 13:02:45 1990 X*************** X*** 125,130 **** X--- 125,131 ---- X || P_ASTAT == ONBOARD || P_ASTAT == TRADED) { X if ((nocomb_stat(P_ASTAT) == TRUE) || X (nocomb_stat(curntn->arm[army2].stat) == TRUE) || X+ curntn->arm[army2].stat == MARCH || X curntn->arm[army2].stat == SIEGE || /* may not jump out */ X curntn->arm[army2].stat == SORTIE || /* of these statuses */ X P_ATYPE >= MINLEADER || X*** ocexecute.c Sat Aug 11 13:02:31 1990 X--- cexecute.c Sat Aug 11 13:02:46 1990 X*************** X*** 51,57 **** X /* note: i_people is a short, so we must scale to allow for people >= 32K */ X sct[x][y].i_people = sct[x][y].people/256; X else X! sct[x][y].i_people = 0; X X /*open exefile file*/ X sprintf(line,"%s%d",exefile,country); X--- 51,57 ---- X /* note: i_people is a short, so we must scale to allow for people >= 32K */ X sct[x][y].i_people = sct[x][y].people/256; X else X! sct[x][y].i_people = -1; X X /*open exefile file*/ X sprintf(line,"%s%d",exefile,country); X*** oforms.c Sat Aug 11 13:02:32 1990 X--- forms.c Sat Aug 11 13:02:46 1990 X*************** X*** 507,517 **** X break; X } X /*check if already used*/ X! else for(i=1;i<(country-1);i++){ X if((strcmp(ntn[i].name,string)==0)&&(i!=country)) { X errormsg("Name already used"); X break; X } X } X errormsg("New name can be used following next update"); X strcpy(curntn->name,string); X--- 507,519 ---- X break; X } X /*check if already used*/ X! else for(i=1;i<NTOTAL;i++){ X! if (isactive(ntn[i].active)) { X if((strcmp(ntn[i].name,string)==0)&&(i!=country)) { X errormsg("Name already used"); X break; X } X+ } X } X errormsg("New name can be used following next update"); X strcpy(curntn->name,string); X*************** X*** 526,532 **** X mvaddstr(0,0,"What is your current password:"); X refresh(); X (void) get_pass(command); X! strncpy(passwd,crypt(command,SALT),PASSLTH); X if((strncmp(passwd,ntn[0].passwd,PASSLTH)!=0) X &&(strncmp(passwd,curntn->passwd,PASSLTH)!=0)){ X break; X--- 528,534 ---- X mvaddstr(0,0,"What is your current password:"); X refresh(); X (void) get_pass(command); X! strncpy(passwd,crypt(command,SALT),PASSLTH+1); X if((strncmp(passwd,ntn[0].passwd,PASSLTH)!=0) X &&(strncmp(passwd,curntn->passwd,PASSLTH)!=0)){ X break; X*** ocombat.c Sat Aug 11 13:02:31 1990 X--- combat.c Sat Aug 11 13:02:47 1990 X*************** X*** 41,46 **** X--- 41,48 ---- X #define COMBAT_X 0 X #define COMBAT_A 1 X #define COMBAT_N 2 X+ #define FOUGHT_A 4 X+ #define FOUGHT_N 8 X X /************************************************************************/ X /* COMBAT() run all combat on the map */ X*************** X*** 259,267 **** X continue; X } X else if(side[i]==ATKR){ X! if((ntn[owner[i]].arm[unit[i]].stat!=RULE) X! &&( ntn[owner[i]].arm[unit[i]].stat!=TRADED) X! &&( ntn[owner[i]].arm[unit[i]].stat!=SCOUT)) { X asold += ntn[owner[i]].arm[unit[i]].sold; X } else { X side[i]=NTRL; X--- 261,269 ---- X continue; X } X else if(side[i]==ATKR){ X! if ((ntn[owner[i]].arm[unit[i]].stat >= ATTACK) X! &&(ntn[owner[i]].arm[unit[i]].stat <= SORTIE X! ||ntn[owner[i]].arm[unit[i]].stat >= NUMSTATUS)) { X asold += ntn[owner[i]].arm[unit[i]].sold; X } else { X side[i]=NTRL; X*** oupdate.c Sat Aug 11 13:02:34 1990 X--- update.c Sat Aug 11 13:02:48 1990 X*************** X*** 82,89 **** X X /* check for destroyed nations */ X for(country=1;country<NTOTAL;country++) X! if(isntn(ntn[country].active)) { X! if(ntn[country].tciv + ntn[country].tmil < 50) X destroy(country); X } X X--- 82,90 ---- X X /* check for destroyed nations */ X for(country=1;country<NTOTAL;country++) X! if (isntn(ntn[country].active)) { X! if (ntn[country].tciv < 100 && X! ntn[country].tmil < TAKESECTOR) X destroy(country); X } X X*************** X*** 1295,1301 **** X if(armynum>=0&&armynum<MAXARM) { X P_ASOLD=0; X } X! P_NARMY=0; X P_NPEOP=0; X P_NCREW=0; X } X--- 1296,1302 ---- X if(armynum>=0&&armynum<MAXARM) { X P_ASOLD=0; X } X! P_NARMY=MAXARM; X P_NPEOP=0; X P_NCREW=0; X } X*** ocommands.c Sat Aug 11 13:02:31 1990 X--- commands.c Sat Aug 11 13:02:48 1990 X*************** X*** 751,764 **** X return; X } X if(curntn->tgold <= 0){ X! errormsg("you are broke"); X if(isgod==TRUE) reset_god(); X return; X } X X! if((sct[XREAL][YREAL].designation==DTOWN) X! &&(sct[XREAL][YREAL].people*(2*CITYLIMIT+(curntn->tsctrs/2))<curntn->tciv)){ X! mvprintw(LINES-1,0,"need %d people in sector: hit any key",curntn->tciv/(2*CITYLIMIT+(curntn->tsctrs/2))); X refresh(); X getch(); X if(isgod==TRUE) reset_god(); X--- 751,764 ---- X return; X } X if(curntn->tgold <= 0){ X! errormsg("You are broke"); X if(isgod==TRUE) reset_god(); X return; X } X X! if(ISCITY(sct[XREAL][YREAL].designation) X! &&(sct[XREAL][YREAL].people*(3*CITYLIMIT+(curntn->tsctrs/2))<curntn->tciv)){ X! mvprintw(LINES-1,0,"Need %d people in sector: hit any key",curntn->tciv/(3*CITYLIMIT+(curntn->tsctrs/2))); X refresh(); X getch(); X if(isgod==TRUE) reset_god(); X*************** X*** 844,852 **** X /* = imen/4 - ( imen - people) */ X /* = -3/4 * imen + people) */ X /* 192 comes from 3*256/4 */ X! if((men > sct[XREAL][YREAL].people - (sct[XREAL][YREAL].i_people*192)) X! ||(sct[XREAL][YREAL].i_people <= 0)) { X! if(sct[XREAL][YREAL].i_people <= 0) X errormsg("error: sector wasn't city at beginning of turn"); X else errormsg("error: raising too many soldiers"); X if(isgod==TRUE) reset_god(); X--- 844,852 ---- X /* = imen/4 - ( imen - people) */ X /* = -3/4 * imen + people) */ X /* 192 comes from 3*256/4 */ X! if( (newtype != A_MERCENARY && (men > sct[XREAL][YREAL].people - (sct[XREAL][YREAL].i_people*192) ) ) X! ||(sct[XREAL][YREAL].i_people < 0)) { X! if(sct[XREAL][YREAL].i_people < 0) X errormsg("error: sector wasn't city at beginning of turn"); X else errormsg("error: raising too many soldiers"); X if(isgod==TRUE) reset_god(); X*************** X*** 1345,1350 **** X--- 1345,1351 ---- X } X if (people>sct[XREAL][YREAL].people) { X errormsg("Sorry, not that many people live there."); X+ return; X } X if (people*50>curntn->tgold) { X errormsg("Sorry, you do not have enough gold talons."); X*** onewlogin.c Sat Aug 11 13:02:33 1990 X--- newlogin.c Sat Aug 11 13:02:49 1990 X*************** X*** 453,459 **** X newerror("Invalid Password Match"); X } else valid=TRUE; X } X! strncpy(curntn->passwd,crypt(tempc,SALT),PASSLTH); X X /*get your name*/ X valid=FALSE; X--- 453,459 ---- X newerror("Invalid Password Match"); X } else valid=TRUE; X } X! strncpy(curntn->passwd,crypt(tempc,SALT),PASSLTH+1); X X /*get your name*/ X valid=FALSE; X*** omain.c Sat Aug 11 13:02:32 1990 X--- main.c Sat Aug 11 13:02:49 1990 X*************** X*** 61,67 **** X int geteuid(), getuid(), setuid(); X register int i,j; X char name[NAMELTH+1],filename[FILELTH]; X! #ifdef __STDC__ X void srand(); X #endif X void init_hasseen(),mapprep(); X--- 61,67 ---- X int geteuid(), getuid(), setuid(); X register int i,j; X char name[NAMELTH+1],filename[FILELTH]; X! #ifndef __STDC__ X void srand(); X #endif X void init_hasseen(),mapprep(); X*************** X*** 86,92 **** 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--- 86,92 ---- X X /* check conquer options */ X if (getenv(ENVIRON_OPTS)!=NULL) { X! strncpy(cq_opts, getenv(ENVIRON_OPTS), BIGLTH); X } X if (cq_opts[0] != '\0') { X l = strlen(cq_opts); X*************** X*** 313,325 **** X X /*get encrypted password*/ X fprintf(stderr,"\nWhat is your Nation's Password: "); X! strncpy(tmppass,getpass(""),PASSLTH); X! strncpy(passwd,crypt(tmppass,SALT),PASSLTH); X if((strncmp(passwd,curntn->passwd,PASSLTH)!=0) X &&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) { X fprintf(stderr,"\nError: Reenter your Nation's Password: "); X! strncpy(tmppass,getpass(""),PASSLTH); X! strncpy(passwd,crypt(tmppass,SALT),PASSLTH); X if((strncmp(passwd,curntn->passwd,PASSLTH)!=0) X &&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) { X fprintf(stderr,"\nSorry:"); X--- 313,325 ---- X X /*get encrypted password*/ X fprintf(stderr,"\nWhat is your Nation's Password: "); X! strncpy(tmppass,getpass(""),PASSLTH+1); X! strncpy(passwd,crypt(tmppass,SALT),PASSLTH+1); X if((strncmp(passwd,curntn->passwd,PASSLTH)!=0) X &&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) { X fprintf(stderr,"\nError: Reenter your Nation's Password: "); X! strncpy(tmppass,getpass(""),PASSLTH+1); X! strncpy(passwd,crypt(tmppass,SALT),PASSLTH+1); X if((strncmp(passwd,curntn->passwd,PASSLTH)!=0) X &&(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)) { X fprintf(stderr,"\nSorry:"); X*** otrade.c Sat Aug 11 13:02:34 1990 X--- trade.c Sat Aug 11 13:02:50 1990 X*************** X*** 179,204 **** X /* check for minor sales */ X if (holdint==GETFOOD || holdint==GETMETAL || holdint==GETJEWL) { X /* strange flow but less control needed */ X! curntn->tgold-=GODPRICE; X if (curntn->tgold<0L) { X! curntn->tgold+=GODPRICE; X tradeerr("You do not have enough gold"); X } X else switch (holdint) { X case GETFOOD: X! curntn->tfood+=GODFOOD; X if ( (tfile = fopen(tradefile,"a+"))==NULL) { X tradeerr("Error opening file for trading"); X abrt(); X } X! fprintf(tfile, "%d %d %d %d %ld %ld %d\n",BUY, country, GETFOOD, 0, 0, 0, 0); X fclose(tfile); X break; X case GETMETAL: X! curntn->metals+=GODMETAL; X break; X case GETJEWL: X! curntn->jewels+=GODJEWL; X break; X } X inloop=FALSE; X--- 179,207 ---- X /* check for minor sales */ X if (holdint==GETFOOD || holdint==GETMETAL || holdint==GETJEWL) { X /* strange flow but less control needed */ X! mvaddstr(count++,0,"Spend how much gold? "); X! refresh(); X! holdlong = get_number(); X! curntn->tgold-=holdlong; X if (curntn->tgold<0L) { X! curntn->tgold+=holdlong; X tradeerr("You do not have enough gold"); X } X else switch (holdint) { X case GETFOOD: X! curntn->tfood+= (long)(GODFOOD * ((double)holdlong / GODPRICE)); X if ( (tfile = fopen(tradefile,"a+"))==NULL) { X tradeerr("Error opening file for trading"); X abrt(); X } X! fprintf(tfile, "%d %d %d %d %ld %ld %d\n",BUY, country, GETFOOD, 0, curntn->tfood, 0, 0); X fclose(tfile); X break; X case GETMETAL: X! curntn->metals+=(long)(GODMETAL * ((double)holdlong / GODPRICE)); X break; X case GETJEWL: X! curntn->jewels+=(long)(GODMETAL * ((double)holdlong / GODPRICE)); X break; X } X inloop=FALSE; X*************** X*** 747,755 **** X break; X case TDSHIP: X /* give navy to cntry1 */ X! if(!(ntn[cntry1].nvy[extra].merchant!=0 X! && ntn[cntry1].nvy[extra].warships!=0 X! && ntn[cntry1].nvy[extra].galleys!=0) ) return -1; X while(unitnum==(-1)&&unitcount<MAXARM){ X if ((int)ntn[cntry2].nvy[unitcount].merchant+ntn[cntry2].nvy[unitcount].warships+ntn[cntry2].nvy[unitcount].galleys == 0) { X /* give navy to cntry2 */ X--- 750,758 ---- X break; X case TDSHIP: X /* give navy to cntry1 */ X! if(ntn[cntry1].nvy[extra].merchant==0 X! && ntn[cntry1].nvy[extra].warships==0 X! && ntn[cntry1].nvy[extra].galleys==0) return -1; X while(unitnum==(-1)&&unitcount<MAXARM){ X if ((int)ntn[cntry2].nvy[unitcount].merchant+ntn[cntry2].nvy[unitcount].warships+ntn[cntry2].nvy[unitcount].galleys == 0) { X /* give navy to cntry2 */ X*************** X*** 922,928 **** X itemnum++; X } else if (deal[itemnum]==BUY) { X if (natn[itemnum]==country) { X! if (type1[itemnum]==GETFOOD) ntn[country].tfood+=GODFOOD; X else setaside(country,type2[type1[itemnum]],lvar1[itemnum],(int)lvar1[itemnum],TRUE); X } X } X--- 925,931 ---- X itemnum++; X } else if (deal[itemnum]==BUY) { X if (natn[itemnum]==country) { X! if (type1[itemnum]==GETFOOD) ntn[country].tfood=lvar1[itemnum]; X else setaside(country,type2[type1[itemnum]],lvar1[itemnum],(int)lvar1[itemnum],TRUE); X } X } X*************** X*** 990,995 **** X--- 993,999 ---- X } X } X } X+ fclose(tfile); X unlink(tradefile); X if (itemnum == 0) return; X /* reopen the file for unsold commodities */ X*** otxt3 Sat Aug 11 13:02:34 1990 X--- txt3 Sat Aug 11 13:02:51 1990 X*************** X*** 131,140 **** X Efreet 2 +10 x1.5 50 400 DERVISH X Gargoyl 2 +10 x1 75 450 MI_MONST X Wraith 2 +10 x1 75 450 VAMPIRE X! Hero 2 +0 x1 75 200 WARLORD X Centaur 2 +10 x1.5 50 200 CAVALRY X Giant 5 +0 x1 150 2100 X! Suphero 5 +15 x1 150 450 WARRIOR X Mummy 5 +15 x1 150 1000 VAMPIRE X Elmentl 5 +5 x1.5 175 1900 SORCERER X Mintaur 5 +20 x1 150 2100 DESTROYER X--- 131,140 ---- X Efreet 2 +10 x1.5 50 400 DERVISH X Gargoyl 2 +10 x1 75 450 MI_MONST X Wraith 2 +10 x1 75 450 VAMPIRE X! Hero 2 +0 x1 75 200 WARRIOR X Centaur 2 +10 x1.5 50 200 CAVALRY X Giant 5 +0 x1 150 2100 X! Suphero 5 +15 x1 150 450 WARLORD X Mummy 5 +15 x1 150 1000 VAMPIRE X Elmentl 5 +5 x1.5 175 1900 SORCERER X Mintaur 5 +20 x1 150 2100 DESTROYER X END_OF_FILE if test 17423 -ne `wc -c <'patches10'`; then echo shar: \"'patches10'\" unpacked with wrong size! fi # end of 'patches10' fi echo shar: End of shell archive. exit 0