[comp.sources.games] v10i010: gb3 - Galactic Bloodshed, an empire-like war game [Ver. 2.0], Part10/14

billr@saab.CNA.TEK.COM (Bill Randle) (06/02/90)

Submitted-by: VANCLEEF@mps.ohio-state.edu
Posting-number: Volume 10, Issue 10
Archive-name: gb3/Part10
Supersedes: GB2: Volume 7, Issue 44-51



#! /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 10 (of 14)."
# Contents:  Docs/notes.doc Docs/oldfire.doc Docs/order.doc
#   server/declare.c server/launch.c server/map.c server/shlmisc.c
#   server/tweakables.h server/vars.h
# Wrapped by billr@saab on Fri Jun  1 11:53:42 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Docs/notes.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Docs/notes.doc'\"
else
echo shar: Extracting \"'Docs/notes.doc'\" \(6256 characters\)
sed "s/^X//" >'Docs/notes.doc' <<'END_OF_FILE'
X
X	This is a game of interstellar exploration/conquest.  By the time I
Xrealized there really wasn't going to be much fighting going on in the game, I
Xwas so in love with the title that I just couldn't change it...
X
X	Players begin the game as members of a randomly generated race, with
Xattributes (intelligence, birth rate, size, metabolism, etc) that affect
Xdevelopment later.  Each turn, population will migrate to unpopulated areas
Xof the planet.
X
X	Currently I have the following features:
X
X	Exploration: players can build many types of ships with which to 
Xcolonize other planets.
X	Terraforming: planets have atmospheres, composed of different amounts
Xof gases.  players can build machines to alter the atmosphere to one more
Xsuited to their race.
X	Von Neumann machines: This is a ship-type that can be built.  It
Xexists to reproduce itself using whatever resources are available, and can be
Xuseful to send to other players.  I got this idea after reading _The Forge of
XGod_.
X	Co-existance: There are several types of terrain: land, ice, ocean,
Xmountainous, and gas(gasgiant).  Each player has a type which he preferrs; if
Xone race's preference differs from another, both races can co-exist on the same
Xplanet.
X	Communication: players can communicate with each other, but only if
Xthey sacrifice valuable resources to translate another language.
X	Combat: If the above breaks down.
X
X
X	The game is not (of course) complete, but it's fixed up enough to post
XI think.  It runs pretty good on 4.3 and 4.2, but as our versions of
Xboth here are a little funky, it may require some tweaking before it runs to
Xa game keeper's satisfaction.
X
X
XBUGS:
X	None serious that I know of, however there are a few things that need 
Xto be fixed up in the near future:
X
X	Mines might have problems.
X	Well the Space Amoebae are new, there may be some foulups involved with 
Xthem as well, such as not digesting planets properly.
X	Mirrors face the wrong way.
X	Ships with "*" before their names (shipdata.h) don't work as yet.
Xdon't build them.
X	Probably shouldn't have used a square grid implementation for
Xplanet maps, but I wanted the simplest thing possible for that.  I'm
Xthinking of adding new planet types if I can get information on their
Xgeneration.  Any help on this point (once you have seen the game and know how
Xit is done here) would be appreciated.  Ideas of mine on this cover
Xthings such as Ringworlds, Dyson spheres, space elevators, artificial
Xhollow planets, the list goes on..
X
X
X	New versions will be posted/added to/however this is done,
Xwhen I have the time to write same.  I've spent two years writing 
Xthis program, and I hope it is enjoyed by everyone using it.
X
X	Suggestions are welcome, as are bug reports, but don't expect
Xreally fantastic and difficult ideas to be implemented, unless
Xof course they are really fascinating..
X
X
X
XSTARTING THE GAME:
X	This was done on two seperate machines, one running 4.2 and the other
Xrunning a tweaked version of 4.3.  edit the Makefile and delete the
Xwrong one.  when it's done making, try this:
X	Makeuniv < planet.list (wait about 20 minutes)
X	This will set up a fair-sized game with 30 stars and 30 planets,
Xshould be good for a decent system.  GB_daemon updates every 3 hours,
Xwhich is kinda slow at the beginning, but once the game gets more mature,
Xthings tend to pick up.  This was not intended to be as intense a game as,
Xsay, multi-trek or empire.  
X	Once the game is up, you, as the diety player, must enroll
Xfirst.  (several objects in the game are owned by player 1, it would be better
Xif this were you..)  To make the game more interesting, you can build (yes
Xbuild) a space amoeba or two (be sure to send it somewhere else so it doesnt
Xeat YOUR planet); also you could make a couple fleets of Von Neumann machines
Xto generally become a nuisance to everybody.  (To make yourself some resources,
Xuse the fix command.)  Occasionally you might tweak a star or two to go nova
X(fix its stability to 100); this is especially useful for recalcitrant 
Xgame-players complaining about bugs.  Put the fear of god into them.
X
X	Please send me information on trends in the game; what tends to
Xhappen here and there.
X
X
XFIXES:
X	We are now at Version .975.  The datafiles are *NOT* compatible
X	with previous versions you may have.  
X
X	Some recent fixes (over .95) are:
X
X	Ships are now stored in a list, instead of slots in planets.  This 
Xmakes a lot of things much faster, as well as more efficient, and you won't
Xrun into the barrier of 25 ships max in orbit around every planet.
X	Alterations in some algorithms make it impossible (well, hopefully) 
Xfor ships to be in two lists at once, or in the wrong list.
X	Build no longer tries to load stuff onto new ships.
X	Build also lets you examine a ship (same as the examine command)
Xbefore you build it, so new people can figure out what it does.
X	Load used to not check for the other ship overflowing its 
Xbounds; I fixed this since you could load a whole colony onto an
Xexplorer.  You can, however, load as many resource points as you want.
X	We now have Space Amoebae, (ever play a game called Amoeba Wars?)
Xwhich wander randomly around the universe, digesting planets.
X	Planets are now moved in their orbits before ships are moved;
Xthis makes them more efficient in interplanetary navigation.  
X	New ship type: toxic waste canister, which reduces your toxicity
Xof the planet you build it on-- but what do you do with all the canisters?
X	more new ships: ground and space telescopes.  ground telescopes are
Xway cheap and have a much lower tech, while space telescopes cost more
Xbut have a longer range.  range is proportional to your tech.  These
Xwere put in so people don't have to send ships out blindly.  Once you've
Xsurveyed someplace with one of these, you can then map and 'cs' to it.
X	the bug in 'fire', that allowed people to survey any planet by
Xpretending to fire at it, should be gone.
X
X
X	Many thanks to Steven Grimm (koreth@ssyx), without whose help
Xin the early stages of the game, development would not have been possible,
Xand Evan Schaffer admin of ssyx, whose tolerance of huge CPU usages by a lowly
Xundergrad making a game is greatly appreciated.
X
X
X	Rob Chansky
X	smq@ucscb.ucsc.edu
X	smq@ssyx.ucsc.edu
X	...!ucbvax!ucscc!ssyx!smq
X	...!ucbvax!ucscc!ucscb!smq
X
END_OF_FILE
if test 6256 -ne `wc -c <'Docs/notes.doc'`; then
    echo shar: \"'Docs/notes.doc'\" unpacked with wrong size!
