[comp.sources.games] v06i055: GB - Galactic Bloodshed, an empire-like war game, Part04/07

games@tekred.CNA.TEK.COM (04/27/89)

Submitted-by: Robert Chansky <smq@ssyx.ucsc.edu>
Posting-number: Volume 6, Issue 55
Archive-name: GB/Part04



#! /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 4 (of 7)."
# Contents:  build.c doturn.c getplace.c makeuniv.c planet.list
#   read_teleg.c rst.c shootblast.c tweakables.h
# Wrapped by billr@saab on Wed Apr 26 14:41:34 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'build.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'build.c'\"
else
echo shar: Extracting \"'build.c'\" \(6191 characters\)
sed "s/^X//" >'build.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed (Robert Chansky, smq@ucscb.ucsc.EDU)
X * build -- build a ship
X */
X
X#include "vars.h"
X#include "ships.h"
X#include "races.h"
X#include <curses.h>
X#include <setjmp.h>
X#include <signal.h>
Xextern jmp_buf main_jenv;
Xextern int Ignore_filelocks, God, Ignore_readerrors;
Xint build_shdata,build_pdata,build_sectdata;
X
X
Xbuild(APcount, argn,args)
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
X{
Xint j,i,x= -1 ,y= -1 ,shipno, planet_slot,mask;
Xint picked=0;
Xchar shipc;
Xplanettype *planet;
Xsectortype *sect;
Xshiptype s;
Xint build_handler();
X
X
Xif (!enufAP(Stars[Dir.snum]->AP, APcount))
X	return;
X
Xbuild_shdata = build_pdata = build_sectdata = NEUTRAL_FD;
Xsignal(SIGINT, build_handler);
X
X if (Dir.level!=LEVEL_PLAN) {
X	printf("You can't build anything here.\n");
X	build_handler();
X }
X
X  do {
X   tty_on();
X   printf("What ship type (? for help):");
X   shipc=getchr(); putchr('\n');
X   tty_off();
X   if (shipc=='?') {
X     printf("ltr              ship  carg armr dstcap guns  mass fuelcap mintech cost ^crew\n");
X     for (i=0; i<NUMSTYPES; i++)
X	if (Race->tech >= Shipdata[i][ABIL_TECH] || God)
X	  if ((i==STYPE_POD && Race->Thing) || i!=STYPE_POD)
X	    printf(" %c %18s %5d%5d%7d%5d%6d%8d%8d%5d%6d\n",Shipltrs[i],
X		  Shipnames[i],Shipdata[i][ABIL_CARGO],
X		  Shipdata[i][ABIL_ARMOR],
X		  Shipdata[i][ABIL_DESTCAP],
X		  Shipdata[i][ABIL_GUNS],Shipdata[i][ABIL_MASS],
X		  Shipdata[i][ABIL_FUELCAP],Shipdata[i][ABIL_TECH],
X		  Shipdata[i][ABIL_COST],Shipdata[i][ABIL_MAXCREW] );
X   } else {
X    i=0;
X    while ((Shipltrs[i]!=shipc) && (i<NUMSTYPES)) i++;
X    picked = 1;
X    if (i<0 || i>=NUMSTYPES || (i==STYPE_POD && !Race->Thing) ) {
X	printf("Illegal ship letter.\n");
X	picked = 0;
X    } else if (Race->tech < Shipdata[i][ABIL_TECH]) {
X	printf("You don't have enough technology to build one of those.\n");
X	if (!God)
X		picked = 0;
X    } else if (i==STYPE_MIRROR && Dir.level==LEVEL_PLAN) {
X	printf("You can't build one of those on a planet.\n");
X	/*picked = 0;*/
X    }
X   }
X  } while (!picked);
X
X    openpdata(&build_pdata);
X    getplanet(build_pdata,&planet,Stars[Dir.snum]->planetpos[Dir.pnum]);
X
X		/* see if the ship can be made on the planet */
X	j = 0;
X	while (planet->shipnums[j++]) ;
X	 if (j<=MAXPSHIPS) {
X		planet_slot = j-1;
X	 } else {
X		printf("too many ships are already here.\n");
X		free(planet);
X		build_handler();
X	 }
X
X     /*printf(" 1 res %u\n",planet->info[Playernum-1].resource );*/
X     if (planet->info[Playernum-1].resource < Shipdata[i][ABIL_COST]) {
X	printf("not enough resources in stock.\n");
X	free(planet);
X	build_handler();
X     }
X
X	do {
X
X     	   printf("Build %s on planet %s,", Shipnames[i],
X	   		  		Stars[Dir.snum]->pnames[Dir.pnum] );
X	   GetMapSector(planet, &x, &y);
X
X	   opensectdata(&build_sectdata);
X	   getsector(build_sectdata, &sect, planet->sectormappos+(y*planet->Maxx+x)*sizeof(sectortype) );
X	   close(build_sectdata);
X	   free(sect);
X
X      	} while ( sect->owner != Playernum );
X
X		/* keep people from fucking up the data files */
X	mask = sigblock(SIGINT | SIGQUIT | SIGSTOP);
X
X
X 	Bzero(s);
X
X	s.type = i;
X	s.xpos = (float)x;
X	s.ypos = (float)y;
X	/*s.augmented = 0;*/
X	if (s.type==STYPE_POD)
X		s.speed = 1;
X	else
X		s.speed = 2;	/* starting speed default */
X	s.owner = Playernum;
X	/*for (l=0; l < NUMABILS-3; l++)
X		s.abils[l]=Shipdata[i][l];*/
X	s.mass = (float)Shipdata[i][ABIL_MASS];
X	s.fuel = s.destruct = s.resource = 0;
X	s.whatorbits = LEVEL_PLAN; 	/* landed on a planet */
X	s.whatdest = LEVEL_PLAN;	/* no destination */
X	s.storbits = Dir.snum;
X	s.deststar = Dir.snum;
X	s.destpnum = Dir.pnum;
X	s.pnumorbits = Dir.pnum;
X	s.is_docked = 1;
X	s.rad = 0;
X	if (Shipdata[s.type][ABIL_MAXCREW]==0)
X		s.damage = 0;
X	else
X		s.damage = 50;
X
X	if (has_switch(&s)) {
X		s.orders.object.on = 0;
X	}
X	switch (s.type) {
X	    case OTYPE_VN:
X		s.orders.object.number = 1;	/* one of them */
X		s.orders.object.number2 = 1;	/* we have an assignment */
X		s.orders.object.on = 1;
X		break;
X	    case STYPE_MINE:
X		s.orders.object.number = 100;	/* trigger radius */
X		printf("Trigger radius set to 100.\n");
X		break;
X	    case OTYPE_TRANSDEV:
X		printf("Receive OFF.  Change with order.\n");
X		break;
X	    case OTYPE_TERRA:
X		printf("Processor OFF.\n");
X		break;
X	    default:
X		break;
X	}
X
X
X	planet->info[Playernum-1].resource -= Shipdata[i][ABIL_COST];
X		/* deduct resource cost from planet */
X
X	  /* load new ship with fuel */
X	if (planet->info[Playernum-1].fuel >= Shipdata[i][ABIL_FUELCAP]) {
X		planet->info[Playernum-1].fuel-=Shipdata[i][ABIL_FUELCAP];
X		s.fuel = (float)Shipdata[i][ABIL_FUELCAP];
X		s.mass += s.fuel*MASS_FUEL;
X		printf("%s Loaded with %.2f fuel.\n",Shipnames[s.type],s.fuel);
X	} else {
X		s.fuel = 0;
X		printf("No fuel available!\n");
X	}
X	  /* put crew in ship */
X	opensectdata(&build_sectdata);
X	getsector(build_sectdata,&sect,planet->sectormappos+(y*planet->Maxx+x)*sizeof(sectortype));
X	if (sect->popn > Shipdata[i][ABIL_MAXCREW]) {
X		sect->popn -= Shipdata[i][ABIL_MAXCREW];
X		s.popn = Shipdata[i][ABIL_MAXCREW];
X		s.mass += (float)s.popn*Race->mass;
X		putsector(build_sectdata,sect,planet->sectormappos+(y*planet->Maxx+x)*sizeof(sectortype));
X		printf("Loaded with %d crew members.\n",Shipdata[i][ABIL_MAXCREW]);
X	} else {
X		s.popn = 1;
X		printf("Only one crewmember available.\n");
X	}
X	close(build_sectdata);
X	free(sect);
X
X		/* check for dead ships in the data files */
X	openshdata(&build_shdata);
X	if ( (shipno = getdeadship(build_shdata)) == -1) {
X			/* otherwise recycle topmost dead ship in data file */
X			/* no dead ships to recycle */
X		shipno = Numships(build_shdata) + 1;
X	}
X
X	printf("Ship #%d is on sector %.0f,%.0f.\n",shipno,s.xpos,s.ypos);
X
X	putship(build_shdata,&s,shipno);
X	close(build_shdata);
X
X		/* Insert ship into planet's orbit (actually landed) */
X	planet->shipnums[planet_slot] = shipno;
X	planet->numships++;
X	putplanet(build_pdata,planet,Stars[Dir.snum]->planetpos[Dir.pnum]);
X	close(build_pdata);
X
X    Ignore_filelocks = 0;
X    deductAPs(APcount, Dir.snum, 0);
X
X    sigsetmask(mask);
X
X    free(planet);
X
X}
X
X
X
Xbuild_handler(sig, code, scp)
Xint sig,code;
Xstruct sigcontext *scp;
X{
X close(build_shdata );
X close(build_pdata );
X close(build_sectdata );
X Ignore_filelocks = 0;
X longjmp(main_jenv,1);
X}
END_OF_FILE
if test 6191 -ne `wc -c <'build.c'`; then
    echo shar: \"'build.c'\" unpacked with wrong size!
