home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume17 / gbp / part21 < prev    next >
Encoding:
Internet Message Format  |  1993-03-20  |  44.1 KB

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v17i033:  gbp - Galactic Bloodshed+, an empire-like war game, Part21/21
  5. Message-ID: <4561@master.CNA.TEK.COM>
  6. Date: 12 Feb 93 17:33:57 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1653
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1712
  11.  
  12. Submitted-by: deragon@harpo.cs.nyu.edu (Seeker)
  13. Posting-number: Volume 17, Issue 33
  14. Archive-name: gbp/Part21
  15. Supersedes: gb3: Volume 10, Issue 1-14
  16. Environment: sockets, curses
  17.  
  18.  
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 21 (of 21)."
  27. # Contents:  doc/racegen.README hdrs/GB_copyright.h
  28. #   hdrs/TinyMUD_copyright.h hdrs/doturn.h hdrs/files.h
  29. #   hdrs/game_info.h hdrs/power.h misc/Makefile.SH misc/ship.dat
  30. #   server/files.c server/files_rw.c server/get4args.c
  31. #   server/moveplanet.c server/rand.c user/OBJECTS user/SOURCES
  32. #   user/autoreport.c user/capital.c user/guardian.c user/help.c
  33. #   user/relation.c user/sche.c user/tech.c user/toxi.c user/zoom.c
  34. # Wrapped by billr@saab on Fri Feb 12 09:14:33 1993
  35. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  36. if test -f 'doc/racegen.README' -a "${1}" != "-c" ; then 
  37.   echo shar: Will not clobber existing file \"'doc/racegen.README'\"
  38. else
  39. echo shar: Extracting \"'doc/racegen.README'\" \(848 characters\)
  40. sed "s/^X//" >'doc/racegen.README' <<'END_OF_FILE'
  41. X
  42. XRacegen is a program to construct races for Galactic Bloodshed.  It is
  43. Xavailable at pooh.caltech.edu in the /src/games/gb directory as
  44. Xracegen.shar.  (For detail on how to get and compile racegen, see
  45. Xracegen.novice-info.  If you do not have this file, ask your game host
  46. Xfor it.)
  47. X
  48. XThe easiest way to learn how to use racegen is to use it.  Start it
  49. Xup.  Type, "help" to see more info on the available commands.  The
  50. Xmain command you will use is "modify".  Try modifying a few things:
  51. X"modify fight 6", "modify name Demons", "modify pass whatnot".  You
  52. Xcan save races ("save") and work on them later ("load"); you can also
  53. Xprint what the screen shows to files.  When you are done with your
  54. Xrace, typing "send" will dispatch it to whatever address is found in
  55. Xgame_info.h as TO.
  56. X
  57. XFor more information on what racial attributes mean, see races.doc.
  58. END_OF_FILE
  59. if test 848 -ne `wc -c <'doc/racegen.README'`; then
  60.     echo shar: \"'doc/racegen.README'\" unpacked with wrong size!
  61. fi
  62. # end of 'doc/racegen.README'
  63. fi
  64. if test -f 'hdrs/GB_copyright.h' -a "${1}" != "-c" ; then 
  65.   echo shar: Will not clobber existing file \"'hdrs/GB_copyright.h'\"
  66. else
  67. echo shar: Extracting \"'hdrs/GB_copyright.h'\" \(1198 characters\)
  68. sed "s/^X//" >'hdrs/GB_copyright.h' <<'END_OF_FILE'
  69. X/*
  70. X * Galactic Bloodshed, copyright (c) 1989 1990 by Robert P. Chansky, 
  71. X * smq@ucscb.ucsc.edu, Univ of Ca Santa Cruz.
  72. X *  You may copy, alter and distribute this game as you please as
  73. X *    long as these notices remain intact.  No duplication for
  74. X *    commercial purposes without permission of the author.
  75. X *
  76. X * Version 1.0 - current mods by:
  77. X *        Garrett Van Cleef, Ph.D
  78. X *           Dept. of Physics
  79. X *         Ohio State University
  80. X * V1.1 playtesting by:
  81. X *             Hanan Baddar
  82. X *              Ken Bloch
  83. X *             John Davis
  84. X *             Robert Jones
  85. X *         Menelaos Kafkaladis
  86. X *             Brett Lowry
  87. X *             Paul Murphy
  88. X *          Garrett van Cleef
  89. X *           Wolfgang Wenzel
  90. X *               and
  91. X *           tons of people
  92. X *            at U.C. Santa Cruz
  93. X *
  94. X *
  95. X *  Special thanks to Jeff Wallace(jeffw@swindle.berkeley.edu) for helping
  96. X *  get some major client problems straightened out (1.3.2).
  97. X *  Major amounts of help in v2.0-current by Brian Scearce 
  98. X *    (bls@u02.svl.cdc.com).
  99. X */
  100. X
  101. X /* This release is now called GB+.  It is an offshoot of Galactic Bloodshed
  102. X  * maintained by the GBDT (Galactic Bloodshed Development Team.
  103. X  *
  104. X  * Please send any information/bugs/suggestions/comments to:
  105. X  *    gbdt@dumbo.cray.com 
  106. X  *
  107. X  */
  108. X   
  109. END_OF_FILE
  110. if test 1198 -ne `wc -c <'hdrs/GB_copyright.h'`; then
  111.     echo shar: \"'hdrs/GB_copyright.h'\" unpacked with wrong size!
  112. fi
  113. # end of 'hdrs/GB_copyright.h'
  114. fi
  115. if test -f 'hdrs/TinyMUD_copyright.h' -a "${1}" != "-c" ; then 
  116.   echo shar: Will not clobber existing file \"'hdrs/TinyMUD_copyright.h'\"
  117. else
  118. echo shar: Extracting \"'hdrs/TinyMUD_copyright.h'\" \(1413 characters\)
  119. sed "s/^X//" >'hdrs/TinyMUD_copyright.h' <<'END_OF_FILE'
  120. X/* -*-C-*-
  121. X
  122. XCopyright (c) 1989 by David Applegate, James Aspnes, Timothy Freeman,
  123. X           and Bennet Yee.
  124. X
  125. XThis material was developed by the above-mentioned authors.
  126. XPermission to copy this software, to redistribute it, and to use it
  127. Xfor any purpose is granted, subject to the following restrictions and
  128. Xunderstandings.
  129. X
  130. X1. Any copy made of this software must include this copyright notice
  131. Xin full.
  132. X
  133. X2. Users of this software agree to make their best efforts (a) to
  134. Xreturn to the above-mentioned authors any improvements or extensions
  135. Xthat they make, so that these may be included in future releases; and
  136. X(b) to inform the authors of noteworthy uses of this software.
  137. X
  138. X3. All materials developed as a consequence of the use of this
  139. Xsoftware shall duly acknowledge such use, in accordance with the usual
  140. Xstandards of acknowledging credit in academic research.
  141. X
  142. X4. The authors have made no warrantee or representation that the
  143. Xoperation of this software will be error-free, and the authors are
  144. Xunder no obligation to provide any services, by way of maintenance,
  145. Xupdate, or otherwise.
  146. X
  147. X5. In conjunction with products arising from the use of this material,
  148. Xthere shall be no use of the names of the authors, of Carnegie-Mellon
  149. XUniversity, nor of any adaptation thereof in any advertising,
  150. Xpromotional, or sales literature without prior written consent from
  151. Xthe authors and Carnegie-Mellon University in each case. */
  152. X
  153. END_OF_FILE
  154. if test 1413 -ne `wc -c <'hdrs/TinyMUD_copyright.h'`; then
  155.     echo shar: \"'hdrs/TinyMUD_copyright.h'\" unpacked with wrong size!
  156. fi
  157. # end of 'hdrs/TinyMUD_copyright.h'
  158. fi
  159. if test -f 'hdrs/doturn.h' -a "${1}" != "-c" ; then 
  160.   echo shar: Will not clobber existing file \"'hdrs/doturn.h'\"
  161. else
  162. echo shar: Extracting \"'hdrs/doturn.h'\" \(778 characters\)
  163. sed "s/^X//" >'hdrs/doturn.h' <<'END_OF_FILE'
  164. X#ident  "@(#)doturn.h    1.2 12/15/92 "
  165. X/*
  166. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
  167. X * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
  168. X * Restrictions in GB.c.
  169. X * doturn.h -- various turn things we are keeping track of.
  170. X * Galactic Bloodshed by Robert Chansky
  171. X */
  172. X
  173. X
  174. Xstruct stinfo {
  175. X    short temp_add;    /* addition to temperature to each planet */
  176. X    unsigned char Thing_add;    
  177. X            /* new Thing colony on this planet */
  178. X    unsigned char inhab;        /* explored by anybody */
  179. X    unsigned char intimidated;    /* assault platform is here */
  180. X};
  181. X
  182. XEXTERN struct stinfo Stinfo[NUMSTARS][MAXPLANETS];
  183. X
  184. Xstruct sectinfo {
  185. X    char explored;        /* sector has been explored */
  186. X    unsigned char done;    /* this sector has been updated */
  187. X};
  188. X
  189. XEXTERN struct sectinfo Sectinfo[MAX_X][MAX_Y];
  190. END_OF_FILE
  191. if test 778 -ne `wc -c <'hdrs/doturn.h'`; then
  192.     echo shar: \"'hdrs/doturn.h'\" unpacked with wrong size!
  193. fi
  194. # end of 'hdrs/doturn.h'
  195. fi
  196. if test -f 'hdrs/files.h' -a "${1}" != "-c" ; then 
  197.   echo shar: Will not clobber existing file \"'hdrs/files.h'\"
  198. else
  199. echo shar: Extracting \"'hdrs/files.h'\" \(1955 characters\)
  200. sed "s/^X//" >'hdrs/files.h' <<'END_OF_FILE'
  201. X/*
  202. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, { * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
  203. X * Restrictions in GB.c.
  204. X *
  205. X * files.h
  206. X * This file was produced by running the files.h.SH script, which
  207. X * gets its values from config.sh, which is generally produced by
  208. X * running Configure.
  209. X *
  210. X * Feel free to modify any of this as the need arises.  Note, however,
  211. X * that running files.h.SH again will wipe out any changes you've made.
  212. X * For a more permanent change edit config.h.SH.
  213. X */
  214. X#ident  "@(#)files.h.SH    1.2 12/15/92 "
  215. X
  216. X#define PATH(file)    "/var/tmp/GB/"#file
  217. X#define    DATA(file)    PATH(Data/file)
  218. X#define NEWS(file)      PATH(News/file)
  219. X#define TELE(file)      PATH(Tele/file)
  220. X#define LOG(file)        PATH(Logs/file)
  221. X
  222. X#define PATHLEN        200    /* length of file paths to the game.. */
  223. X
  224. X#define CUTE_MESSAGE    "\nThe Galactic News\n\n"
  225. X#define DECLARATION    0    /* news file index */
  226. X#define TRANSFER    1
  227. X#define COMBAT        2
  228. X#define ANNOUNCE    3
  229. X
  230. X#define DATADIR        Files[0]
  231. X#define DOCSDIR        Files[1]
  232. X#define EXAM_FL        Files[2]
  233. X#define ENROLL_FL    Files[3]
  234. X#define STARDATAFL     Files[4]
  235. X#define SECTORDATAFL     Files[5]
  236. X#define PLANETDATAFL     Files[6]
  237. X#define RACEDATAFL     Files[7]
  238. X#define BLOCKDATAFL    Files[8]
  239. X#define SHIPDATAFL     Files[9]
  240. X#define SHIPFREEDATAFL     Files[10]
  241. X#define DUMMYFL        Files[11]
  242. X#define PLAYERDATAFL     Files[12]
  243. X#define TELEGRAMDIR     Files[13]
  244. X#define TELEGRAMFL     Files[14]
  245. X#define POWFL        Files[15]
  246. X#define NEWSDIR        Files[16]
  247. X#define DECLARATIONFL    Files[17]
  248. X#define TRANSFERFL    Files[18]
  249. X#define COMBATFL    Files[19]
  250. X#define ANNOUNCEFL    Files[20]
  251. X#define COMMODDATAFL    Files[21]
  252. X#define COMMODFREEDATAFL        Files[22]
  253. X#define    UPDATEFL    Files[23]
  254. X#define    SEGMENTFL    Files[24]
  255. X#define ERRLOG        Files[25]
  256. X#define USLOG        Files[26]
  257. X#define UPLOG        Files[27]
  258. X    
  259. X#define PLANETLIST    PATH(planet.list)
  260. X#define STARLIST    PATH(star.list)
  261. X    
  262. X#define NOGOFL        PATH(nogo)
  263. X#define    ADDRESSFL    PATH(Addresses)
  264. X
  265. Xextern char *Files[];
  266. X/* END OF FILES.H */
  267. END_OF_FILE
  268. if test 1955 -ne `wc -c <'hdrs/files.h'`; then
  269.     echo shar: \"'hdrs/files.h'\" unpacked with wrong size!
  270. fi
  271. # end of 'hdrs/files.h'
  272. fi
  273. if test -f 'hdrs/game_info.h' -a "${1}" != "-c" ; then 
  274.   echo shar: Will not clobber existing file \"'hdrs/game_info.h'\"
  275. else
  276. echo shar: Extracting \"'hdrs/game_info.h'\" \(1231 characters\)
  277. sed "s/^X//" >'hdrs/game_info.h' <<'END_OF_FILE'
  278. X/* game_info.h - game-variable parameters for compiling racegen
  279. X */
  280. X
  281. X/**************
  282. X * Game dependencies.  These will likely change for each game.
  283. X */
  284. X#define DEADLINE   "Not Given"
  285. X#define GAME       "Pooh"
  286. X#define GB_VERSION "Standard GB 5.0"
  287. X#define LOCATION   "pooh.berkeley.edu 2010"
  288. X#define MODERATOR  "Garrett VanCleef"
  289. X#define PLAYERS    "63"
  290. X#define STARS      "100"
  291. X#define STARTS     "Tentative"
  292. X#define TO         "vancleef@pooh.caltech.edu"
  293. X#define UPDATE_SCH "\
  294. X2 updates/day (12:00 am and pm PST) until 12:00 am Friday, Oct 4.\n\
  295. X6 updates/day (12am/4/8/12pm/4/8 PST) through the weekend; then\n\
  296. X2 updates/day again for the first week; and finally,\n\
  297. X1 update/day (9 pm PST) thereafter."
  298. X#define OTHER_STUFF "\n\
  299. XThis is still a preliminary version of racegen.  Sending from this\n\
  300. Xprogram will NOT get you into the Pooh game.  (I would enjoy seeing\n\
  301. Xthe races you make, though.)  You will know that this is the final\n\
  302. XPooh racegen when you see vancleef@blah.blah.edu as the address that\n\
  303. Xraces are being sent to.\n"
  304. X
  305. X
  306. X/**************
  307. X * Racegen options.  
  308. X */
  309. X#define COVARIANCES
  310. X#define STARTING_POINTS 1100
  311. X#define MIN_PASSWORD_LENGTH 4
  312. X/* #define TRADITIONAL_RACES */
  313. X#define DEFAULT_MESO_IQ_LIMIT 180
  314. END_OF_FILE
  315. if test 1231 -ne `wc -c <'hdrs/game_info.h'`; then
  316.     echo shar: \"'hdrs/game_info.h'\" unpacked with wrong size!
  317. fi
  318. # end of 'hdrs/game_info.h'
  319. fi
  320. if test -f 'hdrs/power.h' -a "${1}" != "-c" ; then 
  321.   echo shar: Will not clobber existing file \"'hdrs/power.h'\"
  322. else
  323. echo shar: Extracting \"'hdrs/power.h'\" \(717 characters\)
  324. sed "s/^X//" >'hdrs/power.h' <<'END_OF_FILE'
  325. X/*
  326. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
  327. X * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
  328. X * Restrictions in GB.c.
  329. X */
  330. X
  331. X    /* for power report */
  332. X
  333. Xstruct power {
  334. X    unsigned long troops;    /* total troops */
  335. X    unsigned long popn;    /* total population */
  336. X    unsigned long resource;    /* total resource in stock */
  337. X    unsigned long fuel;
  338. X    unsigned long destruct;    /* total dest in stock */
  339. X    unsigned short ships_owned;    /* # of ships owned */
  340. X    unsigned short planets_owned;
  341. X    unsigned long sectors_owned;
  342. X    unsigned long money;
  343. X    unsigned long sum_mob;    /* total mobilization */
  344. X    unsigned long sum_eff;    /* total efficiency */
  345. X};
  346. X
  347. XEXTERN struct power Power[MAXPLAYERS];
  348. END_OF_FILE
  349. if test 717 -ne `wc -c <'hdrs/power.h'`; then
  350.     echo shar: \"'hdrs/power.h'\" unpacked with wrong size!
  351. fi
  352. # end of 'hdrs/power.h'
  353. fi
  354. if test -f 'misc/Makefile.SH' -a "${1}" != "-c" ; then 
  355.   echo shar: Will not clobber existing file \"'misc/Makefile.SH'\"
  356. else
  357. echo shar: Extracting \"'misc/Makefile.SH'\" \(1098 characters\)
  358. sed "s/^X//" >'misc/Makefile.SH' <<'END_OF_FILE'
  359. Xcase $CONFIG in
  360. X'')
  361. X    if test ! -f config.sh; then
  362. X    ln ../config.sh . || \
  363. X    ln ../../config.sh . || \
  364. X    ln ../../../config.sh . || \
  365. X    (echo "Can't find config.sh."; exit 1)
  366. X    fi
  367. X    . ./config.sh
  368. X    ;;
  369. Xesac
  370. Xcase "$0" in
  371. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  372. Xesac
  373. X
  374. Xecho "Extracting misc/Makefile (with variable substitutions)"
  375. Xcat >Makefile <<!GROK!THIS!
  376. X#
  377. X#  misc level Makefile for the GB+ program
  378. X#  This makefile will make the commands library routines
  379. X#
  380. X# Bug reports, patches, comments, suggestions should be sent to:
  381. X#
  382. X#    John Deragon deragon@jethro.cs.nyu.edu
  383. X#
  384. X# Revision 1.0  92/12/10 jpd
  385. X# 
  386. X#
  387. X# Variables
  388. X#    Variables established by Configure
  389. XTOUCH        =    $touch
  390. X
  391. X!GROK!THIS!
  392. X
  393. Xcat >>Makefile <<'!NO!SUBS!'
  394. X
  395. X#    Variables you may want to manually edit
  396. X#        If you want debug logging then you'll
  397. X#        want to uncomment the following.
  398. X#    Other general variables
  399. XBIN        =    ../bin
  400. XSHELL        =    /bin/sh
  401. X
  402. Xall: install
  403. X
  404. Xinstall:
  405. X        install daemon.txt $(BIN)
  406. X        install help.txt $(BIN)
  407. X        install welcome.txt $(BIN)
  408. X        install planet.list ..
  409. X        install star.list ..
  410. X        install exam.dat ..
  411. X        install ship.dat ..
  412. X
  413. X!NO!SUBS!
  414. END_OF_FILE
  415. if test 1098 -ne `wc -c <'misc/Makefile.SH'`; then
  416.     echo shar: \"'misc/Makefile.SH'\" unpacked with wrong size!
  417. fi
  418. # end of 'misc/Makefile.SH'
  419. fi
  420. if test -f 'misc/ship.dat' -a "${1}" != "-c" ; then 
  421.   echo shar: Will not clobber existing file \"'misc/ship.dat'\"
  422. else
  423. echo shar: Extracting \"'misc/ship.dat'\" \(1164 characters\)
  424. sed "s/^X//" >'misc/ship.dat' <<'END_OF_FILE'
  425. XSpore pod
  426. X~
  427. XShuttle
  428. X~
  429. XComsat
  430. X~
  431. XBattleship
  432. X~
  433. XDestroyer
  434. X~
  435. XFighter
  436. X~
  437. XCargo ship
  438. X~
  439. X     \_|_/
  440. X    ---|---
  441. X    |     |   
  442. X  \ |  |  | /
  443. X   \|  |  |/ 
  444. X    |     |
  445. X    |     |
  446. X | /   |   \ |
  447. X-+-| --+-- |-+- 
  448. X | \   |   / |
  449. X    |     |
  450. X   /|  |  |\
  451. X  | |  |  | |
  452. X   \|  |  |/
  453. X    |     |
  454. X    -[ _ ]-
  455. X      ^ ^
  456. XExplorer
  457. X~
  458. XTanker
  459. X~
  460. XStation
  461. X~
  462. X       ___     Control center-\\___                  __
  463. X __   /  _|   ____             /   \____      ____  // Phased-meson phalanx
  464. X>==\ / // | =/    \!! !! !! !!/^   /    \=   /    \=   
  465. X\---------------------------------------------------
  466. X   | []  []    []    []   []    [] []  []  []  []|   <-- fighter bays
  467. X/---------------------------------------------------
  468. X>==/=\____/ !! ! !!  !!! ! ! !!!! !! !!  !\____/=
  469. X---        _//
  470. X H2 missles
  471. XOrbital Assault Platform
  472. X~
  473. XDreadnaught
  474. X~
  475. XMithril Ship
  476. X~
  477. XCrystal Ship
  478. X~
  479. XGODSHIP
  480. X~
  481. X    |   
  482. X  \-|-/
  483. X--|-=-|--
  484. X  /-|-\
  485. X    |   
  486. XSpace mine
  487. X~
  488. XSpace mirror
  489. X~
  490. XAtmosphere processor
  491. X~
  492. XCanister of dust
  493. X~
  494. XV.Neumann machine
  495. X~
  496. XPlanet bomb
  497. X~
  498. Xcloaking device
  499. X~
  500. Xemotion suppressor
  501. X~
  502. XAmulet of Yendor
  503. X~
  504. Xbiological weapon
  505. X~
  506. Xgamma ray laser
  507. X~
  508. XSpace Amoeba
  509. X~
  510. Xaudio-vibatory-physio-molecular transport device
  511. X~
  512. END_OF_FILE
  513. if test 1164 -ne `wc -c <'misc/ship.dat'`; then
  514.     echo shar: \"'misc/ship.dat'\" unpacked with wrong size!
  515. fi
  516. # end of 'misc/ship.dat'
  517. fi
  518. if test -f 'server/files.c' -a "${1}" != "-c" ; then 
  519.   echo shar: Will not clobber existing file \"'server/files.c'\"
  520. else
  521. echo shar: Extracting \"'server/files.c'\" \(681 characters\)
  522. sed "s/^X//" >'server/files.c' <<'END_OF_FILE'
  523. X/*
  524. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  525. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  526. X * GB._copyright.h.
  527. X */
  528. X
  529. X#include "GB_copyright.h"
  530. X#include "files.h"
  531. X
  532. Xchar           *Files[] = {
  533. X    PATH(Data),
  534. X    PATH(Docs),
  535. X    PATH(exam.dat),
  536. X    PATH(enroll.dat),
  537. X    DATA(star),
  538. X    DATA(sector),
  539. X    DATA(planet),
  540. X    DATA(race),
  541. X    DATA(block),
  542. X    DATA(ship),
  543. X    DATA(shipfree),
  544. X    DATA(dummy),
  545. X    DATA(players),
  546. X    PATH(Tele),
  547. X    TELE(tele),
  548. X    DATA(power),
  549. X    PATH(News),
  550. X    NEWS(declaration),
  551. X    NEWS(transfer),
  552. X    NEWS(combat),
  553. X    NEWS(announce),
  554. X    DATA(commod),
  555. X    DATA(commodfree),
  556. X    DATA(Update.time),
  557. X    DATA(Segment.time),
  558. X    LOG(error.log),
  559. X    LOG(user.log),
  560. X    LOG(update.log)
  561. X};
  562. END_OF_FILE
  563. if test 681 -ne `wc -c <'server/files.c'`; then
  564.     echo shar: \"'server/files.c'\" unpacked with wrong size!
  565. fi
  566. # end of 'server/files.c'
  567. fi
  568. if test -f 'server/files_rw.c' -a "${1}" != "-c" ; then 
  569.   echo shar: Will not clobber existing file \"'server/files_rw.c'\"
  570. else
  571. echo shar: Extracting \"'server/files_rw.c'\" \(1123 characters\)
  572. sed "s/^X//" >'server/files_rw.c' <<'END_OF_FILE'
  573. X/*
  574. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  575. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  576. X * GB_copyright.h. disk input/output routines
  577. X * 
  578. X * Fileread(p, num, file, posn, routine); -- generic file read Filewrite(p, num,
  579. X * file, posn, routine); -- generic file write
  580. X * 
  581. X */
  582. X
  583. X#include <errno.h>
  584. X#include <signal.h>
  585. X#include <sys/file.h>
  586. X
  587. X#include "GB_copyright.h"
  588. X#define EXTERN extern
  589. X#include "vars.h"
  590. X#include "files.h"
  591. X#include "buffers.h"
  592. X
  593. Xint             sys_nerr;
  594. X
  595. Xextern char    *sys_errlist[];
  596. Xextern int      errno;
  597. X
  598. Xvoid            Fileread(int, char *, int, int);
  599. Xvoid            Filewrite(int, char *, int, int);
  600. X
  601. Xvoid 
  602. XFileread(int fd, char *p, int num, int posn)
  603. X{
  604. X    int             n2;
  605. X
  606. X    if (lseek(fd, posn, L_SET) < 0) {
  607. X        perror("Fileread 1");
  608. X        return;
  609. X    }
  610. X    if ((n2 = read(fd, p, num)) != num) {
  611. X        perror("Fileread 2");
  612. X    }
  613. X}
  614. X
  615. Xvoid 
  616. XFilewrite(int fd, char *p, int num, int posn)
  617. X{
  618. X    int             n2;
  619. X
  620. X    if (lseek(fd, posn, L_SET) < 0) {
  621. X        perror("Filewrite 1");
  622. X        return;
  623. X    }
  624. X    if ((n2 = write(fd, p, num)) != num) {
  625. X        perror("Filewrite 2");
  626. X        return;
  627. X    }
  628. X}
  629. END_OF_FILE
  630. if test 1123 -ne `wc -c <'server/files_rw.c'`; then
  631.     echo shar: \"'server/files_rw.c'\" unpacked with wrong size!
  632. fi
  633. # end of 'server/files_rw.c'
  634. fi
  635. if test -f 'server/get4args.c' -a "${1}" != "-c" ; then 
  636.   echo shar: Will not clobber existing file \"'server/get4args.c'\"
  637. else
  638. echo shar: Extracting \"'server/get4args.c'\" \(750 characters\)
  639. sed "s/^X//" >'server/get4args.c' <<'END_OF_FILE'
  640. X/*
  641. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  642. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  643. X * GB_copyright.h.
  644. X * 
  645. X */
  646. X
  647. X#include "GB_copyright.h"
  648. X
  649. Xvoid            get4args(char *, int *, int *, int *, int *);
  650. X
  651. Xvoid 
  652. Xget4args(char *s, int *xl, int *xh, int *yl, int *yh)
  653. X{
  654. X    char           *p, s1[17], s2[17];
  655. X    p = s;
  656. X
  657. X    sscanf(p, "%[^,]", s1);
  658. X    while ((*p != ':') && (*p != ','))
  659. X        p++;
  660. X    if (*p == ':') {
  661. X        sscanf(s1, "%d:%d", xl, xh);
  662. X        while (*p != ',')
  663. X            p++;
  664. X    } else if (*p == ',') {
  665. X        sscanf(s1, "%d", xl);
  666. X        *xh = (*xl);
  667. X    }
  668. X    sscanf(p, "%s", s2);
  669. X    while ((*p != ':') && (*p != '\0'))
  670. X        p++;
  671. X    if (*p == ':') {
  672. X        sscanf(s2, ",%d:%d", yl, yh);
  673. X    } else {
  674. X        sscanf(s2, ",%d,", yl);
  675. X        *yh = (*yl);
  676. X    }
  677. X
  678. X}
  679. END_OF_FILE
  680. if test 750 -ne `wc -c <'server/get4args.c'`; then
  681.     echo shar: \"'server/get4args.c'\" unpacked with wrong size!
  682. fi
  683. # end of 'server/get4args.c'
  684. fi
  685. if test -f 'server/moveplanet.c' -a "${1}" != "-c" ; then 
  686.   echo shar: Will not clobber existing file \"'server/moveplanet.c'\"
  687. else
  688. echo shar: Extracting \"'server/moveplanet.c'\" \(1699 characters\)
  689. sed "s/^X//" >'server/moveplanet.c' <<'END_OF_FILE'
  690. X/*
  691. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  692. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  693. X * GB_copyright.h.
  694. X * 
  695. X * moveplanet.c -- move the planet in orbit around its star.
  696. X */
  697. X
  698. X#include "GB_copyright.h"
  699. X#define EXTERN extern
  700. X#include "vars.h"
  701. X#include "ships.h"
  702. X#include "races.h"        /* (needed only for races in doturn.h */
  703. X#include "doturn.h"
  704. X#include <math.h>
  705. X
  706. Xvoid            moveplanet(int, planettype *, int);
  707. X
  708. Xvoid 
  709. Xmoveplanet(int starnum, planettype * planet, int planetnum)
  710. X{
  711. X    double          dist;
  712. X    double          xadd, yadd, phase, period;
  713. X    int             sh;
  714. X    shiptype       *ship;
  715. X
  716. X    if (planet->popn || planet->ships)
  717. X        Stinfo[starnum][planetnum].inhab = 1;
  718. X
  719. X    StarsInhab[starnum] = !!(Stars[starnum]->inhabited[0] + Stars[starnum]->inhabited[1]);
  720. X    StarsExpl[starnum] = !!(Stars[starnum]->explored[0] + Stars[starnum]->explored[1]);
  721. X
  722. X    Stars[starnum]->inhabited[0] = Stars[starnum]->inhabited[1] = 0;
  723. X    if (!StarsExpl[starnum])
  724. X        return;        /* no one's explored the star yet */
  725. X
  726. X    dist = hypot((double) (planet->ypos), (double) (planet->xpos));
  727. X
  728. X    phase = atan2((double) (planet->ypos), (double) (planet->xpos));
  729. X    period = dist * sqrt((double) (dist / (SYSTEMGRAVCONST * Stars[starnum]->gravity)));
  730. X    /* keppler's law */
  731. X
  732. X    xadd = dist * cos((double) (-1. / period + phase)) - planet->xpos;
  733. X    yadd = dist * sin((double) (-1. / period + phase)) - planet->ypos;
  734. X    /* one update time unit - planets orbit counter-clockwise */
  735. X
  736. X    /* adjust ships in orbit around the planet */
  737. X    sh = planet->ships;
  738. X    while (sh) {
  739. X        ship = ships[sh];
  740. X        ship->xpos += xadd;
  741. X        ship->ypos += yadd;
  742. X        sh = ship->nextship;
  743. X    }
  744. X
  745. X    planet->xpos += xadd;
  746. X    planet->ypos += yadd;
  747. X}
  748. END_OF_FILE
  749. if test 1699 -ne `wc -c <'server/moveplanet.c'`; then
  750.     echo shar: \"'server/moveplanet.c'\" unpacked with wrong size!
  751. fi
  752. # end of 'server/moveplanet.c'
  753. fi
  754. if test -f 'server/rand.c' -a "${1}" != "-c" ; then 
  755.   echo shar: Will not clobber existing file \"'server/rand.c'\"
  756. else
  757. echo shar: Extracting \"'server/rand.c'\" \(1092 characters\)
  758. sed "s/^X//" >'server/rand.c' <<'END_OF_FILE'
  759. X/*
  760. X * * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, *
  761. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. * Restrictions in
  762. X * GB_copyright.h. *
  763. X * 
  764. X *   Random number generator *
  765. X * 
  766. X *    double double_rand() this returns a random number between 0 and 1 *
  767. X * 
  768. X *    int int_rand(low,hi) -    this returns an integer random number *
  769. X * etween hi and low, inclusive. *
  770. X * 
  771. X *    int round_rand(double) - returns double rounded to integer, with *
  772. X * roportional chance of rounding up or *                down. *
  773. X * 
  774. X *    int rposneg() - either -1 or 1
  775. X */
  776. X
  777. X#include "GB_copyright.h"
  778. X
  779. Xdouble          double_rand(void);
  780. Xint             int_rand(int, int);
  781. Xint             round_rand(double);
  782. Xint             rposneg(void);
  783. X
  784. Xlong            random(void);
  785. X
  786. Xdouble 
  787. Xdouble_rand(void)
  788. X{
  789. X    return (double) random() / 2147483648.0;
  790. X}
  791. X
  792. Xint 
  793. Xint_rand(int low, int hi)
  794. X{
  795. X    return ((hi <= low) ? low : (random() % (hi - low + 1)) + low);
  796. X}
  797. X
  798. Xint 
  799. Xround_rand(double x)
  800. X{
  801. X    return ((double_rand() > (x - (double) ((int) x))) ? (int) x : (int) (x + 1));
  802. X}
  803. X
  804. Xint 
  805. Xrposneg(void)
  806. X{
  807. X    return ((random() & 1) ? -1 : 1);
  808. X}
  809. END_OF_FILE
  810. if test 1092 -ne `wc -c <'server/rand.c'`; then
  811.     echo shar: \"'server/rand.c'\" unpacked with wrong size!
  812. fi
  813. # end of 'server/rand.c'
  814. fi
  815. if test -f 'user/OBJECTS' -a "${1}" != "-c" ; then 
  816.   echo shar: Will not clobber existing file \"'user/OBJECTS'\"
  817. else
  818. echo shar: Extracting \"'user/OBJECTS'\" \(900 characters\)
  819. sed "s/^X//" >'user/OBJECTS' <<'END_OF_FILE'
  820. XUSER_OBJ    =    ../user/analysis.o \
  821. X                ../user/autoreport.o \
  822. X                ../user/autoshoot.o \
  823. X                ../user/build.o \
  824. X                ../user/capital.o \
  825. X                ../user/capture.o \
  826. X                ../user/cs.o \
  827. X                ../user/declare.o \
  828. X                ../user/dissolve.o \
  829. X                ../user/dock.o \
  830. X                ../user/enslave.o \
  831. X                ../user/examine.o \
  832. X                ../user/explore.o \
  833. X                ../user/fire.o \
  834. X                ../user/fuel.o \
  835. X                ../user/help.o \
  836. X                ../user/land.o \
  837. X                ../user/launch.o \
  838. X                ../user/load.o \
  839. X                ../user/map.o \
  840. X                ../user/mobiliz.o \
  841. X                ../user/move.o \
  842. X                ../user/name.o \
  843. X                ../user/orbit.o \
  844. X                ../user/order.o \
  845. X                ../user/power.o \
  846. X                ../user/prof.o \
  847. X                ../user/relation.o \
  848. X                ../user/rst.o \
  849. X                ../user/sche.o \
  850. X                ../user/scrap.o \
  851. X                ../user/shootblast.o \
  852. X                ../user/survey.o \
  853. X                ../user/tech.o \
  854. X                ../user/tele.o \
  855. X                ../user/togg.o \
  856. X                ../user/toxi.o \
  857. X                ../user/vict.o \
  858. X                ../user/chan.o \
  859. X                ../user/zoom.o
  860. END_OF_FILE
  861. if test 900 -ne `wc -c <'user/OBJECTS'`; then
  862.     echo shar: \"'user/OBJECTS'\" unpacked with wrong size!
  863. fi
  864. # end of 'user/OBJECTS'
  865. fi
  866. if test -f 'user/SOURCES' -a "${1}" != "-c" ; then 
  867.   echo shar: Will not clobber existing file \"'user/SOURCES'\"
  868. else
  869. echo shar: Extracting \"'user/SOURCES'\" \(900 characters\)
  870. sed "s/^X//" >'user/SOURCES' <<'END_OF_FILE'
  871. XUSER_SRC    =    ../user/analysis.c \
  872. X                ../user/autoreport.c \
  873. X                ../user/autoshoot.c \
  874. X                ../user/build.c \
  875. X                ../user/capital.c \
  876. X                ../user/capture.c \
  877. X                ../user/cs.c \
  878. X                ../user/declare.c \
  879. X                ../user/dissolve.c \
  880. X                ../user/dock.c \
  881. X                ../user/enslave.c \
  882. X                ../user/examine.c \
  883. X                ../user/explore.c \
  884. X                ../user/fire.c \
  885. X                ../user/fuel.c \
  886. X                ../user/help.c \
  887. X                ../user/land.c \
  888. X                ../user/launch.c \
  889. X                ../user/load.c \
  890. X                ../user/map.c \
  891. X                ../user/mobiliz.c \
  892. X                ../user/move.c \
  893. X                ../user/name.c \
  894. X                ../user/orbit.c \
  895. X                ../user/order.c \
  896. X                ../user/power.c \
  897. X                ../user/prof.c \
  898. X                ../user/relation.c \
  899. X                ../user/rst.c \
  900. X                ../user/sche.c \
  901. X                ../user/scrap.c \
  902. X                ../user/shootblast.c \
  903. X                ../user/survey.c \
  904. X                ../user/tech.c \
  905. X                ../user/tele.c \
  906. X                ../user/togg.c \
  907. X                ../user/toxi.c \
  908. X                ../user/vict.c \
  909. X                ../user/chan.c \
  910. X                ../user/zoom.c
  911. END_OF_FILE
  912. if test 900 -ne `wc -c <'user/SOURCES'`; then
  913.     echo shar: \"'user/SOURCES'\" unpacked with wrong size!
  914. fi
  915. # end of 'user/SOURCES'
  916. fi
  917. if test -f 'user/autoreport.c' -a "${1}" != "-c" ; then 
  918.   echo shar: Will not clobber existing file \"'user/autoreport.c'\"
  919. else
  920. echo shar: Extracting \"'user/autoreport.c'\" \(1960 characters\)
  921. sed "s/^X//" >'user/autoreport.c' <<'END_OF_FILE'
  922. X/*
  923. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  924. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h.c. Restrictions in
  925. X * GB_copyright.h.c. autoreport.c -- tell server to generate a report for
  926. X * each planet
  927. X */
  928. X
  929. X#include "GB_copyright.h"
  930. X#define EXTERN extern
  931. X#include "vars.h"
  932. X#include "ships.h"
  933. X#include "races.h"
  934. X#include "power.h"
  935. X#include "buffers.h"
  936. X
  937. Xvoid            autoreport(int, int, int);
  938. X#include "proto.h"
  939. X
  940. Xvoid 
  941. Xautoreport(int Playernum, int Governor, int APcount)
  942. X{
  943. X    planettype     *p;
  944. X    placetype       place;
  945. X    int             snum, pnum;
  946. X
  947. X    snum = Dir[Playernum - 1][Governor].snum;
  948. X    pnum = Dir[Playernum - 1][Governor].pnum;
  949. X
  950. X    if (Governor && Stars[snum]->governor[Playernum - 1] != Governor) {
  951. X        notify(Playernum, Governor, "You are not authorized to do this here.\n");
  952. X        return;
  953. X    }
  954. X    if (argn == 1) {    /* no args */
  955. X        if (Dir[Playernum - 1][Governor].level == LEVEL_PLAN) {
  956. X            getplanet(&p, snum, pnum);
  957. X            if (p->info[Playernum - 1].autorep)
  958. X                p->info[Playernum - 1].autorep = 0;
  959. X            else
  960. X                p->info[Playernum - 1].autorep = TELEG_MAX_AUTO;
  961. X            putplanet(p, snum, pnum);
  962. X
  963. X            sprintf(buf, "Autoreport on %s has been %s.\n",
  964. X                Stars[snum]->pnames[pnum],
  965. X              p->info[Playernum - 1].autorep ? "set" : "unset");
  966. X            notify(Playernum, Governor, buf);
  967. X            free(p);
  968. X        } else {
  969. X            sprintf(buf, "Scope must be a planet.\n");
  970. X            notify(Playernum, Governor, buf);
  971. X        }
  972. X    } else if (argn > 1) {    /* argn==2, place specified */
  973. X        place = Getplace(Playernum, Governor, args[1], 0);
  974. X        if (place.level == LEVEL_PLAN) {
  975. X            getplanet(&p, snum, pnum);
  976. X            sprintf(buf, "Autoreport on %s has been %s.\n",
  977. X                Stars[snum]->pnames[pnum],
  978. X              p->info[Playernum - 1].autorep ? "set" : "unset");
  979. X            notify(Playernum, Governor, buf);
  980. X            p->info[Playernum - 1].autorep = !p->info[Playernum - 1].autorep;
  981. X            putplanet(p, snum, pnum);
  982. X            free(p);
  983. X        } else {
  984. X            sprintf(buf, "Scope must be a planet.\n");
  985. X            notify(Playernum, Governor, buf);
  986. X        }
  987. X    }
  988. X}
  989. END_OF_FILE
  990. if test 1960 -ne `wc -c <'user/autoreport.c'`; then
  991.     echo shar: \"'user/autoreport.c'\" unpacked with wrong size!
  992. fi
  993. # end of 'user/autoreport.c'
  994. fi
  995. if test -f 'user/capital.c' -a "${1}" != "-c" ; then 
  996.   echo shar: Will not clobber existing file \"'user/capital.c'\"
  997. else
  998. echo shar: Extracting \"'user/capital.c'\" \(1821 characters\)
  999. sed "s/^X//" >'user/capital.c' <<'END_OF_FILE'
  1000. X/*
  1001. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  1002. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  1003. X * GB_copyright.h.
  1004. X * 
  1005. X * capital.c -- designate a capital
  1006. X */
  1007. X
  1008. X#include "GB_copyright.h"
  1009. X#define EXTERN extern
  1010. X#include "vars.h"
  1011. X#include "ships.h"
  1012. X#include "races.h"
  1013. X#include "power.h"
  1014. X#include "buffers.h"
  1015. X#include <signal.h>
  1016. X
  1017. Xvoid            capital(int, int, int);
  1018. X#include "proto.h"
  1019. X
  1020. Xvoid 
  1021. Xcapital(int Playernum, int Governor, int APcount)
  1022. X{
  1023. X    int             shipno, stat, snum;
  1024. X    shiptype       *s;
  1025. X    racetype       *Race;
  1026. X
  1027. X    Race = races[Playernum - 1];
  1028. X    if (Governor) {
  1029. X        (void) notify(Playernum, Governor, "Only the leader may designate the capital.\n");
  1030. X        return;
  1031. X    }
  1032. X    if (argn != 2)
  1033. X        shipno = Race->Gov_ship;
  1034. X    else
  1035. X        shipno = atoi(args[1] + (args[1][0] == '#'));
  1036. X
  1037. X    if (shipno <= 0) {
  1038. X        (void) notify(Playernum, Governor, "Change the capital to be what ship?\n");
  1039. X        return;
  1040. X    }
  1041. X    stat = getship(&s, shipno);
  1042. X
  1043. X    if (argn == 2) {
  1044. X        snum = s->storbits;
  1045. X        if (!stat || testship(Playernum, Governor, s)) {
  1046. X            (void) notify(Playernum, Governor, "You can't do that!\n");
  1047. X            free(s);
  1048. X            return;
  1049. X        }
  1050. X        if (!landed(s)) {
  1051. X            (void) notify(Playernum, Governor, "Try landing this ship first!\n");
  1052. X            free(s);
  1053. X            return;
  1054. X        }
  1055. X        if (!enufAP(Playernum, Governor, Stars[snum]->AP[Playernum - 1], APcount)) {
  1056. X            free(s);
  1057. X            return;
  1058. X        }
  1059. X        if (s->type != OTYPE_GOV) {
  1060. X            sprintf(buf, "That ship is not a %s.\n", Shipnames[OTYPE_GOV]);
  1061. X            (void) notify(Playernum, Governor, buf);
  1062. X            free(s);
  1063. X            return;
  1064. X        }
  1065. X        deductAPs(Playernum, Governor, APcount, snum, 0);
  1066. X        Race->Gov_ship = shipno;
  1067. X        putrace(Race);
  1068. X    }
  1069. X    sprintf(buf, "Efficiency of governmental center: %.0f%%.\n",
  1070. X        ((double) s->popn / (double) Max_crew(s)) *
  1071. X        (100 - (double) s->damage));
  1072. X    (void) notify(Playernum, Governor, buf);
  1073. X    free(s);
  1074. X}
  1075. END_OF_FILE
  1076. if test 1821 -ne `wc -c <'user/capital.c'`; then
  1077.     echo shar: \"'user/capital.c'\" unpacked with wrong size!
  1078. fi
  1079. # end of 'user/capital.c'
  1080. fi
  1081. if test -f 'user/guardian.c' -a "${1}" != "-c" ; then 
  1082.   echo shar: Will not clobber existing file \"'user/guardian.c'\"
  1083. else
  1084. echo shar: Extracting \"'user/guardian.c'\" \(854 characters\)
  1085. sed "s/^X//" >'user/guardian.c' <<'END_OF_FILE'
  1086. X/*
  1087. X * guardian.c - makes sure your server keeps running.
  1088. X * 
  1089. X */
  1090. X
  1091. X#include <stdio.h>
  1092. X#include <signal.h>
  1093. X
  1094. Xchar           *prog;
  1095. X
  1096. Xmain(argc, argv)
  1097. X    int             argc;
  1098. X    char           *argv[];
  1099. X{
  1100. X    int             pid;
  1101. X
  1102. X    (void) sigblock(SIGHUP);/* ignore signal when owner logs out */
  1103. X
  1104. X    prog = *argv++;        /* remember guardian name */
  1105. X    fprintf(stderr, "%s: ", prog);
  1106. X    while (1) {
  1107. X        switch (pid = fork()) {
  1108. X        case -1:    /* error! */
  1109. X            perror("can't fork a child");
  1110. X            sleep(600);    /* 10 min */
  1111. X            break;
  1112. X        case 0:    /* child */
  1113. X            execvp(argv[0], argv);
  1114. X            perror("can't exec child");
  1115. X            exit(1);
  1116. X            break;
  1117. X        default:    /* parent */
  1118. X            fprintf(stderr, "starting %s with pid [%d]\n", argv[0], pid);
  1119. X            wait(0);/* wait for the little brat */
  1120. X            break;
  1121. X        }
  1122. X        fprintf(stderr, "%s: re", prog);
  1123. X        sleep(60);    /* wait a minute then try to start it up
  1124. X                 * again */
  1125. X    }
  1126. X}
  1127. END_OF_FILE
  1128. if test 854 -ne `wc -c <'user/guardian.c'`; then
  1129.     echo shar: \"'user/guardian.c'\" unpacked with wrong size!
  1130. fi
  1131. # end of 'user/guardian.c'
  1132. fi
  1133. if test -f 'user/help.c' -a "${1}" != "-c" ; then 
  1134.   echo shar: Will not clobber existing file \"'user/help.c'\"
  1135. else
  1136. echo shar: Extracting \"'user/help.c'\" \(1673 characters\)
  1137. sed "s/^X//" >'user/help.c' <<'END_OF_FILE'
  1138. X#ident  "@(#)help.c    1.8 2/1/93 "
  1139. X/***********************************************
  1140. X * log.c
  1141. X *
  1142. X * Author: ???
  1143. X *
  1144. X * Version: 1.8 00:14:39
  1145. X *
  1146. X * Contains:
  1147. X *   help()
  1148. X *   help_user()
  1149. X *
  1150. X ***********************************************/
  1151. X
  1152. X
  1153. X#include <stdio.h>
  1154. X#define EXTERN extern
  1155. X#include "vars.h"
  1156. X#include "buffers.h"
  1157. X#include "config.h"
  1158. X
  1159. X/*
  1160. X * Prototypes
  1161. X */
  1162. Xvoid            help_user(struct descriptor_data *);
  1163. Xvoid            help(struct descriptor_data *);
  1164. X
  1165. X/*
  1166. X * help:
  1167. X * 
  1168. X * arguments: who pointer to the descriptor data
  1169. X * 
  1170. X * called by: main
  1171. X * 
  1172. X * description:  Called from the process_commands loop.
  1173. X * 
  1174. X */
  1175. X
  1176. Xvoid
  1177. Xhelp(struct descriptor_data * who)
  1178. X{
  1179. X
  1180. X    FILE           *f;
  1181. X    char            file[1024];
  1182. X    char           *p;
  1183. X
  1184. X    if (argn == 1) {
  1185. X        help_user(who);
  1186. X    } else {
  1187. X        sprintf(file, "%s/%s.doc", DOCSDIR, args[1]);
  1188. X        if ((f = fopen(file, "r")) != 0) {
  1189. X            while (fgets(buf, sizeof buf, f)) {
  1190. X                for (p = buf; *p; p++)
  1191. X                    if (*p == '\n') {
  1192. X                        *p = '\0';
  1193. X                        break;
  1194. X                    }
  1195. X                strcat(buf, "\n");
  1196. X                queue_string(who, buf);
  1197. X            }
  1198. X            fclose(f);
  1199. X            queue_string(who, "----\nFinished.\n");
  1200. X        } else
  1201. X            queue_string(who, "Help on that subject unavailable.\n");
  1202. X    }
  1203. X}
  1204. X/*
  1205. X * help_user:
  1206. X * 
  1207. X * arguments: who pointer to the descriptor data
  1208. X * 
  1209. X * called by: help
  1210. X * 
  1211. X * description:  Called by help(), when user requests generic help
  1212. X * 
  1213. X */
  1214. X
  1215. Xvoid 
  1216. Xhelp_user(struct descriptor_data * d)
  1217. X{
  1218. X    FILE           *f;
  1219. X    char           *p;
  1220. X
  1221. X    if ((f = fopen(HELP_FILE, "r")) != NULL) {
  1222. X        while (fgets(buf, sizeof buf, f)) {
  1223. X            for (p = buf; *p; p++)
  1224. X                if (*p == '\n') {
  1225. X                    *p = '\0';
  1226. X                    break;
  1227. X                }
  1228. X            queue_string(d, buf);
  1229. X            queue_string(d, "\n");
  1230. X        }
  1231. X        fclose(f);
  1232. X    }
  1233. X}
  1234. END_OF_FILE
  1235. if test 1673 -ne `wc -c <'user/help.c'`; then
  1236.     echo shar: \"'user/help.c'\" unpacked with wrong size!
  1237. fi
  1238. # end of 'user/help.c'
  1239. fi
  1240. if test -f 'user/relation.c' -a "${1}" != "-c" ; then 
  1241.   echo shar: Will not clobber existing file \"'user/relation.c'\"
  1242. else
  1243. echo shar: Extracting \"'user/relation.c'\" \(1808 characters\)
  1244. sed "s/^X//" >'user/relation.c' <<'END_OF_FILE'
  1245. X/*
  1246. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  1247. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  1248. X * GB_copyright.h.
  1249. X * 
  1250. X * relation.c -- state relations among players
  1251. X */
  1252. X
  1253. X#include "GB_copyright.h"
  1254. X#define EXTERN extern
  1255. X#include "vars.h"
  1256. X#include "races.h"
  1257. X#include "ships.h"
  1258. X#include "power.h"
  1259. X#include "buffers.h"
  1260. X
  1261. Xextern char    *Desnames[];
  1262. X
  1263. Xvoid            relation(int, int, int);
  1264. Xchar           *allied(racetype *, int, int, int);
  1265. X#include "proto.h"
  1266. X
  1267. Xvoid 
  1268. Xrelation(int Playernum, int Governor, int APcount)
  1269. X{
  1270. X    int             numraces;
  1271. X    int             p, q;
  1272. X    racetype       *r, *Race;
  1273. X
  1274. X    numraces = Num_races;
  1275. X
  1276. X    if (argn == 1) {
  1277. X        q = Playernum;
  1278. X    } else {
  1279. X        if (!(q = GetPlayer(args[1]))) {
  1280. X            notify(Playernum, Governor, "No such player.\n");
  1281. X            return;
  1282. X        }
  1283. X    }
  1284. X
  1285. X    Race = races[q - 1];
  1286. X
  1287. X    sprintf(buf, "\n              Racial Relations Report for %s\n\n", Race->name);
  1288. X    notify(Playernum, Governor, buf);
  1289. X    sprintf(buf, " #       know             Race name       Yours        Theirs\n");
  1290. X    notify(Playernum, Governor, buf);
  1291. X    sprintf(buf, " -       ----             ---------       -----        ------\n");
  1292. X    notify(Playernum, Governor, buf);
  1293. X    for (p = 1; p <= numraces; p++)
  1294. X        if (p != Race->Playernum) {
  1295. X            r = races[p - 1];
  1296. X            sprintf(buf, "%2d %s (%3d%%) %20.20s : %10s   %10s\n", p,
  1297. X                ((Race->God || (Race->translate[p - 1] > 30)) && r->Metamorph && (Playernum == q)) ? "Morph" : "     ", Race->translate[p - 1], r->name,
  1298. X                allied(Race, p, 100, (int) Race->God),
  1299. X                allied(r, q, (int) Race->translate[p - 1], (int) Race->God));
  1300. X            notify(Playernum, Governor, buf);
  1301. X        }
  1302. X}
  1303. X
  1304. Xchar           *
  1305. Xallied(racetype * r, int p, int q, int God)
  1306. X{
  1307. X    if (isset(r->atwar, p))
  1308. X        return "WAR";
  1309. X    else if (isset(r->allied, p))
  1310. X        return "ALLIED";
  1311. X    else
  1312. X        return "neutral";
  1313. X}
  1314. END_OF_FILE
  1315. if test 1808 -ne `wc -c <'user/relation.c'`; then
  1316.     echo shar: \"'user/relation.c'\" unpacked with wrong size!
  1317. fi
  1318. # end of 'user/relation.c'
  1319. fi
  1320. if test -f 'user/sche.c' -a "${1}" != "-c" ; then 
  1321.   echo shar: Will not clobber existing file \"'user/sche.c'\"
  1322. else
  1323. echo shar: Extracting \"'user/sche.c'\" \(1210 characters\)
  1324. sed "s/^X//" >'user/sche.c' <<'END_OF_FILE'
  1325. X#ident  "@(#)sche.c    1.6 2/1/93 "
  1326. X/***********************************************
  1327. X * sched.c
  1328. X *
  1329. X * Created: Fri Dec 11 03:50:49 EST 1992
  1330. X * Author:  ???
  1331. X *
  1332. X * Version: 1.6 00:14:38
  1333. X *
  1334. X * Contains:
  1335. X *   GB_schedule()
  1336. X *
  1337. X ***********************************************/
  1338. X
  1339. X/*
  1340. X * Prototypes
  1341. X */
  1342. Xvoid            GB_schedule(int, int);
  1343. X
  1344. X#include "GB_copyright.h"
  1345. X#define EXTERN extern
  1346. X#include "vars.h"
  1347. X#include "buffers.h"
  1348. X#include <ctype.h>
  1349. X
  1350. X
  1351. X/*
  1352. X * GB_schedule:
  1353. X * 
  1354. X * arguments: Playernum Playernum who called it Governor Governor who called it
  1355. X * 
  1356. X * Called by: process_command
  1357. X * 
  1358. X */
  1359. X
  1360. Xvoid
  1361. XGB_schedule(int Playernum, int Governor)
  1362. X{
  1363. X    clk = time(0);
  1364. X    sprintf(buf, "%d minute update intervals\n", update_time);
  1365. X    notify(Playernum, Governor, buf);
  1366. X    sprintf(buf, "%d movement segments per update\n", segments);
  1367. X    notify(Playernum, Governor, buf);
  1368. X    sprintf(buf, "Current time    : %s", ctime(&clk));
  1369. X    notify(Playernum, Governor, buf);
  1370. X    sprintf(buf, "Next Segment %2d : %s",
  1371. X        nsegments_done == segments ? 1 : nsegments_done + 1,
  1372. X        ctime(&next_segment_time));
  1373. X    notify(Playernum, Governor, buf);
  1374. X    sprintf(buf, "Next Update %3d : %s", nupdates_done + 1,
  1375. X        ctime(&next_update_time));
  1376. X    notify(Playernum, Governor, buf);
  1377. X}
  1378. END_OF_FILE
  1379. if test 1210 -ne `wc -c <'user/sche.c'`; then
  1380.     echo shar: \"'user/sche.c'\" unpacked with wrong size!
  1381. fi
  1382. # end of 'user/sche.c'
  1383. fi
  1384. if test -f 'user/tech.c' -a "${1}" != "-c" ; then 
  1385.   echo shar: Will not clobber existing file \"'user/tech.c'\"
  1386. else
  1387. echo shar: Extracting \"'user/tech.c'\" \(2075 characters\)
  1388. sed "s/^X//" >'user/tech.c' <<'END_OF_FILE'
  1389. X
  1390. X#include "GB_copyright.h"
  1391. X#define EXTERN extern
  1392. X#include "vars.h"
  1393. X#include "ships.h"
  1394. X#include "power.h"
  1395. X#include "races.h"
  1396. X#include "buffers.h"
  1397. X#include <math.h>
  1398. X#include <signal.h>
  1399. X#include <ctype.h>
  1400. X
  1401. X
  1402. X/*
  1403. X * Prototypes
  1404. X */
  1405. Xvoid            technology(int, int, int);
  1406. Xdouble          tech_prod(int, int);
  1407. X#include        "proto.h"
  1408. X
  1409. Xvoid
  1410. Xtechnology(int Playernum, int Governor, int APcount)
  1411. X{
  1412. X    short           invest;
  1413. X    planettype     *p;
  1414. X
  1415. X    if (Dir[Playernum - 1][Governor].level != LEVEL_PLAN) {
  1416. X        sprintf(buf, "scope must be a planet (%d).\n",
  1417. X            Dir[Playernum - 1][Governor].level);
  1418. X        notify(Playernum, Governor, buf);
  1419. X        return;
  1420. X    }
  1421. X    if (!control(Playernum, Governor, Stars[Dir[Playernum - 1][Governor].snum])) {
  1422. X        notify(Playernum, Governor,
  1423. X               "You are not authorized to do that here.\n");
  1424. X        return;
  1425. X    }
  1426. X    if (!enufAP(Playernum, Governor,
  1427. X            Stars[Dir[Playernum - 1][Governor].snum]->AP[Playernum - 1], APcount))
  1428. X        return;
  1429. X
  1430. X
  1431. X    getplanet(&p, Dir[Playernum - 1][Governor].snum,
  1432. X          Dir[Playernum - 1][Governor].pnum);
  1433. X
  1434. X    if (argn < 2) {
  1435. X        sprintf(buf,
  1436. X            "Current investment : %d    Technology production/update: %.3f\n",
  1437. X            p->info[Playernum - 1].tech_invest,
  1438. X            tech_prod((int) (p->info[Playernum - 1].tech_invest),
  1439. X                  (int) (p->info[Playernum - 1].popn)));
  1440. X        notify(Playernum, Governor, buf);
  1441. X        free(p);
  1442. X        return;
  1443. X    }
  1444. X    invest = atoi(args[1]);
  1445. X
  1446. X    if (invest < 0) {
  1447. X        sprintf(buf, "Illegal value.\n");
  1448. X        notify(Playernum, Governor, buf);
  1449. X        free(p);
  1450. X        return;
  1451. X    }
  1452. X    p->info[Playernum - 1].tech_invest = invest;
  1453. X
  1454. X    putplanet(p, Dir[Playernum - 1][Governor].snum,
  1455. X          Dir[Playernum - 1][Governor].pnum);
  1456. X
  1457. X    deductAPs(Playernum, Governor, APcount,
  1458. X          Dir[Playernum - 1][Governor].snum, 0);
  1459. X
  1460. X    sprintf(buf, "   New (ideal) tech production: %.3f (this planet)\n",
  1461. X        tech_prod((int) (p->info[Playernum - 1].tech_invest),
  1462. X              (int) (p->info[Playernum - 1].popn)));
  1463. X    notify(Playernum, Governor, buf);
  1464. X
  1465. X    free(p);
  1466. X}
  1467. X
  1468. Xdouble
  1469. Xtech_prod(int investment, int popn)
  1470. X{
  1471. X    double          scale;
  1472. X
  1473. X    scale = (double) popn / 10000.;
  1474. X    return (TECH_INVEST * log10((double) investment * scale + 1.0));
  1475. X}
  1476. END_OF_FILE
  1477. if test 2075 -ne `wc -c <'user/tech.c'`; then
  1478.     echo shar: \"'user/tech.c'\" unpacked with wrong size!
  1479. fi
  1480. # end of 'user/tech.c'
  1481. fi
  1482. if test -f 'user/toxi.c' -a "${1}" != "-c" ; then 
  1483.   echo shar: Will not clobber existing file \"'user/toxi.c'\"
  1484. else
  1485. echo shar: Extracting \"'user/toxi.c'\" \(1764 characters\)
  1486. sed "s/^X//" >'user/toxi.c' <<'END_OF_FILE'
  1487. X#ident  "@(#)toxi.c    1.4 2/1/93 "
  1488. X/***********************************************
  1489. X * toxi.c
  1490. X *
  1491. X * Created:
  1492. X * Author:  Robert Chansky
  1493. X *
  1494. X * Version: 1.4 00:14:41
  1495. X *
  1496. X * Contains:
  1497. X *  toxicity()
  1498. X *
  1499. X ********************************************/
  1500. X
  1501. X#include "GB_copyright.h"
  1502. X#define EXTERN extern
  1503. X#include "vars.h"
  1504. X#include "ships.h"
  1505. X#include "races.h"
  1506. X#include "power.h"
  1507. X#include "buffers.h"
  1508. X#include <math.h>
  1509. X#include <signal.h>
  1510. X#include <ctype.h>
  1511. X
  1512. X/*
  1513. X * Prototypes
  1514. X */
  1515. Xvoid            toxicity(int, int, int);
  1516. X#include "proto.h"
  1517. X
  1518. X/*
  1519. X * clearlog:
  1520. X * 
  1521. X * arguments: Playernum Governor APcount
  1522. X * 
  1523. X * called by: process_commands
  1524. X * 
  1525. X * description:  Called from process_commands.  This sets the toxicity value on
  1526. X * the planet to automatically launch twc when reached.
  1527. X * 
  1528. X */
  1529. X
  1530. Xvoid
  1531. Xtoxicity(int Playernum, int Governor, int APcount)
  1532. X{
  1533. X
  1534. X    int             thresh;
  1535. X    planettype     *p;
  1536. X
  1537. X    sscanf(args[1], "%d", &thresh);
  1538. X
  1539. X    if (thresh > 100 || thresh < 0) {
  1540. X        sprintf(buf, "Illegal value.\n");
  1541. X        notify(Playernum, Governor, buf);
  1542. X        return;
  1543. X    }
  1544. X    if (Dir[Playernum - 1][Governor].level != LEVEL_PLAN) {
  1545. X        sprintf(buf, "scope must be a planet.\n");
  1546. X        notify(Playernum, Governor, buf);
  1547. X        return;
  1548. X    }
  1549. X    if (!enufAP(Playernum, Governor, Stars[Dir[Playernum - 1][Governor].snum]->AP[Playernum - 1], APcount))
  1550. X        return;
  1551. X
  1552. X    getplanet(&p, Dir[Playernum - 1][Governor].snum, Dir[Playernum - 1][Governor].pnum);
  1553. X
  1554. X    /* set the tox value for the planet */
  1555. X    p->info[Playernum - 1].tox_thresh = thresh;
  1556. X
  1557. X    putplanet(p, Dir[Playernum - 1][Governor].snum, Dir[Playernum - 1][Governor].pnum);
  1558. X
  1559. X    deductAPs(Playernum, Governor, APcount, Dir[Playernum - 1][Governor].snum, 0);
  1560. X
  1561. X    sprintf(buf, " New threshold is: %u\n", p->info[Playernum - 1].tox_thresh);
  1562. X    notify(Playernum, Governor, buf);
  1563. X
  1564. X    free(p);
  1565. X}
  1566. END_OF_FILE
  1567. if test 1764 -ne `wc -c <'user/toxi.c'`; then
  1568.     echo shar: \"'user/toxi.c'\" unpacked with wrong size!
  1569. fi
  1570. # end of 'user/toxi.c'
  1571. fi
  1572. if test -f 'user/zoom.c' -a "${1}" != "-c" ; then 
  1573.   echo shar: Will not clobber existing file \"'user/zoom.c'\"
  1574. else
  1575. echo shar: Extracting \"'user/zoom.c'\" \(1340 characters\)
  1576. sed "s/^X//" >'user/zoom.c' <<'END_OF_FILE'
  1577. X#ident  "@(#)zoom.c    1.7 2/1/93 "
  1578. X/***********************************************
  1579. X * zoom.c
  1580. X *
  1581. X * Created:
  1582. X * Author:  ???
  1583. X *
  1584. X * Version:  1.7 00:14:37
  1585. X *
  1586. X * Contains:
  1587. X *   zoom()
  1588. X *
  1589. X ***********************************************/
  1590. X
  1591. X
  1592. X#include "GB_copyright.h"
  1593. X#define EXTERN extern
  1594. X#include "vars.h"
  1595. X#include "ships.h"
  1596. X#include "races.h"
  1597. X#include "power.h"
  1598. X#include "buffers.h"
  1599. X
  1600. X/*
  1601. X * Prototypes
  1602. X */
  1603. Xvoid            zoom(int, int);
  1604. X#include "proto.h"
  1605. X
  1606. X/*
  1607. X * GB_schedule:
  1608. X * 
  1609. X * arguments: Playernum Playernum who called it Governor Governor who called it
  1610. X * 
  1611. X * Called by: process_command
  1612. X * 
  1613. X */
  1614. Xvoid
  1615. Xzoom(int Playernum, int Governor)
  1616. X{
  1617. X    double          num, denom;
  1618. X    int             i;
  1619. X
  1620. X    i = (Dir[Playernum - 1][Governor].level == LEVEL_UNIV);
  1621. X
  1622. X    if (argn > 1) {
  1623. X        if (sscanf(args[1], "%f/%f", &num, &denom) == 2) {
  1624. X            /* num/denom format */
  1625. X            if (denom == 0.0) {
  1626. X                sprintf(buf, "Illegal denominator value.\n");
  1627. X                notify(Playernum, Governor, buf);
  1628. X            } else    /* if (denom) */
  1629. X                Dir[Playernum - 1][Governor].zoom[i] = num / denom;
  1630. X        } else {
  1631. X            /* one number */
  1632. X            Dir[Playernum - 1][Governor].zoom[i] = num;
  1633. X        }
  1634. X    }
  1635. X    sprintf(buf, "Zoom value %g, lastx = %g, lasty = %g.\n",
  1636. X        Dir[Playernum - 1][Governor].zoom[i],
  1637. X        Dir[Playernum - 1][Governor].lastx[i],
  1638. X        Dir[Playernum - 1][Governor].lasty[i]);
  1639. X    notify(Playernum, Governor, buf);
  1640. X}
  1641. END_OF_FILE
  1642. if test 1340 -ne `wc -c <'user/zoom.c'`; then
  1643.     echo shar: \"'user/zoom.c'\" unpacked with wrong size!
  1644. fi
  1645. # end of 'user/zoom.c'
  1646. fi
  1647. echo shar: End of archive 21 \(of 21\).
  1648. cp /dev/null ark21isdone
  1649. MISSING=""
  1650. 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
  1651.     if test ! -f ark${I}isdone ; then
  1652.     MISSING="${MISSING} ${I}"
  1653.     fi
  1654. done
  1655. if test "${MISSING}" = "" ; then
  1656.     echo You have unpacked all 21 archives.
  1657.     echo "Now type './buildfiles.sh'"
  1658.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1659. else
  1660.     echo You still need to unpack the following archives:
  1661.     echo "        " ${MISSING}
  1662. fi
  1663. ##  End of shell archive.
  1664. exit 0
  1665.