fi
# end of 'Docs/notes.doc'
fi
if test -f 'Docs/oldfire.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Docs/oldfire.doc'\"
else
echo shar: Extracting \"'Docs/oldfire.doc'\" \(4029 characters\)
sed "s/^X//" >'Docs/oldfire.doc' <<'END_OF_FILE'
XFIRE			Galactic Bloodshed			FIRE
X
X
XNAME
X  [1] fire -- shoot at an enemy planet or ship
X
XSYNOPSIS
X       fire 
X
XDESCRIPTION
X  Fire attempts to use stockpiled destructive capacity from one place,
Xto give damage to another.
X
X  Fire will prompt the user for both.  The damage given is proportional to
Xthe amount of destructive capacity used, and inversely proportional to
Xthe distance between them and the armor class (if the defender is a ship) of
Xthe victim ship.
X
X  If the object being fired upon is a planet fire will prompt for a sector 
Xat which to aim; If the object being fired from is a planet, fire will ask for
Xa sector from which to fire (this must be a sector owned by the player, for
Xthe target will attempt to fire back if it can).  The player will be informed
Xhow badly damaged the target is (if this is a planet, the number of sectors
Xdestroyed.) Badly damaged sectors can be rendered uninhabitable for some time.
XThe blast radius on the target planet is inversely proportional to the 
Xstrength of the shot and the distance between attacker and target.  Sectors
Xthat are mobilized will be damaged to a lesser extent; a 100% mobilized
Xsector will be damaged 1/2 as much as a 0% mobilized sector.
X
X  At this point the target will attempt to fire back at the originating
Xarea (ship or sector) with twice the strength of the attacking player, if
Xit can.  If more then one player inhabits a planet, each player that was
Xaffected by the attack, and does not belong to the attacking player,
Xwill attempt to return fire at twice the attacking strength.
X
X
XSEE ALSO
X  tactical, mobilize
X>From VANCLEEF@MPS.OHIO-STATE.EDU Sun Nov 12 14:26:40 1989
XReceived: from ohstpy.mps.ohio-state.edu by ucscb.UCSC.EDU (5.61/1.34)
X	id AA12847; Sun, 12 Nov 89 14:26:24 -0800
XMessage-Id: <8911122226.AA12847@ucscb.UCSC.EDU>
XDate: Sun, 12 Nov 89 17:25 EST
XFrom: VANCLEEF@MPS.OHIO-STATE.EDU
XSubject: fire description
XTo: smq@ucscb.UCSC.EDU
XX-Vms-To: IN%"smq@ucscb.ucsc.edu"
XStatus: RO
X
X
Xplease send me the original files and not the shar file.
Xit makes it much more difficult to incorporate these changes
Xfor me. we will still converge on the same results either
Xway.
X
Xi have the new fire routine which has been tested and works quite well.
X
Xhere is how is works.
X
Xa player fires N guns at another ship. basically, each gun is
Xevaluated whether it has hit or missed. after this damage is evaluated.
X
Xhere is how i calculate the number of hits (N being the maximum).
X
Xthere several factors which are taken into consideration:
X
X1: the size of the target, bigger targets are easier to hit
X		(represented by body = Shipdata[type][ABIL_TARGET])
X
X2: the speed of the target and the speed of the firing ship
X
X3: whether or not evasive maneuvers have been ordered by either
X	ship (these represent erratic motions of the ships
X		ordered to make the ship harder to hit)
X
X4: the range to the target, the farther away it is the harder it
X	is to land a hit.
X
Xbasically a ship at 0 range should get hit by everything and a ship
X	infinitely away gets 0 hits.
X
Xthe hit probability/shot goes like this
X
Xhit prob = 100 / (1 + (r/factor)^2)
X
Xas r->0 hit prob = 100 and as r->infty hit prob = 0.
X
Xthe square factor is a normal field of view dispersion ("radiation law")
X
Xwhat is factor? factor is the range where the hit prob = 50%
X
Xthis is what we calculate with the other factors involved.
X
Xfactor = 20 * body /(1+firing ship evades)/(1+target evades)
X		/(1+target speed+firing speed).
X
Xmotion by either ship affects the hit probability adversely
X(including evasiove actions which is 1 (yes) or 0.
X
Xa hit percentage is evaluated and each ship and the number of hits is computed.
X
Xthe damage to the ship is then evaluated
X
Xdamage = 30 * (hits - armor) / body.
X
Xthe armor factor (Shipdata[type][ABIL_ARMOR]) represent how many
Xhits a ship can take per salvo without suffering any damage.
Xif hits > armor, the ships takes damage.
X
Xthe amount of % damage a ship takes depends on the size of the
Xvessel. a bigger ship gets less percentage damage than a small ship.
X
X
END_OF_FILE
if test 4029 -ne `wc -c <'Docs/oldfire.doc'`; then
    echo shar: \"'Docs/oldfire.doc'\" unpacked with wrong size!
fi
# end of 'Docs/oldfire.doc'
fi
if test -f 'Docs/order.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Docs/order.doc'\"
else
echo shar: Extracting \"'Docs/order.doc'\" \(5829 characters\)
sed "s/^X//" >'Docs/order.doc' <<'END_OF_FILE'
XORDER			Galactic Bloodshed			ORDER
X
X
XNAME
X  [1] order -- give ships standing orders
X
XSYNTAX
X  order <shipnumber or shiptypes> <order> <arguments...>
X
XDESCRIPTION
X  ``order'' gives standing orders to the ship specified.  A list of ship 
Xtypes can also be used instead of a ship number. This will order all ships 
Xof the designated types in the same level the same. For example, 
X'order dBC <orders...>' will order all destroyers, battleships, and 
Xcruisers in the current scope.
X
X  Certain ships cannot be given certain orders; The program will notify
Xthe user of illegal orders.
X
X If no shipnumber is specified, the program will list the orders of all ships
Xin the current ship. If a shipnumber is specified, but no other arguments are
Xgiven, the orders for that ship will be displayed.
X
X
X  Currently the orders that can be changed are:
X
X
X  destination -- The ship will attempt to move towards the star/planet/ship
X	specified.  This order cannot be changed for ships that are landed
X	or docked. 
X	Syntax: order <shipnumber> destination <destination>
X
X
X  speed -- Change the speed of a ship. All speed factors are between 0 and 4.
X	Higher speeds used fuel less efficiently than lower speeds.
X	Syntax: order <shipnumber> speed <speed factor>
X
X  jump -- This orders the ship to activate it's hyper-space engines in order to
X	jump to another star system. The ship cannot be ordered to navigate when
X	the engines are activated. In order to use the hyperspace jump, the engines
X	must reach a charge level of 1, then the ship is 'ready'. When the engines
X	are activated and charge is complete, the ship will automatically jump
X	to the destination system (specified with order). Ships that do not have
X	hyper-drive may not use this option. Jumps cost fuel. Specifically, it
X	costs ship_mass * (distance_to_destination_star/10000)^2.
X	Syntax: order jump <on or off>
X
X  bombard -- if bombard is on and the ship is in orbit around a planet,
X	the ship will fire at the planet, targetting at sectors belonging to
X	players indicated in that player's war status.  If no such sectors 
X	exist, it will fire at sectors belonging to neutral status players.
X	Attackes occur during updates.
X	Syntax: order <shipnumber> bombard <on or off>
X	
X
X
X  on and off -- Many devices have an on/off switch to activate or deactivate
X	them.
X	Syntax: order <shipnumber> <on or off>
X
X  aim -- Change the ship/object 'aimed at'.  There are several ship
X	types that can do this, with a different effect for each.
X	For instance, Space Mirrors can be focussed at an object in the
X	same system or 2000 distance away at a cost of 0.3 fuel for 
X	maneuvering.) Ships being focused on will take a certain amount
X	of damage per turn, and planets will experience a temperature change
X	corresponding to the intensity.
X	Syntax: order <shipnumber> aim <target>
X
X    intensity -- change degree of focus for a space mirror.
X	Syntax: order <shipnumber> intensity <new intensity>
X
X    transport -- this sets the target device for a transporter.
X	Syntax: order <shipnumber> transport <target device>
X
X    evade -- this orders a ship to be performing evasive maneauvers. Although
X	this makes a ship, when moving, harder to hit, it also uses up
X	twice as much fuel as normal.
X	Syntax: order <shipnumber> evade <on or off>
X
X    retaliate -- normally, if a ship is attacked and suffers damage, it
X	and all ships assigned to protect will immediately retaliate
X	with one salvo against the violating ships. A ship can also
X	be order *not* to retaliate
X	Syntax: order <shipnumber> retaliate <on or off>
X
X    navigate -- while this is on the destination described above is 
X	ignored and instead, the ship will travel in the direction
X	specified by the course. The directions are specified with
X	degrees between 0 and 360 where 0 is 'up', 90 is 'right',
X	180 is 'down' etc. You must also specify the number of turns
X	to do the maneuver. After every move the turn count is decremented
X	one until it becomes zero. After the maneuver the navigate
X	setting is automatically turned off and if a destination
X	has been set the ship will then proceed in that direction.
X	Syntax: order <shipnumber> navigate <course> <turns>
X
X    protect -- this allows a ship to protect another ship. Suppose, for
X	example, ship A is set to protect ship B. If another ship C
X	fires at B then both B *and* A will retaliate. This allows
X	players to design their own defense networks. If no argument is
X	specified protect will be turned off.
X	Syntax: order <shipnumber> protect <ship to protect>
X
X
X    defense -- If this is set 'on' it will retaliate
X	if the planet that it is in orbit around or landed on is
X	attacked. If it is set 'off' the ship will not retaliate if
X	its host planet is attacked.
X	Syntax: order <shipnumber> defense <on or off>
X
X    switch -- Turn mines and transporters on or off.
X	Syntax: order <shipnumber> switch
X
X    explosive -- If the ship is a mine, this command sets it to be in explosive 
X	mode which can damage ships.
X	Syntax: order <shipnumber> explosive
X
X    radiative --  Similar to the previous command.  Radiation mines incapacitate 
X	ships caught in the trigger radius.
X	Syntax: order <shipnumber> radiative
X
X    move  -- If the ship is a terraforming device, the direction it
X	is to move across the planet.  This must be two integers, given as
X	'x,y' where x and y is one of (-1,0,1).
X	Syntax: order <shipnumber> move <x> <y>
X
X    trigger -- If the ship is a mine the trigger radius can be specified.
X	Syntax: order <shipnumber> trigger <trigger radius>
X
X
X
X  Action Points are deducted from the root and each star.  No more than
Xthe normal AP cost will be deducted from the root or each star, no matter
Xhow many ships' orders are changed in each.
X
X  Ships that are landed or docked, or have no crew and are not robotic
Xships, cannot be given orders.
X
X
X
XSEE ALSO
X scope, actionpoints
X
X
END_OF_FILE
if test 5829 -ne `wc -c <'Docs/order.doc'`; then
    echo shar: \"'Docs/order.doc'\" unpacked with wrong size!