fi
# end of 'build.c'
fi
if test -f 'doturn.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'doturn.c'\"
else
echo shar: Extracting \"'doturn.c'\" \(5974 characters\)
sed "s/^X//" >'doturn.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed (Robert Chansky, smq@b)
X * doturn -- does one turn.  
X */
X
X#include "vars.h"
X#include "ships.h"
X#include "races.h"
X#include "doturn.h"
X#include "power.h"
Xstruct power Power[MAXPLAYERS];
X#include <math.h>
X
Xchar telegram_buf[AUTO_TELEG_SIZE];
Xshiptype *ships[MAXTOTALSHIPS];
Xplanettype *planets[NUMSTARS][MAXPLANETS];
Xracetype *races[MAXPLAYERS];
Xus Sdatanumships[MAXPLAYERS];
Xul Sdatapopns[MAXPLAYERS];
Xus starnumships[NUMSTARS][MAXPLAYERS];
Xul starpopns[NUMSTARS][MAXPLAYERS];
X
Xint Num_races,Num_ships;
X
Xextern int Ignore_lockfile;
X
Xdoturn(command)
Xint command;	/* if run from a shell by super user */
X{
X int star,i,fd;
X int shdata,stardata,pdata,sectdata;
X bool err=0;
X char buf[80];
X shiptype *ship;
X
X Ignore_lockfile = 1;
X
X 		/* make all 0 for first iteration of doplanet */
X bzero((char *)starpopns, sizeof(starpopns));
X bzero((char *)starnumships, sizeof(starnumships));
X bzero((char *)Sdatanumships, sizeof(Sdatanumships));
X bzero((char *)Stinfo, sizeof(Stinfo));
X bzero((char *)Power, sizeof(Power));
X
X	/* create lock file that locks all file reads */
X if ( (fd = open(LOCK_ALL, O_EXCL|O_CREAT, 0000) ) < 0) {
X	printf("lock file already exists!\n");
X	exit(-1);
X }
X close(fd);
X	/* close it--have to do it this way or we get too many files open*/
X
X
XNum_races = Numraces();
Xprintf(" Num_races = %d\n",Num_races);
X
X openshdata(&shdata);
X Num_ships = Numships(shdata);
X	/* i<MAXTOTALSHIPS is to prevent daemon allocating all mem to itself
X	     in case of accidental write onto position 0 */
X for (i=1; i<=Num_ships && i<MAXTOTALSHIPS; i++)
X	getship(shdata,&ships[i],i);
X
X close(shdata);
X
X	/* get all stars & planets */
X openstardata(&stardata);
X getsdata(stardata,&Sdata);
X openpdata(&pdata);
X for (star=0; star<Sdata.numstars; star++) {
X 	getstar(stardata, &(Stars[star]), star);
X	fix_stability(Stars[star]);		 /* nova */
X 	for (i=0; i<Stars[star]->numplanets; i++) {
X    	   getplanet(pdata,&planets[star][i],Stars[star]->planetpos[i]);
X	}
X }
X close(stardata);
X close(pdata);
X
X
X
Xfor (i=1; i<=Num_races; i++) {
X printf(" numraces=%d\n",Num_races);
X	getrace(&(races[i]),i);
X			/* increase tech; change to something else */
X	races[i]->tech += (float)races[i]->IQ / 100.0;	
X	if (races[i]->tech >= TECH_EXPLORE)
X		planets[races[i]->homesystem][races[i]->homeplanetnum]->is_explored = 1;
X}
X
X
X
X for (i=1; i<=Num_ships && i<MAXTOTALSHIPS; i++) 
X    doship(i,ships[i]);
X
X
X openstardata(&stardata);
X openpdata(&pdata);
X
X  /* add APs to sdata for ea. player */
X for (i=0; i<=Num_races; i++) { int a;
X    if ( (a = Sdata.AP[i] + APadd((int)Sdatanumships[i], (int)Sdatapopns[i]) + 1) > LIMIT_APs)
X	Sdata.AP[i] = LIMIT_APs;
X    else
X	Sdata.AP[i] = a;
X }
X 
X
X for (star=0; star<Sdata.numstars; star++) {
X
X  for (i=0; i<Stars[star]->numplanets; i++) { int ppp,pppp;
X	 /*for (ppp=0; ppp<Sdata.numstars; ppp++)
X		  for (pppp=0; pppp<Stars[star]->numplanets; pppp++)
X		   printf(" 8Pointer %d,%d= %x\n",ppp,pppp,planets[ppp][pppp]);*/
X
X    if (doplanet(star, planets[star][i], i, command)) {
X	/* save smap gotten & altered by doplanet only if the planet is expl*/
X       opensectdata(&sectdata);
X       putsmap(sectdata,Smap,planets[star][i]->sectormappos,planets[star][i]->Maxx*planets[star][i]->Maxy);
X       close(sectdata);
X    }
X    putplanet(pdata,planets[star][i],Stars[star]->planetpos[i]);
X    free(planets[star][i]);
X  }
X
X	   /* do AP's for ea. player  */
X  for (i=0; i<=Num_races; i++) {
X     if (isset(Stars[star]->explored, i) ) { int a;
X	 if ((a = Stars[star]->AP[i] + APadd((int)starnumships[star][i], (int)starpopns[star][i]) + 1) > LIMIT_APs)
X         	Stars[star]->AP[i] = LIMIT_APs;
X	 else
X		Stars[star]->AP[i] = a;
X       }
X    }
X    if (starpopns[star][i])
X	setbit(Stars[star]->inhabited,i);
X    else
X	clrbit(Stars[star]->inhabited,i);
X    putstar(stardata, Stars[star], star);
X
X    if (!command) 
X	free(Stars[star]);
X
X }
X close(pdata);
X putsdata(stardata,&Sdata);
X close(stardata);
X
X
X
X  for (i=1; i<=Num_races; i++) {
X	/*printf(" putting race %d -- ",i);*/
X	putrace(races[i]);
X	if (!(command && i==Race->Playernum))
X		free(races[i]);
X  }
X
X  Putpower(Power);	/* put power report to disk */
X
X openshdata(&shdata);
X		/* put all ships back */
X for (i=1; i<=Num_ships && i<MAXTOTALSHIPS; i++) {
X	putship(shdata,ships[i],i);
X	free(ships[i]);
X }
X close(shdata);
X
X
X  unlink(LOCK_ALL);	 /* remove the LOCK_ALL file */
X  Ignore_lockfile = 0;	 /* not realy needed for daemon but needed for doturn */
X			 	/*  as shell command */
X       /* readjust pointers to star; Dir now points to dead memory */
X  if (command) {
X	free(Race);
X	Race = races[Race->Playernum];
X  }
X
X}
X
X
X
X /* routine for number of AP's to add to each player in ea. system */
X
Xint APadd(ships, popn) 
Xint ships, popn;
X{
X return round_rand((float)(ships)/5.0 + popn / 10000.0);
X}
X
X
X
X	/* fix stability for stars */
Xfix_stability(s)
Xstartype *s;
X{
Xchar buf[100];
Xint a,i;
X
X  if (s->nova_stage > 0) {
X  	if (s->nova_stage > 14) {
X		s->stability = 30;
X		s->nova_stage = 0;
X		teleg_add("",telegram_buf);
X		teleg_add("Notice\n",telegram_buf );
X		sprintf(buf,"\n  Scientists report that star %s\n", s->name);
X		teleg_add(buf,telegram_buf);
X		teleg_add("is no longer undergoing nova.\n",telegram_buf);
X		for (i=1; i<=Num_races; i++)
X	    		teleg_send(TELEG_PLAYER_AUTO, i, telegram_buf);
X			/* telegram everyone when nova over? */
X	} else
X		s->nova_stage++;
X
X  } else if (s->stability > 50) {
X	a = int_rand(-1,3);
X		/* nova just starting; notify everyone */
X  	if ( (s->stability + a) > 100) {
X		s->stability = 100;
X		s->nova_stage = 1;
X		teleg_add("",telegram_buf);
X		teleg_add( "***** BULLETIN! ******\n",telegram_buf );
X		sprintf(buf,"\n  Scientists report that star %s\n", s->name);
X		teleg_add(buf,telegram_buf);
X		teleg_add("is undergoing nova.\n",telegram_buf);
X		for (i=1; i<=Num_races; i++)
X	    		teleg_send(TELEG_PLAYER_AUTO, i, telegram_buf);
X	} else
X		s->stability += a;
X  } else
X  	a = int_rand(-3,2);
X  	if ( (s->stability + a) < 0)
X		s->stability = 0;
X	else
X		s->stability += a;
X}
END_OF_FILE
if test 5974 -ne `wc -c <'doturn.c'`; then
    echo shar: \"'doturn.c'\" unpacked with wrong size!
