Path: utzoo!utgpu!watserv1!watmath!att!pacbell!pacbell.com!ucsd!usc!cs.utexas.edu!uunet!zephyr.ens.tek.com!tekred!saab!billr From: billr@saab.CNA.TEK.COM (Bill Randle) Newsgroups: comp.sources.games Subject: v11i026: conquer4 - middle earth multi-player game (V4), Patch10 Message-ID: <6182@tekred.CNA.TEK.COM> Date: 22 Aug 90 18:37:30 GMT Sender: news@tekred.CNA.TEK.COM Lines: 564 Approved: billr@saab.CNA.TEK.COM Submitted-by: Adam Bryant 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 '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 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;iname,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=0&&armynum=0&&armynumtgold <= 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))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))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