fi
# end of 'Docs/order.doc'
fi
if test -f 'server/declare.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'server/declare.c'\"
else
echo shar: Extracting \"'server/declare.c'\" \(5176 characters\)
sed "s/^X//" >'server/declare.c' <<'END_OF_FILE'
X/* 
X** Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
X** smq@ucscb.ucsc.edu, mods by people in GB_copyright.h.
X** Restrictions in GB_copyright.h.
X** declare.c -- declare alliance, neutrality, war, the basic thing.
X*/
X
X#include "GB_copyright.h"
X#define EXTERN extern
X#include "vars.h"
X#include "races.h"
X#include "buffers.h"
X#include <signal.h>
X#include <ctype.h>
Xint declare_racedata;
X
X/* invite people to join your alliance block */
Xinvite(Playernum, APcount, argn, args, mode)
Xint Playernum;
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
Xint mode;
X{
Xracetype *alien;
Xint n;
X
X GetPlayer(args[1], &n, &alien);
X   if (n == -1) {
X	sprintf(buf,"No such player.\n");
X		notify(Playernum, buf);
X	return;
X   }
X
Xif(n==Playernum) {
X	notify(Playernum, "Not needed, you are the leader.\n");
X	return;
X	}
X
X  free(Race);
X  openracedata(&declare_racedata); 
X  getrace(declare_racedata, &Race, Playernum);	
X  close_file(declare_racedata);
X
Xif(mode) {
X	setbit(Blocks[Playernum-1].invite, n);
X	sprintf(buf, "%s [%d] has invited you to join %s\n", Race->name, 
X			Playernum, Blocks[Playernum-1].name);
X	notify(n, buf);
X	push_message(TELEG_PLAYER_AUTO, n, buf);
X	sprintf(buf, "%s has been invited to join %s\n", alien->name,
X		Blocks[Playernum-1].name);
X	notify(Playernum, buf);
X    } else {
X	clrbit(Blocks[Playernum-1].invite, n);
X	sprintf(buf, "%s [%d] has retracted the invitation from %s\n", Race->name,
X			Playernum, Blocks[Playernum-1].name);
X	notify(n, buf);
X	push_message(TELEG_PLAYER_AUTO, n, buf);
X	sprintf(buf, "%s has been blackballed from %s\n", alien->name,
X		Blocks[Playernum-1].name);
X	notify(Playernum, buf);
X}
X
XPutblock(Blocks);
X}
X
X/* declare that you wish to be included in the alliance block */
Xpledge(Playernum, APcount, argn, args, mode)
Xint Playernum;
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
Xint mode;
X{
Xracetype *alien;
Xint n;
X
X  GetPlayer(args[1], &n, &alien);
X   if (n == -1) {
X	sprintf(buf,"No such player.\n");
X		notify(Playernum, buf);
X	return;
X   }
X
Xif(n==Playernum) {
X	notify(Playernum, "Not needed, you are the leader.\n");
X	return;
X	}
X
X if(mode) {
X	setbit(Blocks[n-1].pledge, Playernum);
X	sprintf(buf, "%s [%d] has pledged %s.\n", Race->name, 
X			Playernum, Blocks[n-1].name);
X	notify(n, buf);
X	push_message(TELEG_PLAYER_AUTO, n, buf);
X	sprintf(buf, "You have pledged allegiance to %s.\n",
X                  Blocks[n-1].name);
X	notify(Playernum, buf);
X    } else {
X	clrbit(Blocks[n-1].pledge, Playernum);
X	sprintf(buf, "%s [%d] has quit %s.\n", Race->name,
X			Playernum, Blocks[n-1].name);
X	notify(n, buf);
X	push_message(TELEG_PLAYER_AUTO, n, buf);
X	sprintf(buf, "You have quit %s\n", Blocks[n-1].name);
X	notify(Playernum, buf);
X    }
X
XPutblock(Blocks);
X}
X
Xdeclare(Playernum,APcount, argn,args)
Xint Playernum;
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
X{
Xchar str[RNAMESIZE];
Xracetype *alien;
Xint n;
X
X     /* look in sdata for APs first */
X   if (Sdata.AP[Playernum] >= APcount)  /* enufAPs would print something */
X	   deductAPs(Playernum,APcount, 0, 1);
X     /* otherwise use current star */
X   else if (Dir[Playernum-1].level==LEVEL_STAR || Dir[Playernum-1].level==LEVEL_PLAN) {
X       if (enufAP(Playernum,Stars[Dir[Playernum-1].snum]->AP[Playernum-1], APcount) )
X	   deductAPs(Playernum,APcount, Dir[Playernum-1].snum, 0);
X   } else {
X	   sprintf(buf,"You don't have enough AP's (%d)\n",APcount);
X		notify(Playernum, buf);
X	return;
X   }
X
X  GetPlayer(args[1], &n, &alien);
X   if (n == -1) {
X	sprintf(buf,"No such player.\n");
X		notify(Playernum, buf);
X	return;
X   }
X
X  free(Race);
X	openracedata(&declare_racedata); 
X  getrace(declare_racedata, &Race, Playernum);	
X	close_file(declare_racedata);
X
X   switch (*args[2]) {
X	case 'a':
X		setbit(Race->allied, n);
X		clrbit(Race->atwar, n);
X		if (int_rand(0,100) >= 96)
X			{
X			sprintf(buf,"But would you want your sister to marry one?\n");
X				notify(Playernum, buf);
X		} else {
X			sprintf(buf,"Good for you.\n");
X				notify(Playernum, buf);
X			}
X
X		sprintf(buf," Player #%d (%s) has declared an alliance with you!\n",
X			Playernum,Race->name);
X			notify(n, buf);
X		push_message(TELEG_PLAYER_AUTO, n, buf);
X		break;
X	case 'n':
X		clrbit(Race->allied, n);
X		clrbit(Race->atwar, n);
X		sprintf(buf,"Done.\n");
X			notify(Playernum, buf);
X
X		sprintf(buf," Player #%d (%s) has declared neutrality with you!\n",Playernum,Race->name);
X			notify(n, buf);
X		push_message(TELEG_PLAYER_AUTO, n, buf);
X		break;
X	case 'w':
X		setbit(Race->atwar, n);
X		clrbit(Race->allied, n);
X		if (int_rand(0,100) >= 96) {
X			sprintf(buf, "Your enemies flaunt their secondary male reproductive glands in your\ngeneral direction.\n");
X				notify(Playernum, buf);
X		} else {
X			sprintf(buf, "Give 'em hell!\n");
X				notify(Playernum, buf);
X			}
X
X		sprintf(buf," Player #%d (%s) has declared war against you!\n",Playernum,Race->name);
X			notify(n, buf);
X		push_message(TELEG_PLAYER_AUTO, n, buf);
X
X		break;
X	default:
X		return;
X		break;
X   }
X/* They, of course, learn more about you */
Xalien->translate[Playernum-1] = MIN(alien->translate[Playernum-1]+30, 100);
X
Xopenracedata(&declare_racedata);
Xputrace(declare_racedata, alien);
Xputrace(declare_racedata, Race);
Xclose_file(declare_racedata);
X}
X
X
END_OF_FILE
if test 5176 -ne `wc -c <'server/declare.c'`; then
    echo shar: \"'server/declare.c'\" unpacked with wrong size!