fi
# end of 'doturn.c'
fi
if test -f 'getplace.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'getplace.c'\"
else
echo shar: Extracting \"'getplace.c'\" \(5141 characters\)
sed "s/^X//" >'getplace.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed (Robert Chansky, smq@b)
X *  Getplace -- returns directory level from string and current Dir
X *  Dispplace -- returns string from directory level
X */
X
X#include "vars.h"
X#include <ctype.h>
X#include "ships.h"
Xchar Disps[PLACENAMESIZE];
Xplacetype Getplace2();
Xextern int God;
X
X
Xplacetype Getplace(string, ignoreexpl)
Xchar *string;
Xint ignoreexpl;
X{
X bool error;
X int getplace_shdata;
X placetype where;	/* return value */
X
X Bzero(where);
X
X switch (*string) {
X	  case '/':
X		   where.level=LEVEL_UNIV;	/* scope = root (universe) */
X		   where.snum=0;
X		   where.pnum= where.shipno=0;
X		   return(Getplace2(string+1,&where,ignoreexpl));
X	 case '#':
X		   sscanf(++string,"%hd",&where.shipno);
X		   openshdata(&getplace_shdata);
X		   if (!getship(getplace_shdata,&where.shipptr,where.shipno)) {
X			close(getplace_shdata);
X			DontOwnErr(where.shipno);
X			where.err = 1;
X			return where;
X		   }
X		   close(getplace_shdata);
X		   if ( (where.shipptr->owner==Playernum || ignoreexpl)
X						&& !where.shipptr->is_dead) {
X			   where.level = LEVEL_SHIP;
X			   where.snum = where.shipptr->storbits;
X			   where.pnum = where.shipptr->pnumorbits;
X			/* where.shipno already taken care of */
X			   printf(" |%s|\n",string);
X			   while (isdigit(*string)) {putchr(*string),string++;}
X		   	   putchr(*string);
X			   printf(" |%s|\n",string);
X			   if (*string=='/')
X				 return Getplace2(string+1,&where, ignoreexpl);
X			   else
X				 return where;
X		   } else {
X			where.err = 1;
X			DontOwnErr(where.shipno);
X			return where;
X		   }
X
X	 case '-':
X			/* no destination */
X		   where.level = LEVEL_UNIV;
X		   return where;
X
X	default:
X			/* copy current scope to scope */
X		   where.level = Dir.level;
X		   where.snum = Dir.snum;
X		   where.pnum = Dir.pnum;
X		   if (where.level==LEVEL_SHIP) {
X			   where.shipno = Dir.shipno;
X			   openshdata(&getplace_shdata);
X			   getship(getplace_shdata,&(where.shipptr),where.shipno);
X			   close(getplace_shdata);
X		   }
X		   if (*string==CHAR_CURR_SCOPE)
X			return where;
X		   else 
X			return Getplace2(string,&where, ignoreexpl);
X }
X
X}
X
X
X
Xplacetype Getplace2(string,where, ignoreexpl)
Xchar *string;
Xplacetype *where;
Xint ignoreexpl;
X{
Xchar substr[NAMESIZE];
Xplanettype *p;
Xshiptype *s;
Xregister int i,l;
Xint shdata,tick;
Xint getplace2_pdata;
X
X /*printf("getplace2:looking for '%s'\n",string);*/
X
X if (where->err || *string=='\0' || *string=='\n')
X	return(*where);		/* base cases */
X
X else if (*string=='.') {
X    if (where->level==LEVEL_UNIV) {
X	printf("Can't go higher.\n");
X	where->err=1;
X	return(*where);
X    } else {
X	if (where->level==LEVEL_SHIP)
X		where->level = where->shipptr->whatorbits;
X	else 
X		where->level--;
X	while (*string=='.') string++;
X	while (*string=='/') string++;
X	return(Getplace2(string,where,ignoreexpl));
X    }
X } else {
X		/* is a char string, name of something */
X    /*printf("before scanf str=`%s`\n",string);*/
X    sscanf(string,"%[^/ \n]",substr);
X    /*printf("after scanf sub=`%s`\n",substr);*/
X
X    do {
X       /*if (isupper(*string) )
X		(*string) = tolower(*string);*/
X       string++;
X    } while (*string!='/' && *string!='\n' && *string!='\0');
X
X    l=strlen(substr);
X    if (where->level==LEVEL_UNIV) {
X	for (i=0; i<Sdata.numstars; i++)
X	   if (!strncmp(substr,Stars[i]->name,l)) {
X		 where->level=LEVEL_STAR;
X		 where->snum = i;
X		 if (ignoreexpl || isset(Stars[where->snum]->explored, Playernum) || God) {
X			 tick = (*string=='/');
X			 return(Getplace2(string+tick,where,ignoreexpl));
X		 }
X		 printf("You have not explored %s yet.\n",
X						Stars[where->snum]->name);
X		 where->err = 1;
X		 return(*where);
X	   }
X	if (i>=Sdata.numstars) {
X		printf("No such star %s.\n",substr);
X		where->err=1;
X		return(*where);
X	}
X    } else if (where->level==LEVEL_STAR) {
X	for (i=0; i<Stars[where->snum]->numplanets; i++)
X	   if (!strncmp(substr,Stars[where->snum]->pnames[i],l)) {
X		 where->level=LEVEL_PLAN;
X		 where->pnum = i;
X		 openpdata(&getplace2_pdata);
X		 getplanet(getplace2_pdata, &p, Stars[where->snum]->planetpos[i]);
X		 close(getplace2_pdata);
X		 if (ignoreexpl || p->info[Playernum-1].explored || God) {
X			 free(p);
X			 tick = (*string=='/');
X			 return(Getplace2(string+tick,where,ignoreexpl));
X		 }
X		 printf("You have not explored %s yet.\n",Stars[where->snum]->pnames[i]);
X		 where->err = 1;
X		 free(p);
X		 return(*where);
X	   }
X	if (i >= Stars[where->snum]->numplanets) {
X		printf("No such planet %s.\n",substr);
X		where->err=1;
X		return(*where);
X	}
X    } else if (where->level==LEVEL_PLAN) {
X	printf("Can't descend to %s.\n",substr);
X	where->err=1;
X	return(*where);
X    }
X }
X}
X
X
X
Xchar *Dispplace(where)
Xplacetype *where;
X{
X
X switch (where->level) {
X      case LEVEL_STAR:
X	     sprintf(Disps,"/%s",Stars[where->snum]->name);
X	     return(Disps);
X      case LEVEL_PLAN:
X	     sprintf(Disps,"/%s/%s",Stars[where->snum]->name, Stars[where->snum]->pnames[where->pnum]);
X	     return(Disps);
X      case LEVEL_SHIP:
X	     sprintf(Disps,"#%d",where->shipno);
X	     return(Disps);
X      case LEVEL_UNIV:
X	     return("-");
X      default:
X	     printf("illegal Dispplace val = %d\n",where->level);
X	     where->err = 1;
X	     return("/");
X	     break;
X }
X}
END_OF_FILE
if test 5141 -ne `wc -c <'getplace.c'`; then
    echo shar: \"'getplace.c'\" unpacked with wrong size!
