games@tekred.TEK.COM (06/17/88)
Submitted by: ihnp4!homxc!smile Comp.sources.games: Volume 4, Issue 49 Archive-name: conquer3/Part08 #! /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 8 (of 8)." # Contents: admin.c cexecute.c data.c extcmds.c man.page newhelp.c # newlogin.h run # Wrapped by billr@saab on Thu Jun 16 09:40:04 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f admin.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"admin.c\" else echo shar: Extracting \"admin.c\" \(4919 characters\) sed "s/^X//" >admin.c <<'END_OF_admin.c' X/*conquer : Copyright (c) 1988 by Ed Barlow. X * I spent a long time writing this code & I hope that you respect this. X * I give permission to alter the code, but not to copy or redistribute X * it without my explicit permission. If you alter the code, X * please document changes and send me a copy, so all can have it. X * This code, to the best of my knowledge works well, but it is my first X * 'C' program and should be treated as such. I disclaim any X * responsibility for the codes actions (use at your own risk). I guess X * I am saying "Happy gaming", and am trying not to get sued in the process. X * Ed X */ X X/*include files*/ X#include <ctype.h> X#include "header.h" X#include "data.h" X#include <signal.h> X#include <fcntl.h> X#include <pwd.h> X X/*Declarations*/ Xchar *getpass(); Xstruct s_sector sct[MAPX][MAPY]; Xstruct nation ntn[NTOTAL]; /* player nation stats */ X/*is sector occupied by an army?*/ Xchar occ[MAPX][MAPY]; Xshort movecost[MAPX][MAPY]; Xlong startgold=0; X X/*offset of upper left hand corner*/ Xshort xoffset=0,yoffset=0; X/*current cursor postion (relative to 00 in upper corner)*/ X/* position is 2*x,y*/ Xshort xcurs=0,ycurs=0; X/*display state*/ Xshort dismode=2; Xshort selector=0; /*selector (y vbl) for which army/navy... is "picked"*/ Xshort pager=0; /*pager for selector 0,1,2,3*/ X/* nation id of owner*/ Xshort country=0; X XFILE *fexe, *fopen(); X Xint Xmain(argc,argv) Xint argc; Xchar **argv; X{ X int geteuid(), getuid(), setuid(); X register int i; X char *name; X void srand(); X int getopt(); X long time(); X /*mflag = makeworld, a=add player, x=execute, p=print, h=help, s=score*/ X int mflag, aflag, xflag, pflag; X char string[80]; X extern char *optarg; X char defaultdir[256]; X#ifndef OGOD X int uid; X#endif OGOD X struct passwd *getpwnam(); X X#ifdef OGOD X if ((getuid())!=(getpwnam(LOGIN)->pw_uid)) X { X printf("Sorry -- you can not administrate conquer\n"); X printf("you need to be logged in as %s\n",LOGIN); X exit(FAIL); X } X#endif OGOD X X mflag = aflag = xflag = pflag = 0; X srand((unsigned) time((long *) 0)); X strcpy(defaultdir, DEFAULTDIR); X name = string; X *name = 0; X X /* process the command line arguments */ X while((i=getopt(argc,argv,"maxpd:"))!=EOF) switch(i){ X /* process the command line arguments */ X case 'm': /* make a new world*/ X mflag++; X break; X case 'a': /* anyone with password can add player*/ X aflag++; X break; X case 'x': /* execute program*/ X xflag++; X break; X case 'p': /* print the map*/ X pflag++; X break; X case 'd': X strcpy(defaultdir, optarg); X break; X case '?': /* print out command line arguments */ X printf("Command line format: %s [-maxp -dDIR]\n",argv[0]); X printf("\t-m make a world\n"); X printf("\t-a add new player\n"); X printf("\t-x execute program\n"); X printf("\t-d DIR to use play different game\n"); X printf("\t-p print a map\n"); X exit(SUCCESS); X }; X X /* now that we have parsed the args, we can got to the X * dir where the files are kept and do some work. X */ X if (chdir(defaultdir)) { X printf("unable to change dir to %s\n",defaultdir); X exit(FAIL); X } X if (mflag) { X makeworld(); X exit(SUCCESS); X } X X /* read data*/ X readdata(); X verifydata( __FILE__, __LINE__ ); X X if (aflag) { /* a new player */ X printf("\n********************************************"); X printf("\n* PREPARING TO ADD NEW PLAYERS *"); X printf("\n********************************************\n"); X#ifndef OGOD X if(strncmp(crypt(getpass("\nwhat is conquer super user password:"),SALT),ntn[0].passwd,PASSLTH)!=0) { X printf("sorry, must be super user to add player\n"); X exit(FAIL); X } X#endif OGOD X newlogin(); X exit(SUCCESS); X } else if (pflag) { /* print a map of the game */ X#ifndef OGOD X if(strncmp(crypt(getpass("\nwhat is conquer super user password:"),SALT),ntn[0].passwd,PASSLTH)!=0) { X printf("sorry, must be super user to get map\n"); X exit(FAIL); X } X#endif OGOD X printf("what type of map\noptions are\n"); X printf("\t1) altitudes\n\t2) vegetations\n"); X printf("\t3) nations\n\n"); X printf("\tINPUT:"); X scanf("%hd",&dismode); X if(dismode==1) printele(); X else if(dismode==2) printveg(); X else pr_ntns(); X exit(SUCCESS); X } else if (xflag) { /* update the game */ X#ifndef OGOD X uid=getuid(); /* use the real user id */ X if ( uid != (getpwnam(LOGIN))->pw_uid ){ X printf("sorry -- your uid is invalid for updating\n"); X printf("you need to be logged in as %s\n",LOGIN); X exit(FAIL); X } X#endif OGOD X update(); X writedata(); X exit(SUCCESS); X } X printf("error: must specify an option\n"); X X /* print out command line arguments */ X printf("Command line format: %s [-maxp -dDIR]\n",argv[0]); X printf("\t-a add new player\n"); X printf("\t-d DIR to use play different game\n"); X printf("\t-m make a world\n"); X printf("\t-p print a map\n"); X printf("\t-x execute program\n"); X exit(SUCCESS); X} END_OF_admin.c if test 4919 -ne `wc -c <admin.c`; then echo shar: \"admin.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f cexecute.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"cexecute.c\" else echo shar: Extracting \"cexecute.c\" \(5059 characters\) sed "s/^X//" >cexecute.c <<'END_OF_cexecute.c' X/*conquer : Copyright (c) 1988 by Ed Barlow. X * I spent a long time writing this code & I hope that you respect this. X * I give permission to alter the code, but not to copy or redistribute X * it without my explicit permission. If you alter the code, X * please document changes and send me a copy, so all can have it. X * This code, to the best of my knowledge works well, but it is my first X * 'C' program and should be treated as such. I disclaim any X * responsibility for the codes actions (use at your own risk). I guess X * I am saying "Happy gaming", and am trying not to get sued in the process. X * Ed X */ X X/*EXECUTE THE PROGRAM*/ X#include "header.h" X#include "data.h" Xextern long startgold; Xextern short country; Xextern FILE *fexe; X Xint Xexecute() X{ X FILE *fp, *fopen(); X int cmd,savectry; X char comment[20]; X char temp[10]; X long longvar,long2var; X int armynum; X short int x,y; X int execed=0; X int done=FALSE; X char line[80]; X X /* initialize startgold */ X startgold = ntn[country].tgold; X X /* initialize i_people */ X for(x=0;x<MAPX;x++) X for(y=0;y<MAPX;y++) X if(( sct[x][y].owner == country)&& X ((sct[x][y].designation == DCITY) X ||( sct[x][y].designation == DCAPITOL))) X sct[x][y].i_people = sct[x][y].people; X else X sct[x][y].i_people = 0; X X /*execute in random order*/ X /*open exefile file*/ X sprintf(line,"%s%d",exefile,country); X if ((fp=fopen(line,"r"))==NULL) { X /*THIS MEANS THAT THE NATION HAS NOT MOVED YET*/ X return(0); X } X savectry=country; X X /*read in file*/ X if(fgets(line,80,fp)==NULL) done=TRUE; X while(done==FALSE) { X /*read and parse a new line*/ X /*CODE IF YOU USE LONG VAR IS L_*/ X if( line[0] == 'L' && line[1] == '_' ) { X sscanf(line,"%s %d %hd %ld %ld %hd %s", X temp,&cmd,&country,&longvar,&long2var,&y,comment); X } else { X sscanf(line,"%s %d %hd %d %hd %hd %s", X temp,&cmd,&country,&armynum,&x,&y,comment); X } X execed=1; X switch(cmd){ X case XASTAT: /*Aadjstat*/ X if((x>0)&&(x<6)) ASTAT=x; X break; X case XAMEN: /*Aadjmen*/ X armynum= (int) longvar; X ASOLD= (int) long2var; X ATYPE= y; X break; X case XALOC: /*Aadjloc*/ X AXLOC=x; X AYLOC=y; X break; X case XNLOC: /*nadjloc*/ X ntn[country].nvy[armynum].xloc=x; X ntn[country].nvy[armynum].yloc=y; X break; X case XNASHP: /*nadjshp*/ X ntn[country].nvy[armynum].merchant=x; X ntn[country].nvy[armynum].warships=y; X break; X case XECNAME: /*Nadjname*/ X strcpy(ntn[country].name,comment); X break; X case XECPAS: /*Nadjpas*/ X strncpy(ntn[country].passwd,comment,PASSLTH); X break; X case EDSPL: /*Edecspl*/ X ntn[country].spellpts-=armynum; X break; X case XSADES: /*Sadjdes*/ X if((sct[x][y].owner==country)||(country==0)) { X sct[x][y].designation=comment[0]; X } X if(sct[x][y].designation==DCAPITOL){ X ntn[country].capx=x; X ntn[country].capy=y; X } X break; X case XSACIV: /*Sadjciv*/ X sct[x][y].people=armynum; X break; X case XSIFORT: /*Sincfort*/ X sct[x][y].fortress++; X break; X case XNAGOLD: /*Nadjgold:*/ X ntn[country].tgold = longvar; X break; X case XAMOV: X AMOVE=x; X break; X case XNMOV: X ntn[country].nvy[armynum].smove=x; X break; X case XSAOWN: X sct[x][y].owner=country; X break; X case EDADJ: X ntn[country].dstatus[armynum]=x; X break; X case XNARGOLD: X ntn[country].jewels = longvar; X break; X case XNAIRON: X ntn[country].tiron = longvar; X break; X case INCAPLUS: X ntn[country].aplus++; X break; X case INCDPLUS: X ntn[country].dplus++; X break; X case DESTRY: X sct[ntn[armynum].capx][ntn[armynum].capy].owner=savectry; X country=armynum; X destroy(country); X country=savectry; X break; X case CHG_MGK: X ntn[country].powers|=long2var; X if(ntn[country].powers!=longvar){ X printf("\nERROR ON MAGIC READ %ld != %ld (or of %ld)",longvar,ntn[country].powers,long2var); X getchar(); X } X exenewmgk(long2var); X long2var=0; X } X if(fgets(line,80,fp)==NULL) done=TRUE; X } X fclose(fp); X /*return 1 if it did something*/ X country=savectry; X if(execed==1) return(1); X else return(0); X} X#ifdef CONQUER Xvoid Xhangup() X{ X char line[100]; X FILE *fp, *fopen(); X char name[12]; X char realname[12]; X int temp=0; 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 XNAGOLD ,country,ntn[country].tgold,"null"); X fprintf(fexe,"L_NIRON\t%d \t%d \t%ld \t0 \t0 \t%s\n", X XNAIRON ,country,ntn[country].tiron,"null"); X fprintf(fexe,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n", X XNARGOLD ,country,ntn[country].jewels,"null"); X } X /*close file*/ X fclose(fexe); X /*send a message to God*/ X strcpy(name,"God"); X strcpy(realname,"unowned"); X sprintf(line,"%s%d",msgfile,temp); X if((fp=fopen(line,"a+"))==NULL) { X exit(FAIL); X } X fprintf(fp,"%s Message to %s from CONQUER\n",realname,name); X fprintf(fp,"%s \n",realname); X fprintf(fp,"%s WARNING: Nation %s hungup on me.\n",realname,ntn[country].name); X fprintf(fp,"%s I DEMAND RESPECT!!!!\n",realname); X fputs("END\n",fp); X X fclose(fp); X /* exit program */ X exit(FAIL); X} X#endif CONQUER END_OF_cexecute.c if test 5059 -ne `wc -c <cexecute.c`; then echo shar: \"cexecute.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f data.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"data.c\" else echo shar: Extracting \"data.c\" \(5939 characters\) sed "s/^X//" >data.c <<'END_OF_data.c' X/*conquer : Copyright (c) 1988 by Ed Barlow. X * I spent a long time writing this code & I hope that you respect this. X * I give permission to alter the code, but not to copy or redistribute X * it without my explicit permission. If you alter the code, X * please document changes and send me a copy, so all can have it. X * This code, to the best of my knowledge works well, but it is my first X * 'C' program and should be treated as such. I disclaim any X * responsibility for the codes actions (use at your own risk). I guess X * I am saying "Happy gaming", and am trying not to get sued in the process. X * Ed X */ X X/* THIS FILE CONTAINS STRING DATA DEFINITIONS */ X X/*include files*/ X#include "header.h" X#include "data.h" X X/*initialization data*/ X/*Movement costs*/ Xchar *ele= "~#^%-0"; X/* BELOW ARE MOVEMENT COSTS FOR TERRAIN */ Xchar *HElecost= "EE321E"; Xchar *OElecost= "EE211E"; Xchar *EElecost= "EE631E"; Xchar *DElecost= "EE211E"; Xchar *elename[]= { "WATER","PEAK", "MOUNTAIN", "HILL", "FLAT","ERROR"}; X X/* BELOW ARE MOVEMENT COSTS FOR VEG */ Xchar *veg= "vdyblgwfjsi~0"; Xchar *HVegcost= "83210000232EE"; /* Human */ Xchar *OVegcost= "52100012517EE"; /* Orcs */ Xchar *EVegcost= "86221000017EE"; Xchar *DVegcost= "57100013577EE"; Xint vegfood[]= { 0,0,0,4,6,9,7,3,0,0,0,0 }; Xchar *vegname[]= { "VOLCANO", "DESERT", "TUNDRA", "BARREN", "LT VEG", X"GOOD", "WOOD", "FOREST", "JUNGLE", "SWAMP", "ICE", "NONE"}; Xchar *des= "tcmfx$!-0"; Xchar *desname[]= {"TOWN", "CAPITOL", "MINE", "FARM", "DEVASTATED", "GOLDMINE", X"CASTLE", "NODESIG", "PEAK", "WATER"}; X Xchar *Class[]= { "NPC", "king", "emperor", "wizard", "priest", "pirate", X"trader", "tyrant", "demon", "dragon", "shadow"}; Xchar *races[]= { "GOD","ORC","ELF","DWARF","LIZARD", X"HUMAN","PIRATE","BARBARIAN","NOMAD","UNKNOWN"}; Xchar *diploname[]= { "UNMET", "CONFEDERACY", "ALLIED", "FRIENDLY", X"NEUTRAL", "HOSTILE", "WAR", "JIHAD"}; Xchar *soldname[]= { "","MARCH","SCOUT","ATTACK","DEFEND","GARRISON"}; X Xchar *unittype[]= { X"Militia", "Goblin", "Orc", "Infantry", "Sailor", "Marines", "Archer", X"Uruk-Hai", "Ninja", "Phalanx", "Olog-Hai", "Legion", "Dragoon", "Mercenary", X"Troll", "Elite", "Lt_cav", "Cavalry", "Catapult", "Seige", "Roc", X"Knight", "Griffon","Elephant", X"Leader", X"Spirit", "Assasin", "Efreeti", "Gargoyle", "Wraith", X"Hero", "Centaur", "Giant", "Superhero", "Mummy", X"Elemental", "Minotarur", "Demon", "Balrog", "Dragon" X}; X X/*short unit types...for printing in upper right corner*/ Xchar *shunittype[]= { X"mlta", "Gob", "Orc", "Inf", "Sail", "XMar", "Arch", X"Uruk", "Ninj", "Phax", "olog", "Legn", "Drag", "Merc", X"Trol", "Elit", "lCav", "Cav", "cat", "sge", "Roc", X"Kni", "grif","ele", X"Lea", X"spir", "Assn", "efr", "Garg", "Wra", X"Hero", "Cent", "gt", "Shro", "Mumm", X"Elem", "mino", "dem", "Bal", "Drag" X}; Xint unitminsth[]= /* min strength of a unit */ X{ X1, 1, 1, 1, 1, 1, 1, X1, 1, 1, 1, 1, 1, 1, X1, 1, 1, 1, 1, 1, 1, X1, 1, 1, X1, X50, 50, 50, 75, 75, X100, 50, 150, 150, 150, X175, 150, 500, 500, 1000 X}; X X#ifdef ADMIN Xint unitattack[]= X{ -25, -15, 0, 0, 0, 25, 0, X5, 20, 10, 15, 20, 10, 20, X25, 20, 10, 30, -20, -20, 20, X50, 40, 50, X0, X0, 20, 10, 10, 10, X0, 10, 0, 15, 15, X5, 20, 50, 40, 50 X}; X#ifdef ADMIN X#endif ADMIN Xint unitdefend[]= X{ X-25, -15, 0, 0, 0, 25, 10, X5, 0, 10, 15, 20, 10, 15, X15, 20, 10, 30, 20, 20, 30, X50, 50, 50, X0, X0, 20, 10, 10, 10, X0, 10, 0, 15, 15, X5, 20, 50, 40, 50 X}; X#ifdef ADMIN X#endif ADMIN X/*ten times the move rate of a unit*/ Xint unitmove[]= X{ X 0, 10, 10, 10, 0, 0, 10, X10, 10, 10, 10, 10, 20, 10, X10, 13, 15, 20, 5, 5, 10, X20, 15, 5, X0, X10, 10, 15, 10, 10, X10, 15, 10, 10, 10, X15, 10, 10, 15, 20 X}; X#endif ADMIN X/*iron cost of a unit*/ Xint u_eniron[]= X{ X 0, 80, 80, 100, 100, 0, 100, X150, 150, 150, 150, 150, 100, 0, X200, 200, 100, 300,1000,1000, 300, X600, 400, 600, X0, X0, 0, 0, 0, 0, X0, 0, 0, 0, 0, X0, 0, 0, 0, 0 X}; X/*enlist cost for a unit*/ Xint u_encost[]= X{ X 40, 70, 90, 90, 90, 90, 90, /* gold cost for enlistment */ X 120, 130, 150, 200, 200, 250, 300, X 300, 300, 400, 600, 750, 750, 700, X1000,1200 , 1000, X0, X2, 2, 2, 2, 2, /* spell points for enlistment */ X2, 2, 5, 5, 5, X5, 5,10,10,15 X}; X/*maintenance cost for a unit*/ Xint unitmaint[]= { X 10, 20, 40, 40, 40, 40, 40, X 40, 80, 60, 80, 80, 100, 100, X120, 120, 200, 250, 300, 300, 350, X400, 500, 400, X0, /* GOLD COST PER EQUIVALENT MAN FOR MONSTERS */ X100, 40, 40, 30, 30, /* AND 5 x JEWELS COST PER MAN */ X10, 20, 70, 15 ,35, X55, 70, 60, 60, 50 X}; X Xchar *exefile = "execute"; Xchar *datafile = "data"; Xchar *msgfile = "messages"; X#ifdef ADMIN Xchar *npcsfile = "nations"; X#endif ADMIN Xchar *helpfile = "help"; Xchar *newsfile = "news"; Xchar *isonfile = "lock"; X Xchar *pwrname[] = { X"WARRIOR", "CAPTAIN", "WARLORD", "ARCHER", "CAVALRY", "SAPPER", X"ARMOR", "AVIAN", "MI_MONST", "AV_MONST", "MA_MONST", X/*CIVILIAN POWERS */ X"SLAVER", "DERVISH", "HIDDEN", "ARCHITECT", "HEALER", "MINER", X"BREEDER", "URBAN", "STEEL", "NINJA", "SAILOR", "DEMOCRACY", "ROADS", X/* MAGICAL SKILLS */ X"THE_VOID", "KNOWALL", "DESTROYER", "VAMPIRE", X"SUMMON", "SUGGEST", "WYZARD", "SORCERER" X}; X Xlong powers[] = { X WARRIOR, /*MILITARY POWERS => START=0*/ X CAPTAIN, /*1*/ X WARLORD, /*2*/ X ARCHER, /*3*/ X CAVALRY, /*4*/ X SAPPER, /*5*/ X ARMOR, /*6*/ X AVIAN, /*7*/ X MI_MONST, /*8*/ X AV_MONST, /*9*/ X MA_MONST, /*10th power; Mil power #11*/ X X SLAVER, /*CIVILIAN POWERS => START=11*/ X DERVISH, /*12*/ X HIDDEN, /*13*/ X ARCHITECT, /*14*/ X HEALER, /*15*/ X MINER, /*16*/ X BREEDER, /*17*/ X URBAN, /*18*/ X STEEL, /*19*/ X NINJA, /*20*/ X SAILOR, /*21*/ X DEMOCRACY, /*22*/ X ROADS, /* 13th CIVILIAN POWER (23rd total) */ X X THE_VOID, /* MAGICAL SKILLS => START=24 */ X KNOWALL, /*25*/ X DESTROYER, /*26*/ X VAMPIRE, /*27*/ X SUMMON, /*28*/ X WYZARD, /*29*/ X SORCERER, /*30th Entry => 31 total powers => End=7*/ X 0 X}; X XFILE *fnews, *fopen(); Xstruct sprd_sht spread; END_OF_data.c if test 5939 -ne `wc -c <data.c`; then echo shar: \"data.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f extcmds.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"extcmds.c\" else echo shar: Extracting \"extcmds.c\" \(3954 characters\) sed "s/^X//" >extcmds.c <<'END_OF_extcmds.c' X/* X* additions made in tut.fi (winter 1987 and spring 1988) X* for more information ask from mta@tut.fi or esc@tut.fi X*/ X X/* THESE COMMANDS APPEAR USEFUL and (of course) I have heavily X modified them. I basically decided to use these subroutines in X my code too. - The Ed */ X X/* ext_cmd() run extended commands */ X/* clear_bottom(i) clear bottom min(i,4) lines of the map */ X/* errormsg(str) print error message to bottom line */ X/* splitarmy(army) split ? men from army */ X/* reducearmy(army,men) subtract men from army */ X/* change_status(army,stat) change army stat to integer status */ X/* combinearmies(army1,army2) add army2 to army1 */ X X#include <stdio.h> X#include "header.h" X#include "data.h" X Xextern FILE *fexe; Xextern short selector; Xextern short country; Xextern short xcurs, ycurs, xoffset, yoffset; X Xext_cmd() X{ X int stat=0,armynum,army2,men; X X clear_bottom(0); X X mvprintw(LINES-3, 0, X " (+) combine,(-) split n men,(/) divide by 2,([1-5]) chg status"); X mvprintw(LINES-4, 0, "Extended command:"); X refresh(); X X switch(getch()) { X case '-': /* split army */ X armynum = getselunit(); X splitarmy(armynum); X break; X case '/': /* divide army */ X armynum = getselunit(); X men = ASOLD/2; X reducearmy(armynum,men); X break; X case '+': /* combine armies */ X armynum = getselunit(); X selector +=2; X army2 = getselunit(); X selector -=2; X combinearmies(armynum,army2); X break; X case '5': /* Army status */ X stat++; X case '4': X stat++; X case '3': X stat++; X case '2': X stat++; X case '1': X stat++; X armynum = getselunit(); X change_status(armynum,stat); X break; X default: /* unimplemented? */ X errormsg("Unimplemented extended command"); X } X makebottom(); X refresh(); X} X Xcombinearmies(armynum,army2) Xint armynum, army2; X{ X if (armynum < 0 || armynum >= MAXARM || X army2 < 0 || army2 >= MAXARM || X armynum == army2 || X ASTAT == SCOUT || X ntn[country].arm[army2].stat == SCOUT || X ATYPE >= MINMONSTER || X ATYPE!=ntn[country].arm[army2].unittyp) { X errormsg("Selected armies not legal"); X return; X } X if((ntn[country].arm[army2].xloc!=AXLOC) X &&(ntn[country].arm[army2].yloc!=AYLOC)) { X errormsg("Selected armies not together"); X return; X } X ASOLD += ntn[country].arm[army2].sold; X ntn[country].arm[army2].sold = 0; X AMOVE=min(AMOVE,ntn[country].arm[army2].smove); X AADJMEN; X AADJMOV; X armynum = army2; X AADJMEN; X} X Xchange_status(armynum,new_stat) Xint armynum,new_stat; X{ X if (armynum < 0 || armynum >= MAXARM || ASTAT==SCOUT) { X errormsg("Selected army not legal"); X return; X } X if (new_stat == SCOUT && ASOLD > 25) { X errormsg("Need less than 26 men to scout"); X return; X } X ASTAT = new_stat; X AADJSTAT; X} X Xreducearmy(armynum,men) Xint armynum,men; X{ X int army2; X int oldx, oldy, army; X X if(ATYPE>=MINMONSTER){ X errormsg("sorry -- army is monster"); X return; X } X X if(men<0 || armynum < 0 || armynum >= MAXARM || ASOLD < men+25 ) { X errormsg("Selected army too small or illegal"); X return; X } X X if(ASOLD < men) { X errormsg("Too many men to split from army"); X return; X } X X oldx=AXLOC; X oldy=AYLOC; X army2=armynum; X X armynum=(-1); X for(army=0;army<MAXARM;army++) X if(ntn[country].arm[army].sold==0){ X if(armynum==(-1)) armynum=army; X } X /*overflow*/ X if(armynum==(-1)) { X errormsg("TOO MANY ARMIES"); X return; X } else { X AMOVE=ntn[country].arm[army2].smove; X ATYPE=ntn[country].arm[army2].unittyp; X ASTAT=ntn[country].arm[army2].stat; X AXLOC=oldx; X AYLOC=oldy; X ASOLD=men; X ntn[country].arm[army2].sold-=ASOLD; X AADJSTAT; X AADJMEN; X AADJLOC; X AADJMOV; X armynum=army2; X AADJMEN; X } X} X Xsplitarmy(armynum) Xint armynum; X{ X int men; X clear_bottom(2); X mvaddstr(LINES-2, 0, "How many men to split? "); X refresh(); X men = get_number(); X reducearmy(armynum,men); X} X Xerrormsg(str) Xchar *str; X{ X mvprintw(LINES-1, 0, str); X mvprintw(LINES-1, 60, "PRESS ANY KEY"); X beep(); X refresh(); X getch(); X} X Xclear_bottom(i) Xint i; X{ X if(i==0) i=4; X for (; i>0 ; i--) { X move( LINES-i, 0); X clrtoeol(); X } X} END_OF_extcmds.c if test 3954 -ne `wc -c <extcmds.c`; then echo shar: \"extcmds.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f man.page -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"man.page\" else echo shar: Extracting \"man.page\" \(4886 characters\) sed "s/^X//" >man.page <<'END_OF_man.page' X.TH CONQUER 6 X.SH NAME Xconquer \- multiuser game of strategy X.SH SYNOPSIS X.B conquer X[-maxhps -nNAT -dDIR] X.sp X.B admin X[-maxp -dDIR ] X.SH DESCRIPTION X.I CONQUER Xis a multi player computer game designed to run under the UNIX Xoperating system. In X.I CONQUER, Xeach player is the leader of a nation, Xcomposed of people (humans, orcs, elves, dwarves), recourses, and land. XRulers customize their nation at creation by chosing their race and by giving Xtheir nation special powers (magic, combat factor, location, speed...) Xand resources (civilians, troops, iron, gold...). Play involves building, Xmoving, and controlling armies and navies, diplomacy with other players, Xand adjusting economic activity, which is primarily geared to the production Xof gold for your treasury. Iron is needed, however to build ships & armies, Xand food is needed to prevent revolts and keep people alive. X.SH ON LINE HELP XFor detailed information, run conquer with the -h option (see below). X.SH OPTIONS X.B conquer X[-hs -nNAT -dDIR] X.IP \-h Xprint this help text X.IP "\-n NTN" Xrun as nation NTN X.IP "\-d DIR" XRun on data in directory DIR. Each game has its own data directory. The Xdefault is set up at compile time and should only be used if only one game Xis run. X.IP \-s Xprint out scores X.B Xadmin X[-maxp -dDIR ] X.IP \-a Xadd new player X.IP \-m Xmake a world X.IP \-p Xprint a map to standard output. X.IP \-x Xexecute program X.IP "\-d DIR " Xrun on data in directory DIR XIt is suggested that each player set up an alias for their game & nation. XMy alias, for example, is X.I conquer -d/d7/c7913/smile/oldgame/lib -norcland X.SH CURSOR MOVEMENT Xh: move west Xy: move north-west Xk: move north Xu: move north-east Xl: move east Xn: move south-east Xj: move south Xb: move south west XJ: scroll south XK: scroll north XL: scroll east XH: scroll west X.SH COMMANDS X.TP X\'a\': X.B army report: XGives army details & permits changing army status, merging 2 armies, Xsplitting armies, and disbanding armies. X.TP X\'c\': X.B administration: XReport on nation status and then change name, password, Xadd to combat bonus, or (if god) destroy a nation. X.TP X\'d\': X.B change display: XChange display mode. Numbers in gold screens... are Xrelative values of the materials. X.TP X\'f\': X.B fleet report: XReport on the status of your fleets. X.TP X\'g\': X.B group report: XGives army details on current sector & permits changing army status, Xmerging 2 armies, splitting armies, and disbanding armies. X.TP X\'m\': X.B move unit: Xmove selected unit. The unit will stop when it runs out Xof move points or runs into an army larger than it. X.TP X\'p\': X.B pick item: Xallows you to select the next army or navy in the Xsector. Other commands will operate on that unit. X.TP X\'r\': X.B redesignate: Xyou can change habitable sectors you own to other Xdesignations. Cities require 500+ people & Capitols Xrequire cities. God can redesignate anything. X.TP X\'s\': X.B score: Xprint out a screen showing the scores X.TP X\'?\': X.B help screen: Xprint out help text X.TP X\'A\': X.B adjust army: XThe quick way to adjust the status of your armies. X.TP X\'B\': X.B budget : XESTIMATE your nations budget statistics X.TP X\'C\': X.B construct: XIf you have cash, you can build fortifications and Xships in your cities. Ships can only be built in cities Xlocated on the water. X.TP X\'D\': X.B draft: XYou may draft a quarter of the population of your Xcities (those with more than a certain percent of Xyour population in it) if you have the gold. You Xneed 10 per man iron for this. X.TP X\'F\': X.B next fleet: XMove cursor to your next fleet X.TP X\'G\': X.B next army: XMove cursor to your next army X.TP X\'M\': X.B magic: XPrints your magic powers & offers you the option to Xpurchase more (cost doubles each power). Monster Power Xgives you the chance to take over NPC nations. X.TP X\'N\': X.B newspaper: XBriefs you on world happenings. Note the News has 4 pages. X.TP X\'P\': X.B production: XESTIMATE your nations production statistics X.TP X\'S\': X.B diplomacy: XAlloy you to see and alter your diplomatic status. X.TP X\'Q\': X.B quit: XSave your move and quit the game. Note there is no Xmeans supported to quit without saving your moves. X.TP X\'R\': X.B read mail: XRead mail messages X.TP X\'W\': X.B write mail: XWrite mail messages X.TP X\'Z\': X.B move people: XCivilians can move between two of your sectors at a cost Xof 50 per civilian. Civilians move naturally in the update. X.SH FILES X/usr/local/games/src/conquer/data datafile for the running game X.SH BUGS XProbably lots, if you find any please mail them to homxc!smile. X.sp X1) Security is not as tight as it should be. People might be able to alter Xthe data of others nations... this is cheating and unacceptable. X.br X2) Naval battles do not handle capturing merchant ships correctly. X.br X3) NPC nations can not build navies or move over water. God should be Xsure that all NPC nations have a minimum of 5 sectors to move to. END_OF_man.page if test 4886 -ne `wc -c <man.page`; then echo shar: \"man.page\" unpacked with wrong size! fi # end of overwriting check fi if test -f newhelp.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"newhelp.c\" else echo shar: Extracting \"newhelp.c\" \(5044 characters\) sed "s/^X//" >newhelp.c <<'END_OF_newhelp.c' X/*conquer : Copyright (c) 1988 by Ed Barlow. X * I spent a long time writing this code & I hope that you respect this. X * I give permission to alter the code, but not to copy or redistribute X * it without my explicit permission. If you alter the code, X * please document changes and send me a copy, so all can have it. X * This code, to the best of my knowledge works well, but it is my first X * 'C' program and should be treated as such. I disclaim any X * responsibility for the codes actions (use at your own risk). I guess X * I am saying "Happy gaming", and am trying not to get sued in the process. X * Ed X*/ X X/*include files*/ X#include <stdio.h> X#include "header.h" X#include "data.h" X Xint Xmain() X{ X FILE *fp, *fopen(); X if((fp=fopen("helpscript","w"))==NULL) { X printf("cant open helpscript file\n"); X exit(FAIL); X } X X /* create sed script */ X fprintf(fp,"s/XOWNER/%s/g\n",OWNER); X fprintf(fp,"s/XLOGIN/%s/g\n",LOGIN); X fprintf(fp,"s/XVERSION/%s/g\n",VERSION); X fprintf(fp,"s/XPWATER/%d/g\n",PWATER); X fprintf(fp,"s/XPVULCAN/%d/g\n",PVULCAN); X fprintf(fp,"s/XPMOUNT/%d/g\n",PMOUNT); X fprintf(fp,"s/XPSTORM/%d/g\n",PSTORM); X fprintf(fp,"s/XMAPX/%d/g\n",MAPX); X fprintf(fp,"s/XMAPY/%d/g\n",MAPY); X fprintf(fp,"s/XMAXNTN/%d/g\n",MAXNTN); X fprintf(fp,"s/XMAXPTS/%d/g\n",MAXPTS); X fprintf(fp,"s/XMAXARM/%d/g\n",MAXARM); X fprintf(fp,"s/XMAXNAVY/%d/g\n",MAXNAVY); X X /* check all the defined options */ X#ifdef LZARD X fprintf(fp,"s/XLZARD/(True) /g\n"); X#else X fprintf(fp,"s/XLZARD/(False)/g\n"); X#endif X#ifdef OGOD X fprintf(fp,"s/XOGOD/(True) /g\n"); X#else X fprintf(fp,"s/XOGOD/(False)/g\n"); X#endif X#ifdef DERVDESG X fprintf(fp,"s/XDERVDESG/Dervish can/g\n"); X#else X fprintf(fp,"s/XDERVDESG/Dervish cannot/g"); X#endif X#ifdef SYSV X fprintf(fp,"s/XSYSV/(True) /g\n"); X#else X fprintf(fp,"s/XSYSV/(False)/g\n"); X#endif X#ifdef MONSTER X fprintf(fp,"s/XMONSTER/(True) /g\n"); X#else X fprintf(fp,"s/XMONSTER/(False)/g\n"); X#endif X#ifdef NPC X fprintf(fp,"s/XNPC/(True) /g\n"); X#else X fprintf(fp,"s/XNPC/(False)/g\n"); X#endif X#ifdef CHEAT X fprintf(fp,"s/XCHEAT/(True) /g\n"); X#else X fprintf(fp,"s/XCHEAT/(False)/g\n"); X#endif X#ifdef CMOVE X fprintf(fp,"s/XCMOVE/(True) /g\n"); X#else X fprintf(fp,"s/XCMOVE/(False)/g\n"); X#endif X#ifdef RANEVENT X fprintf(fp,"s/XRANEVENT/(True) /g\n"); X#else X fprintf(fp,"s/XRANEVENT/(False)/g\n"); X#endif X#ifdef VULCANIZE X fprintf(fp,"s/XVULCANIZE/(True) /g\n"); X#else X fprintf(fp,"s/XVULCANIZE/(False)/g\n"); X#endif X#ifdef STORMS X fprintf(fp,"s/XSTORMS/(True) /g\n"); X#else X fprintf(fp,"s/XSTORMS/(False)/g\n"); X#endif X#ifdef ORCTAKE X fprintf(fp,"s/XORCTAKE/(True) /g\n"); X#else X fprintf(fp,"s/XORCTAKE/(False)/g\n"); X#endif X /* map sectors */ X fprintf(fp,"s/ZMOUNTAIN/MOUNTAIN (%c)/g\n",MOUNTAIN); X fprintf(fp,"s/ZHILL/HILL (%c)/g\n",HILL); X fprintf(fp,"s/ZCLEAR/CLEAR (%c)/g\n",CLEAR); X fprintf(fp,"s/ZWATER/WATER (%c)/g\n",WATER); X fprintf(fp,"s/ZPEAK/PEAK (%c)/g\n",PEAK); X fprintf(fp,"s/ZVOLCANO/VOLCANO (%c)/g\n",VOLCANO); X fprintf(fp,"s/ZDESERT/DESERT (%c)/g\n",DESERT); X fprintf(fp,"s/ZJUNGLE/JUNGLE (%c)/g\n",JUNGLE); X fprintf(fp,"s/ZTUNDRA/TUNDRA (%c)/g\n",TUNDRA); X fprintf(fp,"s/ZICE/ICE (%c)/g\n",ICE); X fprintf(fp,"s/ZSWAMP/SWAMP (%c)/g\n",SWAMP); X fprintf(fp,"s/ZGOOD/GOOD (%c)/g\n",GOOD); X fprintf(fp,"s/ZFOREST/FOREST (%c)/g\n",FOREST); X fprintf(fp,"s/ZLIGHT/LIGHT VEG (%c)/g\n",LT_VEG); X fprintf(fp,"s/ZWOOD/WOOD (%c)/g\n",WOOD); X fprintf(fp,"s/ZBARREN/BARREN (%c)/g\n",BARREN); X X /* designations */ X fprintf(fp,"s/ZMINE/MINE\t\t (%c)/g\n",DMINE); X fprintf(fp,"s/ZFARM/FARM\t\t (%c)/g\n",DFARM); X fprintf(fp,"s/ZGOLD/GOLD MINE\t (%c)/g\n",DGOLDMINE); X fprintf(fp,"s/ZCASTLE/CASTLE\t\t (%c)/g\n",DCASTLE); X fprintf(fp,"s/ZDEVASTATED/DEVASTATED\t (%c)/g\n",DDEVASTATED); X fprintf(fp,"s/ZTOWN/TOWN\t\t (%c)/g\n",DCITY); X fprintf(fp,"s/ZCAPITOL/CAPITOL\t\t (%c)/g\n",DCAPITOL); X X /* other defines */ X fprintf(fp,"s/XNORANDEVENTS/%d/g\n",NORANDEVENTS); X fprintf(fp,"s/XLANDSEE/%d/g\n",LANDSEE); X fprintf(fp,"s/XNAVYSEE/%d/g\n",NAVYSEE); X fprintf(fp,"s/XARMYSEE/%d/g\n",ARMYSEE); X fprintf(fp,"s/XTAXFOOD/%ld/g\n",TAXFOOD); X fprintf(fp,"s/XTAXIRON/%ld/g\n",TAXIRON); X fprintf(fp,"s/XTAXGOLD/%ld/g\n",TAXGOLD); X fprintf(fp,"s/XTAXCAP/%ld/g\n",TAXCAP); X fprintf(fp,"s/XTAXCITY/%ld/g\n",TAXCITY); X fprintf(fp,"s/XSHIPMAINT/%ld/g\n",SHIPMAINT); X fprintf(fp,"s/XSHIPCP/%ld/g\n",SHIPHOLD); X fprintf(fp,"s/XDESCOST/%ld/g\n",DESCOST); X fprintf(fp,"s/XFORTCOST/%ld/g\n",FORTCOST); X fprintf(fp,"s/XWARSHPCOST/%ld/g\n",WARSHPCOST); X fprintf(fp,"s/XMERSHPCOST/%ld/g\n",MERSHPCOST); X fprintf(fp,"s/XSHIPHOLD/%d/g\n",SHIPHOLD); X fprintf(fp,"s/XCITYLIMIT/%d/g\n",CITYLIMIT); X fprintf(fp,"s/XMILRATIO/%d/g\n",MILRATIO); X fprintf(fp,"s/XMILINCAP/%d/g\n",MILINCAP); X fprintf(fp,"s/XBRIBE/%ld/g\n",BRIBE); X fprintf(fp,"s/XDESFOOD/%d/g\n",DESFOOD); X fprintf(fp,"s/XTOMUCHMINED/%d/g\n",TOMUCHMINED); X fprintf(fp,"s/XTOMANYPEOPLE/%d/g\n",TOMANYPEOPLE); X fprintf(fp,"s/XFINDPERCENT/%d/g\n",FINDPERCENT); X fprintf(fp,"s/XTAKEPRICE/%d/g\n",TAKEPRICE); X X close(fp); X exit(SUCCESS); X} END_OF_newhelp.c if test 5044 -ne `wc -c <newhelp.c`; then echo shar: \"newhelp.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f newlogin.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"newlogin.h\" else echo shar: Extracting \"newlogin.h\" \(1745 characters\) sed "s/^X//" >newlogin.h <<'END_OF_newlogin.h' X/*conquer : Copyright (c) 1988 by Ed Barlow. */ X/* initial starting stats */ X X/*dwarf*/ X#define NLDGOLD 100000 /* 1 */ X#define NLDFOOD 25000 /* 0 */ X#define NLDJEWEL 15000 /* 0 */ X#define NLDIRON 15000 /* 0 */ X#define NLDCIVIL 6000 /* 6 */ X#define NLDMILIT 1000 /* 1 */ X#define NLDREPRO 4 /* 8 */ X#define NLDMMOVE 6 /* 2 */ X#define NLDAPLUS 20 /* 0 */ X#define NLDDPLUS 20 /* 5 */ X#define NLPTDW 23 /* point loss */ X X/*elf*/ X#define NLEGOLD 100000 /* 1 */ X#define NLEFOOD 25000 /* 0 */ X#define NLEJEWEL 15000 /* 0 */ X#define NLEIRON 15000 /* 0 */ X#define NLECIVIL 7000 /* 7 */ X#define NLEMILIT 200 /* 0 */ X#define NLEREPRO 5 /* 10 */ X#define NLEMMOVE 8 /* 3 */ X#define NLEAPLUS 10 /* 0 */ X#define NLEDPLUS 40 /* 6 */ X#define NLPTEL 27 /* point loss */ X X/*orc*/ X#define NLOGOLD 1000 /* 0 */ X#define NLOFOOD 25000 /* 0 */ X#define NLOJEWEL 15000 /* 0 */ X#define NLOIRON 15000 /* 0 */ X#define NLOCIVIL 6000 /* 6 */ X#define NLOMILIT 2000 /* 2 */ X#define NLOREPRO 8 /* 16 */ X#define NLOMMOVE 6 /* 2 */ X#define NLOAPLUS 0 /* 0 */ X#define NLODPLUS 0 /* 0 */ X#define NLPTOR 26 /* point loss */ X X/*human*/ X#define NLHGOLD 1000 /* 0 */ X#define NLHFOOD 25000 /* 0 */ X#define NLHJEWEL 15000 /* 0 */ X#define NLHIRON 15000 /* 0 */ X#define NLHCIVIL 6000 /* 6 */ X#define NLHMILIT 1000 /* 1 */ X#define NLHREPRO 5 /* 10 */ X#define NLHMMOVE 10 /* 3 */ X#define NLHAPLUS 15 /* 0 */ X#define NLHDPLUS 10 /* 3 */ X#define NLPTHU 23 /* point loss */ X X/* the purchase definitions and/or costs */ X#define NLPOP 1000 X#define NLGOLD 100000 X#define NLLOCCOST 1 X#define NLSOLD 900 X#define NLATTACK 8 X#define NLDEFENCE 8 X#define NLREPRO 1 X#define NLREPCOST 2 X#define NLMOVE 3 X#define NLDBLCOST 2 X#define NLMAGIC 2 END_OF_newlogin.h if test 1745 -ne `wc -c <newlogin.h`; then echo shar: \"newlogin.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f run -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"run\" else echo shar: Extracting \"run\" \(1789 characters\) sed "s/^X//" >run <<'END_OF_run' X#below is a shell script that runs updates 3 times a day every day but sunday X# X#PLEASE CHANGE TIME* VARIABLES TO APPROPRIATE TIMES, and CHANGE PATH VARIABLES X# X#KEEP THE TIMES IN CHRONOLOGICAL ORDER AND THE TIME1H and TIME2H values X#represent the hours of TIME1 and TIME2 X######################################################### X# use the command "at -l" to get a list of existing at jobs X# use the command "at -r <jobname>" to remove existing at jobs X######################################################### XTIME1=1000 XTIME1H=10 XTIME2=1700 XTIME2H=17 XTIME3=2300 X#Below is the full command to update a game of conquer XPATHTOCONQ="/d7/c7913/smile/oldgame/conquer -x -d/d7/c7913/smile/oldgame/temp" X#Path to this file XPATHTORUN=/d7/c7913/smile/oldgame/run X#LOG is full path name of log file XLOG=/d7/c7913/smile/oldgame/runlog X X/bin/date >> $LOG X$PATHTOCONQ >> $LOG X XDAY=`/bin/date | /usr/bin/awk '{ print $1 }'` Xecho "day is $DAY" >> $LOG XHOUR=`/bin/date|/usr/bin/awk '{ print $4 }'|/usr/bin/awk -F: '{ print $1 }'` Xecho "hour is $HOUR" >> $LOG X#BELOW IS AN EXAMPLE OF A BSD SCRIPT X#switch $DAY X# case Sat: X# set nextday=mon X# breaksw X# default: X# set nextday = X# breaksw X#endsw Xcase $DAY in X Sat) X nextday=mon X ;; X *) X nextday="" X ;; Xesac X#switch $HOUR X# case 00: X# set nexthour=$TIME1 X# breaksw X# default: X# set nexthour=$TIME2 X# breaksw X#endsw Xcase $HOUR in X$TIME1H) X nexthour=$TIME2 X echo "nexthour is $nexthour" >> $LOG X ;; X$TIME2H) X nexthour=$TIME3 X echo "nexthour is $nexthour" >> $LOG X ;; X*) X nexthour=$TIME1 X echo "nexthour is $nexthour" >> $LOG X ;; Xesac X#below for bsd (i think) X#/usr/bin/at $nexthour $nextday $PATHTORUN X#below for SYSV Xecho "/usr/bin/at $nexthour $nextday < $PATHTORUN" >> $LOG Xecho "XXX" >> $LOG X/usr/bin/at $nexthour $nextday < $PATHTORUN END_OF_run if test 1789 -ne `wc -c <run`; then echo shar: \"run\" unpacked with wrong size! fi chmod +x run # end of overwriting check fi echo shar: End of archive 8 \(of 8\). cp /dev/null ark8isdone MISSING="" for I in 1 2 3 4 5 6 7 8 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 8 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