fi
# end of 'server/declare.c'
fi
if test -f 'server/launch.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'server/launch.c'\"
else
echo shar: Extracting \"'server/launch.c'\" \(6074 characters\)
sed "s/^X//" >'server/launch.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h.
X * Restrictions in GB_copyright.h.
X *
X *  launch.c -- launch or undock a ship (also undock)
X */
X
X#include "GB_copyright.h"
X#define EXTERN extern
X#include "vars.h"
X#include "ships.h"
X#include "buffers.h"
X#include <signal.h>
X
X
Xint launch_shdata,launch_pdata,launch_stdata;
X
Xlaunch(Playernum,APcount, argn,args)
Xint Playernum;
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
X{
Xint sh, sh2, sh3;
Xshiptype *s,*s2,*s3;
Xplanettype *p;
Xboolean planet=0;
Xint shipno;
Xfloat fuel;
X
Xlaunch_shdata = launch_pdata = NEUTRAL_FD;
X
X	sscanf(args[1]+(args[1][0]=='#'),"%d",&shipno);
X
X  openshdata(&launch_shdata);
X  if (!getship(launch_shdata, &s, shipno)) {
X      close_file(launch_shdata);
X      return;
X  }
Xclose_file(launch_shdata);
X
X
X  if (s->owner!=Playernum) {
X	DontOwnErr(Playernum,shipno);
X	return;
X  }
X  if (!speed_rating(s)) {
X	sprintf(buf,"That ship is not designed to be launched.\n");
X		notify(Playernum, buf);
X	return;
X  }
X
X
X  if (testship(Playernum,s,shipno)) {
X	return;
X	}
X
X  if (!s->is_docked) {
X	sprintf(buf,"Ship #%d is not landed or docked.\n",shipno);
X		notify(Playernum, buf);
X	return;
X  }
X  if (s->whatdest==LEVEL_PLAN && s->resource > Max_resource(s)) {
X	sprintf(buf,"Ship #%d is too overloaded to launch.\n", shipno);
X		notify(Playernum, buf);
X	return;
X  }
X
X  if (s->whatdest==LEVEL_SHIP) {
X      openshdata(&launch_shdata);
X	(void)getship(launch_shdata, &s2, s->destshipno);
X      close_file(launch_shdata);
X  	if (s2->whatorbits==LEVEL_UNIV) {
X	  if (!enufAP(Playernum,Sdata.AP[Playernum-1], APcount)) { 
X		return;
X	 } else
X  		deductAPs(Playernum,APcount, 0, 1);
X  	} else {
X	  if (!enufAP(Playernum,Stars[s->storbits]->AP[Playernum-1], APcount)) {
X		return;
X	  } else
X  		deductAPs(Playernum,APcount, s->storbits, 0);
X	}
X
X	if( !(s->type == STYPE_FIGHTER && s2->type == STYPE_CARRIER) )
X		{
X	s->is_docked = 0;
X	s->whatdest = LEVEL_UNIV;
X	sh2 = s->destshipno;
X	s->destshipno = 0;
X	openshdata(&launch_shdata);
X	putship(launch_shdata, s, shipno);
X
X	s2->is_docked = 0;
X	s2->whatdest = LEVEL_UNIV;
X	s2->destshipno = 0;
X	putship(launch_shdata, s2, sh2);
X	close_file(launch_shdata);
X	free(s);
X	free(s2);
X		} else {   /* fighters docked with carriers */
X
X	/* fix carrier linked list */
X	sh = s2->object.number;
X	if(sh == shipno) {
X		s2->object.number = s->object.number;
X		} else {
Xopenshdata(&launch_shdata);
X	while(sh != shipno) {
X
X		(void)getship(launch_shdata, &s3, sh);
X	sh3 = sh;
X	sh = s3->object.number;
X		}
X
X	s3->object.number = s->object.number; /* change pointer */
X	putship(launch_shdata, s3, sh3);
X	close_file(launch_shdata);
X    }
X
X	/* fighter is on its own */
X	s->is_docked = 0;
X	s->whatdest = LEVEL_UNIV;
X	s->whatorbits = s2->whatorbits;
X	s->object.number = 0;
X	s->object.number4 = 0;
X	sh2 = s->destshipno;
X	s->destshipno = 0;
X	s->xpos = s2->xpos;
X	s->ypos = s2->ypos;
X	s->storbits = s2->storbits;
X	s->pnumorbits = s2->pnumorbits;
X
X	s2->mass -= s->mass; /* carrier is lighter */
X	s2->object.number4 -= 1;
X/* put fighter into the appropriate linked list (planet/star/universe).
X   it is put into the level of the carrier */
X
X	if(s2->whatorbits==LEVEL_PLAN)
X	{
X  
X  openpdata(&launch_pdata);
X  getplanet(launch_pdata, &p, Stars[s2->storbits]->planetpos[s2->pnumorbits]);
X	s->nextship = p->ships;
X	p->ships = shipno;
X  putplanet(launch_pdata,p,Stars[s2->storbits]->planetpos[s2->pnumorbits]);
X  	close_file(launch_pdata);
X	}
X	if(s2->whatorbits==LEVEL_STAR)
X	{
X  openstardata(&launch_stdata);
X  getstar(launch_stdata, &Stars[s2->storbits],s2->storbits);
X	s->nextship = Stars[s2->storbits]->ships;
X	Stars[s2->storbits]->ships = shipno;
X  putstar(launch_stdata, Stars[s2->storbits],s2->storbits);
X	close_file(launch_stdata);
X	}
X
X	openshdata(&launch_shdata);
X	putship(launch_shdata, s, shipno);
X	putship(launch_shdata, s2, sh2);
X	close_file(launch_shdata);
X
X	free(s);
X	free(s2);
X	free(s3);
X			}
X
X
X	sprintf(buf,"%s #%d undocked from %s #%d.\n", 
X		Shipnames[s->type], shipno, Shipnames[s2->type],sh2);
X		notify(Playernum, buf);
X
X  } else {
X
X	  if (!enufAP(Playernum,Stars[s->storbits]->AP[Playernum-1], APcount)) { 
X		return;
X	  } else
X  		deductAPs(Playernum,APcount, s->storbits, 0);
X
X  s->is_docked = 0;
X  s->whatdest = LEVEL_UNIV;	/* no destination */
X
X
X	/* adjust x,ypos to absolute coords */
X  openpdata(&launch_pdata);
X  getplanet(launch_pdata, &p, Stars[s->storbits]->planetpos[s->pnumorbits]);
X  close_file(launch_pdata);
X
X  sprintf(buf,"Planet /%s/%s has gravity field of %.2f\n", Stars[s->storbits]->name,
X	Stars[s->storbits]->pnames[s->pnumorbits], gravity(p));
X		notify(Playernum, buf);
X   /* alter sector location of ship x,y to stellar coords x,y */
X  s->xpos = Stars[s->storbits]->xpos + p->xpos + 
X		(float)int_rand((int)(-DIST_TO_LAND/4),(int)(DIST_TO_LAND/4));
X  s->ypos = Stars[s->storbits]->ypos + p->ypos + 
X		(float)int_rand((int)(-DIST_TO_LAND/4),(int)(DIST_TO_LAND/4));
X
X   /* subtract fuel from ship */
X  fuel = gravity(p) * s->mass * LAUNCH_GRAV_MASS_FACTOR;
X  if (s->fuel < fuel) {
X	sprintf(buf,"Ship #%d does not have enough fuel! (%.1f)\n",shipno, fuel);
X		notify(Playernum, buf);
X	return;
X  }
X  s->fuel -= fuel;
X  s->mass -= fuel * MASS_FUEL;
X
X
X  if (s->type == OTYPE_CANIST)
X	s->object.number = 80;	/* canister dissapates after 20 turns */
X
X  s->notified = 0;
Xopenshdata(&launch_shdata);
X	  putship(launch_shdata, s, shipno);
X  close_file(launch_shdata);
X
X  if (!p->is_explored) {
X		/* not yet explored by owner; space exploration causes the
X		   player to see a whole map */
X	p->is_explored = 1;
Xopenpdata(&launch_pdata);
X  	putplanet(launch_pdata,p,Stars[s->storbits]->planetpos[s->pnumorbits]);
X  	close_file(launch_pdata);
X  }
X  free(p);
X
X  sprintf(buf,"%s #%d %s launched from planet,", Shipnames[s->type], shipno, s->name);
X		notify(Playernum, buf);
X  sprintf(buf," using %.1f fuel.\n",fuel);
X 		notify(Playernum, buf);
X if (s->type == OTYPE_CANIST) {
X		notify(Playernum, buf);
X	sprintf(buf, "A thick cloud of dust envelops your planet.\n");
X		notify(Playernum, buf); 
X	}
X
X  free(s);
X
X  }
X
X}
X
X
END_OF_FILE
if test 6074 -ne `wc -c <'server/launch.c'`; then
    echo shar: \"'server/launch.c'\" unpacked with wrong size!