fi
# end of 'getplace.c'
fi
if test -f 'makeuniv.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'makeuniv.c'\"
else
echo shar: Extracting \"'makeuniv.c'\" \(5790 characters\)
sed "s/^X//" >'makeuniv.c' <<'END_OF_FILE'
X/* 
X * Galactic Bloodshed (Robert Chansky, smq@b)
X * makeuniv.c -- make data files for the game
X */
X
X#include "vars.h"
X#include "ships.h"
X#include "races.h"
X#include "power.h"	/* (for power) */
X#include <math.h>
X
XFILE *fopen();
Xplanettype Makeplanet();
Xint ftell();	/* not a long */
Xchar *Romannums[] = { "I","II","III","IV","V","VI","VII","IIX","IX","X","XI",
X		      "XII","XIII","XIV","XV" };	/* for planet naming*/
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
XFILE *teledata,*racedata,*stardata,*planetdata,*sectordata,*shipdata;
Xplanettype planet;
Xstartype *Star;
Xint star,e,e2,type,lowp,hip;
Xregister int i,y,x;
Xchar types[MAXPLANETS], str[50];
Xfloat att,xspeed[NUMSTARS],yspeed[NUMSTARS];
X
X srandom(getpid());
X
X Bzero(Sdata);
X printf("# of stars(1-%d):",NUMSTARS-1);
X scanf("%d",&(Sdata.numstars));
X printf("low # of planets (1-%d):",MAXPLANETS-1);
X scanf("%d",&lowp);
X printf("hi # of planets (%d-%d):",lowp,MAXPLANETS-1);
X scanf("%d",&hip);
X printf("approx # of habitable planets:");
X scanf("%d",&e);
X getchr();
X
X sprintf(str, "/bin/mkdir %s", DATADIR );
X system(str);
X
X if ( (planetdata = fopen(PLANETDATAFL,"w+"))==NULL)
X	printf("unable to open %s\n",PLANETDATAFL);
X if ( (sectordata = fopen(SECTORDATAFL,"w+")) == NULL )
X	printf("unable to open %s\n",SECTORDATAFL);
X
X  /* get names, positions of stars first */
X for (star=0; star<Sdata.numstars; star++) {
X 	Stars[star]=(startype *)malloc(sizeof(startype));
X 	Bzero(*Stars[star]);
X 	Star = Stars[star];
X 	Star->numplanets=int_rand(lowp,hip);
X 	Star->gravity = (float)int_rand(100000,1000000) / 100;
X 	printf("name of star (%d planets):",Star->numplanets);
X	for (i=0; i<NAMESIZE-4; i++)
X	   putchr('.');
X	for (i=0; i<NAMESIZE-4; i++)
X	   putchr('\010');
X 	scanf("%10[^\n]",Star->name);
X	  getchr();
X 	Star->xpos=(float)int_rand(-UNIVSIZE,UNIVSIZE);
X	xspeed[star] = 0;
X 	Star->ypos=(float)int_rand(-UNIVSIZE,UNIVSIZE);
X	yspeed[star] = 0;
X }
X
X for (star=0; star<Sdata.numstars; star++) {
X
X  Star=Stars[star];
X
X  for (i=0; i<=Star->numplanets; i++) 
X			types[i] = 200;
X  e2=e;
X  while (e2--) {
X  	types[int_rand(0,Star->numplanets-1)] = TYPE_EARTH;
X  }
X  for (i=0; i<Star->numplanets; i++)
X	if (types[i]!=TYPE_EARTH) types[i]=int_rand(1,3);
X  for (i=0; i<Star->numplanets; i++)  {
X	sprintf(Star->pnames[i],"%s-%s",Star->name,Romannums[i]);
X	if (argc==2 && argv[1][1]=='v')
X		printf("planet %s is type %d\n",Star->pnames[i],types[i]);
X
X	planet = Makeplanet(types[i]);
X
X	do {
X	  planet.xpos=(float)int_rand(-SYSTEMSIZE,SYSTEMSIZE);
X	  planet.ypos=(float)int_rand(-SYSTEMSIZE,SYSTEMSIZE);
X	} while ( sqrt(Distsq( planet.xpos, planet.ypos, 0, 0)) >= SYSTEMSIZE );
X
X	if (argc==2 && argv[1][1]=='v') {
X	  printf("at %f,%f relative to %s.\n",planet.xpos,planet.ypos,Star->name);
X	  printf("sect map(%d X %d):\n",planet.Maxx,planet.Maxy);
X	  for (y=0; y<planet.Maxy; y++) {
X	   for (x=0; x<planet.Maxx; x++) {
X	      switch (Smap[y*planet.Maxx+x].des) {
X		case DES_LAND: putchr(CHAR_UNOWNED_LAND); break;
X		case DES_SEA: putchr(CHAR_SEA); break;
X		case DES_MOUNT: putchr(CHAR_MOUNT); break;
X		case DES_GAS: putchr(CHAR_GAS); break;
X	      }
X	   }
X	   putchr('\n');
X	  }
X	}
X    	Star->planetpos[i] = ftell(planetdata); 
X				/* posn of file-last write*/
X    	planet.sectormappos = ftell(sectordata); /* sector map pos */
X    	fwrite(&planet,sizeof(planettype),1,planetdata); /* write planet */
X     	for (y=0; y<planet.Maxy; y++)
X       	  	fwrite(&(Smap[y*planet.Maxx]),sizeof(sectortype),planet.Maxx,sectordata);
X  }
X }
X fchmod(planetdata,00660);	/* change data files to group readwrite */
X fclose(planetdata);
X fchmod(sectordata,00660);
X fclose(sectordata);
X
X  /* get rid of this */
X stardata = fopen("data.starB","w+");
X fwrite(&(Sdata),sizeof(Sdata),1,stardata);
X for (star=0; star<Sdata.numstars; star++) {
X   fwrite(Stars[star],sizeof(startype),1,stardata);
X }
X fchmod(stardata,00660);
X fclose(stardata);
X
X  /* try to (more or less) evenly space the stars */
X for (i=0; i<CREAT_UNIV_ITERAT; i++)
X   for (star=0; star<Sdata.numstars; star++) {
X     for (x=0; x<Sdata.numstars; x++)	/* star2 */
X	if (x!=star) {
X		/* find inverse of distance squared */
X	   att = 10*UNIVSIZE / Distsq(Stars[star]->xpos, Stars[star]->ypos, Stars[x]->xpos, Stars[x]->ypos);
X	   xspeed[star] += att * (Stars[star]->xpos - Stars[x]->xpos);
X	   if (Stars[star]->xpos>UNIVSIZE || Stars[star]->xpos< -UNIVSIZE)
X		xspeed[star] *= -1;
X	   yspeed[star] += att * (Stars[star]->ypos - Stars[x]->ypos);
X	   if (Stars[star]->ypos>UNIVSIZE || Stars[star]->ypos< -UNIVSIZE)
X		yspeed[star] *= -1;
X        }
X    Stars[star]->xpos += xspeed[star];
X    Stars[star]->ypos += yspeed[star];
X    }
X
X stardata = fopen(STARDATAFL,"w+");
X fwrite(&(Sdata),sizeof(Sdata),1,stardata);
X for (star=0; star<Sdata.numstars; star++) {
X   fwrite(Stars[star],sizeof(startype),1,stardata);
X }
X fchmod(stardata,00660);
X fclose(stardata);
X
X shipdata = fopen(SHIPDATAFL,"w+");
X fchmod(shipdata,00660);
X fclose(shipdata);   /* put top ship # in front of ship data file */
X
X shipdata = fopen(SHIPFREEDATAFL,"w+");
X fchmod(shipdata,00660);
X fclose(shipdata);	/* touch ship free position file */
X
X shipdata = fopen(PLAYERDATAFL,"w+");
X fchmod(shipdata,00660);
X fclose(shipdata);	/* touch player file */
X
X racedata = fopen(RACEDATAFL,"w+");
X fchmod(racedata,00660);
X fclose(racedata);	/* touch race data file */
X
X { struct power p[MAXPLAYERS];
X bzero((char *)p, sizeof(p));
X racedata = fopen(POWFL,"w+");
X fwrite(p,sizeof(p),1,racedata);
X fchmod(racedata,00660);
X fclose(racedata);	/* touch power data file */
X }
X
X sprintf(str, "/bin/mkdir %s", TELEGRAMDIR );
X system(str);
X chmod(TELEGRAMDIR, 00770);
X
X	/* make telegram files for each player */
X for (i=1; i<=MAXPLAYERS; i++) {
X 	sprintf(str, "%s.%d", TELEGRAMFL, i );
X 	teledata = fopen(str, "w+");
X 	fchmod(teledata,00660);
X 	fclose(teledata);
X }
X
X}
END_OF_FILE
if test 5790 -ne `wc -c <'makeuniv.c'`; then
    echo shar: \"'makeuniv.c'\" unpacked with wrong size!
