[comp.sources.games] v07i048: GB2 - Galactic Bloodshed, an empire-like war game [Ver. 1.0], Part05/08

billr@saab.CNA.TEK.COM (Bill Randle) (07/19/89)

Submitted-by: VANCLEEF@mps.ohio-state.edu
Posting-number: Volume 7, Issue 48
Archive-name: GB2/Part05



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 5 (of 8)."
# Contents:  docommand.c doturn.c getplace.c map.c planet.list
#   read_teleg.c shootblast.c survey.c tweakables.h
# Wrapped by billr@saab on Thu Jul  6 07:39:52 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'docommand.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'docommand.c'\"
else
echo shar: Extracting \"'docommand.c'\" \(3862 characters\)
sed "s/^X//" >'docommand.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed (Robert Chansky, smq@b)
X * docommand.c  --  figures out what command it is and the arguments, 
X * executes the command via the proper subroutine
X */
X
X#include "vars.h"
X#include <strings.h>
X#include <ctype.h>
Xextern int God;
X
Xint docommand(commstring)
Xchar commstring[];
X{
Xint i,argn=0;
Xbool parse_exit=0;
Xchar args[MAXARGS][COMMANDSIZE];
Xchar *string;
X
X	string=commstring;	/* make pointers the same */
X	while (!parse_exit) {
X	    i=0;
X	    while ( !isspace(*string) && (*string!='\0') && (i<COMMANDSIZE) )
X		args[argn][i++]=(*string++);
X	    args[argn][i]='\0';
X	    /*printf("arg %d |%s|\n",argn,args[argn]);*/
X	    while ((*string)==' ') string++;
X	    if ( (*string=='\0') || (argn>=MAXARGS)) parse_exit=1;
X	    argn++;
X	}
X	for (i=argn; i<MAXARGS; i++)
X		args[i][0]='\0';
X
X	if (args[0][0]=='\0')   /* just pressed return */
X		return(1);	/* go back and wait again */
X	i=strlen(args[0]);
X	if (!strncmp(args[0],"quit",i)) return(0);  /* quit game */
X				/* return quit status */
X	else if (!strncmp(args[0],"autoreport",i)) autoreport(0,argn,args);
X	else if (!strncmp(args[0],"build",i)) build(1,argn,args);
X	else if (!strncmp(args[0],"survey",i)) survey(0,argn,args);
X	else if (!strncmp(args[0],"cs",i)) cs(0,argn,args);
X	else if (!strncmp(args[0],"assault",i)) land(1,argn,args,1);
X	else if (!strncmp(args[0],"dock",i)) land(1,argn,args,0);
X	else if (!strncmp(args[0],"fire",i)) fire(1,argn,args);
X	else if (!strncmp(args[0],"help",i)) help(0,argn,args);
X	else if (!strncmp(args[0],"land",i)) land(1,argn,args,0);
X	else if (!strncmp(args[0],"launch",i)) launch(1,argn,args);
X	else if (!strncmp(args[0],"load",i)) load(1,argn,args);
X	else if (!strncmp(args[0],"unload",i)) load(1,argn,args);
X	else if (!strncmp(args[0],"map",i)) map(0,argn,args);
X	else if (!strncmp(args[0],"mobilize",i)) mobilize(2,argn,args);
X	else if (!strncmp(args[0],"name",i)) name(2,argn,args);
X	else if (!strncmp(args[0],"orbit",i)) orbit(0,argn,args);
X	else if (!strncmp(args[0],"order",i)) order(1,argn,args);
X	else if (!strncmp(args[0],"profile",i)) profile(0,argn,args);
X	else if (!strncmp(args[0],"relation",i)) relation(0,argn,args);
X	else if (!strncmp(args[0],"read",i)) teleg_read(0,argn,args);
X	else if (!strncmp(args[0],"report",i)) rst(0,argn,args,0);
X	else if (!strncmp(args[0],"stock",i)) rst(0,argn,args,1);
X	else if (!strncmp(args[0],"tactical",i)) rst(0,argn,args,2);
X	else if (!strncmp(args[0],"ship",i)) rst(0,argn,args,3);
X	else if (!strncmp(args[0],"object",i)) rst(0,argn,args,4);
X	else if (!strncmp(args[0],"power",i)) power(0,argn,args);
X	else if (!strncmp(args[0],"telegram",i)) telegram(2,argn,args);
X	else if (!strncmp(args[0],"undock",i)) launch(1,argn,args);
X	else if (!strncmp(args[0],"declare",i)) declare(1,argn,args);
X	else if (!strncmp(args[0],"scrap",i)) scrap(1,argn,args);
X	else if (!strncmp(args[0],"examine",i)) examine(1,argn,args);
X	else if (!strncmp(args[0],"zoom",i)) zoom(0,argn,args);
X	else if (!strncmp(args[0],"explore",i)) exploration(0,argn,args);
X	else if (!strncmp(args[0],"enslave",i)) enslave(1,argn,args);
X#if SHELL_DOTURN
X		/* only do this if compiler option to save disk space.. */
X			/* only owning player can do turns */
X	else if (!strncmp(args[0],"doturn",i)) {
X			if (God) {
X				doturn(1);	/* from shell */
X				docommand("cs :");
X			}
X			else printf("You are not empowered to do that.\n");
X	}
X#endif
X			/* only owning player can use fix */
X	else if (!strncmp(args[0],"fix",i)) {
X			if (God) {
X				fix(argn,args);
X				docommand("cs :");
X			} else 
X				printf("You are not empowered to do that.\n");
X	} else if (!strncmp(args[0],"god",i)) {
X			if (God) {
X				God = 0;
X				printf("Diety priveledges off.\n");
X			} 
X	} else 
X	       printf("'%s':illegal command error(%d).\n",args[0],*args[0]);
X		/* grab extraneous return chars if there are any */
X
X	return(1);  /*  main() knows user is not quitting  */
X}
END_OF_FILE
if test 3862 -ne `wc -c <'docommand.c'`; then
    echo shar: \"'docommand.c'\" unpacked with wrong size!