fi
# end of 'server/launch.c'
fi
if test -f 'server/map.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'server/map.c'\"
else
echo shar: Extracting \"'server/map.c'\" \(5409 characters\)
sed "s/^X//" >'server/map.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h.
X * Restrictions in GB_copyright.h.
X *
X *  map.c -- display sector map of current planet
X */
X
X#define DISP_DATA 1
X
X#include "GB_copyright.h"
X#define EXTERN extern
X#include "vars.h"
X#include "ships.h"
X#include "races.h"
X#include <curses.h>
Xextern float compatibility();
Xchar desshow();
X
Xint map_racedata;
X
Xmap(Playernum,APcount, argn,args)
Xint Playernum;
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
X{
Xregister int i;
Xint map_pdata,inv,flag;
Xplanettype *p;
Xplacetype where;
X
X   where = Getplace(Playernum, args[1],0);
X
X   if (where.err) return;
X
X   if (where.level==LEVEL_PLAN) {
X  
X  	openpdata(&map_pdata);
X  	getplanet(map_pdata,&p,Stars[where.snum]->planetpos[where.pnum]);
X  	close_file(map_pdata);
X 
X  	show_map(Playernum, where.snum, where.pnum, p, DISP_DATA, 0);	
X					/* 0 is begin iq*/
X
X  	free(p);
X
X	if (Stars[where.snum]->stability > 50)
X		notify(Playernum, "WARNING! This planet's primary is unstable.\n");
X
X   } else {
X	orbit(Playernum, APcount, argn,args);	/* make orbit map instead */
X   }
X
X}
X
X
X
Xshow_map(Playernum, snum, pnum, p, show,iq)
Xint Playernum;
Xint snum, pnum;
Xplanettype *p;
Xint show;
Xint iq;
X{
Xreg int x,y,i,f,address,owned1;
Xboolean cap_inv;
Xint sh,map_sectdata,map_shdata;
Xshiptype *s;
Xchar shiplocs[MAX_X][MAX_Y];
Xshiptype **ships;
Xhugestr output;
Xchar temp[1024], buf[1024];
X
X  bzero((char *)shiplocs, sizeof(shiplocs));
X
X  opensectdata(&map_sectdata);
X  getsmap(map_sectdata, Smap, p);
X  close_file(map_sectdata);
X   /* traverse ship list on planet; find out if we can look at 
X       ships here. */
X	iq |= p->info[Playernum-1].numsectsowned;
X	sh = p->ships;
X	
X  openshdata(&map_shdata);
X ships = (shiptype **)malloc((Numships(map_shdata)+1) * sizeof(shiptype *) );
X		while (sh) {
X
X		(void)getship(map_shdata,&ships[sh], sh);
X
X				/* need crew to sight, except for probes*/
X		if(ships[sh]->owner == Playernum && 
X			(ships[sh]->popn || (ships[sh]->type==OTYPE_PROBE)
X				|| (ships[sh]->type == OTYPE_VN))) 
X		  iq = 1;
X		sh = ships[sh]->nextship;
X	}
Xclose_file(map_shdata);
X	if (iq) {
X  	  sh = p->ships;
X	  while (sh) {
X		s = ships[sh]; 
X      		if (s->is_alive && s->is_docked && (s->whatdest==LEVEL_PLAN))
X			if( (s->xpos < p->Maxx) && (s->xpos >= 0.0) &&
X			(s->ypos < p->Maxy) && (s->ypos >= 0.0) )
X		  shiplocs[(int)s->xpos][(int)s->ypos] = Shipltrs[s->type];
X
X		sh = s->nextship;
X		free(s); 
X	  }
X	}
X   free(ships);
X
X  close_file(map_shdata);
X
X/* report that this is a planet map */
X	sprintf(output, "$");
X
X	sprintf(buf, "%s;", Stars[snum]->pnames[pnum]);	
X	str_cat(output, buf);
X
X	sprintf(buf, "%d;%d;%d;", p->Maxx, p->Maxy,show);
X	str_cat(output, buf);
X
X	free(Race);
X	openracedata(&map_racedata);
X	getrace(map_racedata, &Race, Playernum);
X	close_file(map_racedata);
X
X/* send map data */
X for(y=0; y<p->Maxy; y++)
X     for (x=0; x<p->Maxx; x++) {
X	owned1 = (Sector(*p,x,y).owner==Playernum);
X	if (shiplocs[x][y]) {
X		if(owned1 && Race->inverse)
X			sprintf(buf,"1%c", shiplocs[x][y]);
X		else
X			sprintf(buf,"0%c", shiplocs[x][y]);
X		} else {
X		if(owned1 && Race->inverse)
X	    		sprintf(buf,"1%c", desshow(Playernum, p,x,y, Race));
X		else
X	    		sprintf(buf,"0%c", desshow(Playernum, p,x,y, Race));
X		}
X	str_cat(output, buf);
X     }
X
Xnotify(Playernum, output);
X
X     if (show){
X
X	sprintf(temp, "    Sects %s: %u", Race->Thing ? "covered" : "owned", 
X			p->info[Playernum-1].numsectsowned);
X	sprintf(buf, "  Aliens:");
X	str_cat(temp, buf);
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			   sprintf(buf, "%c%d", isset(Race->atwar,i) ? '*' : ' ', i);
X			    str_cat(temp, buf);
X			}
X		  if (!f) str_cat(temp, "(none)");
X	  } else {
X		str_cat(temp, "???");
X	}
Xstr_cat(temp, "\n");
Xnotify(Playernum, temp);
X
X       sprintf(temp, "      Mobilization : %3d (%3d)     Compatibility: %.2f%%",
X		p->info[Playernum-1].comread,
X		p->info[Playernum-1].mob_set,
X		compatibility(p,Race));
X       if(p->conditions[TOXIC]>50) {
X	       sprintf(buf,"    (%d%% TOXIC)",p->conditions[TOXIC]);
X		str_cat(temp, buf);
X		}
X
Xstr_cat(temp, "\n");
Xnotify(Playernum, temp);
X
X       sprintf(temp, "Resource stockpile : %-9u    Fuel stockpile: %u\n",
X		p->info[Playernum-1].resource,
X		p->info[Playernum-1].fuel);
Xnotify(Playernum, temp);
X
X       sprintf(temp, "      Destruct cap : %u%26s: %u (%u)\n",p->info[Playernum-1].destruct,
X				Race->Thing ? "Tons of biomass" : "Total Population", p->popn, 
X		round_rand(.01*(100.-p->conditions[TOXIC])*p->maxpopn) );
X
Xnotify(Playernum, temp);
X }
X
X}
X
X
X
Xchar desshow(Playernum, p,x,y,r)
Xint Playernum;
Xreg planettype *p;
Xreg int x,y;
Xracetype *r;
X{
Xreg sectortype *s;
X
Xs = &Sector(*p,x,y);
X
Xif (s->VN)
X	return Shipltrs[OTYPE_VN];
X
Xif(s->owner && !r->geography)
X	if(!r->inverse || s->owner != Playernum)
X		if(!r->double_digits)
X			return s->owner %10 + '0'; 
X		else {
X			if (s->owner < 10 || x % 2)
X				return s->owner % 10 + '0';
X			else
X				return s->owner / 10 + '0';
X			}
X
X   if (s->is_wasted) 
X	return CHAR_WASTELAND;
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_PLATED: return CHAR_PLATED;
X     	case DES_ICE: return CHAR_ICE;
X     	default: return('!');
X   }
X
X
X}
X
END_OF_FILE
if test 5409 -ne `wc -c <'server/map.c'`; then
    echo shar: \"'server/map.c'\" unpacked with wrong size!