fi
# end of 'makeuniv.c'
fi
if test -f 'planet.list' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'planet.list'\"
else
echo shar: Extracting \"'planet.list'\" \(4998 characters\)
sed "s/^X//" >'planet.list' <<'END_OF_FILE'
X8
X3
X3
X1
XTawil
XAah
XAdonis
XAegir
XSampsa
XSarasvati
XAeolus
XBuddha
XBui
XZhar
XZumbiboo
XBunjil
XButo
XByagoona
XByatis
XCetella
XCalliope
XCathubodua
XRhea
XRhiannon
XRona
XFreyja
XLeto
XLevanah
XLilith
XLir
XLleu
XLloigor
XLlyr
XFreyr
XRongo-mai
XRoon
XSaturn
XSaya
XScana
XHwan
XHydra
XHymen
XHypnos
XIacchos
XIalonus
XIbeji
XIdhunn
XSebek
XSedna
XSekhmet
XSelene
XSelkhet
XSelu
XSet
XAeron
XAgni
XAgwe
XAhto
XAine
XAkna
XAlkuntam
XAllah
XAmaethon
XAmaterasu
XAmergin
XAmon
XAmphitrite
XAnath
XAndraste
XAngus
XAnhur
XAnimiki
XAnu
XAphrodite
XApollo
XAradia
XArawn
XArduanna
XAres
XArianrhod
XAroni
XArtemis
XArtio
XAsherah
XAshur
XAstarte
XAsten
XAtaranga
XAtarapa
XAthena
XAtropos
XAtum
XAudhumla
XAwhiowhio
XAye-Shaluga
XAzacca
XAzathoth
Xbaal
XBabalu-Aye
XBacchus
XBadhbh
XBael
XBaldr
XBalor
XBanbha
XBast
XBel
XBelenos
XBeli
XBenten
XBes
XBhairava
XBishamon
XBoann
XBorvo
XBraciaca
XBragi
XBrahma
XBranwen
XBrigantia
XBrighid
XBron
XBuanann
XCeres
XCeridwen
XCernunnos
XChandra
XChang Kuo-Lao
XChanging Woman
XChango
XChantico
XCharon
XChemsem
XChibiabos
XChih-Nii
XChimata-no-Kami
XChiron
XChu Jung
XChung-Li Ch'uan
XCinteotl
XClio
XClotho
XCoatlicue
XCocidius
XCondatis
XCopper Woman
XCorn Mother
XCoyolxauhqui
XCoyote
XCreidhne
XCronos
XCthuga
XCthulhu
XCupid
XCybele
XCymidei Cymeinfoll
XDagda
XDagon
XDaikoku
XDalon Ap Landu
XDamballah
XDamona
XDanu
XDaramulun
XDasra
XDeganawida
XDemeter
XDevi
XDian Cecht
XDiana
XDiancecht
XDionysos
XDionysus
XDis Pater
XDjilakons
XDjokabesh
XDon
XDonn
XDorozhand
XDumuzi
XDunatis
XDurga
XDylan Eil Ton
XEarth Diver
XEarth Mother
XEbisu
XEnki
XEnlil
XEos
XEpona
XErato
XErce
XErda
XEris
XErishkegal
XEriu
XEros
XErzulie
XEsus
XEtain
XEuterpe
XFaunus
XFer Ben
XFjorgyn
XFlidhais
XFoam Woman
XFodla
XForseti
XGanesha
XGanga
XGeb
XGefion
XGhatothoa
XGhede
XGidja
XGluskap
XGna
XGnoph-Keh
XGobban Saer
XGoibhniu
XGovannon
XGrandmother Cloud
XGrannus
XGreat Rainbow Snake
XGribaun
XGwydion
XHabaniah
XHabondia
XHades
XHan
XHan Hsiang-Tzu
XHanui-o-Ranga
XHanuman
XHapi
XHaroeris
XHaronga
XHarpocrates
XHastur
XHathor
XHaumia-tikitiki
XHaya-ji
XHeammawihio
XHebe
XHecate
XHeide
XHeimdall
XHel
XHela
XHelios
XHephaestos
XHera
XHermes
XHerne
XHestia
XHestia 
XHina'
XHine-i-tapeka
XHine-kaikomako
XHine-nui-te-po
XHine-te-iwaiwa
XHiniko
XHish
XHo Hsien-Ku
XHo-Masubi
XHobith
XHongatar
XHonua-mea
XHoodrazai
XHorus
XHotei
XHowalachi
XHugin & Munin
XIka-tere
XIlmarinen
XIlmatar
XIlythia
XImberombera
XInari
XIndra
XIngvi
XInktomi
XInnana
XIo'
XIris
XIshtar
XIsis
XIthaqua
XIxcunia
XIzanagi
XIzanami
XJrdh
XJabim
XJanus
XJesus
XJotma
XJove
XJumala
XJuno
XJupiter
XJurojin
XK'ue Hsing
XKahu-kura
XKali
XKama
XKami-Nari
XKanati
XKanekelak
XKankahatar
XKauppi
XKawa-no-Kami
XKeb
XKhensu
XKhepri
XKhnemu
XKib
XKilibob
XKilooloogung
XKinnekasus
XKitche Manito
XKoitar
XKrishna
XKuan Yin
XKubera
XKumukumts
XKundalini
XKurma
XKutnahin
XKutuahui
XKuu
XKvasir
XKyaklo
XLa'a-maomao
XLachesis
XLaka
XLakshmi
XLegba
XLei Kung
XLemmink
XLoco & Ayizan
XLoki
XLone Man
XLu Tung-Pin
XLuchta
XLugh
XLuoja
XLuonnotar
XLupan
XMaat
XMabon
XMacha
XMadumda
XMaja
XMana-Bozho
XMana-Yood-Sushai
XManabozho
XManannan
XManawyddan
XManito
XManjusri
XMaponus
XMarduc
XMars
XMaru
XMasawu
XMath
XMatrona
XMaui'
XMayauel
XMelpomene
XMem Loimis
XMenglodh
XMercury
XMesho
XMetis
XMictlantecutli
XMielikki
XMimir
XMin
XMinerva
XMiru
XMithras
XMixcoatl
XMnemosyne
XModron
XMomoy
XMondamin
XMoon
XMorkul Kua Luan
XMorrigan
XMudevi
XMung
XMusp & Komol
XMut
XMyrddyn
XNabu
XNagaicho
XNamtar
XNanahuatl
XNapi
XNasatya
XNefertum
XNeith
XNekhebet
XNemhain
XNephthys
XNeptune
XNereus
XNergal
XNerthus
XNet
XNimrod
XNinib
XNishanu
XNisroch
XNjordhr
XNodens
XNorfi
XNr-Simha
XNuada
XNudd
XNug
XNuliajuk
XNut
XNyarlathotep
XNyogtha
XO-Kuni-Nushi
XO-Yama-Tsu-Mi
XOannes
XObatala
XOchosi
XOchu
XOddudua
XOdin
XOggun
XOgma
XOgun
XOlarosa
XOld Woman Night
XOlelbis
XOlimerin
XOlorun-Olofi
XOlwen
XOrmuzd
XOrun
XOrunla
XOsachin
XOshun
XOsiris
XOsmo
XOtavatar
XOuranos
XOya
XPakkanen
XPales
XPan
XPani
XPapa'
XParuhti
XParvati
XPashupati
XPele
XPeople Mother
XPersephone
XPheobe
XPhoebus
XPihlajatar
XPitsu
XPolyhymnia
XPoseidon
XPriapus
XPrithivi
XPrithvi
XPrometheus
XProserpine
XPryderi
XPtah
XPunga
XPwyll
XQuetzalcoatl
XRa
XRadha
XRama
XRan
XRangi'
XRaven
XRemunen
XRhan-Tegoth
XRhea
XRhiannon
XRona
XRongo-ma-tane
XRongo-mai
XRoon
XRua-ai-moko
XSalmon Boy
XSampsa
XSarasvati
XSaturn
XSaya
XScana
XSebek
XSedna
XSekhmet
XSelene
XSelkhet
XSelu
XSet
XShakti
XShakuru
XShamash
XShekhinah
XShiva
XShou Hsing
XShu
XShub-Niggurath
XSif
XSila
XSilenus
XSin
XSinav
XSirona
XSish
XSita
XSjfn
XSkadi
XSklumyoa
XSkuld
XSlid
XSoma
XSotkotar
XSpider Grandmother
XSubramanja
XSuonetar
XSuovakko
XSurya
XSusano
XSylvanus
XTahti
XTakanakapsaluk
XTaki-Tsu-Hiko
XTaliesin
XTammuz
XTane-mahuta
XTangaroa
XTara
XTaranis
XTaueret
XTawa
XTefnut
XTekkeitsertok
XTellervo
XTemu
XTeraranga & Teiiri
XTerhenetar
XTerminus
XTerpsichore
XTethys
XTeutatis
XTezcatlipoca
XThalia
XThemis
XThor
XThoth
XThoume
XTiamat
XTien Mu
XTirawahat
XTlaloc
XTlazoteotl
XTonantzin
XTonatiuh
XTriboogie
XTriton
XTs'ang Chien
XTs'ao Kuo-Chiu
XTsathoggua
XTsonoqua
XTsuki-Yomi
XTu-matauenga
XTuoni
XTuuri
XTyr
XUbbo-Sathla
XUenuku
XUeuecoyotl
XUkko
XUnkatahe
XUntamo
XUrania
XUrdhr
XUtu-tytt
XVac
XVainamoinen
XVar
XVaraha
XVaruna
XVayu
XVellamo
XVenus
XVerdhandi
XVesta
XVishnu
XVolund
XVolva
XWa-Hun-De-Dan
XWakan-Tanka
XWakonda
XWasco
XWegyet
XWen-Chang
XWhite Buffalo Woman
XWihio
XWisakedjak
XWiyot
XWohoon
XWuraka
XYHVH
XYacatecuhtli
XYama
XYaocihuatl
XYarilo
XYatahentshi
XYeb
XYemanja
XYemaya
XYig
XYmir
XYo-He-Wa
XYog-Sothoth
XYoharneth-Lahai
XYu-Huang-Shang-Ti
XZeus
END_OF_FILE
if test 4998 -ne `wc -c <'planet.list'`; then
    echo shar: \"'planet.list'\" unpacked with wrong size!