fi
# end of 'docommand.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'\" \(6896 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;
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 *)StarsInhab, sizeof(StarsInhab));
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
X Num_races = Numraces();
X printf(" Num_races = %d\n",Num_races);
X
X openshdata(&shdata);
X Num_ships = Numships(shdata);
X printf("Num ships %d\n", Num_ships);
X
X ships = (shiptype **)malloc(sizeof(shiptype *) * Num_ships);
X for (i=1; i<=Num_ships; i++) {
X	getship(shdata,&ships[i],i);
X	if (ships[i]->whatorbits >= LEVEL_STAR)
X		StarsInhab[ships[i]->storbits] = 1;
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	   moveplanet(Stars[star], star, planets[star][i], i);
X		/* move planets in orbit; also sets StarsInhab[] */
X	}
X }
X close(stardata);
X close(pdata);
X
X
X
Xraces[0] = (racetype *)NULL;	/* for maxsupport() */
Xfor (i=1; i<=Num_races; i++) {
X	getrace(&(races[i]),i);
X			/* increase tech; change to something else */
X	races[i]->tech += (float)races[i]->IQ / 100.0;	
X}
X
X
X	/* do all ships one turn */
X for (i=1; i<=Num_ships; i++)
X    doship(i,ships[i]);
X
X
X
X	/* clear ship list for insertion */
X Sdata.ships = 0;
X for (star=0; star<Sdata.numstars; star++) {
X	Stars[star]->ships = 0;
X 	for (i=0; i<Stars[star]->numplanets; i++) {
X	   planets[star][i]->ships = 0;
X	}
X }
X
X     /* insert ship into the list of wherever it might be */
X for (i=Num_ships; i>=1; i--) {
X    insert_sh(&Sdata, Stars[ships[i]->storbits], 
X		planets[ships[i]->storbits][ships[i]->pnumorbits], 
X		ships[i], i);
X }
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]);
X        close(sectdata);
X   	/*if (planets[star][i]->type==TYPE_GASGIANT) {
X	 	 /* blow some wind on gasgiant planet */
X		 /*  (there was no easy way to do this in doplanet) */
X		 /* (on second thought, let's not...) */
X		/*if (--planets[star][i]->rottimer)
X			planets[star][i]->sectormappos += sizeof(sectortype);
X		else {
X			planets[star][i]->rottimer = planets[star][i]->Maxx;
X			planets[star][i]->sectormappos -= planets[star][i]->Maxx * sizeof(sectortype);
X		}
X   	}*/
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++) {
X	putship(shdata,ships[i],i);
X	free(ships[i]);
X }
X close(shdata);
X free(ships);
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 / 10.0 + (float)popn / 3000.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 6896 -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'\" \(5827 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 *  testship(ship) -- tests various things for the ship.
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		   Locks(1);
X		   if (!getship(getplace_shdata,&where.shipptr,where.shipno)) {
X			Locks(0);
X			close(getplace_shdata);
X			DontOwnErr(where.shipno);
X			where.err = 1;
X			return where;
X		   }
X		   Locks(0);
X		   close(getplace_shdata);
X		   if ( (where.shipptr->owner==Playernum || ignoreexpl || God)
X				&& (!where.shipptr->is_dead || God)) {
X			   if (where.shipptr->is_dead)
X				printf("Ship is dead.\n");
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			   while (isdigit(*string)) 
X				string++;
X			   if (*string=='/')
X				 return Getplace2(string+1,&where, ignoreexpl);
X			   else
X				 return where;
X		   } else {
X			where.err = 1;
X			if (where.shipptr->is_dead)
X				printf("That ship has been destroyed.\n");
X			else
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		 Locks(1);
X		 openpdata(&getplace2_pdata);
X		 getplanet(getplace2_pdata, &p, Stars[where->snum]->planetpos[i]);
X		 Locks(0);
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}
X
X
X
Xint testship(s,n)
Xreg shiptype *s;
Xreg int n;
X{
Xreg int r=0;
X
X if (s->is_dead) {
X	printf("%s #%d has been destroyed.\n", Shipnames[s->type], n);
X	r = 1;
X } else if (s->owner!=Playernum) {
X	DontOwnErr(n);
X	r = 1;
X } else {
X   if (s->rad) {
X	printf("%s #%d is irradiated and inactive.\n",Shipnames[s->type], n);
X	r = 1;
X   } 
X   if (!s->popn && Shipdata[s->type][ABIL_MAXCREW]) {
X	printf("%s #%d has no crew and is not a robotic ship.\n", 
X		Shipnames[s->type], n);
X	r = 1;
X   }
X }
X
X return r;
X}
END_OF_FILE
if test 5827 -ne `wc -c <'getplace.c'`; then
    echo shar: \"'getplace.c'\" unpacked with wrong size!