fi
# end of 'server/map.c'
fi
if test -f 'server/shlmisc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'server/shlmisc.c'\"
else
echo shar: Extracting \"'server/shlmisc.c'\" \(5735 characters\)
sed "s/^X//" >'server/shlmisc.c' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h.
X * Restrictions in GB_copyright.h.
X *
X *  miscellaneous stuff included in the shell
X */
X
X#include "GB_copyright.h"
X#define EXTERN extern
X#include "vars.h"
X#include "races.h"
X#include "ships.h"
X#include "buffers.h"
X#include <curses.h>
X#include <signal.h>
X#include <ctype.h>
X#include <stdio.h>
Xint shl_racedata;
X
XDontOwnErr(Playernum,shipno)
Xint Playernum;
Xreg int shipno;
X{
X  sprintf(buf,"You don't own ship #%d.\n",shipno);
X	notify(Playernum, buf);
X}
X
X
Xint enufAP(Playernum,AP, x)
Xunsigned short AP;
Xreg int x;
X{
X reg int blah;
X
X if (blah = (AP < x) ) {
X	sprintf(buf,"You don't have %d action points there.\n", x);
X 	notify(Playernum, buf);
X}
X return (!blah);
X}
X
X
Xint Getracenum(login)
Xreg char *login;
X{
X reg int i = 0;
X char s[LOGIN_NAME_SIZE];
X FILE *fd;
X
X fd = fopen(PLAYERDATAFL, "r");
X s[0] = '\0';
X
X while (!feof(fd) && strcmp(s,login) ) {
X   i++;
X   fscanf(fd,"%s",s);
X }
X fclose(fd);
X return( (strcmp(s,login)) ? 0 : i );
X}
X
X
X/* returns player # from string containing that players name or #. */
X
XGetPlayer(name, rnum, race)
Xchar *name;
Xint *rnum;
Xracetype **race;
X{
Xint numraces;
Xregister int i,l;
X
X	numraces = Numraces();
X	*rnum = 0;
X
X	if (isdigit(*name)) {
X		if ( (*rnum = atoi(name)) < 1 || *rnum > numraces) {
X			*rnum = -1;
X			return;
X		} else {
X	openracedata(&shl_racedata);
X			getrace(shl_racedata, race, *rnum);
X	close_file(shl_racedata);
X			return;
X		}
X	} else {
X		l = strlen(name);
X	openracedata(&shl_racedata);
X		for (i=1; !(*rnum) && i<=numraces; i++) {
X			getrace(shl_racedata, race, i);
X			if (!strncmp(name, (*race)->name, l)) {
X				*rnum = i;
X			close_file(shl_racedata);
X				return;
X			} else
X				free(*race);
X		}
X	close_file(shl_racedata);
X		*rnum = -1;
X	}
X}
X
Xint allocateAPs(Playernum, APcount, argn, args)
Xint Playernum;
Xint APcount;
Xint argn;
Xchar args[MAXARGS][COMMANDSIZE];
X{
Xint maxalloc,stardatafile,mask;
Xint alloc;
X
Xif(Dir[Playernum-1].level == LEVEL_UNIV)
X  {
X   sprintf(buf,"Change scope to the system you which to transfer global APs to.\n");
X	notify(Playernum, buf);
X   return;
X  }
Xalloc = atoi(args[1]);
Xif(alloc <= 0) {
X    notify(Playernum, "You must specify a positive amount of APs to allocate.\n");
X    return;
X}
X
Xopenstardata(&stardatafile);
Xgetsdata(stardatafile,&Sdata);
Xmaxalloc = MIN(Sdata.AP[Playernum-1],LIMIT_APs-
X		Stars[Dir[Playernum-1].snum]->AP[Playernum-1]);
Xif(alloc>maxalloc)
X  {
X    sprintf(buf,"Illegal value (%d) - maximum = %d\n", alloc,maxalloc);
X	notify(Playernum, buf);
X    close_file(stardatafile);
X    return;
X    }
XSdata.AP[Playernum-1] -= alloc;
X     putsdata(stardatafile,&Sdata);
X     getstar(stardatafile, &Stars[Dir[Playernum-1].snum], Dir[Playernum-1].snum);
XStars[Dir[Playernum-1].snum]->AP[Playernum-1] = MIN(99,Stars[Dir[Playernum-1].snum]->AP[Playernum-1]
X				      +alloc);
X     putstar(stardatafile, Stars[Dir[Playernum-1].snum], Dir[Playernum-1].snum);
X  close_file(stardatafile);
X	sprintf(buf,"Allocated\n");
X	notify(Playernum, buf);
X}
X
X
Xint deductAPs(Playernum, n, snum, sdata)
Xint n, snum, Playernum;
Xint sdata;	/* whether or not sdata is involved */
X{
X int deductAPs_stardata, mask;
X
X if (n) {
X
X  openstardata(&deductAPs_stardata);
X
X  if (!sdata) {
X      free(Stars[snum]);
X      getstar(deductAPs_stardata, &Stars[snum], snum);
X
X     if (Stars[snum]->AP[Playernum-1] >= n)
X	     Stars[snum]->AP[Playernum-1] -= n;
X     else {
X	Stars[snum]->AP[Playernum-1] = 0;
X	sprintf(buf,"WHOA!  You cheater!  Oooohh!  OOOOH!\n  I'm tellllllllliiiiiiinnnnnnnnnggggggggg!!!!!!!\n");
X		notify(Playernum, buf);
X     }
X
X     putstar(deductAPs_stardata, Stars[snum], snum);
X
X     if (Dir[Playernum-1].level!=LEVEL_UNIV && Dir[Playernum-1].snum == snum) {
X         /* fix the prompt */
X       sprintf(Dir[Playernum-1].prompt + 5, "%02d", Stars[snum]->AP[Playernum-1]);
X       Dir[Playernum-1].prompt[7] = ']';		/* fix bracket (made '\0' by sprintf)*/
X     }
X  } else {
X     getsdata(deductAPs_stardata,&Sdata);
X     Sdata.AP[Playernum-1] -= n;
X     	if (Sdata.AP[Playernum-1] < 0)
X	     Sdata.AP[Playernum-1] = 0;
X     putsdata(deductAPs_stardata,&Sdata);
X
X     if (Dir[Playernum-1].level==LEVEL_UNIV) {
X       sprintf(Dir[Playernum-1].prompt + 2, "%02d", Sdata.AP[Playernum-1]);
X       Dir[Playernum-1].prompt[3] = ']';
X     }
X  }
X  close_file(deductAPs_stardata);
X }
X
X}
X
Xvoid dots(i)
Xreg int i;
X{
Xreg int j;
X
X  for (j=0; j<i; j++)
X	putchar('.');
X  for (j=0; j<i; j++)
X	putchar('\010');	/* ^H */
X}
X
X
X
X/* tty stuff -- set cbreak mode */
Xtty_on()
X{
X#ifdef VER_4_3
X	cbreak();
X#else			/* this is 4.2 */
X 	crmode();
X#endif
X
X}
X
Xtty_off()
X{
X#ifdef VER_4_3
X	nocbreak();
X#else
X	nocrmode();
X#endif
X}
X
X
X/* lists all ships in current scope for debugging purposes */
Xlist(Playernum)
Xint Playernum;
X{
Xshiptype *ship;
Xplanettype *p;
Xint sh;
Xint fix_stardata, fix_shdata, fix_pdata, fix_sectdata;
X 
X switch(Dir[Playernum-1].level) {
X    case LEVEL_UNIV:
X	sh = Sdata.ships;
X	break;
X    case LEVEL_STAR:
X	openstardata(&fix_stardata);
X	getstar(fix_stardata, &Stars[Dir[Playernum-1].snum], Dir[Playernum-1].snum);
X	close_file(fix_stardata);
X	sh = Stars[Dir[Playernum-1].snum]->ships;
X	break;
X    case LEVEL_PLAN:
X	openpdata(&fix_pdata);
X	getplanet(fix_pdata, &p, Stars[Dir[Playernum-1].snum]->planetpos[Dir[Playernum-1].pnum]);
X	close_file(fix_pdata);
X	sh = p->ships;
X	break;
X    case LEVEL_SHIP:
X	sh = Dir[Playernum-1].shipno;
X	break;
X }
X
X openshdata(&fix_shdata);
X
X while (sh) {
X	getship(fix_shdata,&ship,sh);
X
X	sprintf(buf, "%15s #%d '%s' (pl %d) -> #%d %s\n",Shipnames[ship->type],
X		sh,ship->name,ship->owner,ship->nextship,
X		ship->is_alive ? "" : "(dead)");
X	notify(Playernum, buf);
X	sh = ship->nextship;
X	free(ship);
X }
X
X close_file(fix_shdata);
X
X}
X
X
END_OF_FILE
if test 5735 -ne `wc -c <'server/shlmisc.c'`; then
    echo shar: \"'server/shlmisc.c'\" unpacked with wrong size!