fi
# end of 'planet.list'
fi
if test -f 'read_teleg.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'read_teleg.c'\"
else
echo shar: Extracting \"'read_teleg.c'\" \(5671 characters\)
sed "s/^X//" >'read_teleg.c' <<'END_OF_FILE'
X/*
X** Galactic Bloodshed (Robert Chansky, smq@b)
X**	read.c -- (try to) read telegrams
X**	 the first byte in each telegram is the sending player #, or 254
X**	 to denote autoreport.  then the time sent, then the message itself,
X**	 terminated by TELEG_DELIM.
X*/
X
X#include "vars.h"
X#include "races.h"
X#include "ships.h"
X#include <curses.h>
X#include <ctype.h>
X#include <signal.h>
X#include <setjmp.h>
X#include <strings.h>
X#include <errno.h>
Xextern jmp_buf main_jenv;
XFILE *fopen(), *teleg_read_fd;
X
Xchar telegram_file[50];
Xint teleg_read_pdata;
X
X
Xteleg_read(APcount, argn,args)
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
X{
Xint quit=0,noprt=0,altered=0,t, j, i, z, c, teleg_read_handler();
Xchar cmd='\0', tgrams[MAX_TELEGRAMS][TELEGRAM_SIZE];
Xplanettype *p;
X
X  teleg_read_pdata = NEUTRAL_FD;
X
X  signal(SIGINT, teleg_read_handler);
X
X  printf("Interstellar Communication O/S ver %s Ready.\n",VERS);
X
X  printf("reading %s\n",telegram_file);
X  if ( (teleg_read_fd = fopen( telegram_file, "r" ))==NULL ) {
X	perror("teleg_read.c");
X	teleg_read_handler();
X  }
X
X	/* read in all telegrams */
X  i = 0;
X  while ( (tgrams[i][0]=fgetc(teleg_read_fd))!=EOF) {  /* sending player # */
X
X	  /* get text of message */
X	if (fscanf(teleg_read_fd, TELEG_NDELIM, &(tgrams[i++][1]) )!=1) 
X		printf("Bad teleread.\n");
X
X	if ((t=fgetc(teleg_read_fd))!=TELEG_DELIM)
X		printf("uhoh! '%c' not found! '%c'\n",TELEG_DELIM,t);
X				/* get rid of '~' */
X
X	if (i>=MAX_TELEGRAMS) {
X		i = 1;		/* recycle telegs (should be i=0?)*/
X		printf("No more than %d msgs can be seen.\n",MAX_TELEGRAMS);
X	}
X  }
X  fclose(teleg_read_fd);
X
X  printf("\nMessages: %d\n",i);
X  if (i==0)
X	return;
X
X  /* print out messages */
X
X  tty_on();
X
X  t = 0;
X  while (t<i && !quit) {
X
X    if (noprt)
X	noprt = 0;
X    else if (tgrams[t][1]!='\0') {
X	  printf("Message #%d received ",t+1);
X	  if (tgrams[t][0]==TELEG_PLAYER_AUTO)
X		    printf("via autoreport");
X	  else
X		    printf("from player #%2d",tgrams[t][0]);
X
X	  printf(" On %.25sSubject: ", &tgrams[t][1] );
X
X	  teleg_report( &tgrams[t][26], tgrams[t][0]);
X    }
X    printf("%d:(br tdmq?) ",t+1);
X    cmd = getchr();
X    putchr('\n');
X
X    switch(cmd) {
X
X	case ' ':	/* goto next message */
X	case '\n':
X	  break;
X
X	case 'r':
X	  t--;		/* will be incr next */
X	  break;
X
X	case 'b':
X	  if (t>0)
X	  	t -= 2;		/* back one */
X	  else
X		t--;
X	  break;
X
X	case 'd':
X	    if (tgrams[t][1]=='\0') {
X		printf("Message unavailable.\n");
X		noprt = 1;
X		break;
X	    }
X
X	    tgrams[t][1] = '\0';
X	    printf("\n--flushed--\n");
X	    altered = 1;
X	    break;
X
X	case 't':
X	    if (tgrams[t][1]=='\0') {
X		printf("Message unavailable.\n");
X		noprt = 1;
X		break;
X	    }
X	    if (Dir.level!=LEVEL_PLAN) {
X		  printf("Scope must be a planet.\n");
X		  noprt = 1;
X		  break;
X	    }
X
X	    if (Race->translate[tgrams[t][0]] == 100 || 
X		  	tgrams[t][0]==Playernum || 
X		  	tgrams[t][0]==TELEG_PLAYER_AUTO) {
X		printf("There is no need to do that.\n");
X		noprt = 1;
X		break;
X	    }
X	    /*if (!enufAP(Stars[Dir.snum]->AP, TELEG_TRANS_APCOST) ) {
X		  noprt = 1;
X		  break;
X	    }*/
X
X	    /*deductAPs(TELEG_TRANS_APCOST, Dir.snum, 0);*/
X
X	    openpdata(&teleg_read_pdata);
X	    getplanet(teleg_read_pdata, &p, Stars[Dir.snum]->planetpos[Dir.pnum]);
X	    printf("\nresource cost: %d\n",TELEG_TRANS_RPCOST);
X	    if (p->info[Playernum-1].resource < TELEG_TRANS_RPCOST) {
X		  printf("Not enough resources in stock.\n");
X	    	  close(teleg_read_pdata);
X		  noprt = 1;
X		  break;
X	    }
X
X	    p->info[Playernum-1].resource -= TELEG_TRANS_RPCOST;
X	    putplanet(teleg_read_pdata,p, Stars[Dir.snum]->planetpos[Dir.pnum]);
X	    close(teleg_read_pdata);
X
X	    j = Race->translate[tgrams[t][0]];
X
X	    Race->translate[tgrams[t][0]] += 
X			round_rand( (100.0 - j) * TELEG_TRANS_AMT);
X
X	    putrace(Race);
X
X	    printf("Translation modifier was %d%%, now %d%%.\n", j, 
X			Race->translate[tgrams[t][0]]);
X	    sleep(1);
X
X	    t--;
X	    break;
X
X	case 'q':
X	    quit = 1;
X	    break;
X
X	case 'm':
X 	    printf("\nTranslation modifiers:\nPlayer : mod\n");
X   	    for (i=0; i<= MAXPLAYERS /*toprace*/ ; i++)
X		    printf("%3d    : %02d%%\n", i, Race->translate[i]);
X	    noprt = 1;
X	    t--;
X	    break;
X
X	case '?':
X	    printf("\n\n  r -- reread message\n  b -- go back one message\n ' '-- goto next message\n  d -- delete message\n  m -- print translation modifiers\n  q -- quit telegram\n\n");
X	    t--;
X	    noprt = 1;
X	    break;
X
X	default:
X	    printf("\n'%c': Bad command.\n", cmd);
X	    t--;
X	    noprt = 1;
X	    break;
X   }
X
X  t++;
X  }
X  putchr('\n');
X  tty_off();
X
X  if (altered) {
X	if (!fork()) {
X  	     teleg_read_fd = fopen( telegram_file, "w+" );	/* trunc file */
X	     for (t=0; t<i; t++)
X		   if (tgrams[t][1] != '\0' ) {
X			   fprintf(teleg_read_fd,"%s%c",&tgrams[t][0],
X					TELEG_DELIM);
X		   }
X	     fclose(telegram_file);
X	     exit();
X	}
X    }
X
X}
X
X
X
Xteleg_report(t, from)
Xregister char *t,from;
X{
Xregister int trans_perc, prob;
X
X	/* TELEG_PLAYER_AUTO means autoreport */
X trans_perc = (from == TELEG_PLAYER_AUTO) ? 100 : Race->translate[from];
X
X	/* telegrams begin w/ whitespace character */
X do {
X	if (isspace(*t)) {
X		 /* probability of translation of this word ==following char*/
X		prob = *((t++)+1);
X	}
X	/*printf("(%d)",prob);*/
X
X		/* print the word, if it's translateable */
X	if (prob <= trans_perc) {
X		while ( !isspace(*(++t)) && *t!='\0')
X			putchr(*t);
X	} else {
X		while ( !isspace(*(++t)) && *t!='\0')
X			;
X		printf("%s",UNTRANS_MSG);
X	}
X	if (isspace(*t))
X		putchr(*t);	/* *t==\n or ' ' */
X } while (*(t+1)!='\0');
X
X putchr('\n');
X
X}
X
X
Xteleg_read_handler(sig, code, scp)
Xint sig,code;
Xstruct sigcontext *scp;
X{
X fclose(teleg_read_fd);
X close(teleg_read_pdata);
X longjmp(main_jenv,1);
X}
END_OF_FILE
if test 5671 -ne `wc -c <'read_teleg.c'`; then
    echo shar: \"'read_teleg.c'\" unpacked with wrong size!
fi
# end of 'read_teleg.c'
fi
if test -f 'rst.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rst.c'\"
else
echo shar: Extracting \"'rst.c'\" \(4715 characters\)
sed "s/^X//" >'rst.c' <<'END_OF_FILE'
X
X/*
X * Galactic Bloodshed (Robert Chansky, smq@b)
X *  ship -- report -- stock -- tactical -- stuff on ship
X */
X
X#define REPORT	0
X#define STOCK	1
X#define TACTICAL 2
X#define SHIP	3
X#define OBJECT	4
X
X#include "vars.h"
X#include "ships.h"
Xextern char Shipltrs[];
Xextern char *prin_ship_dest();
Xextern int God;
Xextern int Ignore_filelocks;
Xstatic bool Object,Ship,Stock,Report,Tactical,first;
X
Xrst(APcount, argn,args,Rst)
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
Xint Rst;
X{
X int nums,i,shipno;
X
X first = 1;
X switch (Rst) {
X	case REPORT:	Report = 1;
X			Object = Stock = Ship = Tactical = 0;
X			break;
X	case STOCK:	Stock = 1;
X			Object = Report = Ship = Tactical = 0;
X			break;
X	case TACTICAL:	Tactical = 1;
X			Object = Report = Ship = Stock = 0;
X			break;
X	case SHIP:	Ship = Report = Stock = Tactical = 1;
X			Object = 0;
X			break;
X	case OBJECT:	Object = Report = Stock = Tactical = 1;
X			Ship = 0;
X			break;
X }
X
X if (argn==2) {
X   sscanf(args[1] + (*args[1]=='#' ? 1 : 0),"%d",&shipno);
X   ship_report(shipno,0.0,0.0);
X
X } else
X
X  switch (Dir.level) {
X   case LEVEL_UNIV:
X      if (Sdata.numships) {
X	  for (i=0; i<MAXUSHIPS; i++)
X	    if (Sdata.shipnums[i])
X  	      ship_report(Sdata.shipnums[i],0.0,0.0);
X      }
X      for (i=0; i<Sdata.numstars; i++)
X        star_ship_report(i);
X      break;
X   case LEVEL_STAR:
X      star_ship_report(Dir.snum);
X      break;
X   case LEVEL_PLAN:
X      plan_ship_report(Stars[Dir.snum]->planetpos[Dir.pnum],Stars[Dir.snum]->xpos,Stars[Dir.snum]->ypos);
X      break;
X   case LEVEL_SHIP:
X      ship_report(Dir.shipno, 0.0, 0.0);
X      break;
X  }
X}
X
X
Xship_report(shipno,xoff,yoff)
Xint shipno;
Xfloat xoff,yoff;
X{
X shiptype *s;
X bool noerr;
X int shdata,pos,c=0;
X placetype where;
X char orb[PLACENAMESIZE];
X 
X
X  openshdata(&shdata);
X  Ignore_filelocks = 1;
X  noerr = getship(shdata,&s,shipno);
X  Ignore_filelocks = 0;
X  close(shdata);
X  if (!noerr) 
X	return;
X
X	/* a launched canister doesn't show up */
X  if ( !(s->type==OTYPE_CANIST && !s->is_docked) ) {
X
X
X   if (Stock) {
X    if (first) {
X      printf("  #   mass res  ^res  dest ^dest   fuel ^fuel  crew ^crew dock\n");
X      if (!Ship && !Object)
X	      first=0;
X    }
X    if (is_object(s) == Object)
X     if (s->owner == Playernum || God) {
X      printf("%3d %c%5.1f%4u%6d%6u%6d%7.1f%6d%6u%6d%5s",
X	shipno, Shipltrs[s->type], s->mass,
X	s->resource, Shipdata[s->type][ABIL_CARGO],
X	s->destruct, Shipdata[s->type][ABIL_DESTCAP],
X	s->fuel, Shipdata[s->type][ABIL_FUELCAP],
X	s->popn, Shipdata[s->type][ABIL_MAXCREW],
X	(s->is_docked) ? ((s->whatdest==LEVEL_PLAN) ? "land" : "dock") :"    ");
X      if (s->type==OTYPE_VN) 
X	printf(" * %d",s->orders.object.number);
X      if (s->rad)
X	printf(" INACTIVE(%d)",s->rad);
X      putchr('\n');
X
X   }
X   }
X   if (Report) {
X         if (first) {
X		 printf("  #   own dam dest  fuel land               orbits           destination\n");
X		 if (!Ship && !Object)
X		      first=0;
X	 }
X
X	if (s->owner == Playernum || God) {
X	 if (is_object(s) == Object) {
X 	  printf("%3d %c%4u%4u%5u%6.1f%5s %20s %21s",
X		shipno, Shipltrs[s->type],
X		s->owner, s->damage, s->destruct, s->fuel, 
X		(s->is_docked) ? ( (s->whatdest==LEVEL_SHIP) ? "dock" 
X			: "land") : "    ",
X		prin_ship_orbits(s), prin_ship_dest(s) );
X         if (s->type==OTYPE_VN) printf("* %d",s->orders.object.number);
X      if (s->rad)
X	printf(" INACTIVE(%d)",s->rad);
X         putchr('\n');
X	}
X
X	}
X   }
X	/* objects dont have a tac display */
X   if (!is_object(s) && Tactical) {
X        if (first) {
X	 printf("  # own typ dest fuel dam      x,y          orbits\n");
X         if (!Ship)
X 	      first=0;
X        }
X 	where.level = s->whatorbits;
X 	where.snum = s->storbits;
X 	where.pnum = s->pnumorbits;
X	sprintf(orb, "%.30s", Dispplace(&where));
X	printf("%3d%4d  %c %5u%5.1f%4u%6.0f,%-6.0f%10s",
X		shipno, s->owner, Shipltrs[s->type], s->destruct,
X		s->fuel, s->damage, s->xpos, s->ypos, orb );
X      if (s->rad)
X	printf(" INACTIVE(%d)",s->rad);
X      putchr('\n');
X   }
X
X
X  }
X  free(s);
X
X}
X
X
X
Xplan_ship_report(filepos,starx,stary)
Xint filepos;
Xfloat starx,stary;
X{
X register int i;
X planettype *p;
X int pdata;
X
X openpdata(&pdata);
X getplanet(pdata, &p,filepos);
X close(pdata);
X if (p->info[Playernum-1].explored)
X 	for (i=0; i<MAXPSHIPS; i++)
X  	   if (p->shipnums[i])
X    	      ship_report(p->shipnums[i],starx+p->xpos,stary+p->ypos);
X free(p);
X}
X
Xstar_ship_report(num)
Xint num;
X{
X register int i;
X
X if (isset(Stars[num]->explored, Playernum)) {
X   for (i=0; i<MAXSSHIPS; i++)
X     if (Stars[num]->shipnums[i])
X        ship_report(Stars[num]->shipnums[i],Stars[num]->xpos,
X		  Stars[num]->ypos);
X   for (i=0; i<Stars[num]->numplanets; i++)
X     plan_ship_report(Stars[num]->planetpos[i],Stars[num]->xpos,
X	  Stars[num]->ypos);
X }
X}
X
END_OF_FILE
if test 4715 -ne `wc -c <'rst.c'`; then
    echo shar: \"'rst.c'\" unpacked with wrong size!