fi
# end of 'getplace.c'
fi
if test -f 'map.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'map.c'\"
else
echo shar: Extracting \"'map.c'\" \(4902 characters\)
sed "s/^X//" >'map.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed (Robert Chansky, smq@b)
X *  map.c -- display sector map of current planet
X */
X
X#include "vars.h"
X#include "ships.h"
X#include "races.h"
Xextern float compatibility();
Xchar desshow();
X
Xmap(APcount, argn,args)
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
X{
Xint map_pdata;
Xplanettype *p;
Xplacetype where;
X
X   Locks(1);
X   where = Getplace(args[1],0);
X   Locks(0);
X   if (where.err) return;
X
X   if (where.level==LEVEL_PLAN) {
X  	openpdata(&map_pdata);
X   	Locks(1);
X  	getplanet(map_pdata,&p,Stars[where.snum]->planetpos[where.pnum]);
X   	Locks(0);
X  	close(map_pdata);
X
X  	show_map(p,1);	/* 1 means display data */
X
X  	free(p);
X
X	if (Stars[where.snum]->stability > 50)
X		printf("WARNING! This planet's primary is unstable.\n");
X
X   } else {
X	Dir.lastx = Dir.lasty = 0.0;
X	orbit(APcount, argn,args);	/* make orbit map instead */
X   }
X
X}
X
X
X
Xshow_map(p, show)
Xplanettype *p;
Xregister int show;
X{
Xregister int x,y,i,f;
Xint sh,iq,map_sectdata,map_shdata;
Xshiptype *s;
Xchar shiplocs[MAX_X][MAX_Y];
X
X  bzero((char *)shiplocs, sizeof(shiplocs));
X
X  opensectdata(&map_sectdata);
X  getsmap(map_sectdata,Smap,p);
X  close(map_sectdata);
X
X  openshdata(&map_shdata);
X  Locks(1);
X   /* traverse ship list on planet. */
X  sh = p->ships;
X	iq = 0;
X
X	while (sh) {
X		(void)getship(map_shdata,&s, sh);
X		if(s->owner == Playernum && s->popn) /* need crew to sight */
X			iq = 1;
X		sh = s->nextship;
X		free(s);
X	  }
X
X
X  sh = p->ships;
X  while (sh) {
X      (void)getship(map_shdata,&s, sh);
X      if (!s->is_dead && s->is_docked && s->whatdest==LEVEL_PLAN &&
X		s->xpos < p->Maxx && s->xpos >= 0 &&
X		s->ypos < p->Maxy && s->ypos >= 0 &&
X		( (s->owner == Playernum) || (iq == 1) ) )
X	shiplocs[(int)s->xpos][(int)s->ypos] = Shipltrs[s->type];
X      sh = s->nextship;
X      free(s);
X  }
X  Locks(0);
X  close(map_shdata);
X
X
X  printf("   ");
X  for (x=0; x<p->Maxx; x++) 
X	printf("%d",x/10);
X  if (show)
X  	printf("  Sects %s: %d", Race->Thing ? "covered" : "owned", 
X			p->info[Playernum-1].numsectsowned);
X  printf("\n   ");
X  for (x=0; x<p->Maxx; x++) 
X	printf("%d",x%10);
X  if (show) { 
X	int i,f=0;
X	  printf("  Aliens:");
X	  if (p->is_explored || Race->tech >= TECH_EXPLORE) {
X		  for (i=1; i<MAXPLAYERS; i++)
X			if (p->info[i-1].numsectsowned && i!=Playernum) {
X			   f=1;
X			   printf("%c%d", isset(Race->atwar,i) ? '*' : ' ', i);
X			}
X		  if (!f) printf("(none)");
X	  } else printf("???");
X  }
X  putchr('\n');
X
X  for (y=0; y<p->Maxy; y++) {
X     printf("%2d ",y);
X     for (x=0; x<p->Maxx; x++) {
X	if (shiplocs[x][y])
X		putchr(shiplocs[x][y]);
X	else
X	    	putchr(desshow(p, x, y));
X     }
X     if (show)
X       switch (y) {	/* give stockpile info */
X        case 0: printf("| Combat readiness:  %u", p->info[Playernum-1].comread);
X	      break;
X        case 1: printf("| Compatibility:   %.2f%s",compatibility(p,Race),
X			p->conditions[TOXIC] > 50 ? "(TOXIC)" : "");
X	      break;
X        case 3:printf("| Resource stockpile:%u",p->info[Playernum-1].resource);
X	      break;
X        case 4: printf("| Fuel stockpile:    %u",p->info[Playernum-1].fuel);
X	      break;
X        case 5:printf("| Destruct cap:      %u",p->info[Playernum-1].destruct);
X	      break;
X        case 6:printf("| %s:  %u (%u)", Race->Thing ? "Tons of biomass" : 
X				"Total Population", p->popn, p->maxpopn);
X	      break;
X        /*case 7: 
X	      break;
X        case 8: 
X	      break;
X        case 9: 
X	      break;
X        case 10: 
X	      break;*/
X        default: printf("|");
X	      break;
X       }
X  putchr('\n');
X  }
X
X
X}
X
X
Xchar desshow(p,x,y)
Xregister planettype *p;
Xregister int x,y;
X{
Xregister sectortype *s;
X
Xs = &Sector(*p,x,y);
X
Xif (s->VN)
X	return Shipltrs[OTYPE_VN];
X
Xif (s->amoeba)
X	return Shipltrs[OTYPE_AMOEBA];
X
X
X	/*  owned by you */
Xif (s->owner==Playernum) {
X
X   if (Race->Thing)
X	return CHAR_OWNED_THING;
X   if (s->is_wasted) 
X	return CHAR_OWNED_WASTELAND;
X   switch (s->des) {
X     	case DES_SEA: return CHAR_OWNED_SEA;
X     	case DES_LAND: return CHAR_OWNED_LAND;
X     	case DES_MOUNT: return CHAR_OWNED_MOUNT;
X     	case DES_GAS: return CHAR_OWNED_GAS;
X     	case DES_PLATED: return CHAR_PLATED;
X     	case DES_ICE: return CHAR_OWNED_ICE;
X     	default: return('!');
X   }
X
X	/* un-owned by anybody */
X
X} else if (!s->owner) {
X if (!p->is_explored && Race->tech < TECH_EXPLORE) {
X	if ( !( (x>0 && (s-1)->owner==Playernum) ||
X	     (x<p->Maxx-1 && (s+1)->owner==Playernum) || 
X	     (y>0 && (s-p->Maxx)->owner==Playernum) ||
X	     (y<p->Maxy-1 && (s+p->Maxx)->owner==Playernum) ) )
X			return CHAR_CLOAKED;
X }
X
X if (s->is_wasted) 
X	return(CHAR_WASTELAND);
X
X  switch (s->des) {
X     case DES_SEA: return(CHAR_SEA);
X     case DES_LAND: return(CHAR_LAND);
X     case DES_MOUNT: return(CHAR_MOUNT);
X     case DES_GAS: return(CHAR_GAS);
X     case DES_ICE: return CHAR_ICE;
X     case DES_PLATED: return(CHAR_PLATED);
X     default: return('!');
X  }
X
X	/* different owner */
X
X} else
X    return CHAR_DIFFOWNED;
X
X}
END_OF_FILE
if test 4902 -ne `wc -c <'map.c'`; then
    echo shar: \"'map.c'\" unpacked with wrong size!
