billr@saab.CNA.TEK.COM (Bill Randle) (09/21/89)
Submitted-by: Adam Bryant <adb@bu-cs.bu.edu> Posting-number: Volume 8, Issue 33 Archive-name: conquer4/Patch6b 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.6 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 sed 's/^X//' << 'SHAR_EOF' >> patchV4.6 X! } X X if( TURN!= 1) { X curntn->reputation += rand()%8-3; X*************** X*** 501,522 **** X else temp = 0; X curntn->farm_ability = min( temp,MAXTGVAL ); X } X temp = (minepts/3 + cityfolk/2 + townfolk/2 + blksmths); X- curntn->mine_ability = min( temp,MAXTGVAL ); X if( magic(country,MINER) ) X! curntn->mine_ability += 15; X if( magic(country,STEEL) ) X! curntn->mine_ability += 15; X X temp = cityfolk/2 + townfolk/6 + scholars/2; X curntn->knowledge = min( temp,MAXTGVAL ); X X temp = (curntn->wealth + 10*P_EATRATE + clerics + curntn->popularity)/2; X curntn->popularity = min( temp,MAXTGVAL ); X X- /* poverty tends 10% to 100-wealth/4 */ X- curntn->poverty += (100-curntn->wealth/4-curntn->poverty+5)/10; X- X if(magic(country,SLAVER)) curntn->terror+=PWR_NA; X if(magic(country,RELIGION)) curntn->popularity+=PWR_NA; X if(magic(country,URBAN)) { X--- 512,538 ---- X else temp = 0; X curntn->farm_ability = min( temp,MAXTGVAL ); X } X+ X+ /* calcualte mining ability */ X temp = (minepts/3 + cityfolk/2 + townfolk/2 + blksmths); X if( magic(country,MINER) ) X! temp += 15; X if( magic(country,STEEL) ) X! temp += 15; X! if (temp >= curntn->mine_ability) { X! curntn->mine_ability = min( temp,MAXTGVAL ); X! } else { X! curntn->mine_ability -= (curntn->mine_ability - temp)/4; X! } X X+ /* calculate knowledge */ X temp = cityfolk/2 + townfolk/6 + scholars/2; X curntn->knowledge = min( temp,MAXTGVAL ); X X+ /* find national popularity */ X temp = (curntn->wealth + 10*P_EATRATE + clerics + curntn->popularity)/2; X curntn->popularity = min( temp,MAXTGVAL ); X X if(magic(country,SLAVER)) curntn->terror+=PWR_NA; X if(magic(country,RELIGION)) curntn->popularity+=PWR_NA; X if(magic(country,URBAN)) { X*************** X*** 529,535 **** X if(curntn->terror > PWR_NA) X curntn->terror-=PWR_NA; X else curntn->terror=0; X! curntn->charity+=2; /* it creeps up */ X } X if(magic(country,KNOWALL)) curntn->knowledge+=PWR_NA; X if(magic(country,ARCHITECT)){ X--- 545,554 ---- X if(curntn->terror > PWR_NA) X curntn->terror-=PWR_NA; X else curntn->terror=0; X! if (curntn->charity < 15) { X! /* it creeps up */ X! curntn->charity+=2; X! } X } X if(magic(country,KNOWALL)) curntn->knowledge+=PWR_NA; X if(magic(country,ARCHITECT)){ X*** oextcmds.c Wed Sep 20 21:40:55 1989 X--- extcmds.c Wed Sep 20 21:41:23 1989 X*************** X*** 44,50 **** X if (P_ATYPE>=MINLEADER && P_ATYPE<MINMONSTER && X ISCITY(sct[P_AXLOC][P_AYLOC].designation)) addstr(", (R)ule"); X } X! mvprintw(LINES-4, 0, "Extended command:"); X refresh(); X X switch(getch()) { X--- 44,50 ---- X if (P_ATYPE>=MINLEADER && P_ATYPE<MINMONSTER && X ISCITY(sct[P_AXLOC][P_AYLOC].designation)) addstr(", (R)ule"); X } X! mvaddstr(LINES-4, 0, "Extended command:"); X refresh(); X X switch(getch()) { X*************** X*** 80,87 **** X default: /* unimplemented? */ X errormsg("Unimplemented extended command"); X } X- makebottom(); X- refresh(); X } X X /* returns TRUE if uncombinable FALSE if combinable */ X--- 80,85 ---- X*** omakeworl.c Wed Sep 20 21:40:55 1989 X--- makeworl.c Wed Sep 20 21:41:24 1989 X*************** X*** 23,29 **** X X int pwater; /* percent water in world (0-100) */ X extern short country; X! extern int numleaders; X char datadir[FILELTH]; X char **area_map; /*Value Map of Areas*/ X char **type; X--- 23,29 ---- X X int pwater; /* percent water in world (0-100) */ X extern short country; X! extern int numleaders,remake; X char datadir[FILELTH]; X char **area_map; /*Value Map of Areas*/ X char **type; X*************** X*** 65,70 **** X--- 65,71 ---- X curntn->powers = curntn->tciv = curntn->tmil = curntn->score = 0L; X curntn->race = TUNKNOWN; X curntn->maxmove = 0; X+ curntn->spellpts = 0; X curntn->class = curntn->aplus = curntn->dplus = (short)0; X curntn->inflation = curntn->tsctrs = curntn->tships = (short)0; X } X*************** X*** 106,112 **** X X valid=FALSE; X while(valid==FALSE) { /* password routine */ X! mvprintw(7,0,"Enter Super-User Password: "); X clrtoeol(); X refresh(); X i = get_pass(newstring); X--- 107,113 ---- X X valid=FALSE; X while(valid==FALSE) { /* password routine */ X! mvaddstr(7,0,"Enter Super-User Password: "); X clrtoeol(); X refresh(); X i = get_pass(newstring); X*************** X*** 117,123 **** X newerror("Password Too Long"); X continue; X } X! mvprintw(7,0,"Reenter Super-User Password: "); X clrtoeol(); X refresh(); X i = get_pass(passwd); X--- 118,124 ---- X newerror("Password Too Long"); X continue; X } X! mvaddstr(7,0,"Reenter Super-User Password: "); X clrtoeol(); X refresh(); X i = get_pass(passwd); X*************** X*** 130,142 **** X X /* finally ask for the secondary administrator */ X mvaddstr(7,0,"You may designate an other user as an alternate \"god\" for this world."); X! mvaddstr(8,0,"Enter System Login of alternate user or hit return to continue."); X while(TRUE) { X! mvaddstr(9,0,"What demi-god shall co-rule this world: "); X clrtoeol(); X refresh(); X get_nname( newstring ); X! if (strlen(newstring)==0) { X newmsg("God will personally rule this world!!!"); X sleep(1); X (void) strcpy(ntn[0].leader,LOGIN); X--- 131,155 ---- X X /* finally ask for the secondary administrator */ X mvaddstr(7,0,"You may designate an other user as an alternate \"god\" for this world."); X! mvaddstr(8,0,"Enter a System Login or \"god\" to have none. [Return for default]"); X! #ifdef REMAKE X! if (remake==FALSE) { X! (void) strcpy(ntn[0].leader,"god"); X! } else if (getpwnam(ntn[0].leader)==NULL) { X! (void) strcpy(ntn[0].leader,"god"); X! remake=FALSE; X! } X! #else X! (void) strcpy(ntn[0].leader,"god"); X! #endif REMAKE X while(TRUE) { X! mvprintw(9,0,"What demi-god shall co-rule this world? [%s]: ",ntn[0].leader); X clrtoeol(); X refresh(); X get_nname( newstring ); X! if ((strcmp(newstring,"GOD")==0) X! ||(strcmp(newstring,"God")==0) X! ||(strcmp(newstring,"god")==0)) { X newmsg("God will personally rule this world!!!"); X sleep(1); X (void) strcpy(ntn[0].leader,LOGIN); X*************** X*** 143,151 **** X mvaddstr(7,0,"Demi-God: [none]"); X clrtoeol(); X break; X } else if (strlen(newstring) <= LEADERLTH) { X if (getpwnam(newstring)!=NULL) { X! sprintf(tempc,"The demi-god %s may administrate this new world.",newstring); X newmsg(tempc); X (void) strncpy(ntn[0].leader,newstring,LEADERLTH); X mvprintw(7,0,"Demi-God: %s",ntn[0].leader); X--- 156,185 ---- X mvaddstr(7,0,"Demi-God: [none]"); X clrtoeol(); X break; X+ } X+ if (strlen(newstring)==0) { X+ #ifdef REMAKE X+ if (remake==FALSE) { X+ #endif /*REMAKE*/ X+ newmsg("God will personally rule this world!!!"); X+ sleep(1); X+ (void) strcpy(ntn[0].leader,LOGIN); X+ mvaddstr(7,0,"Demi-God: [none]"); X+ clrtoeol(); X+ break; X+ #ifdef REMAKE X+ } else { X+ (void) sprintf(tempc,"The demi-god %s will continue to reign.",ntn[0].leader); X+ newmsg(tempc); X+ sleep(1); X+ mvprintw(7,0,"Demi-God: [%s]",ntn[0].leader); X+ clrtoeol(); X+ break; X+ } X+ #endif /*REMAKE*/ X } else if (strlen(newstring) <= LEADERLTH) { X if (getpwnam(newstring)!=NULL) { X! (void) sprintf(tempc,"The demi-god %s may administrate this new world.",newstring); X newmsg(tempc); X (void) strncpy(ntn[0].leader,newstring,LEADERLTH); X mvprintw(7,0,"Demi-God: %s",ntn[0].leader); X*************** X*** 152,158 **** X clrtoeol(); X break; X } else { X! sprintf(tempc,"Their is no mortal named %s on this system.",newstring); X newerror(tempc); X } X } else { X--- 186,192 ---- X clrtoeol(); X break; X } else { X! (void) sprintf(tempc,"Their is no mortal named %s on this system.",newstring); X newerror(tempc); X } X } else { X*************** X*** 722,731 **** X } X } X X! mvprintw(13,5,"All manner of creatures were created: big ones, little ones,"); X! mvprintw(14,0,"fat ones, skinny ones, orange ones, turquois ones, bright blue ones."); X! mvprintw(15,0,"WAIT!!! God has suddenly realized that smurfs were taking things"); X! mvprintw(16,0,"too far and stopped creating new ones, and placed everybody on the map..."); X newmsg("Day 5... God decreed that world would be populated"); X sleep(1); X move(14,0); X--- 756,765 ---- X } X } X X! mvaddstr(13,5,"All manner of creatures were created: big ones, little ones,"); X! mvaddstr(14,0,"fat ones, skinny ones, orange ones, turquois ones, bright blue ones."); X! mvaddstr(15,0,"WAIT!!! God has suddenly realized that smurfs were taking things"); X! mvaddstr(16,0,"too far and stopped creating new ones to place everybody on the map..."); X newmsg("Day 5... God decreed that world would be populated"); X sleep(1); X move(14,0); X*************** X*** 1140,1149 **** X } X X cnum=1; X! mvprintw(15,0,"ADDING NATIONS:"); X refresh(); X xpos = 16; X! ypos = 15; X while(fgets(line,LINELTH,fp)!=NULL) { X /*read and parse a new line*/ X if(line[0]!='#') { X--- 1174,1184 ---- X } X X cnum=1; X! mvaddstr(14,0,"ADDING NATIONS:"); X! clrtoeol(); X refresh(); X xpos = 16; X! ypos = 14; X while(fgets(line,LINELTH,fp)!=NULL) { X /*read and parse a new line*/ X if(line[0]!='#') { X*** orandeven.c Wed Sep 20 21:41:00 1989 X--- randeven.c Wed Sep 20 21:41:24 1989 X*************** X*** 903,910 **** X X /*send a message to the country if it is a PC*/ X if(ispc(ntn[cntry].active)) { X! mailopen( cntry ); X! fprintf(fm,"MESSAGE FROM CONQUER\n"); X fprintf(fm,"An event occurs within your nation (%s)\n",ntn[cntry].name); X fprintf(fm,"%s during the %s of Year %d,\n",event,PSEASON(TURN),YEAR(TURN)); X if(xloc != -1) X--- 903,910 ---- X X /*send a message to the country if it is a PC*/ X if(ispc(ntn[cntry].active)) { X! if(mailopen( cntry )!=(-1)) { X! fprintf(fm,"MESSAGE FROM CONQUER\n\n"); X fprintf(fm,"An event occurs within your nation (%s)\n",ntn[cntry].name); X fprintf(fm,"%s during the %s of Year %d,\n",event,PSEASON(TURN),YEAR(TURN)); X if(xloc != -1) X*************** X*** 912,917 **** X--- 912,918 ---- X if(prcnt>0) { X fprintf(fm,"Damage was estimated at about %d%% in severity.\n",prcnt); X } X+ } X } X X if(strlen(eventstr)>5) { X*************** X*** 928,934 **** X if(ispc(ntn[cntry].active)) X fprintf(fm,"\t%s\n",eventstr); X } X! mailclose(); X } X X int X--- 929,935 ---- X if(ispc(ntn[cntry].active)) X fprintf(fm,"\t%s\n",eventstr); X } X! if(ispc(ntn[cntry].active)) mailclose(cntry); X } X X int X*** ocexecute.c Wed Sep 20 21:40:54 1989 X--- cexecute.c Wed Sep 20 21:41:25 1989 X*************** X*** 194,199 **** X--- 194,210 ---- X } X sct[x][y].people=armynum; X break; X+ case XSACIV3: /*Sadjciv3 - incremental people adjust */ X+ /* if you dont own it, put people in your capitol */ X+ if((sct[x][y].owner!=country)&&(country!=0)) { X+ sct[curntn->capx][curntn->capy].people+=armynum; X+ fprintf(stderr,"SACIV3: <%s> told to put %d civilians in sector %d,%d not owned - placed in capitol\n",curntn->name,armynum,x,y); X+ } X+ else X+ { X+ sct[x][y].people+=armynum; X+ } X+ break; X case XSIFORT: /*Sincfort*/ X sct[x][y].fortress++; X break; X*************** X*** 269,274 **** X--- 280,287 ---- X void X hangup() X { X+ char line[LINELTH]; X+ X if(country==0) writedata(); X else { X fprintf(fexe,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n", X*************** X*** 281,292 **** X /*close file*/ X fclose(fexe); X /*send a message to God*/ X! mailopen( 0 ); X! fprintf(fm,"WARNING: Nation %s hungup on me.\n",curntn->name); X! mailclose(); X X /* remove the lock file */ X unlink(fison); X /* exit program */ X exit(FAIL); X } X--- 294,313 ---- X /*close file*/ X fclose(fexe); X /*send a message to God*/ X! if(mailopen( 0 )!=(-1)) { X! fprintf(fm,"WARNING: Nation %s hungup on me.\n",curntn->name); X! mailclose(0); X! } X X /* remove the lock file */ X unlink(fison); X+ /* remove any existing mail reading/writing file */ X+ if (mailok!=DONEMAIL) { X+ extern char tmp_mail_name[]; X+ unlink(tmp_mail_name); X+ } X+ sprintf(line,"%s%hd.tmp",msgfile,country); X+ unlink(line); X /* exit program */ X exit(FAIL); X } X*** oforms.c Wed Sep 20 21:40:55 1989 X--- forms.c Wed Sep 20 21:41:25 1989 X*************** X*** 41,48 **** X int nationid; /*current nation id */ X X count2=1; X while(done==FALSE) { X! clear(); X standout(); X mvaddstr(0,(COLS/2)-10,"NATION SCORE SCREEN"); X standend(); X--- 41,50 ---- X int nationid; /*current nation id */ X X count2=1; X+ clear(); X while(done==FALSE) { X! move(0,0); X! clrtobot(); X standout(); X mvaddstr(0,(COLS/2)-10,"NATION SCORE SCREEN"); X standend(); X*************** X*** 94,101 **** X mvprintw(ypos+6,xpos,"%ld",ntn[nationid].score); X #ifdef NOSCORE X if(isnpc(ntn[nationid].active)) X! mvprintw(ypos+7,xpos,"Yes"); X! else mvprintw(ypos+7,xpos,"No"); X if (country==0) { X mvprintw(ypos+8,xpos,"%ld",ntn[nationid].tgold); X mvprintw(ypos+9,xpos,"%ld",ntn[nationid].tmil); X--- 96,103 ---- X mvprintw(ypos+6,xpos,"%ld",ntn[nationid].score); X #ifdef NOSCORE X if(isnpc(ntn[nationid].active)) X! mvaddstr(ypos+7,xpos,"Yes"); X! else mvaddstr(ypos+7,xpos,"No"); X if (country==0) { X mvprintw(ypos+8,xpos,"%ld",ntn[nationid].tgold); X mvprintw(ypos+9,xpos,"%ld",ntn[nationid].tmil); X*************** X*** 108,115 **** X mvprintw(ypos+9,xpos,"%ld",ntn[nationid].tciv); X mvprintw(ypos+10,xpos,"%d",ntn[nationid].tsctrs); X if(isnpc(ntn[nationid].active)) X! mvprintw(ypos+11,xpos,"Yes"); X! else mvprintw(ypos+11,xpos,"No"); X #endif /* NOSCORE */ X count++; X if(count<MAXINSCR && count%MAXINROW==0) { X--- 110,117 ---- X mvprintw(ypos+9,xpos,"%ld",ntn[nationid].tciv); X mvprintw(ypos+10,xpos,"%d",ntn[nationid].tsctrs); X if(isnpc(ntn[nationid].active)) X! mvaddstr(ypos+11,xpos,"Yes"); X! else mvaddstr(ypos+11,xpos,"No"); X #endif /* NOSCORE */ X count++; X if(count<MAXINSCR && count%MAXINROW==0) { X*************** X*** 151,161 **** X isgod=TRUE; X if (get_god()) return; X } X count2=1; X while(1){ X count=1; X offset=0; X! clear(); X standout(); X mvaddstr(0,(COLS/2)-12,"NATION DIPLOMACY SUMMARY"); X standend(); X--- 153,165 ---- X isgod=TRUE; X if (get_god()) return; X } X+ clear(); X count2=1; X while(1){ X count=1; X offset=0; X! move(0,0); X! clrtobot(); X standout(); X mvaddstr(0,(COLS/2)-12,"NATION DIPLOMACY SUMMARY"); X standend(); X*************** X*** 255,261 **** X exit(FAIL); X } X BRIBENATION; X- mailclose(); X X ntn[nation].dstatus[country]--; X X--- 259,264 ---- X*************** X*** 313,328 **** X } X if((temp<=UNMET)||(temp>JIHAD) X ||((isgod==FALSE)&&(temp==UNMET))){ X! mvprintw(LINES-1,0,"SORRY, Invalid inputs -- hit return"); X! refresh(); X! getch(); X if(isgod==TRUE) reset_god(); X return; X } X X! if(((curntn->dstatus[nation]==TREATY)&&(temp!=TREATY)) X! ||(( curntn->dstatus[nation]==JIHAD)&&(temp!=JIHAD))) X curntn->tgold -= BREAKJIHAD; X X curntn->dstatus[nation]=temp; X EADJDIP(country,nation); X--- 316,335 ---- X } X if((temp<=UNMET)||(temp>JIHAD) X ||((isgod==FALSE)&&(temp==UNMET))){ X! errormsg("SORRY, Invalid inputs -- hit return"); X if(isgod==TRUE) reset_god(); X return; X } X X! if((curntn->dstatus[nation]==JIHAD)&&(temp!=JIHAD)) X curntn->tgold -= BREAKJIHAD; X+ else if ((curntn->dstatus[nation]==TREATY)&&(temp!=TREATY)) { X+ if (ntn[nation].dstatus[country]!=TREATY) { X+ errormsg("Non-binding Treaty broken... fee waived."); X+ } else { X+ curntn->tgold -= BREAKJIHAD; X+ } X+ } X X curntn->dstatus[nation]=temp; X EADJDIP(country,nation); X*************** X*** 330,340 **** X if((temp>HOSTILE) X &&(ispc(ntn[nation].active)) X &&(ntn[nation].dstatus[country]<WAR)) { X! mailopen(nation); X! fprintf(fm,"Message to %s from CONQUER\n",ntn[nation].name); X! fprintf(fm," During the %s of Year %d,\n",PSEASON(TURN),YEAR(TURN)); X! fprintf(fm," %s declared war on you\n",curntn->name); X! mailclose(); X } X X /*prevent ron from being sneaky*/ X--- 337,348 ---- X if((temp>HOSTILE) X &&(ispc(ntn[nation].active)) X &&(ntn[nation].dstatus[country]<WAR)) { X! if(mailopen(nation)!=(-1)) { X! fprintf(fm,"Message to %s from CONQUER\n",ntn[nation].name); X! fprintf(fm," During the %s of Year %d,\n",PSEASON(TURN),YEAR(TURN)); X! fprintf(fm," %s declared war on you\n",curntn->name); X! mailclose(nation); X! } X } X X /*prevent ron from being sneaky*/ X*************** X*** 347,353 **** X if(ntn[i].dstatus[nation]==TREATY){ X ntn[i].dstatus[country]=WAR; X EADJDIP(i,country); X! mailopen(country); X fprintf(fm,"Message to %s from %s\n",ntn[country].name,ntn[i].name); X switch( rand()%4 ) { X case 0: fprintf(fm,"You just attacked my friend %s - your loss!!!\n",ntn[nation].name); X--- 355,361 ---- X if(ntn[i].dstatus[nation]==TREATY){ X ntn[i].dstatus[country]=WAR; X EADJDIP(i,country); X! if (mailopen(country)==(-1)) { X fprintf(fm,"Message to %s from %s\n",ntn[country].name,ntn[i].name); X switch( rand()%4 ) { X case 0: fprintf(fm,"You just attacked my friend %s - your loss!!!\n",ntn[nation].name); X*************** X*** 361,367 **** X fprintf(fm,"appropriate counter measures!!! DIE!!!\n"); X break; X } X! mailclose(); X } X } X } X--- 369,376 ---- X fprintf(fm,"appropriate counter measures!!! DIE!!!\n"); X break; X } X! } X! mailclose(country); X } X } X } X*************** X*** 390,397 **** X } X X /* continuous loop */ X- while(1) { X clear(); X standout(); X mvaddstr(0,(COLS/2)-10,"NATION STATS SUMMARY"); X mvprintw(3,0,"nation name is %s",curntn->name); X--- 399,408 ---- X } X X /* continuous loop */ X clear(); X+ while(1) { X+ move(0,0); X+ clrtobot(); X standout(); X mvaddstr(0,(COLS/2)-10,"NATION STATS SUMMARY"); X mvprintw(3,0,"nation name is %s",curntn->name); X*** omisc.c Wed Sep 20 21:40:56 1989 X--- misc.c Wed Sep 20 21:41:25 1989 X*************** X*** 5,10 **** X--- 5,11 ---- X #include "data.h" X X extern FILE *fnews; X+ extern short country; X X extern char *HVegcost, *OVegcost, *EVegcost, *DVegcost, *FVegcost; X extern char *HElecost, *OElecost, *EElecost, *DElecost, *FElecost; X*************** X*** 182,187 **** X--- 183,190 ---- X if( (y = ay + dy[i]) < 0 || y >= MAPY ) X continue; X X+ if ( movecost[ x ][ y ] < 0 ) /* just in case */ X+ continue; X if( sct[x][y].altitude == PEAK) X continue; X if( sct[x][y].altitude == WATER) X*************** X*** 790,808 **** X } X P_ASOLD=0; X if(ispc(curntn->active)) { X! mailopen(country); X! fprintf(fm,"Message to %s from Conquer\n\n",curntn->name); X! fprintf(fm,"\tYour %s Army %d disperses into the population\n",*(unittype+(P_ATYPE%UTYPE)),armynum); X! mailclose(); X } X } else if(P_ATYPE>=MINMONSTER) { X /* disbanding of ALL monsters should take place */ X P_ASOLD=0; X if(ispc(curntn->active)) { X! mailopen(country); X! fprintf(fm,"Message to %s from Conquer\n\n",curntn->name); X! fprintf(fm,"\tYour %s (unit %d) leaves due to the loss of your jewels.\n",*(unittype+(P_ATYPE%UTYPE)),armynum); X! mailclose(); X } X } X } X--- 793,813 ---- X } X P_ASOLD=0; X if(ispc(curntn->active)) { X! if (mailopen(country)!=(-1)) { X! fprintf(fm,"Message to %s from Conquer\n\n",curntn->name); X! fprintf(fm,"\tYour %s Army %d disperses into the population\n",*(unittype+(P_ATYPE%UTYPE)),armynum); X! mailclose(country); X! } X } X } else if(P_ATYPE>=MINMONSTER) { X /* disbanding of ALL monsters should take place */ X P_ASOLD=0; X if(ispc(curntn->active)) { X! if (mailopen(country)!=(-1)) { X! fprintf(fm,"Message to %s from Conquer\n\n",curntn->name); X! fprintf(fm,"\tYour %s (unit %d) leaves due to the loss of your jewels.\n",*(unittype+(P_ATYPE%UTYPE)),armynum); X! mailclose(country); X! } X } X } X } X*************** X*** 810,818 **** X /* check for sectors breaking away -- not capx, capy */ X if(ispc(curntn->active)) { X /* create a summarized mail message of sectors effected */ X! mailopen(country); X! fprintf(fm,"Message to %s from Conquer\n\n",curntn->name); X! fprintf(fm,"Riots and Rebellion flourish:\n"); X } X for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++) X if(sct[i][j].owner==country && (i!=x || j!=y) ) { X--- 815,824 ---- X /* check for sectors breaking away -- not capx, capy */ X if(ispc(curntn->active)) { X /* create a summarized mail message of sectors effected */ X! if (mailopen(country)!=(1)) { X! fprintf(fm,"Message to %s from Conquer\n\n",curntn->name); X! fprintf(fm,"Riots and Rebellion flourish:\n"); X! } X } X for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++) X if(sct[i][j].owner==country && (i!=x || j!=y) ) { X*************** X*** 838,844 **** X } X } X if(ispc(curntn->active)) { X! mailclose(); X } else if(isnpc(curntn->active)) { X if(sct[curntn->capx][curntn->capy].owner==country) { X /* reset capitol for npcs */ X--- 844,850 ---- X } X } X if(ispc(curntn->active)) { X! mailclose(country); X } else if(isnpc(curntn->active)) { X if(sct[curntn->capx][curntn->capy].owner==country) { X /* reset capitol for npcs */ X*************** X*** 912,924 **** X if ((x!=curntn->capx)||(y!=curntn->capy)) { X /* assign new pseudo capitol */ X if(ispc(curntn->active)) { X! mailopen(country); X fprintf(fm,"Message to %s from Conquer\n\n",ntn[country].name); X fprintf(fm,"\tYour Capitol at sector location %d,%d\n",curntn->capx,curntn->capy); X fprintf(fm,"\t was overrun by nation %s.\n\n",ntn[nation].name); X fprintf(fm,"\tA temporary headquarters is now in sector %d,%d,\n",x,y); X fprintf(fm,"\t but designation of a new Capitol is recommended.\n"); X! mailclose(); X } X curntn->capx=x; X curntn->capy=y; X--- 918,931 ---- X if ((x!=curntn->capx)||(y!=curntn->capy)) { X /* assign new pseudo capitol */ X if(ispc(curntn->active)) { X! if(mailopen(country)!=(-1)) { X fprintf(fm,"Message to %s from Conquer\n\n",ntn[country].name); X fprintf(fm,"\tYour Capitol at sector location %d,%d\n",curntn->capx,curntn->capy); X fprintf(fm,"\t was overrun by nation %s.\n\n",ntn[nation].name); X fprintf(fm,"\tA temporary headquarters is now in sector %d,%d,\n",x,y); X fprintf(fm,"\t but designation of a new Capitol is recommended.\n"); X! mailclose(country); X! } X } X curntn->capx=x; X curntn->capy=y; X*************** X*** 925,937 **** X } else { X /* no new capitol assignment */ X if(ispc(curntn->active)) { X! mailopen(country); X fprintf(fm,"Message to %s from Conquer\n\n",ntn[country].name); X fprintf(fm,"\tYour Capitol at sector location %d,%d\n",curntn->capx,curntn->capy); X fprintf(fm,"\t was overrun by nation %s.\n\n",ntn[nation].name); X fprintf(fm,"\tNo other land remains. The destruction\n"); X fprintf(fm,"\t of your nation seems imminent.\n"); X! mailclose(); X } X } X /* restore */ X--- 932,945 ---- X } else { X /* no new capitol assignment */ X if(ispc(curntn->active)) { X! if(mailopen(country)!=(-1)) { X fprintf(fm,"Message to %s from Conquer\n\n",ntn[country].name); X fprintf(fm,"\tYour Capitol at sector location %d,%d\n",curntn->capx,curntn->capy); X fprintf(fm,"\t was overrun by nation %s.\n\n",ntn[nation].name); X fprintf(fm,"\tNo other land remains. The destruction\n"); X fprintf(fm,"\t of your nation seems imminent.\n"); X! mailclose(country); X! } X } X } X /* restore */ X*************** X*** 1375,1381 **** X X /* check for 'god' */ X if (strcmp("god",name)==0) hold=0; X! if (strcmp("news",name)==0) hold= -2; X X /* check for numbers if name too long */ X if (hold==NTOTAL) { X--- 1383,1389 ---- X X /* check for 'god' */ X if (strcmp("god",name)==0) hold=0; X! if (strcmp("news",name)==0) hold= NEWSMAIL; X X /* check for numbers if name too long */ X if (hold==NTOTAL) { X*************** X*** 1454,1485 **** X } X #endif ADMIN X X! void X mailopen(to) X { X char line[LINELTH]; X! if(mailok == TRUE) mailclose(); X X! if (to != -2) X! sprintf(line,"%s%d",msgfile,to); X! else X! sprintf(line,"news%d",TURN -1); /* -1 so it appears in X! the news now */ X! if ((fm=fopen(line,"a+"))==NULL) { X! printf("error opening %s",line); X! return; X } X! mailok=TRUE; X } X X void X! mailclose() X { X! if(mailok==FALSE) return; X X! fputs("END\n",fm); X fclose(fm); X! mailok=FALSE; X } X X #ifdef ADMIN X--- 1462,1539 ---- X } X #endif ADMIN X X! /* name of the currently open mail file */ X! char tmp_mail_name[LINELTH]; X! X! int X mailopen(to) X { X char line[LINELTH]; X! if(mailok != DONEMAIL) mailclose(ABORTMAIL); X X! if (to != NEWSMAIL) { X! #ifdef CONQUER X! /* check if the player is currently reading messages */ X! sprintf(line,"%s%hd.tmp",msgfile,to); X! if (access(line,00)==0) { X! if (to>0 && to<NTOTAL) { X! sprintf(line,"Nation %s is reading their mail... try again later.", ntn[to].name); X! errormsg(line); X! } X! return(-1); X! } X! X! /* otherwise continue; checking for others */ X! /* this file name is also used in rmessages() */ X! sprintf(tmp_mail_name,"send.%s%hd",msgfile,to); X! if (access(tmp_mail_name,00)==0) { X! if (to>=0 && to<NTOTAL) X! errormsg("Someone is already sending mail to Nation %s... try again later.", ntn[to].name); X! return(-1); X! } X! #endif /*CONQUER*/ X! #ifdef ADMIN X! sprintf(tmp_mail_name,"%s%hd",msgfile,to); X! #endif /*ADMIN*/ X! } else { X! /* send to a location marked by the current player */ X! sprintf(tmp_mail_name,"send.news%d", country); X } X! if ((fm=fopen(tmp_mail_name,"a+"))==NULL) { X! fprintf(stderr,"error opening %s",tmp_mail_name); 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! fputs("END\n",fm); X! } X fclose(fm); X! X! #ifdef CONQUER X! if((to!=ABORTMAIL)&&(to==mailok)) { X! if (to==NEWSMAIL) { X! /* send to the current newspaper */ X! sprintf(line,"cat %s >> news%d",tmp_mail_name,TURN-1); X! } else { X! /* send to the player now */ X! sprintf(line,"cat %s >> %s%d",tmp_mail_name,msgfile,to); X! } X! system(line); X! } X! if (tmp_mail_name!=NULL) { X! (void) unlink(tmp_mail_name); X! } X! #endif /*CONQUER*/ X! mailok=DONEMAIL; X } X X #ifdef ADMIN X*** oreports.c Wed Sep 20 21:41:00 1989 X--- reports.c Wed Sep 20 21:41:26 1989 X*************** X*** 65,74 **** X return; X } X } X- count2=0; X /*new army screen*/ X while(done==FALSE) { X! clear(); X armynum=count2; X xpos=BUF_COLS; X ypos=2; X--- 65,76 ---- X return; X } X } X /*new army screen*/ X+ clear(); X+ count2=0; X while(done==FALSE) { X! move(0,0); X! clrtobot(); X armynum=count2; X xpos=BUF_COLS; X ypos=2; X*************** X*** 194,200 **** X /*spys are given a shut up fee */ X mvprintw(LINES-4,0,"Your spy demands %ld talons to remain quiet", X *(u_encost+(P_ATYPE%UTYPE)) * 2); X! mvprintw(LINES-3,0,"Pay him off? (y or n)"); X clrtoeol(); X refresh(); X if(getch()=='y'){ X--- 196,202 ---- X /*spys are given a shut up fee */ X mvprintw(LINES-4,0,"Your spy demands %ld talons to remain quiet", X *(u_encost+(P_ATYPE%UTYPE)) * 2); X! mvaddstr(LINES-3,0,"Pay him off? (y or n)"); X clrtoeol(); X refresh(); X if(getch()=='y'){ X*************** X*** 208,214 **** X mvprintw(LINES-4,0,"Your mercenaries demand %ld talons to disband", X *(u_encost+(P_ATYPE%UTYPE)) * P_ASOLD); X X! mvprintw(LINES-3,0,"Give them severance pay? (y or n)"); X clrtoeol(); X refresh(); X if(getch()=='y'){ X--- 210,216 ---- X mvprintw(LINES-4,0,"Your mercenaries demand %ld talons to disband", X *(u_encost+(P_ATYPE%UTYPE)) * P_ASOLD); X X! mvaddstr(LINES-3,0,"Give them severance pay? (y or n)"); X clrtoeol(); X refresh(); X if(getch()=='y'){ X*************** X*** 497,505 **** X } X } X X count2=0; X while(done==FALSE) { X! clear(); X ypos=2; X xpos=BUF_COLS; X count=0; X--- 499,509 ---- X } X } X X+ clear(); X count2=0; X while(done==FALSE) { X! move(0,0); X! clrtobot(); X ypos=2; X xpos=BUF_COLS; X count=0; X*************** X*** 524,530 **** X standout(); X mvprintw(ypos,xpos,"%d:",nvynum); X standend(); X! mvprintw(ypos+1,xpos,"lt/md/hv"); X mvprintw(ypos+2,xpos,"%2hd/%2hd/%2hd",P_NWAR(N_LIGHT),P_NWAR(N_MEDIUM),P_NWAR(N_HEAVY)); X mvprintw(ypos+3,xpos,"%2hd/%2hd/%2hd",P_NMER(N_LIGHT),P_NMER(N_MEDIUM),P_NMER(N_HEAVY)); X mvprintw(ypos+4,xpos,"%2hd/%2hd/%2hd",P_NGAL(N_LIGHT),P_NGAL(N_MEDIUM),P_NGAL(N_HEAVY)); X--- 528,534 ---- X standout(); X mvprintw(ypos,xpos,"%d:",nvynum); X standend(); X! mvaddstr(ypos+1,xpos,"lt/md/hv"); X mvprintw(ypos+2,xpos,"%2hd/%2hd/%2hd",P_NWAR(N_LIGHT),P_NWAR(N_MEDIUM),P_NWAR(N_HEAVY)); X mvprintw(ypos+3,xpos,"%2hd/%2hd/%2hd",P_NMER(N_LIGHT),P_NMER(N_MEDIUM),P_NMER(N_HEAVY)); X mvprintw(ypos+4,xpos,"%2hd/%2hd/%2hd",P_NGAL(N_LIGHT),P_NGAL(N_MEDIUM),P_NGAL(N_HEAVY)); X*** ocombat.c Wed Sep 20 21:40:54 1989 X--- combat.c Wed Sep 20 21:41:26 1989 X*************** X*** 35,40 **** X--- 35,41 ---- X int xspot,yspot; /*location of battles*/ X int anation; /*nation attacking in this fight*/ X int dnation; /*one nation defending in this fight*/ X+ int count=0; /*number of armies or navies in sector*/ X X /************************************************************************/ X /* COMBAT() run all combat on the map */ X*************** X*** 49,55 **** X int initialized=FALSE; /* TRUE if arrays initialized */ X short armynum,nvynum; X int valid; X- int count=0; X struct s_nation *nptr; X struct army *aptr; X X--- 50,55 ---- X*************** X*** 195,201 **** X int done; X int i,j,k; X long asold=0,dsold=0; /*a's and d's total soldiers*/ X! long astr=0,dstr=0; /*a's and d's relative strength*/ X long Aloss,Dloss; /*a's and d's total losses*/ X int PAloss,PDloss; /*percent a and d loss*/ X long loss; X--- 195,201 ---- X int done; X int i,j,k; X long asold=0,dsold=0; /*a's and d's total soldiers*/ X! float astr=0,dstr=0; /*a's and d's relative strength*/ X long Aloss,Dloss; /*a's and d's total losses*/ X int PAloss,PDloss; /*percent a and d loss*/ X long loss; X*************** X*** 204,210 **** X short nvamps=0; /* number of vampire armies */ X X /* determine who is attacker & who is on defenders side?*/ X! for(j=0;j<MGKNUM;j++) if(owner[j]!=(-1)){ X if(owner[j]==anation) side[j]=ATKR; X else if(owner[j]==dnation) side[j]=DFND; X else if(ntn[anation].dstatus[owner[j]]==JIHAD) side[j]=DFND; X--- 204,210 ---- X short nvamps=0; /* number of vampire armies */ X X /* determine who is attacker & who is on defenders side?*/ X! for(j=0;j<count;j++) if(owner[j]!=(-1)){ X if(owner[j]==anation) side[j]=ATKR; X else if(owner[j]==dnation) side[j]=DFND; X else if(ntn[anation].dstatus[owner[j]]==JIHAD) side[j]=DFND; X*************** X*** 218,224 **** X /*calculate number of troops and assign statuses */ X asold=0; X dsold=0; X! for(i=0;i<MGKNUM;i++) if(owner[i]>(-1)) { X /* record troops for all units in sector */ X troops[i]=ntn[owner[i]].arm[unit[i]].sold; X X--- 218,224 ---- X /*calculate number of troops and assign statuses */ X asold=0; X dsold=0; X! for(i=0;i<count;i++) if(owner[i]>(-1)) { X /* record troops for all units in sector */ X troops[i]=ntn[owner[i]].arm[unit[i]].sold; X X*************** X*** 228,239 **** X &&( ntn[owner[i]].arm[unit[i]].stat < NUMSTATUS ) X &&( rand()%100<15 )) { X if( ispc(ntn[owner[i]].active)) { X! mailopen( owner[i] ); X! fprintf(fm,"Message to %s from Conquer\n",ntn[owner[i]].name); X! fprintf(fm,"\n Your %s Army %d Refuses to Fight\n", X unittype[ntn[owner[i]].arm[unit[i]].unittyp], X unit[i]); X! mailclose(); X } X retreatside = side[i]; X fdxyretreat(); X--- 228,240 ---- X &&( ntn[owner[i]].arm[unit[i]].stat < NUMSTATUS ) X &&( rand()%100<15 )) { X if( ispc(ntn[owner[i]].active)) { X! if (mailopen( owner[i] )!=(-1)) { X! fprintf(fm,"Message to %s from Conquer\n\n",ntn[owner[i]].name); X! fprintf(fm," Your %s Army %d Refuses to Fight\n", X unittype[ntn[owner[i]].arm[unit[i]].unittyp], X unit[i]); X! mailclose(owner[i]); X! } X } X retreatside = side[i]; X fdxyretreat(); X*************** X*** 281,287 **** X else odds = (asold*100)/dsold; X X /* mercenaries/orcs/goblins might run away */ X! for(i=0;i<MGKNUM;i++) if(owner[i]>(-1)) { X if(((( odds > 200 )&&(side[i]==DFND)) X ||(( odds < 100 )&&(side[i]==ATKR))) X &&((ntn[owner[i]].arm[unit[i]].unittyp == A_MERCENARY) X--- 282,288 ---- X else odds = (asold*100)/dsold; X X /* mercenaries/orcs/goblins might run away */ X! for(i=0;i<count;i++) if(owner[i]>(-1)) { X if(((( odds > 200 )&&(side[i]==DFND)) X ||(( odds < 100 )&&(side[i]==ATKR))) X &&((ntn[owner[i]].arm[unit[i]].unittyp == A_MERCENARY) X*************** X*** 290,301 **** X &&(ntn[owner[i]].arm[unit[i]].stat < NUMSTATUS) X &&( rand()%100<30 )) { X if( ispc(ntn[owner[i]].active)) { X! mailopen( owner[i] ); X! fprintf(fm,"Message to %s from Conquer\n",ntn[owner[i]].name); X fprintf(fm," Your %s Army %d Runs Away\n", X unittype[ntn[owner[i]].arm[unit[i]].unittyp], X unit[i]); X! mailclose(); X } X retreatside = side[i]; X if( side[i] == ATKR ) asold-= troops[i]; X--- 291,303 ---- X &&(ntn[owner[i]].arm[unit[i]].stat < NUMSTATUS) X &&( rand()%100<30 )) { X if( ispc(ntn[owner[i]].active)) { X! if(mailopen( owner[i] )!=(-1)) { X! fprintf(fm,"Message to %s from Conquer\n\n",ntn[owner[i]].name); X fprintf(fm," Your %s Army %d Runs Away\n", X unittype[ntn[owner[i]].arm[unit[i]].unittyp], X unit[i]); X! mailclose(owner[i]); X! } X } X retreatside = side[i]; X if( side[i] == ATKR ) asold-= troops[i]; X*************** X*** 324,330 **** X /* CALCULATE AVERAGE COMBAT BONUS */ X abonus=0; X dbonus=0; X! for(i=0;i<MGKNUM;i++) if(owner[i]>(-1)) { X if(side[i]==ATKR) X abonus += cbonus(i)*troops[i]; X else if(side[i]==DFND && ntn[owner[i]].arm[unit[i]].stat!=RULE) X--- 326,332 ---- X /* CALCULATE AVERAGE COMBAT BONUS */ X abonus=0; X dbonus=0; X! for(i=0;i<count;i++) if(owner[i]>(-1)) { X if(side[i]==ATKR) X abonus += cbonus(i)*troops[i]; X else if(side[i]==DFND && ntn[owner[i]].arm[unit[i]].stat!=RULE) X*************** X*** 334,340 **** X /*archer bonus if not in fort vs knights/cavalry*/ X j=0; X k=0; X! for(i=0;i<MGKNUM;i++) if(owner[i]>(-1)) X if(ISCITY(sct[xspot][yspot].designation)){ X if((ntn[owner[i]].arm[unit[i]].unittyp == A_CAVALRY) X ||(ntn[owner[i]].arm[unit[i]].unittyp == A_KNIGHT)) X--- 336,342 ---- X /*archer bonus if not in fort vs knights/cavalry*/ X j=0; X k=0; X! for(i=0;i<count;i++) if(owner[i]>(-1)) X if(ISCITY(sct[xspot][yspot].designation)){ X if((ntn[owner[i]].arm[unit[i]].unittyp == A_CAVALRY) X ||(ntn[owner[i]].arm[unit[i]].unittyp == A_KNIGHT)) X*************** X*** 342,348 **** X else if(side[i]==DFND) k+=troops[i]; X } X X! for(i=0;i<MGKNUM;i++) if(owner[i]>(-1)) { X if(j>0) abonus += (15 * j * troops[i]) / asold; X if(k>0 && dsold>0) dbonus += (15 * k * troops[i]) / dsold; X } X--- 344,350 ---- X else if(side[i]==DFND) k+=troops[i]; X } X X! for(i=0;i<count;i++) if(owner[i]>(-1)) { X if(j>0) abonus += (15 * j * troops[i]) / asold; X if(k>0 && dsold>0) dbonus += (15 * k * troops[i]) / dsold; X } X*************** X*** 351,357 **** X if (dsold>0) dbonus/=dsold; X X /*CALCULATED BONUSES TO WHOLE COMBAT*/ X! for(i=0;i<MGKNUM;i++) if(owner[i]>(-1)) { X if(fort_val(&sct[xspot][yspot]) != 0){ X /*Catapults add +1%/20 men defending castle (max +10%)*/ X if((ntn[owner[i]].arm[unit[i]].unittyp == A_CATAPULT) X--- 353,359 ---- X if (dsold>0) dbonus/=dsold; X X /*CALCULATED BONUSES TO WHOLE COMBAT*/ X! for(i=0;i<count;i++) if(owner[i]>(-1)) { X if(fort_val(&sct[xspot][yspot]) != 0){ X /*Catapults add +1%/20 men defending castle (max +10%)*/ X if((ntn[owner[i]].arm[unit[i]].unittyp == A_CATAPULT) X*************** X*** 472,478 **** X if(PDloss>100) PDloss = 100; X X Aloss = Dloss = 0; X! for(i=0;i<MGKNUM;i++) if(owner[i]>(-1)){ X if(side[i]==ATKR){ X if( ntn[owner[i]].arm[unit[i]].unittyp >= MINLEADER) { X if((rand()%100) < PAloss){ /* kill it */ X--- 474,480 ---- X if(PDloss>100) PDloss = 100; X X Aloss = Dloss = 0; X! for(i=0;i<count;i++) if(owner[i]>(-1)){ X if(side[i]==ATKR){ X if( ntn[owner[i]].arm[unit[i]].unittyp >= MINLEADER) { X if((rand()%100) < PAloss){ /* kill it */ X*************** X*** 546,557 **** X fprintf(fnews,"4.\tBattle in %d,%d",xspot,yspot); X k = 25; X #endif X! for(j=0;j<MGKNUM;j++) if(UOWNER(j)>(-1)){ X done=FALSE; X for(i=0;i<j;i++) if(UOWNER(j)==UOWNER(i)) done=TRUE; X if(done==FALSE) { X loss=NTRL; X! for(i=j;(loss==NTRL||loss==WIMP) && i<MGKNUM;i++) X if(UOWNER(i)==UOWNER(j)) { X if(owner[i]<(-1)) loss=WIMP; X else loss=side[i]; X--- 548,559 ---- X fprintf(fnews,"4.\tBattle in %d,%d",xspot,yspot); X k = 25; X #endif X! for(j=0;j<count;j++) if(UOWNER(j)>(-1)){ X done=FALSE; X for(i=0;i<j;i++) if(UOWNER(j)==UOWNER(i)) done=TRUE; X if(done==FALSE) { X loss=NTRL; X! for(i=j;(loss==NTRL||loss==WIMP) && i<count;i++) X if(UOWNER(i)==UOWNER(j)) { X if(owner[i]<(-1)) loss=WIMP; X else loss=side[i]; X*************** X*** 574,580 **** X } X fprintf(fnews,"\n"); X if(nvamps>0){ X! for(i=0;i<MGKNUM;i++) if(owner[i]>(-1)){ X if((magic(owner[i],VAMPIRE)==TRUE) X &&(ntn[owner[i]].arm[unit[i]].unittyp==A_ZOMBIE) X &&(ntn[owner[i]].arm[unit[i]].sold > 0)) X--- 576,582 ---- X } X fprintf(fnews,"\n"); X if(nvamps>0){ X! for(i=0;i<count;i++) if(owner[i]>(-1)){ X if((magic(owner[i],VAMPIRE)==TRUE) X &&(ntn[owner[i]].arm[unit[i]].unittyp==A_ZOMBIE) X &&(ntn[owner[i]].arm[unit[i]].sold > 0)) X*************** X*** 583,589 **** X } X X /*who is in the battle; but don't send to scared armies */ X! for(j=0;j<MGKNUM;j++) if(owner[j]>(-1)){ X done=FALSE; X X /*first time your nation appears done=FALSE*/ X--- 585,591 ---- X } X X /*who is in the battle; but don't send to scared armies */ X! for(j=0;j<count;j++) if(owner[j]>(-1)){ X done=FALSE; X X /*first time your nation appears done=FALSE*/ X*************** X*** 592,600 **** X if((done==FALSE)&&(ispc(ntn[owner[j]].active))) { X X loss=NTRL; X! for(i=j;loss==NTRL && i<MGKNUM;i++) X loss=side[i]; X! mailopen( owner[j] ); X X fprintf(fm,"BATTLE SUMMARY for sector %d, %d\n",xspot,yspot); X fprintf(fm,"Battle occured during %s of Year %d\n",PSEASON(TURN),YEAR(TURN)); X--- 594,602 ---- X if((done==FALSE)&&(ispc(ntn[owner[j]].active))) { X X loss=NTRL; X! for(i=j;loss==NTRL && i<count;i++) X loss=side[i]; X! if (mailopen( owner[j] )==(-1)) continue; X X fprintf(fm,"BATTLE SUMMARY for sector %d, %d\n",xspot,yspot); X fprintf(fm,"Battle occured during %s of Year %d\n",PSEASON(TURN),YEAR(TURN)); X*************** X*** 606,621 **** X else fprintf(fm,"You are Neutral\n"); X X /*detail all participants in battle*/ X! for(k=0;k<MGKNUM;k++) if(owner[k]!=(-1)){ X fprintf(fm," %s ",ntn[UOWNER(k)].name); X if(owner[k]<(-1)) X fprintf(fm,"chickens out: "); X else if(side[k]==DFND X! && ntn[UOWNER(k)].arm[unit[k]].stat!=RULE) X fprintf(fm,"defending: "); X else if(side[k]==ATKR) X fprintf(fm,"attacking: "); X! else fprintf(fm,"neutral: "); X fprintf(fm,"army %d (%s, men %d, bonus=%d, loss=%d)", X unit[k], X unittype[ntn[UOWNER(k)].arm[unit[k]].unittyp%UTYPE], X--- 608,629 ---- X else fprintf(fm,"You are Neutral\n"); X X /*detail all participants in battle*/ X! for(k=0;k<count;k++) if(owner[k]!=(-1)){ X fprintf(fm," %s ",ntn[UOWNER(k)].name); X if(owner[k]<(-1)) X fprintf(fm,"chickens out: "); X else if(side[k]==DFND X! && ntn[owner[k]].arm[unit[k]].stat!=RULE) X fprintf(fm,"defending: "); X else if(side[k]==ATKR) X fprintf(fm,"attacking: "); X! else if(side[k]==NTRL X! || (side[k]==DFND X! && ntn[owner[k]].arm[unit[k]].stat==RULE)) X! fprintf(fm,"neutral: "); X! else X! fprintf(fm,"in limbo: "); X! X fprintf(fm,"army %d (%s, men %d, bonus=%d, loss=%d)", X unit[k], X unittype[ntn[UOWNER(k)].arm[unit[k]].unittyp%UTYPE], X*************** X*** 643,649 **** X if(Dloss<dsold) X fprintf(fm,"Additionally, All defenders retreat to %d %d\n",retreatx,retreaty); X } X! mailclose(); X } X } X retreat( -1 ); X--- 651,657 ---- X if(Dloss<dsold) X fprintf(fm,"Additionally, All defenders retreat to %d %d\n",retreatx,retreaty); X } X! mailclose(owner[j]); X } X } X retreat( -1 ); X*************** X*** 794,800 **** X X if(retreatside == 0) return; X X! for(cnum=0;cnum<MGKNUM;cnum++) if(owner[cnum]>(-1)){ X if( unitnum != (-1) ) cnum=unitnum; X if((side[cnum]==ATKR)&&(retreatside==ATKR)){ X ntn[owner[cnum]].arm[unit[cnum]].xloc = retreatx; X--- 802,808 ---- X X if(retreatside == 0) return; X X! for(cnum=0;cnum<count;cnum++) if(owner[cnum]>(-1)){ X if( unitnum != (-1) ) cnum=unitnum; X if((side[cnum]==ATKR)&&(retreatside==ATKR)){ X ntn[owner[cnum]].arm[unit[cnum]].xloc = retreatx; X*************** X*** 840,846 **** X printf("In Naval Combat....\n"); X X /* determine who is attacker & who is on defenders side?*/ X! for(j=0;j<MGKNUM;j++) if(owner[j]!=(-1)){ X if(owner[j]==anation) side[j]=ATKR; X else if(ntn[anation].dstatus[owner[j]]==JIHAD) side[j]=DFND; X else if(ntn[owner[j]].dstatus[anation]==JIHAD) side[j]=DFND; X--- 848,854 ---- X printf("In Naval Combat....\n"); X X /* determine who is attacker & who is on defenders side?*/ X! for(j=0;j<count;j++) if(owner[j]!=(-1)){ X if(owner[j]==anation) side[j]=ATKR; X else if(ntn[anation].dstatus[owner[j]]==JIHAD) side[j]=DFND; X else if(ntn[owner[j]].dstatus[anation]==JIHAD) side[j]=DFND; X*************** X*** 864,870 **** X * MARINE 1/3 X * others 4/3 X */ X! for(j=0;j<MGKNUM;j++) if(owner[j]!=(-1)){ X curntn= &ntn[owner[j]]; X country= owner[j]; X wnum[j]=SHIPS(ntn[country].nvy[unit[j]].warships,N_LIGHT)+ X--- 872,878 ---- X * MARINE 1/3 X * others 4/3 X */ X! for(j=0;j<count;j++) if(owner[j]!=(-1)){ X curntn= &ntn[owner[j]]; X country= owner[j]; X wnum[j]=SHIPS(ntn[country].nvy[unit[j]].warships,N_LIGHT)+ X*************** X*** 1016,1022 **** X if (PDloss>100) PDloss=100; X X /* calculate actual losses */ X! for(j=0;j<MGKNUM;j++) if(owner[j]!=(-1)){ X curntn= &ntn[owner[j]]; X country= owner[j]; X X--- 1024,1030 ---- X if (PDloss>100) PDloss=100; X X /* calculate actual losses */ X! for(j=0;j<count;j++) if(owner[j]!=(-1)){ X curntn= &ntn[owner[j]]; X country= owner[j]; X X*************** X*** 1228,1234 **** X #else X fprintf(fnews,"4.\t%d,%d: Naval Battle",xspot,yspot); X #endif X! for(j=0;j<MGKNUM;j++) if(owner[j]!=(-1)){ X k=0; X for(i=0;i<j;i++) if(owner[j]==owner[i]) k=1; X if(k==0) { X--- 1236,1242 ---- X #else X fprintf(fnews,"4.\t%d,%d: Naval Battle",xspot,yspot); X #endif X! for(j=0;j<count;j++) if(owner[j]!=(-1)){ X k=0; X for(i=0;i<j;i++) if(owner[j]==owner[i]) k=1; X if(k==0) { X*************** X*** 1241,1247 **** X fprintf(fnews,"\n"); X X /*mail results; who is in the battle*/ X! for(j=0;j<MGKNUM;j++) if(owner[j]!=(-1)){ X done=FALSE; X X /*first time your nation appears done=FALSE*/ X--- 1249,1255 ---- X fprintf(fnews,"\n"); X X /*mail results; who is in the battle*/ X! for(j=0;j<count;j++) if(owner[j]!=(-1)){ X done=FALSE; X X /*first time your nation appears done=FALSE*/ X*************** X*** 1248,1254 **** X for(i=0;i<j;i++) if(owner[j]==owner[i]) done=TRUE; X X if((done==FALSE)&&(ispc(ntn[owner[j]].active))) { X! mailopen( owner[j] ); X X fprintf(fm,"NAVAL BATTLE in sector %d %d\n",xspot,yspot); X fprintf(fm,"Battle occured during %s of Year %d\n", X--- 1256,1262 ---- X for(i=0;i<j;i++) if(owner[j]==owner[i]) done=TRUE; X X if((done==FALSE)&&(ispc(ntn[owner[j]].active))) { X! if (mailopen( owner[j] )==(-1)) continue; X X fprintf(fm,"NAVAL BATTLE in sector %d %d\n",xspot,yspot); X fprintf(fm,"Battle occured during %s of Year %d\n", X*************** X*** 1261,1267 **** X else fprintf(fm,"You are on the Neutral Side\n"); X X /*detail all participants in battle*/ X! for(k=0;k<MGKNUM;k++) if(owner[k]!=(-1)){ X if(side[k]==DFND) X fprintf(fm," %s is defender with navy ",ntn[owner[k]].name); X else if(side[k]==ATKR) X--- 1269,1275 ---- X else fprintf(fm,"You are on the Neutral Side\n"); X X /*detail all participants in battle*/ X! for(k=0;k<count;k++) if(owner[k]!=(-1)){ X if(side[k]==DFND) X fprintf(fm," %s is defender with navy ",ntn[owner[k]].name); X else if(side[k]==ATKR) X*************** X*** 1283,1289 **** X show_ships("Defending","sunk",dwsunk,dgsunk,dmsunk); X show_ships("Attacking","captured",awcapt,agcapt,amcapt); X show_ships("Defending","captured",dwcapt,dgcapt,dmcapt); X! mailclose(); X } X } X curntn= saventn; X--- 1291,1297 ---- X show_ships("Defending","sunk",dwsunk,dgsunk,dmsunk); X show_ships("Attacking","captured",awcapt,agcapt,amcapt); X show_ships("Defending","captured",dwcapt,dgcapt,dmcapt); X! mailclose(owner[j]); X } X } X curntn= saventn; X*************** X*** 1302,1308 **** X printf("capture: hdcnt==%d typ==%d spsz==%d to==%d\n",holdcount, X type,shipsize,to); X #endif DEBUG X! for (i=0;holdcount && i<MGKNUM;i++) { X if (owner[i]!=(-1) && side[i]==to) { X curntn= &ntn[owner[i]]; X holdcount -= fltwhold(unit[i]); X--- 1310,1316 ---- X printf("capture: hdcnt==%d typ==%d spsz==%d to==%d\n",holdcount, X type,shipsize,to); X #endif DEBUG X! for (i=0;holdcount && i<count;i++) { X if (owner[i]!=(-1) && side[i]==to) { X curntn= &ntn[owner[i]]; X holdcount -= fltwhold(unit[i]); X*************** X*** 1315,1321 **** X #ifdef DEBUG X printf("capture 2: holdcount==%d i==%d\n",holdcount,i); X #endif DEBUG X! if (i==MGKNUM) { X curntn = saventn; X return; X } X--- 1323,1329 ---- X #ifdef DEBUG X printf("capture 2: holdcount==%d i==%d\n",holdcount,i); X #endif DEBUG X! if (i==count) { X curntn = saventn; X return; X } X*** omove.c Wed Sep 20 21:40:56 1989 SHAR_EOF echo "End of part 2, continue with part 3" echo "3" > s2_seq_.tmp exit 0