fi
# end of 'rst.c'
fi
if test -f 'shootblast.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'shootblast.c'\"
else
echo shar: Extracting \"'shootblast.c'\" \(5198 characters\)
sed "s/^X//" >'shootblast.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed (Robert Chansky, smq@b)
X * shoot() -- shoot from ship or planet to ship or planet (does dam acc. to
X * 		range -- does not remove dest cap from firing ship/planet)
X * blast() -- generic damaging routine -- saves only smap
X */
X
X
X#include "vars.h"
X#include "ships.h"
X#include <math.h>
Xextern int Shipdata[NUMSTYPES][NUMABILS];
Xextern int Distmap();
Xbool Nuked[MAXPLAYERS];	/* who was nuked on the planet/ship */
X
X
Xint shoot(from,to,fpl,tpl,sectorx,sectory,strength, sdatamod,starmod,planetmod)
Xplacetype from,*to;
Xplanettype *fpl,*tpl;
Xint sectorx,sectory,strength;
X	/* reported modifications to datafiles */
Xbool *sdatamod,*starmod, *planetmod;
X{
Xint i;
Xdouble dist,xfrom,yfrom,xto,yto;
Xdouble str;
Xfloat r;
X
X if (from.level==LEVEL_PLAN) {
X   xfrom = Stars[from.snum]->xpos + fpl->xpos;
X   yfrom = Stars[from.snum]->ypos + fpl->ypos;
X } else if (from.level==LEVEL_SHIP) {
X   xfrom = from.shipptr->xpos;
X   yfrom = from.shipptr->ypos;
X }
X
X if (to->level==LEVEL_PLAN) {
X   xto = Stars[to->snum]->xpos + tpl->xpos;
X   yto = Stars[to->snum]->ypos + tpl->ypos;
X } else if (to->level==LEVEL_SHIP) {
X   xto = to->shipptr->xpos;
X   yto = to->shipptr->ypos;
X }
X
X dist = sqrt( (double)Distsq(xfrom, yfrom, xto, yto)) + 50.0;
X						/* (adjust for too close) */
X if (dist > SYSTEMSIZE) {
X	 /* out of range */
X	return -1;
X } else {
X
X     str = (double)strength * FACTOR_DAMAGE / dist;
X     printf(" str = %f, rad = %f\n",str,str*FACTOR_DESTPLANET);
X
X     r = blast(to, tpl, sectorx, sectory, str * FACTOR_DESTPLANET, str);
X
X
X     if (to->level==LEVEL_SHIP && to->shipptr->is_dead) {
X	if (to->shipptr->whatorbits==LEVEL_UNIV) {
X		/* not used since ships can't fire in UNIV scope */
X		for (i=0; i<MAXUSHIPS; i++)
X			if (Sdata.shipnums[i] == to->shipno) {	
X				Sdata.shipnums[i] = 0;
X				Sdata.numships--;
X				*sdatamod |= 1;
X			}
X	} else if (to->shipptr->whatorbits==LEVEL_STAR) {
X		for (i=0; i<MAXSSHIPS; i++)
X			if (Stars[to->snum]->shipnums[i] == to->shipno) {	
X				Stars[to->snum]->shipnums[i] = 0;
X				Stars[to->snum]->numships--;
X				*starmod |= 1;
X			}
X	} else {	/* LEVEL_PLAN */
X		for (i=0; i<MAXPSHIPS; i++)
X			if (tpl->shipnums[i] == to->shipno) {	
X				tpl->shipnums[i] = 0;
X				tpl->numships--;
X				*planetmod |= 1;	/* don't need this */
X			}
X	}
X     }
X
X     return (int)r;
X  }
X
X}
X
X
X		/* returns amt of damage or # of sectors nuked */
Xint blast(place, pl, x, y, r, str)
Xplacetype *place;	/* place being destroyed */
Xplanettype *pl;		/* pointer to planet being destroyed */
Xint x,y;		/* sector x,y of planet */
Xregister float r;	/* radius of blast */
Xdouble str;		/* strength of blast */
X{
Xregister int x2,y2;
Xfloat d;
Xint numdest = 0,lowx,lowy,hix,hiy;
Xregister sectortype *s;
Xregister float fac;
Xint shfdata,sectdata;
X
X bzero( (char *)Nuked, sizeof(Nuked) );
X
X if (place->level==LEVEL_SHIP) {
X	numdest = round_rand(str / Shipdata[place->shipptr->type][ABIL_ARMOR]);
X	if (numdest > 100)
X		numdest = 100;
X
X	if (place->shipptr->type!=OTYPE_VN) {
X		if (place->shipptr->damage+numdest >= 100) {
X			place->shipptr->is_dead = 1;
X			openshfdata(&shfdata);
X			destroyship(shfdata, (short)place->shipno);
X			close(shfdata);
X		} else
X			place->shipptr->damage += numdest;
X	} else {
X		if (place->shipptr->orders.object.number - numdest < 1) {
X			place->shipptr->is_dead = 1;
X			openshfdata(&shfdata);
X			destroyship(shfdata, (short)place->shipno);
X			close(shfdata);
X		} else
X			place->shipptr->orders.object.number -= numdest;
X	}
X	Nuked[place->shipptr->owner] = 1;
X	return numdest;		/* return amt of dest made */
X
X } else if (place->level==LEVEL_PLAN) {
X
X    opensectdata(&sectdata);
X    getsmap(sectdata,Smap,pl->sectormappos,pl->Maxx*pl->Maxy );
X    lowx = MAX((x-r-1),0);
X    lowy = MAX((y-r-1),0);
X    hix = MIN((x+r+1),pl->Maxx-1);
X    hiy = MIN((y+r+1),pl->Maxy-1);
X    for (y2=lowy; y2<=hiy; y2++) {
X         for (x2=lowx; x2<=hix; x2++) {
X	  if ( (d = Distmap(x,y,x2,y2) ) <= r) {
X	     s = &Smap[y2*pl->Maxx+x2];
X	     fac = ((float)str/10) * logscale(100 - s->mobilization)/(d+1);
X		/* factor of destruction */
X	     /*printf("%d,%d  dist = %.2f,dest fac %.2f",x2,y2,d,fac);*/
X	     if (fac > 0.55) {
X		   Nuked[s->owner] = 1;	/* for retaliating */
X	     	   if (fac > 1.00) {
X			fac = 1.00;	/* really pulverize it */
X			s->popn = s->owner = 0;
X			if (s->des==DES_MOUNT) 
X					s->des=DES_LAND;
X			else if (s->des==DES_LAND && 
X				(s+1)->des==DES_SEA || (s-1)->des==DES_SEA)
X					s->des=DES_SEA;
X	     	   	s->is_wasted = 1;
X			s->fert = 0;
X		   }
X		   numdest++;	/* more than 50% destruction on sector */
X	     	   s->resource += (percent)round_rand(s->resource * fac)/2;
X				/* add some resources to be fair */
X		   s->fert -= (percent)round_rand(s->fert * fac)/2;
X	     	   s->mobilization -= (percent)(round_rand(s->mobilization * fac/2) );
X	     	   /*printf("::%d,%d killed %d.\n",x2,y2,round_rand(s->popn * fac) );*/
X	     	   s->popn -= (us)(round_rand(s->popn * fac) );
X	     	   s->eff -= (percent)(round_rand(s->eff * fac) );
X	     }
X	  }
X	}
X    }
X
X    pl->conditions[TOXIC] += (100-pl->conditions[TOXIC]) * 
X				((float)numdest / (pl->Maxx*pl->Maxy));
X
X    putsmap(sectdata,Smap,pl->sectormappos,pl->Maxx*pl->Maxy );
X    close(sectdata);
X
X    return(numdest);
X }
X
X}
END_OF_FILE
if test 5198 -ne `wc -c <'shootblast.c'`; then
    echo shar: \"'shootblast.c'\" unpacked with wrong size!