fi
# end of 'map.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'
X30
X3
X3
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'\" \(5601 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 <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[PATHLEN];
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; 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()
X{
X tty_off();
X fclose(teleg_read_fd);
X close(teleg_read_pdata);
X longjmp(main_jenv,1);
X}
END_OF_FILE
if test 5601 -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 'shootblast.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'shootblast.c'\"
else
echo shar: Extracting \"'shootblast.c'\" \(7275 characters\)
sed "s/^X//" >'shootblast.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed (Robert Chansky, smq@ssyx)
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 * tele_range(r,s) -- range of telescope
X * gun_range(r,s) -- range of ship's guns
X */
X
X
X#include "vars.h"
X#include "ships.h"
X#include "races.h"
X#include <math.h>
Xextern int Distmap();
Xbool Nuked[MAXPLAYERS];	/* who was nuked on the planet/ship */
X
Xfloat blast();
X
Xfloat Kill_factor();
X
Xint shoot(from,to,fpl,tpl,sectorx,sectory,strength, dist, msg, getmap)
Xplacetype from,*to;
Xplanettype *fpl,*tpl;
Xint sectorx,sectory,strength;
Xfloat *dist;
Xchar *msg;
Xint getmap;
X{
Xint i;
Xdouble xfrom,yfrom,xto,yto;
Xchar buf[300];
Xfloat nd;
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   if (from.shipptr->is_docked && from.shipptr->whatdest==LEVEL_PLAN) {
X   	xfrom = Stars[from.shipptr->storbits]->xpos + fpl->xpos;
X   	yfrom = Stars[from.shipptr->storbits]->ypos + fpl->ypos;
X	if (to->level==LEVEL_SHIP &&
X	    to->shipptr->is_docked && to->shipptr->whatdest==LEVEL_PLAN) {
X		 /* ground distance */
X		xfrom += from.shipptr->xpos;
X		yfrom += from.shipptr->ypos;
X	}
X   } else {
X   	xfrom = from.shipptr->xpos;
X   	yfrom = from.shipptr->ypos;
X   }
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   if (to->shipptr->is_docked && to->shipptr->whatdest==LEVEL_PLAN) {
X   	xto = Stars[to->shipptr->storbits]->xpos + tpl->xpos;
X   	yto = Stars[to->shipptr->storbits]->ypos + tpl->ypos;
X	printf(" xto %g yto %g, tpl %g,%g\n", xto, yto, tpl->xpos,tpl->ypos);
X	if (from.level==LEVEL_SHIP &&
X	    from.shipptr->is_docked && from.shipptr->whatdest==LEVEL_PLAN) {
X		xto += to->shipptr->xpos;
X		yto += to->shipptr->ypos;
X	}
X   } else {
X   	xto = to->shipptr->xpos;
X   	yto = to->shipptr->ypos;
X   }
X }
X
X *dist = sqrt( (double)Distsq(xfrom, yfrom, xto, yto));
X if (*dist > SYSTEMSIZE*2.0) {
X	 /* out of range */
X	return -1;
X } else {
X
X     nd = blast(&from, to, tpl, sectorx, sectory, *dist, strength, getmap);
X
X     teleg_add("", msg);
X     if (from.level==LEVEL_SHIP && from.shipptr->type==OTYPE_GR)
X	sprintf(buf,"%.0f points radiation damage given", nd);
X     else if (to->level==LEVEL_SHIP)
X	    if (to->shipptr->type==OTYPE_VN)
X		sprintf(buf,"%.0f Von Neumann machines destroyed", nd);
X	    else
X		sprintf(buf,"%.0f%% damage done", nd);
X     else
X	    sprintf(buf,"%.0f sectors destroyed", nd);
X     teleg_add(buf, msg);
X     teleg_add(".\n\n", msg);
X
X     if (to->level==LEVEL_SHIP && to->shipptr->is_dead) {
X	sprintf(buf,"%s #%d DESTROYED.\n", Shipnames[to->shipptr->type],
X			to->shipno);
X	teleg_add(buf,msg);
X     }
X
X     return (int)nd;
X }
X
X}
X
X
X	/* returns amt of damage or # of sectors nuked */
X
Xfloat blast(from, to, pl, x, y, dist, strength, getmap)
Xplacetype *from,*to;
Xplanettype *pl;		/* pointer to planet being destroyed */
Xint x,y;		/* sector x,y of planet */
Xfloat dist;		/* distance to target */
Xint strength;		/* strength of blast */
Xint getmap;		/* whether to get smap or not */
X{
Xregister int x2,y2;
Xreg float r;		/* radius of blast */
Xfloat d,str;
Xint numdest = 0,lowx,lowy,hix,hiy;
Xregister sectortype *s;
Xregister float fac;
Xint shfdata,sectdata;
X
X
X str = Kill_factor(dist, strength);
X
X if (to->level==LEVEL_SHIP) {
X	numdest = int_rand(round_rand((float)str / Shipdata[to->shipptr->type][ABIL_ARMOR])-10, round_rand((float)str / Shipdata[to->shipptr->type][ABIL_ARMOR])+10);
X	if (numdest > 100)
X		numdest = 100;
X	if (numdest < 0)
X		numdest = 0;
X
X	if (from->level==LEVEL_SHIP && from->shipptr->type==OTYPE_GR) {
X		/* gamma-ray lasers irradiate targets */
X		if (to->shipptr->type==OTYPE_VN) {
X			 /* damage spread around the machine herd */
X			numdest = round_rand((float)numdest / (to->shipptr->orders.object.number * 0.3) );
X				/* radiation is not accumulated */
X			to->shipptr->rad = numdest;
X		} else {
X			to->shipptr->rad = numdest;
X		}
X	} else {
X	   if (to->shipptr->type!=OTYPE_VN) {
X		if (to->shipptr->damage+numdest >= 100) {
X			kill_ship(to->shipptr);
X			 /* mess up the planet a bit. */
X			if (to->shipptr->type==OTYPE_TOXWC &&
X			    to->shipptr->is_docked &&
X			    to->shipptr->whatdest==LEVEL_PLAN)
X				pl->conditions[TOXIC] = 
X					MIN(pl->conditions[TOXIC]+
X					      to->shipptr->orders.object.number,
X					    100);
X		} else
X			to->shipptr->damage += numdest;
X	   } else {
X		numdest = round_rand((float)numdest / Shipdata[OTYPE_VN][ABIL_ARMOR]);
X		if (to->shipptr->orders.object.number - numdest < 1)
X			kill_ship(to->shipptr);
X		else
X			to->shipptr->orders.object.number -= numdest;
X	   }
X	}
X	Nuked[to->shipptr->owner] = 1;
X	return (float)numdest;		/* return amt of dest made */
X
X } else if (to->level==LEVEL_PLAN) {
X
X    r = str * FACTOR_DESTPLANET;
X    if (getmap) {
X	    opensectdata(&sectdata);
X	    getsmap(sectdata,Smap,pl);
X    }
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 = &Sector(*pl,x2,y2);
X	     fac = ((float)str*FACTOR_DESTPLANET/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 > 1.00) {
X		   	Nuked[s->owner] = 1;	/* for retaliating */
X			s->popn = s->owner = 0;
X				/* mutate the sector. */
X			if (s->des==DES_ICE)
X				s->des==DES_SEA;
X			else if (s->des==DES_PLATED)
X				s->des==DES_LAND;
X			else if (s->des==DES_SEA)
X				s->des==DES_LAND;
X			else 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			else if (s->des==DES_LAND && 
X				(s+1)->des==DES_GAS || (s-1)->des==DES_GAS)
X					s->des=DES_GAS;
X	     	   	s->is_wasted = 1;
X			numdest++;
X				/* add some resources to be fair */
X	     	   	s->resource = (percent)round_rand(s->resource * fac);
X		   	s->fert = (percent)round_rand(s->fert / fac);
X	     	   	s->mobilization = (percent)(round_rand(s->mobilization / fac) );
X	     	   	/*printf("::%d,%d killed %d.\n",x2,y2,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    if (getmap) {
X	    putsmap(sectdata,Smap,pl);
X	    close(sectdata);
X    }
X
X   }
X   return (float)numdest;
X
X}
X
X
Xfloat Kill_factor(dist, strength)
Xreg float dist;
Xreg int strength;
X{
Xreg float str;
X
X str = strength * FACTOR_DAMAGE / (dist+50.0);
X return str;
X}
X
X
X
X
X/* 
X * range of telescopes, ground or space, given race and ship 
X*/
Xfloat tele_range(r,t) 
Xreg racetype *r;
Xreg int t;
X{
X  if (t==OTYPE_GTELE)
X	return r->tech*45.4 + SYSTEMSIZE/2;
X  else
X	return r->tech * 75.7 + SYSTEMSIZE;
X}
X
X
X
X/* 
X * gun range of given ship, given race and ship 
X */
Xfloat gun_range(r,s)
Xreg racetype *r;
Xreg shiptype *s;
X{
X	/* (logscale is 0.5 to 0.95) */
X  return (logscale((int)(r->tech)) - 0.45) * SYSTEMSIZE * 2.0;
X}
END_OF_FILE
if test 7275 -ne `wc -c <'shootblast.c'`; then
    echo shar: \"'shootblast.c'\" unpacked with wrong size!
fi
# end of 'shootblast.c'
fi
if test -f 'survey.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'survey.c'\"
else
echo shar: Extracting \"'survey.c'\" \(4948 characters\)
sed "s/^X//" >'survey.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed (Robert Chansky, smq@ssyx)
X * survey.c -- print out survey for planets  
X */
X
X#include "vars.h"
X#include "races.h"
Xextern float compatibility();
Xextern char desshow();
Xextern char *Desnames[];
X	/* user's guide to toxicity */
Xchar *Tox[] = {
X	"Stage 0, mild",
X	"Stage 1, mild",
X	"Stage 2, semi-mild",
X	"Stage 3, semi-semi mild",
X	"Stage 4, ecologically unsound",
X	"Stage 5: ecologically unsound",
X	"Stage 6: below birth threshold",
X	"Stage 7: ecologically unstable--below birth threshold",
X	"Stage 8: ecologically poisonous --below birth threshold", 
X	"Stage 9: WARNING: nearing 100% toxicity",
X	"Stage 10: WARNING: COMPLETELY TOXIC!!!",
X	"???"
X};
X
Xsurvey(APcount, argn,args)
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
X{
Xint lowx,hix,lowy,hiy,x2;
Xchar d;
Xsectortype *s;
Xplanettype *p;
Xint tindex,survey_pdata,survey_sectdata;
Xfloat compat;
X
Xif (argn==1) {   /* no args */
X
X if (Dir.level==LEVEL_PLAN) {
X  openpdata(&survey_pdata);
X  getplanet(survey_pdata,&p,Stars[Dir.snum]->planetpos[Dir.pnum]);
X  close(survey_pdata);
X  printf("%s:\n",Stars[Dir.snum]->pnames[Dir.pnum]);
X  printf("gravity   x,y absolute     x,y relative to %s\n",Stars[Dir.snum]->name);
X  printf("%7.2f   %7.1f,%7.1f   %8.1f,%8.1f\n", 
X		gravity(p),
X		p->xpos + Stars[Dir.snum]->xpos,
X		p->ypos + Stars[Dir.snum]->ypos,
X		p->xpos, p->ypos );
X
X  printf("======== Planetary conditions: ========\n");
X  printf("atmosphere concentrations:\n");
X  printf("     methane %02d%%(%02d%%)     oxygen %02d%%(%02d%%)\n",
X		p->conditions[METHANE], Race->conditions[METHANE],
X		p->conditions[OXYGEN], Race->conditions[OXYGEN] );
X  printf("         CO2 %02d%%(%02d%%)   hydrogen %02d%%(%02d%%)      temperature: %3d (%3d)\n",
X		p->conditions[CO2], Race->conditions[CO2],
X		p->conditions[HYDROGEN], Race->conditions[HYDROGEN],
X		Temp(p->conditions[TEMP]), Temp(Race->conditions[TEMP]) );
X  printf("    nitrogen %02d%%(%02d%%)     sulfur %02d%%(%02d%%)           normal: %3d\n",
X		p->conditions[NITROGEN], Race->conditions[NITROGEN],
X		p->conditions[SULFUR], Race->conditions[SULFUR],
X		Temp(p->conditions[RTEMP]) );
X  printf("      helium %02d%%(%02d%%)      other %02d%%(%02d%%)\n",
X		p->conditions[HELIUM], Race->conditions[HELIUM],
X		p->conditions[OTHER], Race->conditions[OTHER]);
X  if ((tindex = p->conditions[TOXIC]/10) < 0)
X	tindex = 0;
X  else if (tindex > 10)
X	tindex = 11;
X  printf("      Toxicity: %d%% (%s)\n", p->conditions[TOXIC], Tox[tindex] );
X  printf("Total planetary compatibility: %.2f%%\n", compatibility(p, Race) );
X
X  printf("fuel_stock  resource_stock dest_pot.   %s    ^%s\n",
X			Race->Thing ? "biomass" : "popltn",
X			Race->Thing ? "biomass" : "popltn");
X  printf("%10lu  %14lu %9lu  %7lu%11lu\n", p->info[Playernum-1].fuel, 
X		 p->info[Playernum-1].resource, 
X		 p->info[Playernum-1].destruct,
X		 p->popn, p->maxpopn);
X  if (p->slaved_to)
X	printf("This planet ENSLAVED to player %d!\n", p->slaved_to);
X
X  free(p);
X
X } else if (Dir.level==LEVEL_STAR) {
X
X  printf("Star %s\n",Stars[Dir.snum]->name);
X  printf("locn: %f,%f\n",Stars[Dir.snum]->xpos,Stars[Dir.snum]->ypos);
X  printf("gravity: %.2f\tstability: ", Stars[Dir.snum]->gravity);
X  if (Race->tech >= TECH_SEE_STABILITY)
X  	printf("%d%% (%s)\n",
X		Stars[Dir.snum]->stability, 
X		Stars[Dir.snum]->stability<20 ? "stable" :
X		Stars[Dir.snum]->stability<40 ? "unstable" : 
X		Stars[Dir.snum]->stability<60 ? "dangerous" : 
X		Stars[Dir.snum]->stability<100 ? "WARNING! nova iminent!" : 
X		"undergoing nova" );
X  else
X	printf("(cannot determine)\n");
X
X  printf("%d planets are ",Stars[Dir.snum]->numplanets);
X  for (x2=0; x2<Stars[Dir.snum]->numplanets; x2++)
X	printf("%s ", Stars[Dir.snum]->pnames[x2]);
X  putchr('\n');
X
X } else if (Dir.level==LEVEL_UNIV)
X  printf("It's just _there_, you know?\n");
X
X} else if (argn==2)      /* argn==2, survey is on a sector */
X
X if (Dir.level==LEVEL_PLAN) {
X
X  openpdata(&survey_pdata);
X  getplanet(survey_pdata,&p,Stars[Dir.snum]->planetpos[Dir.pnum]);
X  close(survey_pdata);
X
X  compat = compatibility(p,Race);
X
X  opensectdata(&survey_sectdata);
X  getsmap(survey_sectdata,Smap,p);
X  close(survey_sectdata);
X
X  get4args(args[1],&x2,&hix,&lowy,&hiy); 
X  if (hix>=p->Maxx) hix=p->Maxx-1;
X  if (x2<0) x2=0;
X  if (lowy>=p->Maxy) lowy=p->Maxy-1;
X  if (hiy<0) hiy=0;
X  		/* ^^^ translate to lowx:hix,lowy:hiy */
X
X  printf(" x,y des (    type   )  owner eff mob frt res popn ^popn\n");
X
X  for (; lowy<=hiy; lowy++)
X   	for (lowx=x2; lowx<=hix; lowx++) {
X    		s = &Sector(*p, lowx, lowy);
X    		/*if (s->owner==Playernum)*/
X		printf("%2d,%-2d ", lowx, lowy);
X		if ( (d = desshow(p, lowx, lowy))==CHAR_CLOAKED)
X		   printf("?  (     ?     )\n");
X		else
X       		   printf("%c  (%11s) %6u%4u%4u%4u%4u%5u%6d\n",
X			d, Desnames[s->des], s->owner, s->eff,
X			s->mobilization, s->fert, s->resource, s->popn,
X			maxsupport(Race,s,compat) );
X 	}
X  free(p);
X } else
X	printf("scope must be a planet.\n");
X else if (argn>2)
X 	printf("survey: error in args.\n");
X
X}
END_OF_FILE
if test 4948 -ne `wc -c <'survey.c'`; then
    echo shar: \"'survey.c'\" unpacked with wrong size!
fi
# end of 'survey.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'\" \(5671 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 VERS "1.0"		/* game version */
X
X#define UPDATE_TIME 1		/* 1 hour update time */
X
X
X#define LOGIN_NAME_SIZE 13
X
X#define NUM_TIMES_TO_WAIT_FOR_LOCK 200
X#define NEUTRAL_FD 1000
X
X#define MAXCOMMSTRSIZE 250
X#define COMMANDSIZE 42
X#define MAXARGS 6
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_THING 	'@' 
X#define CHAR_LAND 		'*'
X#define CHAR_OWNED_LAND 	'x' 
X#define CHAR_SEA 		'.'
X#define CHAR_OWNED_SEA 		'x'
X#define CHAR_MOUNT 		'^'
X#define CHAR_DIFFOWNED 		'?'
X#define CHAR_PLATED 		'o'
X#define CHAR_WASTELAND 		'%'
X#define CHAR_OWNED_WASTELAND 	'!'
X#define CHAR_GAS 		'~'
X#define CHAR_OWNED_GAS 		'x'
X#define CHAR_CLOAKED 		' '
X#define CHAR_ICE		'#'
X#define CHAR_OWNED_ICE		'x'
X#define CHAR_OWNED_MOUNT 	'X'
X
X#define NAMESIZE 18
X#define RNAMESIZE 35
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
X
X#define MAX_X 48	/* top range for planet */
X#define MAX_Y 19
X#define RATIOXY 3.70		/* map ratio between x and y */
X				/* ranges of map sizes (x usually ) */
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	20
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_HABITAT 20.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 8.0		/* rate at which ships get repaired */
X
X
X#define CREAT_UNIV_ITERAT 10	/* iterations for star movement */
X
X
X#define GRAV_FACTOR 0.0025	/* not sure as to what this should be*/
X
X
X#define FACTOR_FERT_SUPPORT 150
X			       /* # of people/fert pt sector supports*/
X#define EFF_PROD 		0.28		/* production of effcncy/pop*/
X#define RESOURCE_PRODUCTION 	0.10		/* adjust these to change prod*/
X#define FUEL_PRODUCTION 	0.05
X#define DEST_PRODUCTION 	0.07
X#define MOB_COST		0.10   /* mobiliz.c, doplanet.c cost/mob point*/
X#define RESOURCE_DEPLETION 	0.015
X#define FACTOR_MOBPROD 		0.06	/* 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 10	/* min tech to see star stability */
X#define TECH_EXPLORE 	   15	/* min tech to see your whole planet */
X
X#define ENVIR_DAMAGE_TOX	70	/* min tox to damage planet */
X
X#define PLANETGRAVCONST 	0.05
X#define SYSTEMGRAVCONST 	0.05
X
X
X#define FUEL_MANEUVER	0.3	/* order.c-- fuel it costs to change aim */
X#define DIST_TO_LAND 	10.0 	/* moveship.c,land.c -- 
X				   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 		688.0
X#define FACTOR_DESTPLANET 	0.35
X#define FACTOR_DAMAGE_DISTANCE 	1.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
Xtypedef char bool;	/* 1 or 0 */
Xtypedef unsigned char percent;	/* 0-100 */
Xtypedef unsigned long ul;
Xtypedef unsigned short us;
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#define MIN(x,y) ( ((x)>(y)) ? (y) : (x) )
X#define MAX(x,y) ( ((x)<(y)) ? (y) : (x) )
X /* positive modulus */
X#define mod(a,b,dum) ((dum)=(a)%(b),abs(dum))
X /* swap two variables */
X#define	swap(a, b)  ((a) ^= (b), (b) ^= (a), (a) ^= (b))
X /* euclidean distance */
X#define Distsq(x1,y1,x2,y2) ( ((x1)-(x2))*((x1)-(x2)) + ((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
X /* number of AP's to add to each player in ea. system */
X /*   (look in doturn)  */
X#define LIMIT_APs 99	/* max # of APs you can have */
X
X#define TYPE_EARTH 	0
X#define TYPE_ASTEROID 	1
X#define TYPE_AIRLESS 	2
X#define TYPE_ICEBALL	3
X#define TYPE_GASGIANT 	4
X
X#define DES_SEA 	0
X#define DES_LAND 	1
X#define DES_MOUNT 	2
X#define DES_GAS 	3
X#define DES_ICE		4
X#define DES_PLATED 	5
X
X#define MAX_SECT_POPN 9999
X
X/* misc */
Xlong random();
X
END_OF_FILE
if test 5671 -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 5 \(of 8\).
cp /dev/null ark5isdone
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