home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!news.tek.com!master!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v17i033: gbp - Galactic Bloodshed+, an empire-like war game, Part21/21
- Message-ID: <4561@master.CNA.TEK.COM>
- Date: 12 Feb 93 17:33:57 GMT
- Sender: news@master.CNA.TEK.COM
- Lines: 1653
- Approved: billr@saab.CNA.TEK.COM
- Xref: uunet comp.sources.games:1712
-
- Submitted-by: deragon@harpo.cs.nyu.edu (Seeker)
- Posting-number: Volume 17, Issue 33
- Archive-name: gbp/Part21
- Supersedes: gb3: Volume 10, Issue 1-14
- Environment: sockets, curses
-
-
-
- #! /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 21 (of 21)."
- # Contents: doc/racegen.README hdrs/GB_copyright.h
- # hdrs/TinyMUD_copyright.h hdrs/doturn.h hdrs/files.h
- # hdrs/game_info.h hdrs/power.h misc/Makefile.SH misc/ship.dat
- # server/files.c server/files_rw.c server/get4args.c
- # server/moveplanet.c server/rand.c user/OBJECTS user/SOURCES
- # user/autoreport.c user/capital.c user/guardian.c user/help.c
- # user/relation.c user/sche.c user/tech.c user/toxi.c user/zoom.c
- # Wrapped by billr@saab on Fri Feb 12 09:14:33 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'doc/racegen.README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'doc/racegen.README'\"
- else
- echo shar: Extracting \"'doc/racegen.README'\" \(848 characters\)
- sed "s/^X//" >'doc/racegen.README' <<'END_OF_FILE'
- X
- XRacegen is a program to construct races for Galactic Bloodshed. It is
- Xavailable at pooh.caltech.edu in the /src/games/gb directory as
- Xracegen.shar. (For detail on how to get and compile racegen, see
- Xracegen.novice-info. If you do not have this file, ask your game host
- Xfor it.)
- X
- XThe easiest way to learn how to use racegen is to use it. Start it
- Xup. Type, "help" to see more info on the available commands. The
- Xmain command you will use is "modify". Try modifying a few things:
- X"modify fight 6", "modify name Demons", "modify pass whatnot". You
- Xcan save races ("save") and work on them later ("load"); you can also
- Xprint what the screen shows to files. When you are done with your
- Xrace, typing "send" will dispatch it to whatever address is found in
- Xgame_info.h as TO.
- X
- XFor more information on what racial attributes mean, see races.doc.
- END_OF_FILE
- if test 848 -ne `wc -c <'doc/racegen.README'`; then
- echo shar: \"'doc/racegen.README'\" unpacked with wrong size!
- fi
- # end of 'doc/racegen.README'
- fi
- if test -f 'hdrs/GB_copyright.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'hdrs/GB_copyright.h'\"
- else
- echo shar: Extracting \"'hdrs/GB_copyright.h'\" \(1198 characters\)
- sed "s/^X//" >'hdrs/GB_copyright.h' <<'END_OF_FILE'
- X/*
- X * Galactic Bloodshed, copyright (c) 1989 1990 by Robert P. Chansky,
- X * smq@ucscb.ucsc.edu, Univ of Ca Santa Cruz.
- X * You may copy, alter and distribute this game as you please as
- X * long as these notices remain intact. No duplication for
- X * commercial purposes without permission of the author.
- X *
- X * Version 1.0 - current mods by:
- X * Garrett Van Cleef, Ph.D
- X * Dept. of Physics
- X * Ohio State University
- X * V1.1 playtesting by:
- X * Hanan Baddar
- X * Ken Bloch
- X * John Davis
- X * Robert Jones
- X * Menelaos Kafkaladis
- X * Brett Lowry
- X * Paul Murphy
- X * Garrett van Cleef
- X * Wolfgang Wenzel
- X * and
- X * tons of people
- X * at U.C. Santa Cruz
- X *
- X *
- X * Special thanks to Jeff Wallace(jeffw@swindle.berkeley.edu) for helping
- X * get some major client problems straightened out (1.3.2).
- X * Major amounts of help in v2.0-current by Brian Scearce
- X * (bls@u02.svl.cdc.com).
- X */
- X
- X /* This release is now called GB+. It is an offshoot of Galactic Bloodshed
- X * maintained by the GBDT (Galactic Bloodshed Development Team.
- X *
- X * Please send any information/bugs/suggestions/comments to:
- X * gbdt@dumbo.cray.com
- X *
- X */
- X
- END_OF_FILE
- if test 1198 -ne `wc -c <'hdrs/GB_copyright.h'`; then
- echo shar: \"'hdrs/GB_copyright.h'\" unpacked with wrong size!
- fi
- # end of 'hdrs/GB_copyright.h'
- fi
- if test -f 'hdrs/TinyMUD_copyright.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'hdrs/TinyMUD_copyright.h'\"
- else
- echo shar: Extracting \"'hdrs/TinyMUD_copyright.h'\" \(1413 characters\)
- sed "s/^X//" >'hdrs/TinyMUD_copyright.h' <<'END_OF_FILE'
- X/* -*-C-*-
- X
- XCopyright (c) 1989 by David Applegate, James Aspnes, Timothy Freeman,
- X and Bennet Yee.
- X
- XThis material was developed by the above-mentioned authors.
- XPermission to copy this software, to redistribute it, and to use it
- Xfor any purpose is granted, subject to the following restrictions and
- Xunderstandings.
- X
- X1. Any copy made of this software must include this copyright notice
- Xin full.
- X
- X2. Users of this software agree to make their best efforts (a) to
- Xreturn to the above-mentioned authors any improvements or extensions
- Xthat they make, so that these may be included in future releases; and
- X(b) to inform the authors of noteworthy uses of this software.
- X
- X3. All materials developed as a consequence of the use of this
- Xsoftware shall duly acknowledge such use, in accordance with the usual
- Xstandards of acknowledging credit in academic research.
- X
- X4. The authors have made no warrantee or representation that the
- Xoperation of this software will be error-free, and the authors are
- Xunder no obligation to provide any services, by way of maintenance,
- Xupdate, or otherwise.
- X
- X5. In conjunction with products arising from the use of this material,
- Xthere shall be no use of the names of the authors, of Carnegie-Mellon
- XUniversity, nor of any adaptation thereof in any advertising,
- Xpromotional, or sales literature without prior written consent from
- Xthe authors and Carnegie-Mellon University in each case. */
- X
- END_OF_FILE
- if test 1413 -ne `wc -c <'hdrs/TinyMUD_copyright.h'`; then
- echo shar: \"'hdrs/TinyMUD_copyright.h'\" unpacked with wrong size!
- fi
- # end of 'hdrs/TinyMUD_copyright.h'
- fi
- if test -f 'hdrs/doturn.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'hdrs/doturn.h'\"
- else
- echo shar: Extracting \"'hdrs/doturn.h'\" \(778 characters\)
- sed "s/^X//" >'hdrs/doturn.h' <<'END_OF_FILE'
- X#ident "@(#)doturn.h 1.2 12/15/92 "
- 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 * doturn.h -- various turn things we are keeping track of.
- X * Galactic Bloodshed by Robert Chansky
- X */
- X
- X
- Xstruct stinfo {
- X short temp_add; /* addition to temperature to each planet */
- X unsigned char Thing_add;
- X /* new Thing colony on this planet */
- X unsigned char inhab; /* explored by anybody */
- X unsigned char intimidated; /* assault platform is here */
- X};
- X
- XEXTERN struct stinfo Stinfo[NUMSTARS][MAXPLANETS];
- X
- Xstruct sectinfo {
- X char explored; /* sector has been explored */
- X unsigned char done; /* this sector has been updated */
- X};
- X
- XEXTERN struct sectinfo Sectinfo[MAX_X][MAX_Y];
- END_OF_FILE
- if test 778 -ne `wc -c <'hdrs/doturn.h'`; then
- echo shar: \"'hdrs/doturn.h'\" unpacked with wrong size!
- fi
- # end of 'hdrs/doturn.h'
- fi
- if test -f 'hdrs/files.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'hdrs/files.h'\"
- else
- echo shar: Extracting \"'hdrs/files.h'\" \(1955 characters\)
- sed "s/^X//" >'hdrs/files.h' <<'END_OF_FILE'
- X/*
- X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, { * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
- X * Restrictions in GB.c.
- X *
- X * files.h
- X * This file was produced by running the files.h.SH script, which
- X * gets its values from config.sh, which is generally produced by
- X * running Configure.
- X *
- X * Feel free to modify any of this as the need arises. Note, however,
- X * that running files.h.SH again will wipe out any changes you've made.
- X * For a more permanent change edit config.h.SH.
- X */
- X#ident "@(#)files.h.SH 1.2 12/15/92 "
- X
- X#define PATH(file) "/var/tmp/GB/"#file
- X#define DATA(file) PATH(Data/file)
- X#define NEWS(file) PATH(News/file)
- X#define TELE(file) PATH(Tele/file)
- X#define LOG(file) PATH(Logs/file)
- X
- X#define PATHLEN 200 /* length of file paths to the game.. */
- X
- X#define CUTE_MESSAGE "\nThe Galactic News\n\n"
- X#define DECLARATION 0 /* news file index */
- X#define TRANSFER 1
- X#define COMBAT 2
- X#define ANNOUNCE 3
- X
- X#define DATADIR Files[0]
- X#define DOCSDIR Files[1]
- X#define EXAM_FL Files[2]
- X#define ENROLL_FL Files[3]
- X#define STARDATAFL Files[4]
- X#define SECTORDATAFL Files[5]
- X#define PLANETDATAFL Files[6]
- X#define RACEDATAFL Files[7]
- X#define BLOCKDATAFL Files[8]
- X#define SHIPDATAFL Files[9]
- X#define SHIPFREEDATAFL Files[10]
- X#define DUMMYFL Files[11]
- X#define PLAYERDATAFL Files[12]
- X#define TELEGRAMDIR Files[13]
- X#define TELEGRAMFL Files[14]
- X#define POWFL Files[15]
- X#define NEWSDIR Files[16]
- X#define DECLARATIONFL Files[17]
- X#define TRANSFERFL Files[18]
- X#define COMBATFL Files[19]
- X#define ANNOUNCEFL Files[20]
- X#define COMMODDATAFL Files[21]
- X#define COMMODFREEDATAFL Files[22]
- X#define UPDATEFL Files[23]
- X#define SEGMENTFL Files[24]
- X#define ERRLOG Files[25]
- X#define USLOG Files[26]
- X#define UPLOG Files[27]
- X
- X#define PLANETLIST PATH(planet.list)
- X#define STARLIST PATH(star.list)
- X
- X#define NOGOFL PATH(nogo)
- X#define ADDRESSFL PATH(Addresses)
- X
- Xextern char *Files[];
- X/* END OF FILES.H */
- END_OF_FILE
- if test 1955 -ne `wc -c <'hdrs/files.h'`; then
- echo shar: \"'hdrs/files.h'\" unpacked with wrong size!
- fi
- # end of 'hdrs/files.h'
- fi
- if test -f 'hdrs/game_info.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'hdrs/game_info.h'\"
- else
- echo shar: Extracting \"'hdrs/game_info.h'\" \(1231 characters\)
- sed "s/^X//" >'hdrs/game_info.h' <<'END_OF_FILE'
- X/* game_info.h - game-variable parameters for compiling racegen
- X */
- X
- X/**************
- X * Game dependencies. These will likely change for each game.
- X */
- X#define DEADLINE "Not Given"
- X#define GAME "Pooh"
- X#define GB_VERSION "Standard GB 5.0"
- X#define LOCATION "pooh.berkeley.edu 2010"
- X#define MODERATOR "Garrett VanCleef"
- X#define PLAYERS "63"
- X#define STARS "100"
- X#define STARTS "Tentative"
- X#define TO "vancleef@pooh.caltech.edu"
- X#define UPDATE_SCH "\
- X2 updates/day (12:00 am and pm PST) until 12:00 am Friday, Oct 4.\n\
- X6 updates/day (12am/4/8/12pm/4/8 PST) through the weekend; then\n\
- X2 updates/day again for the first week; and finally,\n\
- X1 update/day (9 pm PST) thereafter."
- X#define OTHER_STUFF "\n\
- XThis is still a preliminary version of racegen. Sending from this\n\
- Xprogram will NOT get you into the Pooh game. (I would enjoy seeing\n\
- Xthe races you make, though.) You will know that this is the final\n\
- XPooh racegen when you see vancleef@blah.blah.edu as the address that\n\
- Xraces are being sent to.\n"
- X
- X
- X/**************
- X * Racegen options.
- X */
- X#define COVARIANCES
- X#define STARTING_POINTS 1100
- X#define MIN_PASSWORD_LENGTH 4
- X/* #define TRADITIONAL_RACES */
- X#define DEFAULT_MESO_IQ_LIMIT 180
- END_OF_FILE
- if test 1231 -ne `wc -c <'hdrs/game_info.h'`; then
- echo shar: \"'hdrs/game_info.h'\" unpacked with wrong size!
- fi
- # end of 'hdrs/game_info.h'
- fi
- if test -f 'hdrs/power.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'hdrs/power.h'\"
- else
- echo shar: Extracting \"'hdrs/power.h'\" \(717 characters\)
- sed "s/^X//" >'hdrs/power.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 */
- X
- X /* for power report */
- X
- Xstruct power {
- X unsigned long troops; /* total troops */
- X unsigned long popn; /* total population */
- X unsigned long resource; /* total resource in stock */
- X unsigned long fuel;
- X unsigned long destruct; /* total dest in stock */
- X unsigned short ships_owned; /* # of ships owned */
- X unsigned short planets_owned;
- X unsigned long sectors_owned;
- X unsigned long money;
- X unsigned long sum_mob; /* total mobilization */
- X unsigned long sum_eff; /* total efficiency */
- X};
- X
- XEXTERN struct power Power[MAXPLAYERS];
- END_OF_FILE
- if test 717 -ne `wc -c <'hdrs/power.h'`; then
- echo shar: \"'hdrs/power.h'\" unpacked with wrong size!
- fi
- # end of 'hdrs/power.h'
- fi
- if test -f 'misc/Makefile.SH' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'misc/Makefile.SH'\"
- else
- echo shar: Extracting \"'misc/Makefile.SH'\" \(1098 characters\)
- sed "s/^X//" >'misc/Makefile.SH' <<'END_OF_FILE'
- Xcase $CONFIG in
- X'')
- X if test ! -f config.sh; then
- X ln ../config.sh . || \
- X ln ../../config.sh . || \
- X ln ../../../config.sh . || \
- X (echo "Can't find config.sh."; exit 1)
- X fi
- X . ./config.sh
- X ;;
- Xesac
- Xcase "$0" in
- X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
- Xesac
- X
- Xecho "Extracting misc/Makefile (with variable substitutions)"
- Xcat >Makefile <<!GROK!THIS!
- X#
- X# misc level Makefile for the GB+ program
- X# This makefile will make the commands library routines
- X#
- X# Bug reports, patches, comments, suggestions should be sent to:
- X#
- X# John Deragon deragon@jethro.cs.nyu.edu
- X#
- X# Revision 1.0 92/12/10 jpd
- X#
- X#
- X# Variables
- X# Variables established by Configure
- XTOUCH = $touch
- X
- X!GROK!THIS!
- X
- Xcat >>Makefile <<'!NO!SUBS!'
- X
- X# Variables you may want to manually edit
- X# If you want debug logging then you'll
- X# want to uncomment the following.
- X# Other general variables
- XBIN = ../bin
- XSHELL = /bin/sh
- X
- Xall: install
- X
- Xinstall:
- X install daemon.txt $(BIN)
- X install help.txt $(BIN)
- X install welcome.txt $(BIN)
- X install planet.list ..
- X install star.list ..
- X install exam.dat ..
- X install ship.dat ..
- X
- X!NO!SUBS!
- END_OF_FILE
- if test 1098 -ne `wc -c <'misc/Makefile.SH'`; then
- echo shar: \"'misc/Makefile.SH'\" unpacked with wrong size!
- fi
- # end of 'misc/Makefile.SH'
- fi
- if test -f 'misc/ship.dat' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'misc/ship.dat'\"
- else
- echo shar: Extracting \"'misc/ship.dat'\" \(1164 characters\)
- sed "s/^X//" >'misc/ship.dat' <<'END_OF_FILE'
- XSpore pod
- X~
- XShuttle
- X~
- XComsat
- X~
- XBattleship
- X~
- XDestroyer
- X~
- XFighter
- X~
- XCargo ship
- X~
- X \_|_/
- X ---|---
- X | |
- X \ | | | /
- X \| | |/
- X | |
- X | |
- X | / | \ |
- X-+-| --+-- |-+-
- X | \ | / |
- X | |
- X /| | |\
- X | | | | |
- X \| | |/
- X | |
- X -[ _ ]-
- X ^ ^
- XExplorer
- X~
- XTanker
- X~
- XStation
- X~
- X ___ Control center-\\___ __
- X __ / _| ____ / \____ ____ // Phased-meson phalanx
- X>==\ / // | =/ \!! !! !! !!/^ / \= / \=
- X\---------------------------------------------------
- X | [] [] [] [] [] [] [] [] [] []| <-- fighter bays
- X/---------------------------------------------------
- X>==/=\____/ !! ! !! !!! ! ! !!!! !! !! !\____/=
- X--- _//
- X H2 missles
- XOrbital Assault Platform
- X~
- XDreadnaught
- X~
- XMithril Ship
- X~
- XCrystal Ship
- X~
- XGODSHIP
- X~
- X |
- X \-|-/
- X--|-=-|--
- X /-|-\
- X |
- XSpace mine
- X~
- XSpace mirror
- X~
- XAtmosphere processor
- X~
- XCanister of dust
- X~
- XV.Neumann machine
- X~
- XPlanet bomb
- X~
- Xcloaking device
- X~
- Xemotion suppressor
- X~
- XAmulet of Yendor
- X~
- Xbiological weapon
- X~
- Xgamma ray laser
- X~
- XSpace Amoeba
- X~
- Xaudio-vibatory-physio-molecular transport device
- X~
- END_OF_FILE
- if test 1164 -ne `wc -c <'misc/ship.dat'`; then
- echo shar: \"'misc/ship.dat'\" unpacked with wrong size!
- fi
- # end of 'misc/ship.dat'
- fi
- if test -f 'server/files.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'server/files.c'\"
- else
- echo shar: Extracting \"'server/files.c'\" \(681 characters\)
- sed "s/^X//" >'server/files.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. Restrictions in
- X * GB._copyright.h.
- X */
- X
- X#include "GB_copyright.h"
- X#include "files.h"
- X
- Xchar *Files[] = {
- X PATH(Data),
- X PATH(Docs),
- X PATH(exam.dat),
- X PATH(enroll.dat),
- X DATA(star),
- X DATA(sector),
- X DATA(planet),
- X DATA(race),
- X DATA(block),
- X DATA(ship),
- X DATA(shipfree),
- X DATA(dummy),
- X DATA(players),
- X PATH(Tele),
- X TELE(tele),
- X DATA(power),
- X PATH(News),
- X NEWS(declaration),
- X NEWS(transfer),
- X NEWS(combat),
- X NEWS(announce),
- X DATA(commod),
- X DATA(commodfree),
- X DATA(Update.time),
- X DATA(Segment.time),
- X LOG(error.log),
- X LOG(user.log),
- X LOG(update.log)
- X};
- END_OF_FILE
- if test 681 -ne `wc -c <'server/files.c'`; then
- echo shar: \"'server/files.c'\" unpacked with wrong size!
- fi
- # end of 'server/files.c'
- fi
- if test -f 'server/files_rw.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'server/files_rw.c'\"
- else
- echo shar: Extracting \"'server/files_rw.c'\" \(1123 characters\)
- sed "s/^X//" >'server/files_rw.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. Restrictions in
- X * GB_copyright.h. disk input/output routines
- X *
- X * Fileread(p, num, file, posn, routine); -- generic file read Filewrite(p, num,
- X * file, posn, routine); -- generic file write
- X *
- X */
- X
- X#include <errno.h>
- X#include <signal.h>
- X#include <sys/file.h>
- X
- X#include "GB_copyright.h"
- X#define EXTERN extern
- X#include "vars.h"
- X#include "files.h"
- X#include "buffers.h"
- X
- Xint sys_nerr;
- X
- Xextern char *sys_errlist[];
- Xextern int errno;
- X
- Xvoid Fileread(int, char *, int, int);
- Xvoid Filewrite(int, char *, int, int);
- X
- Xvoid
- XFileread(int fd, char *p, int num, int posn)
- X{
- X int n2;
- X
- X if (lseek(fd, posn, L_SET) < 0) {
- X perror("Fileread 1");
- X return;
- X }
- X if ((n2 = read(fd, p, num)) != num) {
- X perror("Fileread 2");
- X }
- X}
- X
- Xvoid
- XFilewrite(int fd, char *p, int num, int posn)
- X{
- X int n2;
- X
- X if (lseek(fd, posn, L_SET) < 0) {
- X perror("Filewrite 1");
- X return;
- X }
- X if ((n2 = write(fd, p, num)) != num) {
- X perror("Filewrite 2");
- X return;
- X }
- X}
- END_OF_FILE
- if test 1123 -ne `wc -c <'server/files_rw.c'`; then
- echo shar: \"'server/files_rw.c'\" unpacked with wrong size!
- fi
- # end of 'server/files_rw.c'
- fi
- if test -f 'server/get4args.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'server/get4args.c'\"
- else
- echo shar: Extracting \"'server/get4args.c'\" \(750 characters\)
- sed "s/^X//" >'server/get4args.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. Restrictions in
- X * GB_copyright.h.
- X *
- X */
- X
- X#include "GB_copyright.h"
- X
- Xvoid get4args(char *, int *, int *, int *, int *);
- X
- Xvoid
- Xget4args(char *s, int *xl, int *xh, int *yl, int *yh)
- X{
- X char *p, s1[17], s2[17];
- X p = s;
- X
- X sscanf(p, "%[^,]", s1);
- X while ((*p != ':') && (*p != ','))
- X p++;
- X if (*p == ':') {
- X sscanf(s1, "%d:%d", xl, xh);
- X while (*p != ',')
- X p++;
- X } else if (*p == ',') {
- X sscanf(s1, "%d", xl);
- X *xh = (*xl);
- X }
- X sscanf(p, "%s", s2);
- X while ((*p != ':') && (*p != '\0'))
- X p++;
- X if (*p == ':') {
- X sscanf(s2, ",%d:%d", yl, yh);
- X } else {
- X sscanf(s2, ",%d,", yl);
- X *yh = (*yl);
- X }
- X
- X}
- END_OF_FILE
- if test 750 -ne `wc -c <'server/get4args.c'`; then
- echo shar: \"'server/get4args.c'\" unpacked with wrong size!
- fi
- # end of 'server/get4args.c'
- fi
- if test -f 'server/moveplanet.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'server/moveplanet.c'\"
- else
- echo shar: Extracting \"'server/moveplanet.c'\" \(1699 characters\)
- sed "s/^X//" >'server/moveplanet.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. Restrictions in
- X * GB_copyright.h.
- X *
- X * moveplanet.c -- move the planet in orbit around its star.
- X */
- X
- X#include "GB_copyright.h"
- X#define EXTERN extern
- X#include "vars.h"
- X#include "ships.h"
- X#include "races.h" /* (needed only for races in doturn.h */
- X#include "doturn.h"
- X#include <math.h>
- X
- Xvoid moveplanet(int, planettype *, int);
- X
- Xvoid
- Xmoveplanet(int starnum, planettype * planet, int planetnum)
- X{
- X double dist;
- X double xadd, yadd, phase, period;
- X int sh;
- X shiptype *ship;
- X
- X if (planet->popn || planet->ships)
- X Stinfo[starnum][planetnum].inhab = 1;
- X
- X StarsInhab[starnum] = !!(Stars[starnum]->inhabited[0] + Stars[starnum]->inhabited[1]);
- X StarsExpl[starnum] = !!(Stars[starnum]->explored[0] + Stars[starnum]->explored[1]);
- X
- X Stars[starnum]->inhabited[0] = Stars[starnum]->inhabited[1] = 0;
- X if (!StarsExpl[starnum])
- X return; /* no one's explored the star yet */
- X
- X dist = hypot((double) (planet->ypos), (double) (planet->xpos));
- X
- X phase = atan2((double) (planet->ypos), (double) (planet->xpos));
- X period = dist * sqrt((double) (dist / (SYSTEMGRAVCONST * Stars[starnum]->gravity)));
- X /* keppler's law */
- X
- X xadd = dist * cos((double) (-1. / period + phase)) - planet->xpos;
- X yadd = dist * sin((double) (-1. / period + phase)) - planet->ypos;
- X /* one update time unit - planets orbit counter-clockwise */
- X
- X /* adjust ships in orbit around the planet */
- X sh = planet->ships;
- X while (sh) {
- X ship = ships[sh];
- X ship->xpos += xadd;
- X ship->ypos += yadd;
- X sh = ship->nextship;
- X }
- X
- X planet->xpos += xadd;
- X planet->ypos += yadd;
- X}
- END_OF_FILE
- if test 1699 -ne `wc -c <'server/moveplanet.c'`; then
- echo shar: \"'server/moveplanet.c'\" unpacked with wrong size!
- fi
- # end of 'server/moveplanet.c'
- fi
- if test -f 'server/rand.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'server/rand.c'\"
- else
- echo shar: Extracting \"'server/rand.c'\" \(1092 characters\)
- sed "s/^X//" >'server/rand.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. * Restrictions in
- X * GB_copyright.h. *
- X *
- X * Random number generator *
- X *
- X * double double_rand() this returns a random number between 0 and 1 *
- X *
- X * int int_rand(low,hi) - this returns an integer random number *
- X * etween hi and low, inclusive. *
- X *
- X * int round_rand(double) - returns double rounded to integer, with *
- X * roportional chance of rounding up or * down. *
- X *
- X * int rposneg() - either -1 or 1
- X */
- X
- X#include "GB_copyright.h"
- X
- Xdouble double_rand(void);
- Xint int_rand(int, int);
- Xint round_rand(double);
- Xint rposneg(void);
- X
- Xlong random(void);
- X
- Xdouble
- Xdouble_rand(void)
- X{
- X return (double) random() / 2147483648.0;
- X}
- X
- Xint
- Xint_rand(int low, int hi)
- X{
- X return ((hi <= low) ? low : (random() % (hi - low + 1)) + low);
- X}
- X
- Xint
- Xround_rand(double x)
- X{
- X return ((double_rand() > (x - (double) ((int) x))) ? (int) x : (int) (x + 1));
- X}
- X
- Xint
- Xrposneg(void)
- X{
- X return ((random() & 1) ? -1 : 1);
- X}
- END_OF_FILE
- if test 1092 -ne `wc -c <'server/rand.c'`; then
- echo shar: \"'server/rand.c'\" unpacked with wrong size!
- fi
- # end of 'server/rand.c'
- fi
- if test -f 'user/OBJECTS' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/OBJECTS'\"
- else
- echo shar: Extracting \"'user/OBJECTS'\" \(900 characters\)
- sed "s/^X//" >'user/OBJECTS' <<'END_OF_FILE'
- XUSER_OBJ = ../user/analysis.o \
- X ../user/autoreport.o \
- X ../user/autoshoot.o \
- X ../user/build.o \
- X ../user/capital.o \
- X ../user/capture.o \
- X ../user/cs.o \
- X ../user/declare.o \
- X ../user/dissolve.o \
- X ../user/dock.o \
- X ../user/enslave.o \
- X ../user/examine.o \
- X ../user/explore.o \
- X ../user/fire.o \
- X ../user/fuel.o \
- X ../user/help.o \
- X ../user/land.o \
- X ../user/launch.o \
- X ../user/load.o \
- X ../user/map.o \
- X ../user/mobiliz.o \
- X ../user/move.o \
- X ../user/name.o \
- X ../user/orbit.o \
- X ../user/order.o \
- X ../user/power.o \
- X ../user/prof.o \
- X ../user/relation.o \
- X ../user/rst.o \
- X ../user/sche.o \
- X ../user/scrap.o \
- X ../user/shootblast.o \
- X ../user/survey.o \
- X ../user/tech.o \
- X ../user/tele.o \
- X ../user/togg.o \
- X ../user/toxi.o \
- X ../user/vict.o \
- X ../user/chan.o \
- X ../user/zoom.o
- END_OF_FILE
- if test 900 -ne `wc -c <'user/OBJECTS'`; then
- echo shar: \"'user/OBJECTS'\" unpacked with wrong size!
- fi
- # end of 'user/OBJECTS'
- fi
- if test -f 'user/SOURCES' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/SOURCES'\"
- else
- echo shar: Extracting \"'user/SOURCES'\" \(900 characters\)
- sed "s/^X//" >'user/SOURCES' <<'END_OF_FILE'
- XUSER_SRC = ../user/analysis.c \
- X ../user/autoreport.c \
- X ../user/autoshoot.c \
- X ../user/build.c \
- X ../user/capital.c \
- X ../user/capture.c \
- X ../user/cs.c \
- X ../user/declare.c \
- X ../user/dissolve.c \
- X ../user/dock.c \
- X ../user/enslave.c \
- X ../user/examine.c \
- X ../user/explore.c \
- X ../user/fire.c \
- X ../user/fuel.c \
- X ../user/help.c \
- X ../user/land.c \
- X ../user/launch.c \
- X ../user/load.c \
- X ../user/map.c \
- X ../user/mobiliz.c \
- X ../user/move.c \
- X ../user/name.c \
- X ../user/orbit.c \
- X ../user/order.c \
- X ../user/power.c \
- X ../user/prof.c \
- X ../user/relation.c \
- X ../user/rst.c \
- X ../user/sche.c \
- X ../user/scrap.c \
- X ../user/shootblast.c \
- X ../user/survey.c \
- X ../user/tech.c \
- X ../user/tele.c \
- X ../user/togg.c \
- X ../user/toxi.c \
- X ../user/vict.c \
- X ../user/chan.c \
- X ../user/zoom.c
- END_OF_FILE
- if test 900 -ne `wc -c <'user/SOURCES'`; then
- echo shar: \"'user/SOURCES'\" unpacked with wrong size!
- fi
- # end of 'user/SOURCES'
- fi
- if test -f 'user/autoreport.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/autoreport.c'\"
- else
- echo shar: Extracting \"'user/autoreport.c'\" \(1960 characters\)
- sed "s/^X//" >'user/autoreport.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.c. Restrictions in
- X * GB_copyright.h.c. autoreport.c -- tell server to generate a report for
- X * each planet
- X */
- X
- X#include "GB_copyright.h"
- X#define EXTERN extern
- X#include "vars.h"
- X#include "ships.h"
- X#include "races.h"
- X#include "power.h"
- X#include "buffers.h"
- X
- Xvoid autoreport(int, int, int);
- X#include "proto.h"
- X
- Xvoid
- Xautoreport(int Playernum, int Governor, int APcount)
- X{
- X planettype *p;
- X placetype place;
- X int snum, pnum;
- X
- X snum = Dir[Playernum - 1][Governor].snum;
- X pnum = Dir[Playernum - 1][Governor].pnum;
- X
- X if (Governor && Stars[snum]->governor[Playernum - 1] != Governor) {
- X notify(Playernum, Governor, "You are not authorized to do this here.\n");
- X return;
- X }
- X if (argn == 1) { /* no args */
- X if (Dir[Playernum - 1][Governor].level == LEVEL_PLAN) {
- X getplanet(&p, snum, pnum);
- X if (p->info[Playernum - 1].autorep)
- X p->info[Playernum - 1].autorep = 0;
- X else
- X p->info[Playernum - 1].autorep = TELEG_MAX_AUTO;
- X putplanet(p, snum, pnum);
- X
- X sprintf(buf, "Autoreport on %s has been %s.\n",
- X Stars[snum]->pnames[pnum],
- X p->info[Playernum - 1].autorep ? "set" : "unset");
- X notify(Playernum, Governor, buf);
- X free(p);
- X } else {
- X sprintf(buf, "Scope must be a planet.\n");
- X notify(Playernum, Governor, buf);
- X }
- X } else if (argn > 1) { /* argn==2, place specified */
- X place = Getplace(Playernum, Governor, args[1], 0);
- X if (place.level == LEVEL_PLAN) {
- X getplanet(&p, snum, pnum);
- X sprintf(buf, "Autoreport on %s has been %s.\n",
- X Stars[snum]->pnames[pnum],
- X p->info[Playernum - 1].autorep ? "set" : "unset");
- X notify(Playernum, Governor, buf);
- X p->info[Playernum - 1].autorep = !p->info[Playernum - 1].autorep;
- X putplanet(p, snum, pnum);
- X free(p);
- X } else {
- X sprintf(buf, "Scope must be a planet.\n");
- X notify(Playernum, Governor, buf);
- X }
- X }
- X}
- END_OF_FILE
- if test 1960 -ne `wc -c <'user/autoreport.c'`; then
- echo shar: \"'user/autoreport.c'\" unpacked with wrong size!
- fi
- # end of 'user/autoreport.c'
- fi
- if test -f 'user/capital.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/capital.c'\"
- else
- echo shar: Extracting \"'user/capital.c'\" \(1821 characters\)
- sed "s/^X//" >'user/capital.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. Restrictions in
- X * GB_copyright.h.
- X *
- X * capital.c -- designate a capital
- X */
- X
- X#include "GB_copyright.h"
- X#define EXTERN extern
- X#include "vars.h"
- X#include "ships.h"
- X#include "races.h"
- X#include "power.h"
- X#include "buffers.h"
- X#include <signal.h>
- X
- Xvoid capital(int, int, int);
- X#include "proto.h"
- X
- Xvoid
- Xcapital(int Playernum, int Governor, int APcount)
- X{
- X int shipno, stat, snum;
- X shiptype *s;
- X racetype *Race;
- X
- X Race = races[Playernum - 1];
- X if (Governor) {
- X (void) notify(Playernum, Governor, "Only the leader may designate the capital.\n");
- X return;
- X }
- X if (argn != 2)
- X shipno = Race->Gov_ship;
- X else
- X shipno = atoi(args[1] + (args[1][0] == '#'));
- X
- X if (shipno <= 0) {
- X (void) notify(Playernum, Governor, "Change the capital to be what ship?\n");
- X return;
- X }
- X stat = getship(&s, shipno);
- X
- X if (argn == 2) {
- X snum = s->storbits;
- X if (!stat || testship(Playernum, Governor, s)) {
- X (void) notify(Playernum, Governor, "You can't do that!\n");
- X free(s);
- X return;
- X }
- X if (!landed(s)) {
- X (void) notify(Playernum, Governor, "Try landing this ship first!\n");
- X free(s);
- X return;
- X }
- X if (!enufAP(Playernum, Governor, Stars[snum]->AP[Playernum - 1], APcount)) {
- X free(s);
- X return;
- X }
- X if (s->type != OTYPE_GOV) {
- X sprintf(buf, "That ship is not a %s.\n", Shipnames[OTYPE_GOV]);
- X (void) notify(Playernum, Governor, buf);
- X free(s);
- X return;
- X }
- X deductAPs(Playernum, Governor, APcount, snum, 0);
- X Race->Gov_ship = shipno;
- X putrace(Race);
- X }
- X sprintf(buf, "Efficiency of governmental center: %.0f%%.\n",
- X ((double) s->popn / (double) Max_crew(s)) *
- X (100 - (double) s->damage));
- X (void) notify(Playernum, Governor, buf);
- X free(s);
- X}
- END_OF_FILE
- if test 1821 -ne `wc -c <'user/capital.c'`; then
- echo shar: \"'user/capital.c'\" unpacked with wrong size!
- fi
- # end of 'user/capital.c'
- fi
- if test -f 'user/guardian.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/guardian.c'\"
- else
- echo shar: Extracting \"'user/guardian.c'\" \(854 characters\)
- sed "s/^X//" >'user/guardian.c' <<'END_OF_FILE'
- X/*
- X * guardian.c - makes sure your server keeps running.
- X *
- X */
- X
- X#include <stdio.h>
- X#include <signal.h>
- X
- Xchar *prog;
- X
- Xmain(argc, argv)
- X int argc;
- X char *argv[];
- X{
- X int pid;
- X
- X (void) sigblock(SIGHUP);/* ignore signal when owner logs out */
- X
- X prog = *argv++; /* remember guardian name */
- X fprintf(stderr, "%s: ", prog);
- X while (1) {
- X switch (pid = fork()) {
- X case -1: /* error! */
- X perror("can't fork a child");
- X sleep(600); /* 10 min */
- X break;
- X case 0: /* child */
- X execvp(argv[0], argv);
- X perror("can't exec child");
- X exit(1);
- X break;
- X default: /* parent */
- X fprintf(stderr, "starting %s with pid [%d]\n", argv[0], pid);
- X wait(0);/* wait for the little brat */
- X break;
- X }
- X fprintf(stderr, "%s: re", prog);
- X sleep(60); /* wait a minute then try to start it up
- X * again */
- X }
- X}
- END_OF_FILE
- if test 854 -ne `wc -c <'user/guardian.c'`; then
- echo shar: \"'user/guardian.c'\" unpacked with wrong size!
- fi
- # end of 'user/guardian.c'
- fi
- if test -f 'user/help.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/help.c'\"
- else
- echo shar: Extracting \"'user/help.c'\" \(1673 characters\)
- sed "s/^X//" >'user/help.c' <<'END_OF_FILE'
- X#ident "@(#)help.c 1.8 2/1/93 "
- X/***********************************************
- X * log.c
- X *
- X * Author: ???
- X *
- X * Version: 1.8 00:14:39
- X *
- X * Contains:
- X * help()
- X * help_user()
- X *
- X ***********************************************/
- X
- X
- X#include <stdio.h>
- X#define EXTERN extern
- X#include "vars.h"
- X#include "buffers.h"
- X#include "config.h"
- X
- X/*
- X * Prototypes
- X */
- Xvoid help_user(struct descriptor_data *);
- Xvoid help(struct descriptor_data *);
- X
- X/*
- X * help:
- X *
- X * arguments: who pointer to the descriptor data
- X *
- X * called by: main
- X *
- X * description: Called from the process_commands loop.
- X *
- X */
- X
- Xvoid
- Xhelp(struct descriptor_data * who)
- X{
- X
- X FILE *f;
- X char file[1024];
- X char *p;
- X
- X if (argn == 1) {
- X help_user(who);
- X } else {
- X sprintf(file, "%s/%s.doc", DOCSDIR, args[1]);
- X if ((f = fopen(file, "r")) != 0) {
- X while (fgets(buf, sizeof buf, f)) {
- X for (p = buf; *p; p++)
- X if (*p == '\n') {
- X *p = '\0';
- X break;
- X }
- X strcat(buf, "\n");
- X queue_string(who, buf);
- X }
- X fclose(f);
- X queue_string(who, "----\nFinished.\n");
- X } else
- X queue_string(who, "Help on that subject unavailable.\n");
- X }
- X}
- X/*
- X * help_user:
- X *
- X * arguments: who pointer to the descriptor data
- X *
- X * called by: help
- X *
- X * description: Called by help(), when user requests generic help
- X *
- X */
- X
- Xvoid
- Xhelp_user(struct descriptor_data * d)
- X{
- X FILE *f;
- X char *p;
- X
- X if ((f = fopen(HELP_FILE, "r")) != NULL) {
- X while (fgets(buf, sizeof buf, f)) {
- X for (p = buf; *p; p++)
- X if (*p == '\n') {
- X *p = '\0';
- X break;
- X }
- X queue_string(d, buf);
- X queue_string(d, "\n");
- X }
- X fclose(f);
- X }
- X}
- END_OF_FILE
- if test 1673 -ne `wc -c <'user/help.c'`; then
- echo shar: \"'user/help.c'\" unpacked with wrong size!
- fi
- # end of 'user/help.c'
- fi
- if test -f 'user/relation.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/relation.c'\"
- else
- echo shar: Extracting \"'user/relation.c'\" \(1808 characters\)
- sed "s/^X//" >'user/relation.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. Restrictions in
- X * GB_copyright.h.
- X *
- X * relation.c -- state relations among players
- 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 "power.h"
- X#include "buffers.h"
- X
- Xextern char *Desnames[];
- X
- Xvoid relation(int, int, int);
- Xchar *allied(racetype *, int, int, int);
- X#include "proto.h"
- X
- Xvoid
- Xrelation(int Playernum, int Governor, int APcount)
- X{
- X int numraces;
- X int p, q;
- X racetype *r, *Race;
- X
- X numraces = Num_races;
- X
- X if (argn == 1) {
- X q = Playernum;
- X } else {
- X if (!(q = GetPlayer(args[1]))) {
- X notify(Playernum, Governor, "No such player.\n");
- X return;
- X }
- X }
- X
- X Race = races[q - 1];
- X
- X sprintf(buf, "\n Racial Relations Report for %s\n\n", Race->name);
- X notify(Playernum, Governor, buf);
- X sprintf(buf, " # know Race name Yours Theirs\n");
- X notify(Playernum, Governor, buf);
- X sprintf(buf, " - ---- --------- ----- ------\n");
- X notify(Playernum, Governor, buf);
- X for (p = 1; p <= numraces; p++)
- X if (p != Race->Playernum) {
- X r = races[p - 1];
- X sprintf(buf, "%2d %s (%3d%%) %20.20s : %10s %10s\n", p,
- X ((Race->God || (Race->translate[p - 1] > 30)) && r->Metamorph && (Playernum == q)) ? "Morph" : " ", Race->translate[p - 1], r->name,
- X allied(Race, p, 100, (int) Race->God),
- X allied(r, q, (int) Race->translate[p - 1], (int) Race->God));
- X notify(Playernum, Governor, buf);
- X }
- X}
- X
- Xchar *
- Xallied(racetype * r, int p, int q, int God)
- X{
- X if (isset(r->atwar, p))
- X return "WAR";
- X else if (isset(r->allied, p))
- X return "ALLIED";
- X else
- X return "neutral";
- X}
- END_OF_FILE
- if test 1808 -ne `wc -c <'user/relation.c'`; then
- echo shar: \"'user/relation.c'\" unpacked with wrong size!
- fi
- # end of 'user/relation.c'
- fi
- if test -f 'user/sche.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/sche.c'\"
- else
- echo shar: Extracting \"'user/sche.c'\" \(1210 characters\)
- sed "s/^X//" >'user/sche.c' <<'END_OF_FILE'
- X#ident "@(#)sche.c 1.6 2/1/93 "
- X/***********************************************
- X * sched.c
- X *
- X * Created: Fri Dec 11 03:50:49 EST 1992
- X * Author: ???
- X *
- X * Version: 1.6 00:14:38
- X *
- X * Contains:
- X * GB_schedule()
- X *
- X ***********************************************/
- X
- X/*
- X * Prototypes
- X */
- Xvoid GB_schedule(int, int);
- X
- X#include "GB_copyright.h"
- X#define EXTERN extern
- X#include "vars.h"
- X#include "buffers.h"
- X#include <ctype.h>
- X
- X
- X/*
- X * GB_schedule:
- X *
- X * arguments: Playernum Playernum who called it Governor Governor who called it
- X *
- X * Called by: process_command
- X *
- X */
- X
- Xvoid
- XGB_schedule(int Playernum, int Governor)
- X{
- X clk = time(0);
- X sprintf(buf, "%d minute update intervals\n", update_time);
- X notify(Playernum, Governor, buf);
- X sprintf(buf, "%d movement segments per update\n", segments);
- X notify(Playernum, Governor, buf);
- X sprintf(buf, "Current time : %s", ctime(&clk));
- X notify(Playernum, Governor, buf);
- X sprintf(buf, "Next Segment %2d : %s",
- X nsegments_done == segments ? 1 : nsegments_done + 1,
- X ctime(&next_segment_time));
- X notify(Playernum, Governor, buf);
- X sprintf(buf, "Next Update %3d : %s", nupdates_done + 1,
- X ctime(&next_update_time));
- X notify(Playernum, Governor, buf);
- X}
- END_OF_FILE
- if test 1210 -ne `wc -c <'user/sche.c'`; then
- echo shar: \"'user/sche.c'\" unpacked with wrong size!
- fi
- # end of 'user/sche.c'
- fi
- if test -f 'user/tech.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/tech.c'\"
- else
- echo shar: Extracting \"'user/tech.c'\" \(2075 characters\)
- sed "s/^X//" >'user/tech.c' <<'END_OF_FILE'
- X
- X#include "GB_copyright.h"
- X#define EXTERN extern
- X#include "vars.h"
- X#include "ships.h"
- X#include "power.h"
- X#include "races.h"
- X#include "buffers.h"
- X#include <math.h>
- X#include <signal.h>
- X#include <ctype.h>
- X
- X
- X/*
- X * Prototypes
- X */
- Xvoid technology(int, int, int);
- Xdouble tech_prod(int, int);
- X#include "proto.h"
- X
- Xvoid
- Xtechnology(int Playernum, int Governor, int APcount)
- X{
- X short invest;
- X planettype *p;
- X
- X if (Dir[Playernum - 1][Governor].level != LEVEL_PLAN) {
- X sprintf(buf, "scope must be a planet (%d).\n",
- X Dir[Playernum - 1][Governor].level);
- X notify(Playernum, Governor, buf);
- X return;
- X }
- X if (!control(Playernum, Governor, Stars[Dir[Playernum - 1][Governor].snum])) {
- X notify(Playernum, Governor,
- X "You are not authorized to do that here.\n");
- X return;
- X }
- X if (!enufAP(Playernum, Governor,
- X Stars[Dir[Playernum - 1][Governor].snum]->AP[Playernum - 1], APcount))
- X return;
- X
- X
- X getplanet(&p, Dir[Playernum - 1][Governor].snum,
- X Dir[Playernum - 1][Governor].pnum);
- X
- X if (argn < 2) {
- X sprintf(buf,
- X "Current investment : %d Technology production/update: %.3f\n",
- X p->info[Playernum - 1].tech_invest,
- X tech_prod((int) (p->info[Playernum - 1].tech_invest),
- X (int) (p->info[Playernum - 1].popn)));
- X notify(Playernum, Governor, buf);
- X free(p);
- X return;
- X }
- X invest = atoi(args[1]);
- X
- X if (invest < 0) {
- X sprintf(buf, "Illegal value.\n");
- X notify(Playernum, Governor, buf);
- X free(p);
- X return;
- X }
- X p->info[Playernum - 1].tech_invest = invest;
- X
- X putplanet(p, Dir[Playernum - 1][Governor].snum,
- X Dir[Playernum - 1][Governor].pnum);
- X
- X deductAPs(Playernum, Governor, APcount,
- X Dir[Playernum - 1][Governor].snum, 0);
- X
- X sprintf(buf, " New (ideal) tech production: %.3f (this planet)\n",
- X tech_prod((int) (p->info[Playernum - 1].tech_invest),
- X (int) (p->info[Playernum - 1].popn)));
- X notify(Playernum, Governor, buf);
- X
- X free(p);
- X}
- X
- Xdouble
- Xtech_prod(int investment, int popn)
- X{
- X double scale;
- X
- X scale = (double) popn / 10000.;
- X return (TECH_INVEST * log10((double) investment * scale + 1.0));
- X}
- END_OF_FILE
- if test 2075 -ne `wc -c <'user/tech.c'`; then
- echo shar: \"'user/tech.c'\" unpacked with wrong size!
- fi
- # end of 'user/tech.c'
- fi
- if test -f 'user/toxi.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/toxi.c'\"
- else
- echo shar: Extracting \"'user/toxi.c'\" \(1764 characters\)
- sed "s/^X//" >'user/toxi.c' <<'END_OF_FILE'
- X#ident "@(#)toxi.c 1.4 2/1/93 "
- X/***********************************************
- X * toxi.c
- X *
- X * Created:
- X * Author: Robert Chansky
- X *
- X * Version: 1.4 00:14:41
- X *
- X * Contains:
- X * toxicity()
- X *
- X ********************************************/
- X
- X#include "GB_copyright.h"
- X#define EXTERN extern
- X#include "vars.h"
- X#include "ships.h"
- X#include "races.h"
- X#include "power.h"
- X#include "buffers.h"
- X#include <math.h>
- X#include <signal.h>
- X#include <ctype.h>
- X
- X/*
- X * Prototypes
- X */
- Xvoid toxicity(int, int, int);
- X#include "proto.h"
- X
- X/*
- X * clearlog:
- X *
- X * arguments: Playernum Governor APcount
- X *
- X * called by: process_commands
- X *
- X * description: Called from process_commands. This sets the toxicity value on
- X * the planet to automatically launch twc when reached.
- X *
- X */
- X
- Xvoid
- Xtoxicity(int Playernum, int Governor, int APcount)
- X{
- X
- X int thresh;
- X planettype *p;
- X
- X sscanf(args[1], "%d", &thresh);
- X
- X if (thresh > 100 || thresh < 0) {
- X sprintf(buf, "Illegal value.\n");
- X notify(Playernum, Governor, buf);
- X return;
- X }
- X if (Dir[Playernum - 1][Governor].level != LEVEL_PLAN) {
- X sprintf(buf, "scope must be a planet.\n");
- X notify(Playernum, Governor, buf);
- X return;
- X }
- X if (!enufAP(Playernum, Governor, Stars[Dir[Playernum - 1][Governor].snum]->AP[Playernum - 1], APcount))
- X return;
- X
- X getplanet(&p, Dir[Playernum - 1][Governor].snum, Dir[Playernum - 1][Governor].pnum);
- X
- X /* set the tox value for the planet */
- X p->info[Playernum - 1].tox_thresh = thresh;
- X
- X putplanet(p, Dir[Playernum - 1][Governor].snum, Dir[Playernum - 1][Governor].pnum);
- X
- X deductAPs(Playernum, Governor, APcount, Dir[Playernum - 1][Governor].snum, 0);
- X
- X sprintf(buf, " New threshold is: %u\n", p->info[Playernum - 1].tox_thresh);
- X notify(Playernum, Governor, buf);
- X
- X free(p);
- X}
- END_OF_FILE
- if test 1764 -ne `wc -c <'user/toxi.c'`; then
- echo shar: \"'user/toxi.c'\" unpacked with wrong size!
- fi
- # end of 'user/toxi.c'
- fi
- if test -f 'user/zoom.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'user/zoom.c'\"
- else
- echo shar: Extracting \"'user/zoom.c'\" \(1340 characters\)
- sed "s/^X//" >'user/zoom.c' <<'END_OF_FILE'
- X#ident "@(#)zoom.c 1.7 2/1/93 "
- X/***********************************************
- X * zoom.c
- X *
- X * Created:
- X * Author: ???
- X *
- X * Version: 1.7 00:14:37
- X *
- X * Contains:
- X * zoom()
- X *
- X ***********************************************/
- X
- X
- X#include "GB_copyright.h"
- X#define EXTERN extern
- X#include "vars.h"
- X#include "ships.h"
- X#include "races.h"
- X#include "power.h"
- X#include "buffers.h"
- X
- X/*
- X * Prototypes
- X */
- Xvoid zoom(int, int);
- X#include "proto.h"
- X
- X/*
- X * GB_schedule:
- X *
- X * arguments: Playernum Playernum who called it Governor Governor who called it
- X *
- X * Called by: process_command
- X *
- X */
- Xvoid
- Xzoom(int Playernum, int Governor)
- X{
- X double num, denom;
- X int i;
- X
- X i = (Dir[Playernum - 1][Governor].level == LEVEL_UNIV);
- X
- X if (argn > 1) {
- X if (sscanf(args[1], "%f/%f", &num, &denom) == 2) {
- X /* num/denom format */
- X if (denom == 0.0) {
- X sprintf(buf, "Illegal denominator value.\n");
- X notify(Playernum, Governor, buf);
- X } else /* if (denom) */
- X Dir[Playernum - 1][Governor].zoom[i] = num / denom;
- X } else {
- X /* one number */
- X Dir[Playernum - 1][Governor].zoom[i] = num;
- X }
- X }
- X sprintf(buf, "Zoom value %g, lastx = %g, lasty = %g.\n",
- X Dir[Playernum - 1][Governor].zoom[i],
- X Dir[Playernum - 1][Governor].lastx[i],
- X Dir[Playernum - 1][Governor].lasty[i]);
- X notify(Playernum, Governor, buf);
- X}
- END_OF_FILE
- if test 1340 -ne `wc -c <'user/zoom.c'`; then
- echo shar: \"'user/zoom.c'\" unpacked with wrong size!
- fi
- # end of 'user/zoom.c'
- fi
- echo shar: End of archive 21 \(of 21\).
- cp /dev/null ark21isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 21 archives.
- echo "Now type './buildfiles.sh'"
- 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
-