games-request@tekred.TEK.COM (10/26/87)
Submitted by: ihnp4!mhuxd!smile (E.BARLOW)
Comp.sources.games: Volume 2, Issue 62
Archive-name: conquest/Part05
#! /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 archive 5 (of 5)."
# Contents: .nations DIST-NOTE forms.c header.h io.c
# Wrapped by billr@tekred on Mon Oct 26 10:33:09 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f .nations -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \".nations\"
else
echo shar: Extracting \".nations\" \(2950 characters\)
sed "s/^X//" >.nations <<'END_OF_.nations'
X# GAME MASTERS FILE ON NPC NATIONS: COMPILE TIME ONLY
X# comments are offset by a # sign in the first column
X#
X# THERE IS A LIMIT OF "MAXNTN" NATIONS TOTAL; Be sure this is ok
X#
X# name :nations name
X# :examples include Darboth Ummaya Rugar Jute Atlantis Iberia
X# :Kuybyshev Avar Grodor Bantanya Fung Codor Delph Macitania
X# leader : permitted leaders are "dwarfking","elfking","elfdruid",
X# "elfwizard","demon","dragon","wizard","priest",
X# "shadow","king","priestking","wizard","demigod"
X# race :Character, ORC='O',ELF='E',DWARF='D',LZARD='L',HUMAN='H'
X# :BRIGAND='P' BARBARIAN='B'
X# mark :unique mark for race (ie & or ! or 1 or H...)
X# loc :G,F,R location (good,fair,random)
X# aplus :attack percentage plus (multiples of 10 (ie 10,20,30))
X# dplus :defence percentage plus (multiples of 10 (ie 10,20,30))
X# maxmove :movement rate (4 to 8)
X# gold :total gold at start
X# mil :total military at start
X# civilians :total civilians at start
X# repro-rate :reproduction rate of nation (percentage)
X# aggr :aggressiveness (1--always peaceful) to (10 -- always hostile)
X#
X#EXAMPLE NATIONS PTS
X# Sporf demon O S R 0 0 6 1000 2500 4000 10 9 9
X# Athens king H A R 10 10 9 10000 500 5000 5 4 9
X# Fung king E F F 20 30 8 20000 200 3000 3 2 6
X# X dwarfking D X R 20 20 6 20000 1500 4000 4 4 6
X# ADD PTS IN VALUE TO THE ABOVE FORE RACIAL BASES TO GET BALANCE
X#
X# THE NATIONS LISTED BELOW ARE CALIBRATED AS FOLLOWS
X# ELVES: fung (27), lint (28), anorian (29), roos (22) =>106 points
X# ORCS : sporf (24), etland (24), woolos (36), darboth (20) =>106 points
X# HUMAN: argos(24), taelos(20), cordoba(21), zaos(21), tokus(20) =>106
X# DWARF: Goldor (22), Muldor (38), Sodor (25)points, Valar(20) =>106 points
X#
X# format: (note that offset by a space)
X#
X# name leader race mark location aplus dplus maxmove gold mil civ repro aggr
X#########################################################################
Xanorian elfwizard E A F 30 40 8 30000 1500 8500 8 2
Xargos king H a R 10 10 9 10000 1500 11000 7 4
Xbobland dragon O b F 20 0 6 1000 1500 8000 10 9
Xcordoba wizard H c R 10 10 2 10000 1500 8000 8 4
Xdarboth balrog O d R 0 0 7 30000 1500 9500 8 9
Xedland dragon O e R 20 0 8 1000 1500 8500 10 9
Xfarmland warking H F R 10 10 9 20000 1000 6150 8 4
Xfung elfking E f F 10 40 8 20000 1000 9500 8 2
Xgelos dwarfduke D g F 15 10 9 20000 1000 7900 7 8
Xlint elfwizard E l F 20 30 8 20000 1500 7900 10 2
XMuldor dwarfking D m F 10 30 6 60000 5000 18000 7 4
Xmoria dwarfduke D M R 10 30 6 20000 1000 10000 8 4
Xroos elfpriest E r R 20 0 6 3000 2000 6500 10 9
Xtokus king H T R 10 10 8 10000 1000 7500 8 4
Xwoolos shadow O w F 10 10 10 10000 3500 17000 10 9
XValar dwarf D v R 10 15 8 10000 1000 7000 8 4
Xzaos king H z R 10 15 12 10000 1000 7000 8 4
END_OF_.nations
if test 2950 -ne `wc -c <.nations`; then
echo shar: \".nations\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f DIST-NOTE -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"DIST-NOTE\"
else
echo shar: Extracting \"DIST-NOTE\" \(446 characters\)
sed "s/^X//" >DIST-NOTE <<'END_OF_DIST-NOTE'
X October 26, 1987
X
X
XBill Randle
XModerator
Xcomp.sources.games
X
XBill,
X
XThe reason I want to limit re-distribution is to assure source code
Xintegrity when I get modification requests... This version has been
Xplayed by myself about a dozen times, but there will still be many
Xmany bugs and changes... I do want as wide a distribution as possible,
Xso, you have permission to distribute this as widely
Xas desired.
X
XThanks!
XEd
Xihnp4!mhuxd!smile
END_OF_DIST-NOTE
if test 446 -ne `wc -c <DIST-NOTE`; then
echo shar: \"DIST-NOTE\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f forms.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"forms.c\"
else
echo shar: Extracting \"forms.c\" \(12808 characters\)
sed "s/^X//" >forms.c <<'END_OF_forms.c'
X/*conquest is copyrighted 1986 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
X/* screen subroutines */
X
X/*include files*/
X#include <ctype.h>
X#include "header.h"
X
Xextern FILE *fexe;
Xextern short country;
X
Xshowscore()
X{
X int i;
X int done=0;
X int position;
X int count; /*number of time through the loop on this screen*/
X int nationid; /*current nation id */
X
X nationid=1;
X while((done==0)&&(nationid<MAXNTN)) {
X clear();
X standout();
X mvaddstr(0,(COLS/2)-10,"NATION SCORE SCREEN");
X standend();
X mvaddstr(3,0,"nationid is:");
X mvaddstr(4,0,"name is:");
X mvaddstr(5,0,"leader:");
X mvaddstr(6,0,"race:");
X mvaddstr(7,0,"class:");
X mvaddstr(8,0,"score:");
X mvaddstr(9,0,"gold:");
X mvaddstr(10,0,"military:");
X mvaddstr(11,0,"civilians:");
X mvaddstr(12,0,"sectors:");
X mvaddstr(13,0,"ships:");
X
X count=0;
X position=2;
X while((nationid<MAXNTN)&&(count<5)){
X if((nationid<MAXNTN)&&(ntn[nationid].active!=0)) {
X position+=13;
X mvprintw(3,position,"%d",nationid);
X standout();
X mvprintw(4,position,"%s",ntn[nationid].name);
X standend();
X mvprintw(5,position,"%s",ntn[nationid].leader);
X for(i=1;i<8;i++)
X if(ntn[nationid].race==*(races+i)[0])
X mvprintw(6,position,"%s",*(races+i));
X if(ntn[nationid].active>=2) mvprintw(7,position,"NPC");
X else mvprintw(7,position,"%s",*(Class+ntn[nationid].class));
X mvprintw(8,position,"%d",ntn[nationid].score);
X mvprintw(9,position,"%d",ntn[nationid].tgold);
X mvprintw(10,position,"%d",ntn[nationid].tmil);
X mvprintw(11,position,"%d",ntn[nationid].tciv);
X mvprintw(12,position,"%d",ntn[nationid].tsctrs);
X mvprintw(13,position,"%d",ntn[nationid].tships);
X count++;
X }
X nationid++;
X }
X standout();
X mvaddstr(18,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
X mvaddstr(19,(COLS/2)-9,"HIT SPACE IF DONE");
X standend();
X refresh();
X if (getch()==' ') done=1;
X }
X}
X
Xdiploscrn()
X{
X int i;
X char k;
X short nation, offset, count, olddip, oldnat, temp;
X FILE *fp, *fopen();
X short isgod=0;
X if(country==0) {
X isgod=1;
X clear();
X mvaddstr(0,0,"WHAT NATION NUMBER:");
X refresh();
X echo();
X scanw("%hd",&country);
X noecho();
X }
X while(1){
X count=1;
X offset=0;
X clear();
X standout();
X mvaddstr(0,(COLS/2)-10,"NATION DIPLOMACY SUMMARY");
X standend();
X mvaddstr(2,0," BY YOU, TO YOU");
X for(i=1;i<MAXNTN+4;i++) if((ntn[i].active>0)&&(i!=country)) {
X if(count%14==0) {
X offset+=40;
X mvaddstr(2,40," BY YOU, TO YOU");
X count++;
X }
X mvprintw(count%14+2,offset, "%d. %s",i,ntn[i].name);
X mvprintw(count%14+2,offset+14, "=> %s",*(diploname+ntn[country].dstatus[i]));
X mvprintw(count%14+2,offset+28, "=> %s",*(diploname+ntn[i].dstatus[country]));
X count++;
X }
X standout();
X mvaddstr(17,0,"HIT RETURN KEY TO CHANGE STATUS");
X mvprintw(18,0,"HIT 'B' KEY TO BRIBE WARING NPC NATION (%d GOLD/level)",BRIBE);
X mvaddstr(19,0,"ANY OTHER KEY TO CONTINUE:");
X standend();
X refresh();
X k=getch();
X if((k!='\n')&&(k!='B')) {
X if(isgod==1) country=0;
X return;
X }
X if(k=='B'){
X if(ntn[country].tgold<=BRIBE){
X mvaddstr(21,0,"NOT ENOUGH GOLD");
X refresh();
X getch();
X return;
X }
X mvaddstr(20,0,"BRIBES WORK 50% (only the update will show)");
X mvaddstr(21,0,"WHAT NATION NUMBER:");
X refresh();
X echo();
X scanw("%hd",&nation);
X noecho();
X if(ntn[country].active>=2){
X mvaddstr(22,0,"NOT NON PLAYER COUNTRY");
X refresh();
X getch();
X return;
X }
X if((nation<=0)||(nation>MAXNTN)){
X if(isgod==1) country=0;
X return;
X }
X if((isgod!=1)&&((ntn[nation].dstatus[country]==ALLIED)||(ntn[nation].dstatus[country]==JIHAD)||(ntn[nation].dstatus[country]==CONFEDERACY))){
X mvaddstr(22,0,"CANT CHANGE THEIR STATUS");
X refresh();
X getch();
X return;
X }
X ntn[nation].dstatus[country]--;
X ntn[country].tgold-=BRIBE;
X ntn[nation].tgold+=BRIBE;
X EADJDIP;
X oldnat=country;
X country=nation;
X nation=oldnat;
X fprintf(fexe,"NGOLD\t%hd \t%d \t%d \t0 \t0 \t%s\n",XNAGOLD ,country,ntn[country].tgold,"null");
X EADJDIP;
X country=oldnat;
X return;
X }
X mvaddstr(21,0,"WHAT NATION NUMBER:");
X refresh();
X echo();
X scanw("%hd",&nation);
X if((nation<=0)||(nation>MAXNTN)){
X noecho();
X if(isgod==1) country=0;
X return;
X }
X noecho();
X if((isgod==0)&&(((ntn[country].dstatus[nation]==CONFEDERACY)&&(ntn[nation].dstatus[country]<WAR))||(ntn[country].dstatus[nation]==JIHAD))) {
X mvprintw(23,0,"SORRY, Can't change status on ntn %s -- hit return",ntn[nation].name);
X refresh();
X getch();
X return;
X }
X else{
X clear();
X mvaddstr(0,0,"WHAT NEW STATUS");
X mvaddstr(2,0,"1) CONFEDERACY (irrevocable)");
X mvaddstr(3,0,"2) ALLIED");
X mvaddstr(4,0,"3) FRIENDLY");
X mvaddstr(5,0,"4) NEUTRAL");
X mvaddstr(6,0,"5) HOSTILE");
X mvaddstr(7,0,"6) WAR");
X mvaddstr(8,0,"7) JIHAD (irrevocable):");
X mvaddstr(12,0,"INPUT:");
X refresh();
X scanw("%hd",&temp);
X if((temp<1)||(temp>7)){
X mvprintw(23,0,"SORRY, Invalid inputs -- hit return");
X refresh();
X getch();
X return;
X }
X ntn[country].dstatus[nation]=temp;
X EADJDIP;
X
X /*prevent ron from being sneaky*/
X if((temp>HOSTILE)&&(ntn[nation].active>2)&&(ntn[nation].dstatus[country]<WAR)) {
X olddip=ntn[nation].dstatus[country];
X oldnat=country;
X country=nation;
X nation=oldnat;
X ntn[country].dstatus[nation]=WAR;
X EADJDIP;
X ntn[country].dstatus[nation]=olddip;
X oldnat=country;
X country=nation;
X nation=oldnat;
X }
X else if((temp>HOSTILE)&&(ntn[nation].active==1)&&(ntn[nation].dstatus[country]<WAR)) {
X if ((fp=fopen(MSGFILE,"a+"))==NULL) {
X mvprintw(4,0,"error opening %s",MSGFILE);
X refresh();
X getch();
X return;
X }
X fprintf(fp,"%s %s Declared war on you\n",ntn[nation].name,ntn[country].name);
X fputs("END\n",fp);
X fclose(fp);
X }
X }
X }
X}
X
Xchange()
X{
X char string[10];
X int i;
X short armynum;
X char passwd[8];
X short isgod=0;
X
X if(country==0) {
X isgod=1;
X clear();
X mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
X refresh();
X echo();
X scanw("%hd",&country);
X noecho();
X }
X clear();
X mvaddstr(0,(COLS/2)-10,"NATION STATS SUMMARY");
X mvprintw(5,0,"1. nation name is %s ",ntn[country].name);
X mvprintw(6,0,"2. password is XXXXXXXX");
X mvprintw(12,0,"capital loc: x is %d",ntn[country].capx);
X mvprintw(13,0," y is %d",ntn[country].capy);
X mvprintw(14,0,"leader is %s",ntn[country].leader);
X mvprintw(15,0,"class is %s",*(Class+ntn[country].class));
X mvprintw(16,0,"nations mark is...%c ",ntn[country].mark);
X for(i=1;i<8;i++) if(ntn[country].race==*(races+i)[0])
X mvprintw(17,0, "nation race is....%s ",*(races+i));
X mvprintw(18,0,"score currently...%d",ntn[country].score);
X
X mvprintw(4,(COLS/2), "attack bonus...........+%2d",ntn[country].aplus);
X mvprintw(5,(COLS/2), "defense bonus..........+%2d",ntn[country].dplus);
X mvprintw(6,(COLS/2), "maximum move rate.......%2d",ntn[country].maxmove);
X mvprintw(7,(COLS/2), "reproduction rate......%2d%%",ntn[country].repro);
X mvprintw(9,(COLS/2), "gold talons........$%5ld",ntn[country].tgold);
X mvprintw(10,(COLS/2),"jewels ............$%5ld",ntn[country].jewels);
X mvprintw(11,(COLS/2),"iron & minerals......%5ld",ntn[country].tiron);
X if(ntn[country].tfood<2*ntn[country].tciv) standout();
X mvprintw(12,(COLS/2),"food in granary......%5ld",ntn[country].tfood);
X standend();
X
X mvprintw(13,(COLS/2),"total soldiers.......%5ld",ntn[country].tmil);
X mvprintw(14,(COLS/2),"total civilians......%5ld",ntn[country].tciv);
X mvprintw(15,(COLS/2),"total ships..........%5d",ntn[country].tships);
X mvprintw(16,(COLS/2),"total sectors........%5d",ntn[country].tsctrs);
X
X standout();
X mvaddstr(19,(COLS/2)-9, "HIT ANY KEY TO CONTINUE");
X mvaddstr(20,(COLS/2)-15,"HIT 1 or 2 TO CHANGE NAME or PASSWD");
X mvaddstr(21,(COLS/2)-15,"HIT 3 TO CHANGE ADD TO COMBAT BONUS");
X if(isgod==1) mvaddstr(21,(COLS/2)-9,"HIT 4 TO DESTROY NATION");
X
X standend();
X refresh();
X switch(getch()){
X case '1': /*get name*/
X clear();
X echo();
X mvaddstr(0,0,"what name would you like:");
X clrtoeol();
X refresh();
X scanw("%s",string);
X if((strlen(string)<=1)||(strlen(string)>=10)){
X beep();
X mvaddstr(2,0,"invalid name--hit return");
X noecho();
X refresh();
X getch();
X if(isgod==1) country=0;
X return;
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 mvaddstr(2,0,"name already used--hit return");
X beep();
X noecho();
X refresh();
X getch();
X if(isgod==1) country=0;
X return;
X }
X }
X strcpy(ntn[country].name,string);
X noecho();
X ECHGNAME;
X break;
X case '2': /*change password */
X clear();
X if(isgod!=1){
X mvaddstr(0,0,"what is your current password:");
X refresh();
X scanw("%s",string);
X strcpy(passwd,crypt(string,SALT));
X if((strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)&&(strncmp(passwd,ntn[country].passwd,PASSLTH)!=0)){
X beep();
X mvaddstr(2,0,"invalid password--hit return");
X refresh();
X getch();
X if(isgod==1) country=0;
X return;
X }
X }
X mvaddstr(2,0,"what is your new password:");
X refresh();
X scanw("%s",string);
X if((strlen(string)>8)||(strlen(string)<2)) {
X beep();
X mvaddstr(2,0,"invalid new password--hit return");
X refresh();
X getch();
X if(isgod==1) country=0;
X return;
X }
X mvaddstr(4,0,"reenter your new password:");
X refresh();
X scanw("%s",passwd);
X if(strcmp(passwd,string)!=0) {
X if(isgod==1) country=0;
X return;
X }
X ECHGPAS;
X strncpy(ntn[country].passwd,crypt(string,SALT),PASSLTH);
X break;
X case '3':
X for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) i+=ASOLD;
X if(i<1500) i=1500;
X mvprintw(0,0,"DO YOU WISH SPEND %d IRON ON ATTACK (enter y or n):",IRONORE*i);
X refresh();
X if(getch()=='y'){
X if(ntn[country].tiron>IRONORE*i){
X ntn[country].aplus+=1;
X I_APLUS;
X ntn[country].tiron-=IRONORE*i;
X }
X }
X mvprintw(0,0,"DO YOU WISH SPEND %d IRON ON DEFENSE (enter y or n):",IRONORE*i);
X refresh();
X if(getch()=='y'){
X if(ntn[country].tiron>IRONORE*i){
X ntn[country].dplus+=1;
X I_DPLUS;
X ntn[country].tiron-=IRONORE*i;
X }
X }
X break;
X case '4':
X if(isgod==1){
X clear();
X mvaddstr(0,0,"DO YOU WANT TO DESTROY THIS NATION (y or n)");
X refresh();
X if(getch()=='y') destroy();
X }
X break;
X default:
X if(isgod==1) country=0;
X return;
X }
X if(isgod==1) country=0;
X}
X
Xhelp()
X{
X int lineno;
X FILE *fp, *fopen();
X int done=0;
X char line[80];
X
X /*open .help file*/
X if ((fp=fopen(HELPFILE,"r"))==NULL) {
X mvaddstr(0,0,"\nerror on read \n");
X refresh();
X getch();
X return;
X }
X
X while(done==0){
X /*read in screen (until DONE statement)*/
X fgets(line,80,fp);
X if(strncmp(line,"DONE",4)==0) done=1;
X else {
X clear();
X lineno=0;
X while(strncmp(line,"END",3)!=0) {
X mvaddstr(lineno,0,line);
X lineno++;
X if(lineno>LINES-3) strcpy(line,"END");
X else fgets(line,80,fp);
X }
X standout();
X mvaddstr(LINES-2,(COLS/2)-14,"HIT SPACE TO CONTINUE HELP SCREENS");
X mvaddstr(LINES-1,(COLS/2)-12,"TO END HELP HIT ANY OTHER KEY");
X standend();
X refresh();
X if(getch()!=' ') done=1;
X }
X }
X fclose(fp);
X}
X
Xnewspaper()
X{
X int lineno;
X FILE *fp, *fopen();
X int newpage,done;
X short pagenum=1;
X char line[80];
X char title[80];
X
X clear();
X if ((fp=fopen(NEWSFILE,"r"))==NULL) {
X mvaddstr(0,0,"error on read ");
X refresh();
X getch();
X return;
X }
X
X /*open and read one page */
X done=0;
X newpage=0;
X if(fgets(title,80,fp)==NULL) done=1;
X while(done==0){
X if(newpage==0){
X clear();
X lineno=5;
X newpage=1;
X standout();
X mvprintw(0,20,"CONQUEST NEWS REPORT page %d",pagenum);
X mvaddstr(1,23,"ALL THE NEWS THAT FITS");
X mvprintw(3,20,"%s",title+2);
X standend();
X }
X
X if(fgets(line,80,fp)==NULL) done=1;
X else {
X if(line[1]!='.') {
X strcpy(title,line);
X newpage=0;
X pagenum++;
X }
X else {
X mvaddstr(lineno++,0,line+2);
X if(todigit(line[0])!=pagenum) {
X newpage=0;
X pagenum=todigit(line[0]);
X }
X else if(lineno>LINES-3) newpage=0;
X }
X }
X
X if(newpage==0||done==1){
X standout();
X mvaddstr(LINES-2,(COLS/2)-13,"HIT ANY KEY TO CONTINUE");
X mvaddstr(LINES-1,(COLS/2)-12,"TO END NEWS HIT SPACE");
X standend();
X refresh();
X if(getch()==' ') done=1;
X }
X }
X fclose(fp);
X}
END_OF_forms.c
if test 12808 -ne `wc -c <forms.c`; then
echo shar: \"forms.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f header.h -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"header.h\"
else
echo shar: Extracting \"header.h\" \(12852 characters\)
sed "s/^X//" >header.h <<'END_OF_header.h'
X/*conquest is copyrighted 1986 by Ed Barlow.*/
X/* MODIFICATION OF THIS FILE IMPLIES THAT THE MODIFIER WILL ACCEPT
X A LIMITED USE COPYRIGHT AS FOLLOWS:
X
X 1) This software is copyrighted and protected by law. The
X sole owner of this software, which hereafter is known as
X "conquest" is Edward M. Barlow, who hereby grants you a
X personal, non-exclusive right to use this software.
X 2) conquest may not be redistributed in any form. Any
X requests for new software shall, for now, be the perogative
X of the author.
X 3) loss or damage caused by this software shall not be
X the responsibility of the author.
X 4) Ed Barlow shall be notified of modifications to this
X software via electronic mail (mhuxd!smile) and, if there
X is no response, via US mail to:
X
X Ed Barlow
X 974 Delchester Rd
X Newtown Sq. PA, 19073
X
X 5) you agree to use your best efforts to see that any user
X of conquest complies with the terms and conditions stated above.
X*/
X
X/*MODIFICATION IS REQUIRED OF THE FOLLOWING DEFINE STATEMENTS*/
X
X/*file name definitions */
X#define EXEFILE "/c03/smile/private/mygame/lib/.execute"
X#define DATAFILE "/c03/smile/private/mygame/lib/.data"
X#define MSGFILE "/c03/smile/private/mygame/lib/.messages"
X#define NPCSFILE "/c03/smile/private/mygame/lib/.nations"
X#define HELPFILE "/c03/smile/private/mygame/lib/.help"
X#define NEWSFILE "/c03/smile/private/mygame/lib/.news"
X
X#define OWNER "Ed Barlow" /*administrators name*/
X
X/*MODIFICATION IS OPTIONAL ON THE FOLLOWING*/
X#define PWATER 55 /*percentage of water in the world*/
X
X#define MAPX 48 /*Number of X Sectors on Map (divisible by 8 prefered)*/
X /* if you change see MAXX and MAXY*/
X#define MAPY 48 /*Number of Y Sectors on Map (divisible by 8 prefered)*/
X /* if you change see MAXX and MAXY*/
X/*the below three variables *must* be based on the above two*/
X/*MAXX=MAPX/8, MAXY=MAPY/8, NUMAREAS=MAXX*MAXY*/
X#define MAXX 6 /*Number of X areas on map*/
X#define MAXY 6 /*Number of Y areas on map*/
X#define NUMAREAS 36 /*total # areas, MAXX*MAXY*/
X
X/*ALL THESE MUST BE COMMENTED OUT IF YOU WANT TO EXCLUDE THE C CODE*/
X#define LZARD 1 /*defined if lizard npc's exist at beginning*/
X#define MONSTER 1 /*defined if pirates/barbarians/nomads exist*/
X#define NPC 1 /*defined if non player country exists at beginning*/
X#define CMOVE 1 /*Comment this line out if you do not wish the computer
X to move Player nations if they forget to move*/
X#define SYS5 1 /*comment this line out if on a BSD system*/
X /*--not that it does anything at the moment*/
X
X#define MAXNTN 28 /*number of nations (including unowned & npc ntns)*/
X /*but not including pirates...*/
X#define NTOTAL 32 /*MAXNTN+4*/
X#define NLIZARD 28 /*MAXNTN+0*/
X#define NNOMAD 29 /*MAXNTN+1*/
X#define NBARBARIAN 30 /*MAXNTN+2*/
X#define NPIRATE 31 /*MAXNTN+3*/
X
X#define LANDSEE 2 /*how far you can see on land, by armies, by navies*/
X#define NAVYSEE 1 /*making these numbers large takes CPU time*/
X#define ARMYSEE 2
X
X/*Below taxation rates are in thousand dollars (US 1985) per 100 humans per
X *point of whatever -- ie 1 person in veg of 9 means produce $70x9=630K
X *thousand dollars */
X
X#define TAXDEFAULT 5555 /*percent taxes*/
X#define TAXFOOD 100
X#define TAXIRON 100
X#define TAXGOLD 100
X/*city and capital tax rates based on people only (no multipleier)*/
X#define TAXCAP 1000
X#define TAXCITY 750
X
X#define SHIPMAINT 1000 /*ship mainatinance cost*/
X#define SOLDMAINT 40 /*soldier mainatinance cost*/
X
X#define DESCOST 300 /*cost to redesignatie*/
X /*this is also the iron cost for cities*/
X#define FORTCOST 1000 /*cost to build a fort point*/
X#define ENLISTCOST 90 /*cost to enlist one troop*/
X#define WARSHPCOST 3000 /*cost to build one warship*/
X#define MERSHPCOST 2000 /*cost to build one merchant*/
X
X#define SHIPHOLD 300 /*number of humans a ship can hold*/
X
X#define MAXPTS 30 /*points to buy stuff with*/
X#define SECTSCORE 1 /*SECTSCORE points per sector*/
X#define CITYLIMIT 8 /*% of ntns people in sector before => city*/
X
X#define MAXARM 32 /*maximum number of armies per nation*/
X#define MAXNAVY 16 /*maximum number of fleets per nation*/
X#define MILRATIO 5 /*ratio mil:civ for non player countries*/
X#define MILINCAP 5 /*ratio (mil in cap):mil for NPCs*/
X
X#define JWL_MGK 100000L /*jewels needed to use magic*/
X#define BRIBE 100000L /*amount of gold to bribe one level*/
X#define IRONORE 7 /*iron per soldier needed for +1% weapons%/
X
X
X/*-----------------DO NOT ALTER BELOW THIS LINE-------------------*/
X
X#include <curses.h>
X#define VERSION 1 /*version number of the game*/
X#define FLAT 1 /*1 if world is flat 0 if round*/
X
X/*simple contour map definitions*/
X#define WATER '~'
X#define PEAK '#'
X#define MOUNTAIN '^'
X#define HILL '%'
X#define CLEAR '-'
X
X/*racial types*/
X#define GOD '-'
X#define ORC 'O'
X#define ELF 'E'
X#define DWARF 'D'
X#define LIZARD 'L'
X#define HUMAN 'H'
X#define PIRATE 'P'
X#define BARBARIAN 'B'
X#define NOMAD 'N'
X#define UNKNOWN '?'
X
X/*designations*/
X#define DCITY 'c'
X#define DCAPITOL 'C'
X#define DMINE 'm'
X#define DFARM 'f'
X#define DDEVASTATED 'x'
X#define DGOLDMINE '$'
X#define DCASTLE '!'
X#define DNODESIG '-'
X
X#define GREAT 'G'
X#define FAIR 'F'
X#define RANDOM 'R'
X#define OOPS 'X'
X
X/*vegitation types -- these are legal in designations too*/
X#define VOLCANO 'V'
X#define DESERT 'D'
X#define WASTE 'W'
X#define BARREN '4'
X#define LT_VEG '6'
X#define GOOD '9'
X#define WOOD '7'
X#define FORREST '3'
X#define JUNGLE 'J'
X#define SWAMP 'S'
X#define ICE 'I'
X#define NONE '~'
X
X/*Diplomacy Variables*/
X#define JIHAD 7
X#define WAR 6
X#define HOSTILE 5
X#define NEUTRAL 4
X#define FRIENDLY 3
X#define ALLIED 2
X#define CONFEDERACY 1
X#define UNMET 0
X
X/*army status*/
X# define MARCH 1 /*March */
X# define SCOUT 2 /*Scouting--will not engage enemy if possible*/
X# define ATTACK 3 /*Attack anybody (Hostile+) within 2 sectors*/
X# define DEFEND 4 /*Defend */
X# define GARRISON 5 /*Garrison--for a city or Capital*/
X
X
Xstruct s_sector
X{
X char designation;/*designation of sector*/
X char altitude; /*sector altitude */
X char vegitation; /*sector vegitation */
X short owner; /*nation id of owner, MAXNTN+? is SPECIAL*/
X int people; /*civilians in sector*/
X short gold; /*gold production ability*/
X short fortress; /*fortification level (0 to 9)*/
X short iron; /*amount of iron produced by sector*/
X};
X#define XREAL xcurs+xoffset
X#define YREAL ycurs+yoffset
X#define SOWN sct[xcurs+xoffset][ycurs+yoffset].owner
X
Xstruct navy
X{
X short warships;
X short merchant;
X short xloc;
X short yloc;
X short smove;
X};
X
Xstruct army
X{
X short xloc;
X short yloc;
X short smove;
X short sold;
X short stat;
X};
X
Xstruct nation /* player nation stats */
X {
X char name[10];/* name */
X char passwd[8];/* password */
X char leader[10];/* leader title */
X char race; /* national race (integer--see header.h)*/
X short class; /* national class*/
X/*location could be easily changed out*/
X char location;/* location variable gfr */
X char mark; /* unique mark for nation*/
X short capx; /* capital x coord */
X short capy; /* capital y coord */
X short active; /* activity level of nation, but I am not sure if
X i have used this variable consistently:
X 1 if PC NATION,
X 2+Aggressiveness if NPC,
X 0 if inactive,
X 999 to represents MONSTER (pirate...)*/
X short aplus; /* attack plus of all soldiers*/
X short dplus; /* attack plus of all soldiers*/
X short maxmove; /* maximum movement of soldiers*/
X short repro; /* reproduction rate of nation*/
X short score; /* score */
X int tgold; /* gold in treasury */
X int jewels; /* raw amount of gold in treasury */
X int tmil; /* total military */
X int tciv; /* total civilians */
X int tiron; /* total real iron in nation*/
X int tfood; /* total food in nation*/
X long powers;
X short tsctrs; /* total number sectors */
X short tships; /* number warships */
X struct army arm[MAXARM];
X struct navy nvy[MAXNAVY];
X short dstatus[MAXNTN+4]; /*diplomatic status*/
X};
X
X#define AXLOC ntn[country].arm[armynum].xloc
X#define AYLOC ntn[country].arm[armynum].yloc
X#define AMOVE ntn[country].arm[armynum].smove
X#define ASOLD ntn[country].arm[armynum].sold
X#define ASTAT ntn[country].arm[armynum].stat
X#define NWAR ntn[country].nvy[nvynum].warships
X#define NMER ntn[country].nvy[nvynum].merchant
X#define NXLOC ntn[country].nvy[nvynum].xloc
X#define NYLOC ntn[country].nvy[nvynum].yloc
X#define NMOVE ntn[country].nvy[nvynum].smove
X
Xextern struct s_sector sct[MAPX][MAPY];
Xextern struct nation ntn[MAXNTN+4];
Xextern short movecost[MAPX][MAPY];
X
X/*Movement costs*/
Xextern char *ele;
Xextern char *veg;
Xextern char *numbers;
Xextern char *races[];
Xextern char *Class[];
Xextern char *vegname[];
Xextern char *diploname[];
Xextern char *soldname[];
X
X#define AORN 0
X#define ARMY 1
X#define NAVY 2
X
X#define XASTAT 1
X#define XAMEN 2
X#define XALOC 4
X#define XNLOC 5
X#define XNASHP 6
X#define XECNAME 8
X#define XECPAS 9
X#define XECMARK 10
X#define XSADES 11
X#define XSACIV 12
X#define XSIFORT 13
X#define XNAGOLD 14
X#define XAMOV 15
X#define XNMOV 16
X#define XSAOWN 17
X#define EDADJ 18
X#define XNARGOLD 19
X#define XNAIRON 20
X#define INCAPLUS 22
X#define INCDPLUS 23
X#define CHG_MGK 24
X
X#define CHGMGK fprintf(fexe,"MAGIC \t%d \t%hd \t%d \t%d \t0 \t%s\n",CHG_MGK,country,ntn[country].powers,x,"null")
X#define I_APLUS fprintf(fexe,"INC_APLUS \t%d \t%hd \t0 \t0 \t0 \t%s\n",INCAPLUS,country,"null")
X#define I_DPLUS fprintf(fexe,"INC_DPLUS \t%d \t%hd \t0 \t0 \t0 \t%s\n",INCDPLUS,country,"null")
X#define AADJSTAT fprintf(fexe,"A_STAT \t%d \t%hd \t%d \t%d \t0 \t%s\n",XASTAT,country,armynum,ntn[country].arm[armynum].stat,"null")
X#define AADJMEN fprintf(fexe,"A_MEN \t%d \t%hd \t%d \t%d \t0 \t%s\n",XAMEN ,country,armynum,ntn[country].arm[armynum].sold,"null")
X#define NADJSHP fprintf(fexe,"N_ASHP \t%d \t%hd \t%d \t%d \t%d \t%s\n",XNASHP ,country,nvynum,ntn[country].nvy[nvynum].merchant,ntn[country].nvy[nvynum].warships,"null" )
X#define AADJLOC fprintf(fexe,"A_LOC \t%d \t%hd \t%d \t%d \t%d \t%s\n",XALOC ,country,armynum,ntn[country].arm[armynum].xloc,ntn[country].arm[armynum].yloc,"null")
X#define NADJLOC fprintf(fexe,"N_LOC \t%d \t%hd \t%d \t%d \t%d \t%s\n",XNLOC ,country,nvynum,ntn[country].nvy[nvynum].xloc,ntn[country].nvy[nvynum].yloc ,"null")
X#define AADJMOV fprintf(fexe,"A_MOV \t%d \t%hd \t%d \t%d \t0 \t%s\n",XAMOV ,country,armynum,ntn[country].arm[armynum].smove,"null")
X#define NADJMOV fprintf(fexe,"N_MOV \t%d \t%hd \t%d \t%d \t0 \t%s\n",XNMOV ,country,nvynum,ntn[country].nvy[nvynum].smove,"null")
X#define ECHGNAME fprintf(fexe,"E_CNAME \t%d \t%hd \t0 \t0 \t0 \t%s\n",XECNAME ,country,ntn[country].name)
X#define ECHGPAS fprintf(fexe,"E_CPAS \t%d \t%hd \t0 \t0 \t0 \t%s\n",XECPAS ,country,crypt(string,SALT))
X#define SADJDES fprintf(fexe,"S_ADES \t%d \t%hd \t0 \t%d \t%d \t%c\n",XSADES ,country,xcurs+xoffset,ycurs+yoffset,sct[xcurs+xoffset][ycurs+yoffset].designation)
X#define SADJDES2 fprintf(fexe,"S_ADES \t%d \t%hd \t0 \t%d \t%d \t%c\n",XSADES ,country,x,y,sct[x][y].designation)
X#define SADJCIV2 fprintf(fexe,"S_ACIV \t%d \t%hd \t%d \t%d \t%d \t%s\n",XSACIV ,country,sct[i][j].people,i,j,"null")
X#define SADJCIV fprintf(fexe,"S_ACIV \t%d \t%hd \t%d \t%d \t%d \t%s\n",XSACIV ,country,sct[xcurs+xoffset][ycurs+yoffset].people,xcurs+xoffset,ycurs+yoffset,"null")
X#define INCFORT fprintf(fexe,"SIFORT \t%d \t%hd \t0 \t%d \t%d \t%s\n",XSIFORT ,country,xcurs+xoffset,ycurs+yoffset,"null")
X#define SADJOWN fprintf(fexe,"S_AOWN \t%d \t%hd \t0 \t%d \t%d \t%s\n",XSAOWN ,country,xcurs+xoffset,ycurs+yoffset,"null")
X#define EADJDIP fprintf(fexe,"E_ADJ \t%d \t%hd \t%d \t%d \t0 \t%s\n",EDADJ,country,nation,ntn[country].dstatus[nation],"null")
X
X#define WARRIOR 2
X#define CAPTAIN 3
X#define WARLORD 5
X#define MI_MONST 7
X#define AV_MONST 11
X#define MA_MONST 13
X#define SPY 17
X#define KNOWALL 19
X#define DERVISH 23
X/*I CAN CHANGE DESTROYER TO NON PRIME NUMBER IN NEXT GAME*/
X#define DESTROYER 29
X#define HIDDEN 31
X#define THE_VOID 37
X#define ARCHITECT 41
X#define VAMPIRE 43
X#define HEALER 47
X#define MINER 53
X#define URBAN 59
X#define STEEL 61
X#define ARCHER 67
X#define CAVALRY 71
X#define BREEDER 73
X#define MAXPOWER 73 /*maximum power*/
X
X#define NPCPOWERS 9 /*maximum number of powers for NPC*/
X#define PCPOWERS 5 /*maximum number of powers for PC */
X
X/*my first macro: which will return 1 if the nation has that power*/
X#define magic(NATION,POWER) !(ntn[NATION].powers%(POWER))
X
X#define beep() putchar('')
X
X#define FOODTHRESH 3
X#define GOLDTHRESH 10
X#define JEWELTHRESH 10
X
X#define SALT "aa"
X#define PASSLTH 7
X
X/*intialize subroutine types*/
Xchar *crypt();
Xvoid exit();
Xint rand();
X
Xextern char *strcpy(), *strncpy(), *strcat(), *strncat();
X
END_OF_header.h
if test 12852 -ne `wc -c <header.h`; then
echo shar: \"header.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f io.c -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"io.c\"
else
echo shar: Extracting \"io.c\" \(10550 characters\)
sed "s/^X//" >io.c <<'END_OF_io.c'
X/*io.c*/
X/*Print and io subroutines for game*/
X
X/*conquest is copyrighted 1986 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#include <ctype.h>
X#include "header.h"
X
X/*Declarations*/
Xextern struct s_sector sct[MAPX][MAPY];
Xextern struct nation ntn[NTOTAL]; /* player nation stats */
X/*is sector occupied by an army?*/
Xextern short occ[MAPX][MAPY];
X
X/*offset of upper left hand corner*/
Xextern short xoffset;
Xextern short yoffset;
X/*current cursor postion (relative to 00 in upper corner)*/
X/* position is 2*x,y*/
Xextern short xcurs;
Xextern short ycurs;
X/*redraw map in this turn if redraw is a 1*/
Xextern short redraw;
X/*display state*/
Xextern short hilmode; /*highlight modes: 0=owned sectors, 1= armies, 2=none*/
Xextern short dismode; /*display mode: 1=vegitation, 2=desig, 3=contour*/
X/* 4=armies/navies, 5=commodities, 6=fertility, 7=movement*/
X/* nation id of owner*/
Xextern short country;
X
X/*print a sector.altitude map subroutine*/
Xprintele()
X{
X register int X, Y;
X printf("doing print of altitude\n");
X for(Y=0;Y<MAPY;Y++) {
X for(X=0;X<MAPX;X++) putc(sct[X][Y].altitude,stdout);
X putc('\n',stdout);
X }
X}
X
Xpr_ntns()
X{
X register int X, Y;
X printf("doing print of nations\n");
X for(Y=0;Y<MAPY;Y++) {
X for(X=0;X<MAPX;X++) {
X if(sct[X][Y].owner==0)
X putc(sct[X][Y].altitude,stdout);
X else putc(ntn[sct[X][Y].owner].mark,stdout);
X }
X putc('\n',stdout);
X }
X}
X
X/*print all data--trashes/creates datafile in the process*/
Xwritedata()
X{
X int fd;
X printf("\ndoing write of data\n");
X if((fd = creat(DATAFILE,0666))==-1) {
X printf("cant open data. check permissions\n");
X return;
X }
X write(fd,sct,sizeof(sct));
X write(fd,ntn,sizeof(ntn));
X close(fd);
X}
X
Xreaddata()
X{
X int fd;
X int n_read;
X /*read in existing nation army and navy data*/
X /*check if file openable*/
X printf("reading data file\n");
X fd=open(DATAFILE,0);
X if((n_read=read(fd,sct,sizeof(sct)))==0) printf("EOF\n");
X else if(n_read==-1) printf("error reading sector data (sct)\n");
X if(n_read!=sizeof(sct)) {
X printf("wrong data format\n");
X exit(1);
X }
X if((n_read=read(fd,ntn,sizeof(ntn)))==0) printf("EOF\n");
X else if(n_read==-1) printf("error reading nation data (ntn)\n");
X if(n_read!=sizeof(ntn)) {
X printf("wrong data format\n");
X exit(1);
X }
X close(fd);
X}
X
X/*print a map subroutine*/
Xprintveg()
X{
X register int X, Y;
X printf("doing print of vegitation\n");
X for(Y=0;Y<MAPY;Y++) {
X for(X=0;X<MAPX;X++) putc(sct[X][Y].vegitation,stdout);
X putc('\n',stdout);
X }
X}
X
X/*make a map*/
Xmakemap()
X{
X register int x,y;
X register int i,j;
X short armynum,nvynum;
X
X /*can you see all?*/
X if((magic(country,KNOWALL)==1)||(country==0)) {
X for(x=0;x<(COLS-21)/2;x++) {
X for(y=0;y<(LINES-4);y++) {
X highlight(x,y);
X see(x,y);
X }
X }
X if((hilmode==1)||(hilmode==4)||(hilmode==3)) {
X for(armynum=0;armynum<MAXARM;armynum++)
X if((ASOLD>0)&&((AMOVE>0)||(hilmode!=4))){
X standout();
X see(AXLOC-xoffset,AYLOC-yoffset);
X }
X }
X }
X /*see as appropriate?*/
X else {
X for(x=0;x<(COLS-21)/2;x++) for(y=0;y<(LINES-4);y++) {
X if(sct[x+xoffset][y+yoffset].owner==country){
X for(i=x-LANDSEE;i<=x+LANDSEE;i++){
X for(j=y-LANDSEE;j<=y+LANDSEE;j++) {
X highlight(i,j);
X see(i,j);
X }
X }
X }
X }
X for(nvynum=0;nvynum<MAXNAVY;nvynum++) if(NMER+NWAR>0){
X for(i=NXLOC-xoffset-NAVYSEE;i<=NXLOC-xoffset+NAVYSEE;i++) for(j=NYLOC-yoffset-NAVYSEE;j<=NYLOC-yoffset+NAVYSEE;j++){
X highlight(i,j);
X see(i,j);
X }
X }
X for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0){
X for(i=AXLOC-xoffset-ARMYSEE;i<=AXLOC-xoffset+ARMYSEE;i++) for(j=AYLOC-yoffset-ARMYSEE;j<=AYLOC-yoffset+ARMYSEE;j++) {
X highlight(i,j);
X see(i,j);
X }
X }
X /*optimal method of highlighting your armies*/
X if((hilmode==3)||(hilmode==4)) {
X for(armynum=0;armynum<MAXARM;armynum++)
X if((ASOLD>0)&&((AMOVE>0)||(hilmode==3))){
X standout();
X see(AXLOC-xoffset,AYLOC-yoffset);
X }
X for(nvynum=0;nvynum<MAXNAVY;nvynum++)
X if((NWAR+NMER>0)&&((NMOVE>0)||(hilmode==3))){
X standout();
X see(NXLOC-xoffset,NYLOC-yoffset);
X }
X }
X }
X move(ycurs,2*xcurs);
X}
X
Xnewdisplay()
X{
X mvaddstr(LINES-4,0,"viewing options: (d)esignation, (r)ace, (m)ove cost, (p)eople, (D)efense");
X clrtoeol();
X mvaddstr(LINES-3,0," (c)ontour, (v)egitation, (i)ron, (n)ation mark, (g)old");
X clrtoeol();
X mvaddstr(LINES-2,0,"highlight option: (o)wners, (a)rmy, (y)our Army, (M)ove left, (x)=none");
X clrtoeol();
X standout();
X mvaddstr(LINES-1,0,"what display?:");
X clrtoeol();
X move(LINES-1,16);
X standend();
X refresh();
X redraw=TRUE;
X switch(getch()) {
X case 'v': /* vegetation map*/
X dismode=1;
X break;
X case 'd': /* designations map*/
X dismode=2;
X break;
X case 'c': /* contour map of world */
X dismode=3;
X break;
X case 'n': /* nations map*/
X dismode=4;
X break;
X case 'r': /* race map*/
X dismode=5;
X break;
X case 'm': /* move cost map*/
X dismode=7;
X break;
X case 'D':
X dismode=8;
X break;
X case 'p':
X dismode=9;
X break;
X case 'g':
X dismode=10;
X break;
X case 'i':
X dismode=11;
X break;
X case 'a': /* armies hilighted map*/
X prep();
X hilmode=1;
X break;
X case 'o': /* owners hilighted map*/
X hilmode=0;
X break;
X case 'x': /*no highlighting*/
X hilmode=2;
X break;
X case 'y': /* your armies hilighted map*/
X prep();
X hilmode=3;
X break;
X case 'M': /* your armies with moves left hilighted map*/
X prep();
X hilmode=4;
X break;
X default:
X beep();
X redraw=FALSE;
X }
X makebottom();
X}
X
X/*see what is in xy as per display mode*/
Xsee(x,y)
X{
X int armbonus;
X if((x<0)||(y<0)||(x>COLS-21)||(y>=LINES-4)) return;
X if(((y+yoffset)<MAPY)&&((x+xoffset)<MAPX)) {
X
X if((dismode>7)&&(country!=sct[x+xoffset][y+yoffset].owner)&&(magic(sct[x+xoffset][y+yoffset].owner,THE_VOID)==1)&&(country!=0)) {
X standout();
X mvaddch(y,2*x,' ');
X standend();
X }
X else {
X switch(dismode){
X case 1: /*vegitation*/
X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegitation);
X break;
X case 2: /*designation*/
X if(sct[x+xoffset][y+yoffset].owner==0){
X if(isdigit(sct[x+xoffset][y+yoffset].vegitation)!=0) mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
X else mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegitation);
X }
X else if((country==0)||(sct[x+xoffset][y+yoffset].owner==country)) mvaddch(y,2*x,sct[x+xoffset][y+yoffset].designation);
X else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].mark);
X break;
X case 3: /*contour*/
X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
X break;
X case 4: /*ownership*/
X if(sct[x+xoffset][y+yoffset].owner==0)
X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
X else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].mark);
X break;
X case 5: /*race*/
X if(sct[x+xoffset][y+yoffset].owner==0)
X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
X else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].race);
X break;
X case 7: /*movement cost map*/
X if(movecost[x+xoffset][y+yoffset]>=0) mvprintw(y,2*x,"%d",movecost[x+xoffset][y+yoffset]);
X else if(sct[x+xoffset][y+yoffset].altitude==WATER)
X mvaddch(y,2*x,'~');
X else
X mvaddch(y,2*x,'X');
X break;
X case 8: /*Defence*/
X if (sct[x+xoffset][y+yoffset].altitude==WATER)
X mvaddch(y,2*x,'~');
X else if (movecost[x+xoffset][y+yoffset]<0)
X mvaddch(y,2*x,'*');
X else {
X
X /*Racial combat bonus due to terrain (the faster you move the better)*/
X armbonus=0;
X armbonus+=5*(9-movecost[x+xoffset][y+yoffset]);
X
X if(sct[x+xoffset][y+yoffset].altitude==MOUNTAIN) armbonus+=40;
X else if(sct[x+xoffset][y+yoffset].altitude==HILL) armbonus+=20;
X
X if(sct[x+xoffset][y+yoffset].vegitation==JUNGLE)
X armbonus+=30;
X else if(sct[x+xoffset][y+yoffset].vegitation==FORREST)
X armbonus+=20;
X else if(sct[x+xoffset][y+yoffset].vegitation==WOOD)
X armbonus+=10;
X
X if((sct[x+xoffset][y+yoffset].designation==DCASTLE)||(sct[x+xoffset][y+yoffset].designation==DCITY)||(sct[x+xoffset][y+yoffset].designation==DCAPITOL))
X armbonus+=8*sct[x+xoffset][y+yoffset].fortress;
X
X mvprintw(y,2*x,"%d",armbonus/20);
X }
X break;
X case 9: /*People*/
X if (sct[x+xoffset][y+yoffset].altitude==WATER)
X mvaddch(y,2*x,'~');
X else if (sct[x+xoffset][y+yoffset].people>=1000)
X mvaddch(y,2*x,'+');
X else if (sct[x+xoffset][y+yoffset].people>=450)
X mvaddch(y,2*x,'>');
X else if (sct[x+xoffset][y+yoffset].people==0)
X mvaddch(y,2*x,'0');
X else
X mvprintw(y,2*x,"%d",1+sct[x+xoffset][y+yoffset].people/50);
X break;
X case 10: /*Gold*/
X if (sct[x+xoffset][y+yoffset].altitude==WATER)
X mvaddch(y,2*x,'~');
X else if(isdigit(sct[x+xoffset][y+yoffset].vegitation)==0)
X mvaddch(y,2*x,'X');
X else if((sct[x+xoffset][y+yoffset].owner!=0)&&(sct[x+xoffset][y+yoffset].owner!=country))
X mvaddch(y,2*x,'?');
X else if(sct[x+xoffset][y+yoffset].gold>=10)
X mvaddch(y,2*x,'+');
X else
X mvprintw(y,2*x,"%d",sct[x+xoffset][y+yoffset].gold);
X break;
X case 11: /*Iron*/
X if (sct[x+xoffset][y+yoffset].altitude==WATER)
X mvaddch(y,2*x,'~');
X else if(isdigit(sct[x+xoffset][y+yoffset].vegitation)==0)
X mvaddch(y,2*x,'X');
X else if((sct[x+xoffset][y+yoffset].owner!=0)&&(sct[x+xoffset][y+yoffset].owner!=country))
X mvaddch(y,2*x,'?');
X else if (sct[x+xoffset][y+yoffset].iron>=10)
X mvaddch(y,2*x,'+');
X else
X mvprintw(y,2*x,"%d",sct[x+xoffset][y+yoffset].iron);
X break;
X default:
X break;
X }
X }
X }
X else mvaddch(y,2*x,' ');
X standend();
X}
X
X/*highlight what is in xy as per highlight mode*/
Xhighlight(x,y)
X{
X if((x<0)||(y<0)||(x>COLS-21)||(y>=LINES-4)) return;
X if(((y+yoffset)<MAPY)&&((x+xoffset)<MAPX)) {
X switch(hilmode){
X case 0: /*ownership*/
X if(country==0) {
X if(sct[x+xoffset][y+yoffset].owner>0)
X standout();
X }
X else if(sct[x+xoffset][y+yoffset].owner==country)
X standout();
X break;
X case 1: /*army map*/
X if(occ[x+xoffset][y+yoffset]!=0) standout();
X break;
X default:
X break;
X }
X }
X}
END_OF_io.c
if test 10550 -ne `wc -c <io.c`; then
echo shar: \"io.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 5 \(of 5\).
cp /dev/null ark5isdone
MISSING=""
for I in 1 2 3 4 5 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 5 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0