fi
# end of 'server/shlmisc.c'
fi
if test -f 'server/tweakables.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'server/tweakables.h'\"
else
echo shar: Extracting \"'server/tweakables.h'\" \(5933 characters\)
sed "s/^X//" >'server/tweakables.h' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
X * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
X * Restrictions in GB.c.
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 
X
X#define DEFAULT_UPDATE_TIME 4		/* update time (hours) */
X
X
X#define NO_EXCL 0
X#define EXCL 1		/* tells fileread() whether to apply an exclusive
X			   file lock on the data file being read.  (flock only)
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 256
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_LAND 		'*'
X#define CHAR_SEA 		'.'
X#define CHAR_MOUNT 		'^'
X#define CHAR_DIFFOWNED 		'?'
X#define CHAR_PLATED 		'o'
X#define CHAR_WASTELAND 		'%'
X#define CHAR_GAS 		'~'
X#define CHAR_CLOAKED 		' '
X#define CHAR_ICE		'#'
X
X#define NAMESIZE 18
X#define RNAMESIZE 35
X#define PLACENAMESIZE (NAMESIZE + NAMESIZE + 13)
X#define NUMSTARS 100
X#define MAXPLANETS 10
X#define BITS_MAXPLANETS 4	/* # bits required to represent MAXPLANETS*/
X/*#define MAXMOONS 3*/
X
X
X#define MAX_X 45	/* 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	2000
X#define PLORBITSIZE	50
X
X
X#define AUTO_TELEG_SIZE		2000
X#define UNTRANS_MSG		"[ ? ]"
X/*#define TELEG_TRANS_APCOST	1*/
X#define TELEG_TRANS_RPCOST	5
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 VN_RES_TAKE	0.5	/* amt of resource of a sector the VN's take */
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.02		/* fuel use per ship mass pt. per speed
X				   factor */
X
X#define REPAIR_RATE 25.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 25
X			       /* # of people/fert pt sector supports*/
X#define EFF_PROD 		0.20		/* production of effcncy/pop*/
X#define RESOURCE_PRODUCTION 	0.00008 /* adjust these to change prod*/
X#define FUEL_PRODUCTION		0.00004
X
X#define DEST_PRODUCTION 	0.00008
X#define POPN_PROD		0.3
X
X#define HYPER_DRIVE_READY_CHARGE 1
X#define HYPER_DRIVE_FUEL_USE 1.0
X#define HYPER_DIST_FACTOR 20000.
X
X#define TECH_INVEST		0.10	/* invest factor */
X
X#define MOB_COST		0.010   /* mobiliz.c, doplanet.c cost/mob points*/
X/*#define RESOURCE_DEPLETION 	0.015 */
X#define RESOURCE_DEPLETION      0.0
X#define FACTOR_MOBPROD 		0.06	/* mobilization production/person */
X
X#define FUEL_COST_TERRA		3	/* cost to terraform */
X
X#define PLAN_FIRE_LIM		20	/* max fire strength from planets */
X
X#define TECH_SEE_STABILITY 15	/* min tech to see star stability */
X
X#define TECH_EXPLORE 	   10	/* min tech to see your whole planet */
X
X#define ENVIR_DAMAGE_TOX	70
X	/* min tox to damage planet */
X
X#define PLANETGRAVCONST 	0.05
X#define SYSTEMGRAVCONST 	150000.0
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 		2.0
X#define FACTOR_DESTPLANET 	0.35
X
X	/* various compiler options that may save cpu time/disk space */
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#define SHIP_MOVE_SCALE 1.0
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))
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#define TYPE_WATER	5
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 999
X
X#define TOXMAX		20	/* max a toxwc can hold */
X
X#define SIGBLOCKS (SIGHUP|SIGTERM|SIGINT|SIGQUIT|SIGSTOP|SIGTSTP)
X				/* signals to block... */
X
X#define Bzero(x)  bzero( (char *)&(x), sizeof(x) )
X#define Malloc(x) (x *)malloc( sizeof(x) )
X
X
X#define _STDLIB_H	/* for compiling on NeXt machines */
X
X
X
X
X
X
END_OF_FILE
if test 5933 -ne `wc -c <'server/tweakables.h'`; then
    echo shar: \"'server/tweakables.h'\" unpacked with wrong size!