fi
# end of 'shootblast.c'
fi
if test -f 'tweakables.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'tweakables.h'\"
else
echo shar: Extracting \"'tweakables.h'\" \(6087 characters\)
sed "s/^X//" >'tweakables.h' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed (Robert Chansky, smq@b)
X *  tweakable constants & other things -- changing the following may cause GB 
X *	to freak if
X *	the functions using them are not recompiled so be careful.
X */
X
X/*#define UNIX_VERSION4.3  /* otherwise assumes 4.2 */
X
X#define VERS ".8"		/* game version */
X
X#define UPDATE_TIME 3		/* 3 hour  update time */
X#define PAGER "/usr/ucb/zcat"
X
X
X#include "files.h"
X
X
X
X#define LOGIN_NAME_SIZE 13
X
X#define NUM_TIMES_TO_WAIT_FOR_LOCK 20
X#define NEUTRAL_FD 1000
X
X#define MAXCOMMSTRSIZE 250
X#define COMMANDSIZE 42
X#define MAXARGS 6
X
X#define STARTINGPOPN 200
X
X#define CHAR_CURR_SCOPE ':'	/* for getplace */
X
X#define RTEMP 	  0		/* regular temp for planet */
X#define TEMP 	  1		/* temperature */
X#define METHANE   2		/* %age of gases for terraforming */
X#define OXYGEN 	  3
X#define CO2 	  4
X#define HYDROGEN  5
X#define NITROGEN  6
X#define SULFUR 	  7
X#define HELIUM 	  8
X#define OTHER 	  9
X#define TOXIC	 10
X
X#define CHAR_OWNED_LAND 	'x' 
X#define CHAR_OWNED_THING 	'@' 
X#define CHAR_UNOWNED_LAND 	'-'
X#define CHAR_SEA 		'.'
X#define CHAR_OWNED_SEA 		','
X#define CHAR_MOUNT 		'^'
X#define CHAR_OWNED_MOUNT 	'X'
X#define CHAR_DIFFOWNED 		'?'
X#define CHAR_PLATED 		'|'
X#define CHAR_WASTELAND 		'%'
X#define CHAR_OWNED_WASTELAND 	'#'
X#define CHAR_GAS 		'~'
X#define CHAR_CLOAKED 		' '
X
X#define NAMESIZE 15
X#define RNAMESIZE 25
X#define PLACENAMESIZE (NAMESIZE + NAMESIZE + 13)
X#define NUMSTARS 50
X#define MAXPLANETS 5
X#define BITS_MAXPLANETS 3	/* # bits required to represent */
X/*#define MAXMOONS 3*/
X#define MAXSSHIPS 55
X#define MAXPSHIPS 25
X#define MAXUSHIPS 800
X#define MAXTOTALSHIPS (MAXUSHIPS+MAXSSHIPS*NUMSTARS+MAXPSHIPS*MAXPLANETS*NUMSTARS)
X
X#define MAX_X 48		/* you might want to re-compile after tweaking*/
X#define MAX_Y 18
X#define RATIOXY 3.70		/* map ratio between x and y */
X				/* ranges of map sizes (x usually ) */
X#define EARTHTYPE_RANGE int_rand(37,41)
X#define AIRLESS_RANGE int_rand(int_rand(16,20),25)
X#define GASGIANT_RANGE int_rand(27,MAX_X-10)
X#define ASTEROID_RANGE_X int_rand(int_rand(2,4),6)	/* asteroids have */
X#define ASTEROID_RANGE_Y int_rand(int_rand(2,5),8)	/*  funny shapes */
X
X
X#define UNIVSIZE	100000
X#define SYSTEMSIZE	1000
X#define PLORBITSIZE	50
X
X
X#define AUTO_TELEG_SIZE		5000
X#define TELEGRAM_SIZE		500
X#define MAX_TELEGRAMS		50
X#define UNTRANS_MSG		"[untranslateable]"
X/*#define TELEG_TRANS_APCOST	1*/
X#define TELEG_TRANS_RPCOST	4
X#define TELEG_TRANS_AMT		0.45
X#define TELEG_LETTERS		7
X#define TELEG_PLAYER_AUTO	(-2)
X#define TELEG_MAX_AUTO		7   /* when changing, alter field in plinfo */
X#define TELEG_DELIM		'~'
X#define TELEG_NDELIM		"%[^~]"
X
X#define MASS_FUEL 	0.05
X#define MASS_RESOURCE 	0.1
X#define MASS_DESTRUCT 	0.15
X
X#define LAUNCH_GRAV_MASS_FACTOR 0.18	/* fuel use modifier for taking off */
X#define LAND_GRAV_MASS_FACTOR 0.29
X
X#define FUEL_GAS_ADD 5.0	/* amt of fuel to add to ea ships tanks */
X#define FUEL_GAS_ADD_TANKER 10.0
X#define FUEL_GAS_ADD_STATION 20.0
X#define FUEL_USE 0.3		/* fuel use per ship mass pt. */
X
X#define REPAIR_RATE 5.0		/* rate at which ships get repaired */
X
X
X#define CREAT_UNIV_ITERAT 10
X#define MAP_ISLANDS 10		/* # of beginning islands for makeuniv */
X#define MAP_MOUNT_PERCENT 0.22	/* percentage of mountain areas */
X#define MAP_GASGIANT_BANDMIN 30  /* min size gasgiants that have bands */
X#define LANDPERCENTAGE 0.45
X
X#define GRAV_FACTOR 0.0025	/* not sure as to what this should be*/
X
X
X#define FACTOR_FERT_SUPPORT 70
X			       /* # of people/fert pt sector supports*/
X#define EFF_PROD 		0.08		/* production of effcncy/pop*/
X#define RESOURCE_PRODUCTION 	0.0220		/* adjust these to change prod*/
X#define FUEL_PRODUCTION 	0.0110
X#define DEST_PRODUCTION 	0.0045
X#define MOB_COST		0.10   /* mobiliz.c, doplanet.c cost/mob point*/
X#define RESOURCE_DEPLETION 	0.015
X#define FACTOR_MOBPROD 		0.02	/* mobilization production/person */
X
X#define FUEL_COST_TERRA		4	/* cost to terraform */
X
X#define PLAN_FIRE_LIM		40	/* max fire strength from planets */
X
X#define TECH_SEE_STABILITY 3	/* min tech to see star stability */
X#define TECH_EXPLORE 	   6	/* min tech to see your whole planet */
X
X#define PLANETGRAVCONST 	0.05
X#define SYSTEMGRAVCONST 	0.05
X
X
X#define DIST_TO_LAND 5	/* moveship -- distance ship has to be to land */
X#define DIST_TO_BURN 50	/* distance from sun needed to destroy ship */
X
X
X#define FACTOR_DAMAGE 		28.0
X#define FACTOR_DESTPLANET 	0.002
X#define FACTOR_DAMAGE_DISTANCE 	4.00
X
X	/* various compiler options that may save cpu time/disk space */
X#define SHELL_DOTURN 1			/* put doturn() in shell */
X					/*  to do this "doturn.o doplanet.o"
X					/*  must be deleted from the "GB"
X					/*  sources in the Makefile  */
X#define NO_SLIDING_SCALE_AUTOMOVE 0	/* move to all four adjacent spots */
X#define POPN_MOVE_SCALE_1 400		/* limit at which popn moves to all */
X#define POPN_MOVE_SCALE_2 3000		/* " " " popn moves to 2 adj. spaces */
X					/* otherwise move to only 1 adj. space*/
X
X
X#define reg register
X /* to save object code */
X#define getchr() fgetc(stdin)
X#define putchr(c) fputc((c),stdout)
X/* assorted macros */
X /* sign,abs val of number */
X#define sgn(x) ( ((x)>=0) ? (1) : (-1))
X#define abs(x) ( ( (x)<0) ? -(x) : (x) )
X /* positive modulus */
X#define mod(a,b,dum) ((dum)=(a)%(b),abs(dum))
X /* euclidean distance */
X#define Distsq(x1,y1,x2,y2) ( ((x1)-(x2))*((x1)-(x2)) + \
X		((y1)-(y2))*((y1)-(y2)) )
X
X/* look up sector */
X#define Sector(pl,x,y) (Smap[(x) + (y)*(pl).Maxx])
X/* adjust temperature to displayed */
X#define Temp(x) (((int)x)*25)
X/* tty stuff */
X#ifdef UV_4.3
X#   define tty_on() cbreak()
X#   define tty_off() nocbreak()
X#else			/* this is 4.2 */
X#   define tty_on() crmode()
X#   define tty_off() nocrmode()
X#endif
X
X /* number of AP's to add to each player in ea. system */
X /*   (look in doturn)  */
X#define LIMIT_APs 50	/* max # of APs you can have */
X
X#define MIN(x,y) ( ((x)>(y)) ? (y) : (x) )
X#define MAX(x,y) ( ((x)<(y)) ? (y) : (x) )
X#define TYPE_EARTH 0
X#define TYPE_ASTEROID 1
X#define TYPE_AIRLESS 2
X#define TYPE_GASGIANT 3
X
X#define DES_SEA 0
X#define DES_LAND 1
X#define DES_MOUNT 2
X#define DES_GAS 3
X#define DES_PLATED 4
X#define MAX_SECT_POPN 9999
X
END_OF_FILE
if test 6087 -ne `wc -c <'tweakables.h'`; then
    echo shar: \"'tweakables.h'\" unpacked with wrong size!
fi
# end of 'tweakables.h'
fi
echo shar: End of archive 4 \(of 7\).
cp /dev/null ark4isdone
MISSING=""
for I in 1 2 3 4 5 6 7 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 7 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