fi
# end of 'server/tweakables.h'
fi
if test -f 'server/vars.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'server/vars.h'\"
else
echo shar: Extracting \"'server/vars.h'\" \(5792 characters\)
sed "s/^X//" >'server/vars.h' <<'END_OF_FILE'
X/*
X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
X * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
X * Restrictions in GB.c.
X * vars.h --
X *  main bunch of variables 
X */
X
X#include "files.h"
X#include "tweakables.h"
X#include <sys/types.h>
X#include <sys/file.h>
X#include <stdio.h>
X
X#define LEVEL_UNIV 0
X#define LEVEL_STAR 1
X#define LEVEL_PLAN 2
X#define LEVEL_SHIP 3
X
X#define MAXPLAYERS 32
X#define BITS_MAXPLAYERS 5	/* # bits req'd to represent (MAXPLAYERS-1) */
X
X#define MAXSTRLEN 2047
X#define HUGESTRLEN (2*MAXSTRLEN+1)
X#define SMALLSTR 31
X
Xtypedef hugestr[HUGESTRLEN];
X
Xtypedef unsigned char percent;
Xtypedef unsigned long ul;
Xtypedef unsigned short us;
Xtypedef char boolean;
X
Xlong random();
X
Xtypedef struct sector sectortype;
Xtypedef struct planet planettype;
Xtypedef struct star startype;
X
Xstruct plinfo {				/* planetary stockpiles */
X      unsigned short fuel;		/* fuel for powering things */
X      unsigned short destruct;   	/* destructive potential */
X      unsigned short resource;		/* resources in storage */
X      unsigned short numsectsowned;
X
X      unsigned comread : 7;		/* combat readiness (mobilization)*/
X      unsigned explored : 1;		/* 1 bit: explored by each player */
X      unsigned mob_set : 7;		/* mobilization target */
X      unsigned autorep : 1;		/* player wants autoreport */
X      unsigned tech_invest : 7;		/* amt of res. to spend on tech */
X      unsigned spied_on : 1;		/* spied on */
X      unsigned tox_thresh : 7;		/* min to build a waste can */
X      unsigned dummy : 1;	/* dummy bit for development */
X
X      unsigned int unused;     /* more dummy bits for development */
X  };
X
Xstruct sector {
X    percent eff;		/* efficiency (0-100) */
X    percent fert;		/* max popn is proportional to this */
X    percent mobilization;	/* percent popn is mobilized for war */
X    percent resource;	
X
X    unsigned short popn;
X    unsigned des : 3;		/* kind of land the place is */
X    unsigned owner : BITS_MAXPLAYERS;	/* owner of place */
X    unsigned is_wasted : 1;	/* 1 bit: is a wasted sector */
X    unsigned VN : 1;		/* has a VN machine on it */
X    unsigned dummy : 6; /* extra bits for development */
X};
X
X
Xstruct planet {
X    float xpos,ypos;		/* x,y relative to orbit */
X    short conditions[TOXIC+1];  /* atmospheric conditions for terraforming */
X    unsigned short ships;       /* first ship in orbit (to be changed) */
X    percent Maxx,Maxy;		/* size of map */
X    int sectormappos;		/* file posn for sector map */
X
X    struct plinfo info[MAXPLAYERS]; 	/* planetary stockpiles */
X
X    unsigned int popn;
X    unsigned int maxpopn;			/* maximum population */
X
X    unsigned type : 3;		/* what type planet is */
X    unsigned expltimer : 3;	/* timer for explorations */
X    unsigned is_explored : 1;	/* is explored by owner */
X    unsigned is_sheep : 1;	/* 1 bit: is emotion suppressed */
X    unsigned slaved_to : BITS_MAXPLAYERS;	/* owner of place */
X    unsigned dummy : 19;	/* dummy bits for development */
X};
X
Xstruct star {
X    char name[NAMESIZE];	/* name of star */
X    percent numplanets;		/* # of planets in star system */
X    char pnames[MAXPLANETS][NAMESIZE]; /* names of planets */
X    int planetpos[MAXPLANETS]; 		/* file posns of planets */
X    unsigned int explored; 	/* who's been here 32 bits*/
X    unsigned int inhabited;	/* who lives here now 32 bits*/
X    percent stability;		/* how close to nova it is */
X    unsigned short ships;			/* 1st ship in orbit */
X    percent AP[MAXPLAYERS];	/* action pts alotted */
X    unsigned nova_stage : 4;		/* stage of nova */
X    unsigned temperature : 4;  /* factor which expresses how hot the star is */
X    percent dummy;		/* dummy bits for development */
X    float gravity;		/* attraction of star in "Standards". */
X    float xpos,ypos;
X};
X
X
X
X	/* this data will all be read at once */
Xstruct stardata {
X    int numstars;		/* # of stars */
X    unsigned short ships;		/* 1st ship in orbit */
X    percent AP[MAXPLAYERS];	/* Action pts for each player */
X    unsigned short VN_hitlist[MAXPLAYERS];	 
X			/* # of ships destroyed by each player */
X    percent VN_index1[MAXPLAYERS];
X    percent VN_index2[MAXPLAYERS];	/* VN's record of destroyed ships
X					   systems where they bought it */
X};
X
XEXTERN struct stardata Sdata;
X
Xstruct directory {
X    unsigned level : 2;	 /* what directory level */
X    unsigned int gag : 1;/* whether or not to display login/logout messages */
X    int snum;		/* what star system obj # (level=0) */
X    int pnum;		/* number of planet */
X    int shipno;		/* # of ship */
X    char prompt[3*NAMESIZE+5];	/* just to be safe */
X    float lastx[2], lasty[2], zoom[2];	/* last coords for zoom */
X};
X
XEXTERN struct directory Dir[MAXPLAYERS];
X
XEXTERN sectortype Smap[(MAX_X+1)*(MAX_Y+1) + 1];
X
Xextern float powscale(),logscale(),float_rand(),gravity();
Xchar *malloc();
X
XEXTERN boolean Nuked[MAXPLAYERS];
XEXTERN boolean StarsInhab[NUMSTARS];
XEXTERN startype *Stars[NUMSTARS];
XEXTERN unsigned short Sdatanumships[MAXPLAYERS];
XEXTERN unsigned int Sdatapopns[MAXPLAYERS];
XEXTERN unsigned short starnumships[NUMSTARS][MAXPLAYERS];
XEXTERN unsigned int starpopns[NUMSTARS][MAXPLAYERS];
X
XEXTERN int tot_resdep, prod_eff, prod_res[MAXPLAYERS];
XEXTERN int prod_fuel[MAXPLAYERS], prod_destruct[MAXPLAYERS];
XEXTERN int tot_captured, prod_mob, populations[MAXPLAYERS];
XEXTERN float avg_mob[MAXPLAYERS];
XEXTERN char sects_gained[MAXPLAYERS], sects_lost[MAXPLAYERS];
XEXTERN boolean Claims;
X
XEXTERN planettype *planets[NUMSTARS][MAXPLANETS];
XEXTERN float Compat[MAXPLAYERS];
XEXTERN int Num_races, Num_ships;
X
XEXTERN int Two[32];	/* powers of 2 for bit operations */
X
X/* bit routines stolen from UNIX <sys/param.h> */
X#define	setbit(a,i)	((a) |= Two[(i)-1])
X#define	clrbit(a,i)	((a) &= ~Two[(i)-1])
X#define	isset(a,i)	((a) & Two[(i)-1])
X#define	isclr(a,i)	(((a) & Two[(i)-1]) == 0)
X
END_OF_FILE
if test 5792 -ne `wc -c <'server/vars.h'`; then
    echo shar: \"'server/vars.h'\" unpacked with wrong size!
fi
# end of 'server/vars.h'
fi
echo shar: End of archive 10 \(of 14\).
cp /dev/null ark10isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 14 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0