home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume17 / gbp / part20 < prev    next >
Encoding:
Internet Message Format  |  1993-03-20  |  57.0 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: v17i032:  gbp - Galactic Bloodshed+, an empire-like war game, Part20/21
  5. Message-ID: <4560@master.CNA.TEK.COM>
  6. Date: 12 Feb 93 17:33:42 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 2418
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1711
  11.  
  12. Submitted-by: deragon@harpo.cs.nyu.edu (Seeker)
  13. Posting-number: Volume 17, Issue 32
  14. Archive-name: gbp/Part20
  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 20 (of 21)."
  27. # Contents:  Makefile.SH doc/racegen.novice-info hdrs/files.h.SH
  28. #   misc/help.txt misc/star.list server/client.c server/lists.c
  29. #   server/log.c server/max.c server/misc.c user/autoshoot.c
  30. #   user/chan.c user/examine.c user/vict.c utils/Makefile.SH
  31. #   utils/README_EXSHIP
  32. # Wrapped by billr@saab on Fri Feb 12 09:14:31 1993
  33. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  34. if test -f 'Makefile.SH' -a "${1}" != "-c" ; then 
  35.   echo shar: Will not clobber existing file \"'Makefile.SH'\"
  36. else
  37. echo shar: Extracting \"'Makefile.SH'\" \(3100 characters\)
  38. sed "s/^X//" >'Makefile.SH' <<'END_OF_FILE'
  39. Xcase $CONFIG in
  40. X'')
  41. X    if test ! -f config.sh; then
  42. X    ln ../config.sh . || \
  43. X    ln ../../config.sh . || \
  44. X    ln ../../../config.sh . || \
  45. X    (echo "Can't find config.sh."; exit 1)
  46. X    fi
  47. X    . ./config.sh
  48. X    ;;
  49. Xesac
  50. Xcase "$0" in
  51. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  52. Xesac
  53. X
  54. Xcase "$d_symlink" in
  55. X*define*) sln='ln -s' ;;
  56. X*) sln='ln';;
  57. Xesac
  58. X
  59. Xecho "Extracting Makefile (with variable substitutions)"
  60. Xcat >Makefile <<!GROK!THIS!
  61. X#
  62. X#
  63. X#  Top level Makefile for the GB+ program
  64. X#
  65. X#
  66. X# Bug reports, patches, comments, suggestions should be sent to:
  67. X#
  68. X#       John Deragon deragon@jethro.cs.nyu.edu
  69. X#
  70. X# Revision %I% %U% jpd
  71. X#
  72. X#
  73. X#
  74. X#    Variables established by Configure
  75. XCAT        =    $cat
  76. XGREP        =    $grep
  77. XECHO        =    $echo
  78. XMAKE        =    $make
  79. XPR        =    $pr
  80. XSHAR        =    $shar -s 60000
  81. XSLEEP        =    $sleep
  82. XTAR        =    $tar
  83. XHOST        =    $host
  84. XPORT        =    $port
  85. XARCHIVE     =   gb+.tar
  86. X
  87. X!GROK!THIS!
  88. Xcat >>Makefile <<'!NO!SUBS!'
  89. X#    Other variables
  90. XSHELL            =    /bin/sh
  91. XSOURCE_FILES        =    `$(GREP) -v 'doc/' MANIFEST`
  92. XDISTRIBUTED_FILES    =    `$(CAT) MANIFEST`
  93. X
  94. X
  95. X# Targets
  96. X#    Give default target first and alone
  97. Xdefault_target:    all
  98. X
  99. X#    Targets that are simply executed in each subordinate makefile as is
  100. Xall:
  101. X        @echo "Making in library in user"
  102. X        cd user; $(MAKE) -$(MAKEFLAGS) $@
  103. X        @echo "Making in server"
  104. X        cd server; $(MAKE) -$(MAKEFLAGS) $@
  105. X        @echo "Makeinf in utils"
  106. X        cd utils; $(MAKE) -$(MAKEFLAGS) $@
  107. X        @echo "Now do a \"make install\""
  108. X        
  109. X
  110. Xshar:
  111. X        $(SHAR) $(DISTRIBUTED_FILES)
  112. X
  113. Xtar:
  114. X        chmod +x Configure
  115. X        $(TAR) cvf $(ARCHIVE) $(DISTRIBUTED_FILES)
  116. X
  117. Xfloppy:
  118. X        $(TAR) cvf /dev/rfd0c $(DISTRIBUTED_FILES)
  119. X
  120. Xclean:
  121. X    cd user; $(MAKE) clean
  122. X    cd server; $(MAKE) clean
  123. X
  124. XGB:
  125. X    cd user; $(MAKE) -$(MAKEFLAGS) all
  126. X    cd server; $(MAKE) -$(MAKEFLAGS) all
  127. X    cd utils; $(MAKE) -$(MAKEFLAGS) all
  128. X
  129. XGBX:
  130. X    @echo "**** Making objects in user"
  131. X    cd user; $(MAKE) -$(MAKEFLAGS) objects
  132. X    @echo "**** Making in server"
  133. X    cd server; $(MAKE) -$(MAKEFLAGS) GBX
  134. X    @echo "**** Now do a \"make installgbx\""
  135. X
  136. Xinstallgbx:
  137. X    @echo "**** Installing in server"
  138. X    cd server; $(MAKE) -$(MAKEFLAGS) installgbx
  139. X    @echo "**** Installing in utils"
  140. X    cd utils; $(MAKE) -$(MAKEFLAGS) install
  141. X    @echo "**** Installing in misc"
  142. X    cd misc; $(MAKE) -$(MAKEFLAGS) install
  143. X    @echo "**** All Done!"
  144. X
  145. Xinstall:
  146. X    @echo "**** Installing in server"
  147. X    cd server; $(MAKE) -$(MAKEFLAGS) install    
  148. X    @echo "**** Installing in utils"
  149. X    cd utils; $(MAKE) -$(MAKEFLAGS) install
  150. X    @echo "**** Installing in misc"
  151. X    cd misc; $(MAKE) -$(MAKEFLAGS) install    
  152. X    @echo "**** All Done!"
  153. X
  154. X#    The dummy dependency here prevents make from thinking the target is the
  155. X#    utils directory that sits in the current directory, rather than
  156. X#    an abstract target.
  157. Xserver: _server
  158. X
  159. X_server:
  160. X    cd server; $(MAKE) -$(MAKEFLAGS) all
  161. X#    The dummy dependency here prevents make from thinking the target is the
  162. X#    utils directory that sits in the current directory, rather than
  163. X#    an abstract target.
  164. Xuser: _user
  165. X
  166. X_user:
  167. X    cd user; $(MAKE) -$(MAKEFLAGS) all
  168. X
  169. X#    The dummy dependency here prevents make from thinking the target is the
  170. X#    utils directory that sits in the current directory, rather than
  171. X#    an abstract target.
  172. Xutils: _utils
  173. X
  174. X_utils:
  175. X    cd utils; $(MAKE) -$(MAKEFLAGS) all
  176. X
  177. X!NO!SUBS!
  178. END_OF_FILE
  179. if test 3100 -ne `wc -c <'Makefile.SH'`; then
  180.     echo shar: \"'Makefile.SH'\" unpacked with wrong size!
  181. fi
  182. # end of 'Makefile.SH'
  183. fi
  184. if test -f 'doc/racegen.novice-info' -a "${1}" != "-c" ; then 
  185.   echo shar: Will not clobber existing file \"'doc/racegen.novice-info'\"
  186. else
  187. echo shar: Extracting \"'doc/racegen.novice-info'\" \(2130 characters\)
  188. sed "s/^X//" >'doc/racegen.novice-info' <<'END_OF_FILE'
  189. X
  190. XHow to get and compile racegen
  191. X
  192. XFirst off, get net access.  Then you can use the file transfer program, ftp,
  193. Xto get racegen from several sites, including scam.berkeley.edu.  Connect to
  194. Xthe remote system, use "anonymous" as your name (any password is OK), cd to
  195. Xthe src/games/gb directory, and get racegen.shar.  The whole process should
  196. Xlook rather like this:
  197. X
  198. X> ftp scam.berkeley.edu
  199. XConnected to scam.berkeley.edu.
  200. X220 scam.Berkeley.EDU FTP server ready.
  201. XName (scam.berkeley.edu:leonard): anonymous
  202. X331 Guest login ok, send ident as password.
  203. XPassword:
  204. X230-Welcome Guest - access restricted.
  205. Xftp> cd src/games/gb
  206. X200 CWD command okay.
  207. Xftp> get racegen.shar
  208. X200 PORT command okay.
  209. X150 Opening data connection for racegen.shar (60101 bytes).
  210. X226 Transfer complete.
  211. Xlocal: racegen.shar remote: racegen.shar
  212. X62071 bytes received in 6.1 seconds (9.9 Kbytes/s)
  213. Xftp> quit
  214. X221 Goodbye.
  215. X> 
  216. X
  217. XWhen a game is announced, the host will specify what sort of races are
  218. Xdesired.  If the game will not use the "vanilla" racegen, the host will post
  219. Xa file called "game_info.h" that you will then use to compile racegen with.
  220. XNote that racegen.shar comes with a default game_info.h file.
  221. X
  222. XNow you can make an executable racegen.  Unshar the archive you just got,
  223. Xand make it:
  224. X
  225. X> sh racegen.shar
  226. Xx - racegen.c
  227. Xx - racegen.h
  228. Xx - game_info.h
  229. Xx - Makefile
  230. Xx - racegen.README
  231. X> make
  232. Xcc -bsd -g  -target sun3 -c  racegen.c
  233. Xcc -o racegen racegen.o -lm
  234. X> ls
  235. XMakefile        racegen*        racegen.c       racegen.o
  236. Xgame_info.h     racegen.README  racegen.h       racegen.shar
  237. X
  238. X
  239. XNow you are ready to go.  Just type "racegen", and it will run.  If it
  240. Xdoes not, make sure you have the current directory "." as a part of
  241. Xyour path:
  242. X
  243. X> printenv PATH
  244. X.:/usr/imports/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin
  245. X>
  246. X
  247. X(Note that the first directory in my path *is* ".".  ':' is used to
  248. Xseparate the directories in this list.)
  249. X
  250. XIf "." is not in your path, you must either put the racegen executable
  251. Xfile in one of the directories that is in your path, or else put "."
  252. Xinto your path.  The second option is much easier:
  253. X
  254. X> setenv PATH .:$PATH
  255. X
  256. XNow you are ready to go!
  257. END_OF_FILE
  258. if test 2130 -ne `wc -c <'doc/racegen.novice-info'`; then
  259.     echo shar: \"'doc/racegen.novice-info'\" unpacked with wrong size!
  260. fi
  261. # end of 'doc/racegen.novice-info'
  262. fi
  263. if test -f 'hdrs/files.h.SH' -a "${1}" != "-c" ; then 
  264.   echo shar: Will not clobber existing file \"'hdrs/files.h.SH'\"
  265. else
  266. echo shar: Extracting \"'hdrs/files.h.SH'\" \(2392 characters\)
  267. sed "s/^X//" >'hdrs/files.h.SH' <<'END_OF_FILE'
  268. Xcase $CONFIG in
  269. X'')
  270. X    if test ! -f config.sh; then
  271. X    ln ../config.sh . || \
  272. X    ln ../../config.sh . || \
  273. X    ln ../../../config.sh . || \
  274. X    (echo "Can't find config.sh."; exit 1)
  275. X    fi
  276. X    . ./config.sh
  277. X    ;;
  278. Xesac
  279. Xcase "$0" in
  280. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  281. Xesac
  282. X
  283. Xcase "$d_symlink" in
  284. X*define*) sln='ln -s' ;;
  285. X*) sln='ln';;
  286. Xesac
  287. X
  288. Xecho "Extracting files.h (with variable substitutions)"
  289. Xcat >files.h <<!GROK!THIS!
  290. X/*
  291. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, { * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
  292. X * Restrictions in GB.c.
  293. X *
  294. X * files.h
  295. X * This file was produced by running the files.h.SH script, which
  296. X * gets its values from config.sh, which is generally produced by
  297. X * running Configure.
  298. X *
  299. X * Feel free to modify any of this as the need arises.  Note, however,
  300. X * that running files.h.SH again will wipe out any changes you've made.
  301. X * For a more permanent change edit config.h.SH.
  302. X */
  303. X#ident  "@(#)files.h.SH    1.2 12/15/92 "
  304. X
  305. X#define PATH(file)    "${gbpath}/"#file
  306. X#define    DATA(file)    PATH(Data/file)
  307. X#define NEWS(file)      PATH(News/file)
  308. X#define TELE(file)      PATH(Tele/file)
  309. X#define LOG(file)        PATH(Logs/file)
  310. X
  311. X#define PATHLEN        200    /* length of file paths to the game.. */
  312. X
  313. X#define CUTE_MESSAGE    "\nThe Galactic News\n\n"
  314. X#define DECLARATION    0    /* news file index */
  315. X#define TRANSFER    1
  316. X#define COMBAT        2
  317. X#define ANNOUNCE    3
  318. X
  319. X#define DATADIR        Files[0]
  320. X#define DOCSDIR        Files[1]
  321. X#define EXAM_FL        Files[2]
  322. X#define ENROLL_FL    Files[3]
  323. X#define STARDATAFL     Files[4]
  324. X#define SECTORDATAFL     Files[5]
  325. X#define PLANETDATAFL     Files[6]
  326. X#define RACEDATAFL     Files[7]
  327. X#define BLOCKDATAFL    Files[8]
  328. X#define SHIPDATAFL     Files[9]
  329. X#define SHIPFREEDATAFL     Files[10]
  330. X#define DUMMYFL        Files[11]
  331. X#define PLAYERDATAFL     Files[12]
  332. X#define TELEGRAMDIR     Files[13]
  333. X#define TELEGRAMFL     Files[14]
  334. X#define POWFL        Files[15]
  335. X#define NEWSDIR        Files[16]
  336. X#define DECLARATIONFL    Files[17]
  337. X#define TRANSFERFL    Files[18]
  338. X#define COMBATFL    Files[19]
  339. X#define ANNOUNCEFL    Files[20]
  340. X#define COMMODDATAFL    Files[21]
  341. X#define COMMODFREEDATAFL        Files[22]
  342. X#define    UPDATEFL    Files[23]
  343. X#define    SEGMENTFL    Files[24]
  344. X#define ERRLOG        Files[25]
  345. X#define USLOG        Files[26]
  346. X#define UPLOG        Files[27]
  347. X    
  348. X#define PLANETLIST    PATH(planet.list)
  349. X#define STARLIST    PATH(star.list)
  350. X    
  351. X#define NOGOFL        PATH(nogo)
  352. X#define    ADDRESSFL    PATH(Addresses)
  353. X
  354. Xextern char *Files[];
  355. X/* END OF FILES.H */
  356. X!GROK!THIS!
  357. X
  358. END_OF_FILE
  359. if test 2392 -ne `wc -c <'hdrs/files.h.SH'`; then
  360.     echo shar: \"'hdrs/files.h.SH'\" unpacked with wrong size!
  361. fi
  362. # end of 'hdrs/files.h.SH'
  363. fi
  364. if test -f 'misc/help.txt' -a "${1}" != "-c" ; then 
  365.   echo shar: Will not clobber existing file \"'misc/help.txt'\"
  366. else
  367. echo shar: Extracting \"'misc/help.txt'\" \(2372 characters\)
  368. sed "s/^X//" >'misc/help.txt' <<'END_OF_FILE'
  369. X----------------------------------------------------------------------------
  370. XUsage: help <topic>
  371. X
  372. X    CONCEPTS (read these first) -
  373. X        actionpoints    colony          commands        crystal
  374. X                descriptions    lasers          maintain        missiles
  375. X                money           morale          races           scope
  376. X                ships           updates         afv
  377. X
  378. X    COMBAT -
  379. X                assault         bombard         capture         cew
  380. X                defend          enslave         fire
  381. X
  382. X    COMMUNICATIONS -
  383. X                announce        broadcast       highlight       page
  384. X                post            read            send            think
  385. X
  386. X    INFORMATION -
  387. X                analysis        autoreport      colonies        distance
  388. X                dump            examine         explore         governors
  389. X                identify        map             motto           name
  390. X                orbit           personal        power           production
  391. X                profile         report          ship            stars
  392. X                status          survey          victory         fuel
  393. X                mass            schedule
  394. X
  395. X    MILITARY -
  396. X                arm             deploy          disarm          mobilize
  397. X
  398. X    MONETARY -
  399. X                bid             insurgency      pay             sell
  400. X                tax             transfer        treasury
  401. X
  402. X    RELATIONS  -
  403. X                appoint         block           declare         give
  404. X                grant           invite          pledge          relation
  405. X                revoke          uninvite        unpledge
  406. X
  407. X    SHIPS -
  408. X                build           detonate        dismount        dock
  409. X                jettison        land            launch          load
  410. X                make            modify          mount           order
  411. X                scrap           stats           stock           tactical
  412. X                undock          unload          upgrade         weapons
  413. X
  414. X    OTHER -
  415. X                allocate        capital         cs              center
  416. X                dissolve        help            move            repair
  417. X                quit            route           speed           technology
  418. X                time            toggle          toxicity        vote
  419. X                who             zoom
  420. X----------------------------------------------------------------------------
  421. X
  422. END_OF_FILE
  423. if test 2372 -ne `wc -c <'misc/help.txt'`; then
  424.     echo shar: \"'misc/help.txt'\" unpacked with wrong size!
  425. fi
  426. # end of 'misc/help.txt'
  427. fi
  428. if test -f 'misc/star.list' -a "${1}" != "-c" ; then 
  429.   echo shar: Will not clobber existing file \"'misc/star.list'\"
  430. else
  431. echo shar: Extracting \"'misc/star.list'\" \(2354 characters\)
  432. sed "s/^X//" >'misc/star.list' <<'END_OF_FILE'
  433. XAbel
  434. XAchernar
  435. XAcrab
  436. XAdhara
  437. XAdara
  438. XAdonis
  439. XAkbar
  440. XAlbireo
  441. XAlcor
  442. XAldebran
  443. XAleramin
  444. XAlfard
  445. XAlferatz
  446. XAlfwecca
  447. XAlgol
  448. XAlhema
  449. XAlioth
  450. XAlkalurops
  451. XAlmach
  452. XAlnath
  453. XAlnitak
  454. XAlpha
  455. XAltair
  456. XAludra
  457. XAlya
  458. XAnanke
  459. XAndor
  460. XAndromeda
  461. XAntares
  462. XAnthony
  463. XAntlia
  464. XAphrodite
  465. XApocalypse
  466. XApollo
  467. XAquila
  468. XAquarius
  469. XAra
  470. XArchernar
  471. XArcturus
  472. XAres
  473. XAriel
  474. XArioch
  475. XArtemis
  476. XAscella
  477. XAuriga
  478. XAvior
  479. XAyachi
  480. XAzagthoth
  481. XBear
  482. XBeholder
  483. XBellatrix
  484. XBenetnasch
  485. XBeta
  486. XBetelgeuse
  487. XBohr
  488. XBones
  489. XBootes
  490. XBoreas
  491. XBrahe
  492. XBrin
  493. XBrust
  494. XBujold
  495. XByron
  496. XCallisto
  497. XCalrissian
  498. XCalypso
  499. XCamille
  500. XCancer
  501. XCaneb
  502. XCanis
  503. XCanopus
  504. XCapella
  505. XCapricorn
  506. XCard
  507. XCarina
  508. XCarnicula
  509. XCaroli
  510. XCassiopeia
  511. XCastor
  512. XCat
  513. XCentauri
  514. XCepheus
  515. XCetus
  516. XChi
  517. XCiturnae
  518. XColumba
  519. XCopernicus
  520. XCorona
  521. XCorvus
  522. XCrater
  523. XCrusher
  524. XCrux
  525. XCthulhu
  526. XCursa
  527. XCurtis
  528. XCygnus
  529. XCylon
  530. XDalos
  531. XDaphne
  532. XDark
  533. XData
  534. XDeath
  535. XDelphinus
  536. XDelta
  537. XDeneb
  538. XDionysus
  539. XDiphda
  540. XDonaldson
  541. XDorado
  542. XDorcas
  543. XDraco
  544. XDubhe
  545. XEa
  546. XElrond
  547. XEkpe
  548. XEniph
  549. XEpsilon
  550. XEridanus
  551. XErusa
  552. XEshu
  553. XEta
  554. XFantor
  555. XFermi
  556. XFisher
  557. XFomori
  558. XFomalhaut
  559. XFord
  560. XFornax
  561. XFortuna
  562. XFredux
  563. XGamma
  564. XGauss
  565. XGamorae
  566. XGemini
  567. XGerd
  568. XGeinah
  569. XGnur
  570. XGomeisa
  571. XGrus
  572. XGuiness
  573. XGungnir
  574. XHadar
  575. XHalley
  576. XHamal
  577. XHamill
  578. XHawking
  579. XHector
  580. XHeisenberg
  581. XHera
  582. XHerbert
  583. XHercules
  584. XHephiastes
  585. XHodge
  586. XHofstader
  587. XHolly
  588. XHopper
  589. XHorae
  590. XHubble
  591. XHyades
  592. XHydrus
  593. XHyperion
  594. XIki
  595. XInnana
  596. XInterigon
  597. XIota
  598. XIndus
  599. XInus
  600. XIshtar
  601. XIswar
  602. XIzahami
  603. XJade
  604. XJanus
  605. XJhurna
  606. XJocasta
  607. XJones
  608. XJove
  609. XJupiter
  610. XKappa
  611. XKaus
  612. XKeats
  613. XKenobi
  614. XKirk
  615. XKlingon
  616. XKocab
  617. XKornophoros
  618. XKryten
  619. XLamarna
  620. XLambda
  621. XLeia
  622. XLeo
  623. XLepus
  624. XLesath
  625. XLibra
  626. XLister
  627. XLucas
  628. XLupus
  629. XLynx
  630. XLyra
  631. XMagellan
  632. XMars
  633. XMayhew
  634. XMcCaffery
  635. XMcCoy
  636. XMercury
  637. XMesuta
  638. XMegnazon
  639. XMerak
  640. XMeukalinan
  641. XMiaplacidus
  642. XMimosa
  643. XMirach
  644. XMirfak
  645. XMirzam
  646. XMizar
  647. XMonoceros
  648. XMordor
  649. XMuphrid
  650. XMusca
  651. XNemesis
  652. XNeptune
  653. XNessus
  654. XNewton
  655. XNuada
  656. XNunka
  657. XNyx
  658. XOg
  659. XOmega
  660. XOmicron
  661. XOox
  662. XOphiucus
  663. XOrion
  664. XPavo
  665. XPeace
  666. XPegasus
  667. XPelops
  668. XPerseus
  669. XPhakt
  670. XPhecda
  671. XPheonix
  672. XPhi
  673. XPicard
  674. XPictor
  675. XPisces
  676. XPlanck
  677. XPlato
  678. XPleides
  679. XPluto
  680. XPollux
  681. XPolaris
  682. XProcyon
  683. XPsi
  684. XPtolemy
  685. XPuppis
  686. XPyxis
  687. XQrdus
  688. XQuadran
  689. XQuipus
  690. XRastaban
  691. XRegulus
  692. XRemus
  693. XReticulum
  694. XRho
  695. XRigel
  696. XRiker
  697. XRimmer
  698. XRomulus
  699. XRosenberg
  700. XRotarev
  701. XSaberhagen
  702. XSabik
  703. XSadalrud
  704. XSagittarius
  705. XSandage
  706. XSargas
  707. XSaturn
  708. XScorpio
  709. XScott
  710. XSerpens
  711. XShapley
  712. XShaula
  713. XSheat
  714. XSigma
  715. XSimmons
  716. XSirius
  717. XSkywalker
  718. XSol
  719. XSpica
  720. XSpielberg
  721. XSpock
  722. XSulu
  723. XTammuz
  724. XTarazed
  725. XTarkus
  726. XTarsus 
  727. XTaurus
  728. XTeller
  729. XTerl
  730. XTheta
  731. XThuban
  732. XTrinus
  733. XTolkien
  734. XTriangulum
  735. XTucana
  736. XUmbriel
  737. XUnukalkay
  738. XUpsilon
  739. XUranus
  740. XUrsa
  741. XUrth
  742. XVader
  743. XVedas
  744. XVega
  745. XVela
  746. XVenatici
  747. XVenus
  748. XVirgo
  749. XVolans
  750. XWar
  751. XWesen
  752. XWilliams
  753. XWirth
  754. XWoosley
  755. XWorf
  756. XXi
  757. XYima
  758. XYoda
  759. XYuggoth
  760. XYrga
  761. XZarg
  762. XZawijah
  763. XZeus
  764. XZot
  765. XZog
  766. XZozca
  767. XZeta
  768. XZuben
  769. END_OF_FILE
  770. if test 2354 -ne `wc -c <'misc/star.list'`; then
  771.     echo shar: \"'misc/star.list'\" unpacked with wrong size!
  772. fi
  773. # end of 'misc/star.list'
  774. fi
  775. if test -f 'server/client.c' -a "${1}" != "-c" ; then 
  776.   echo shar: Will not clobber existing file \"'server/client.c'\"
  777. else
  778. echo shar: Extracting \"'server/client.c'\" \(3671 characters\)
  779. sed "s/^X//" >'server/client.c' <<'END_OF_FILE'
  780. X/***********************************************
  781. X * log.c
  782. X *
  783. X * Created: Sun Jan 31 23:50:18 EST 1993
  784. X * Author:  J. Deragon (deragon@jethro.nyu.edu
  785. X *
  786. X * Version: 1.3 04:35:26
  787. X *
  788. X * Contains:
  789. X *   clearlog()
  790. X *   log()
  791. X *   check_logsize()
  792. X *
  793. X * #ident  "@(#)client.c    1.3 2/1/93 "
  794. X *
  795. X ***********************************************/
  796. X
  797. X#define EXTERN extern 
  798. X#include "vars.h"
  799. X#include "buffers.h"
  800. X#include "races.h"
  801. X#include "power.h"
  802. X#include "ships.h"
  803. X#include "csp.h"
  804. X#include "proto.h"
  805. X
  806. X/* Protoypes */
  807. Xvoid CSP_process_command(int, int);
  808. Xvoid CSP_client_on(int, int);
  809. Xvoid CSP_client_off(int, int);
  810. Xvoid CSP_client_toggle(int,  int, int);
  811. Xvoid CSP_client_version(int, int);
  812. Xvoid strip2args(void);
  813. X
  814. X/* 
  815. X * CSP_process_command
  816. X * 
  817. X * Process the client generated commands. 
  818. X *
  819. X */
  820. Xvoid 
  821. XCSP_process_command(int Playernum, int Governor)
  822. X{
  823. X    int command;
  824. X
  825. X    if (argn < 2) {
  826. X        sprintf(buf, "%c %d %d\n", CSP_CLIENT, CSP_ERR, 
  827. X            CSP_ERR_TOO_FEW_ARGS);
  828. X        notify(Playernum, Governor, buf);
  829. X    }
  830. X
  831. X    command = atoi(args[1]);
  832. X
  833. X    switch (command) {
  834. X        case CSP_VERSION_COMMAND:
  835. X            CSP_client_version(Playernum, Governor);
  836. X            break;
  837. X        case CSP_SURVEY_COMMAND:
  838. X            strip2args();
  839. X            survey(Playernum, Governor, 0, 1);
  840. X            break;
  841. X        case CSP_LOGIN_COMMAND:
  842. X            CSP_client_toggle(Playernum, Governor, 1);
  843. X            break;
  844. X        default:
  845. X            sprintf(buf, "%c %d %d\n", CSP_CLIENT, CSP_ERR, 
  846. X                CSP_ERR_UNKNOWN_COMMAND);
  847. X            notify(Playernum, Governor, buf);
  848. X            break;
  849. X    }
  850. X
  851. X
  852. X}
  853. X
  854. X/*
  855. X * CSP_client_on
  856. X *
  857. X * Send the init string to the client, letting it know we reconize in
  858. X *
  859. X * ** INTERNAL ** Called by CSP_client_toggle()
  860. X *
  861. X */
  862. Xvoid
  863. XCSP_client_on(int Playernum, int Governor)
  864. X{
  865. X    sprintf(buf, "%c %d %d %d\n", CSP_CLIENT, CSP_CLIENT_ON, 
  866. X        Playernum, Governor);
  867. X    notify(Playernum, Governor, buf);
  868. X}
  869. X
  870. X
  871. X/*
  872. X * CSP_client_off
  873. X *
  874. X * Send the logout string to the client.
  875. X *
  876. X * ** INTERNAL ** Called by CSP_client_toggle()
  877. X *
  878. X */
  879. Xvoid
  880. XCSP_client_off(int Playernum, int Governor)
  881. X{
  882. X    sprintf(buf, "%c %d %d %d\n", CSP_CLIENT, CSP_CLIENT_OFF, 
  883. X        Playernum, Governor);
  884. X    notify(Playernum, Governor, buf);
  885. X}
  886. X
  887. X/*
  888. X * CSP_client_toggle
  889. X *
  890. X * Called from the toggle command, and also when a CSP_CLIENT_LOGIN
  891. X * was received from CSP_process_command 
  892. X *
  893. X */
  894. Xvoid
  895. XCSP_client_toggle(int Playernum, int Governor, int Startup)
  896. X{
  897. X    racetype *r;
  898. X    
  899. X    r = races[Playernum - 1];
  900. X
  901. X    if (Startup) {
  902. X        /* forced via a CSP_CLIENT_LOGIN command */
  903. X        r->governor[Governor].CSP_client_info.csp_user = 1;
  904. X        CSP_client_on(Playernum, Governor);
  905. X    } else {
  906. X        if (r->governor[Governor].CSP_client_info.csp_user == 1) {
  907. X            r->governor[Governor].CSP_client_info.csp_user = 0; 
  908. X            CSP_client_off(Playernum, Governor);
  909. X        } else {
  910. X            r->governor[Governor].CSP_client_info.csp_user = 1;
  911. X            CSP_client_on(Playernum, Governor);
  912. X        }
  913. X    }
  914. X
  915. X}
  916. X
  917. X/*
  918. X * CSP_client_version
  919. X *
  920. X * Prints out the server version information, when requested from client
  921. X *
  922. X */
  923. Xvoid
  924. XCSP_client_version(int Playernum, int Governor)
  925. X{
  926. X
  927. X    sprintf(buf, "%c %d Server Version: %s\n",
  928. X         CSP_CLIENT, CSP_VERSION_INFO, VERSION);
  929. X    notify(Playernum, Governor, buf);
  930. X    sprintf(buf, "%c %d Server Options:", CSP_CLIENT, CSP_VERSION_OPTIONS);
  931. X
  932. X#ifdef SUPER_PODS
  933. X    strcat(buf, " SUPERPODS");
  934. X#endif
  935. X
  936. X#ifdef AUTOSCRAP
  937. X    strcat(buf, " AUTOSCRAP");
  938. X#endif
  939. X
  940. X#ifdef THRESHLOADING
  941. X    strcat(buf, " THRESHLOADING");
  942. X#endif
  943. X
  944. X    strcat(buf, "\n");
  945. X    notify(Playernum, Governor, buf);
  946. X}
  947. X
  948. X
  949. X/*
  950. X * strip2args
  951. X *
  952. X * Strips off two arguments off the args array.  Used only for the
  953. X * survey command currently
  954. X *
  955. X */
  956. Xvoid
  957. Xstrip2args(void)
  958. X{
  959. X
  960. X    int  i;
  961. X    char targs[MAXARGS][COMMANDSIZE];
  962. X
  963. X    argn -= 1;
  964. X
  965. X    for (i = 2; i < MAXARGS; i++)
  966. X        strcpy(targs[i-1], args[i]);
  967. X
  968. X    for (i = 0; i < MAXARGS; i++)
  969. X        strcpy(args[i], targs[i]);
  970. X
  971. X}
  972. END_OF_FILE
  973. if test 3671 -ne `wc -c <'server/client.c'`; then
  974.     echo shar: \"'server/client.c'\" unpacked with wrong size!
  975. fi
  976. # end of 'server/client.c'
  977. fi
  978. if test -f 'server/lists.c' -a "${1}" != "-c" ; then 
  979.   echo shar: Will not clobber existing file \"'server/lists.c'\"
  980. else
  981. echo shar: Extracting \"'server/lists.c'\" \(3663 characters\)
  982. sed "s/^X//" >'server/lists.c' <<'END_OF_FILE'
  983. X#include <ctype.h>
  984. X
  985. X#define EXTERN extern
  986. X#include "vars.h"
  987. X#include "ships.h"
  988. X#include "shipdata.h"
  989. X#include "races.h"
  990. X#include "power.h"
  991. X#include "proto.h"
  992. X
  993. X
  994. X/* utilities for dealing with ship lists */
  995. Xvoid 
  996. Xinsert_sh_univ(sdata, s)
  997. X    struct stardata *sdata;
  998. X    shiptype       *s;
  999. X{
  1000. X    s->nextship = sdata->ships;
  1001. X    sdata->ships = s->number;
  1002. X    s->whatorbits = LEVEL_UNIV;
  1003. X}
  1004. X
  1005. Xvoid 
  1006. Xinsert_sh_star(star, s)
  1007. X    startype       *star;
  1008. X    shiptype       *s;
  1009. X{
  1010. X    s->nextship = star->ships;
  1011. X    star->ships = s->number;
  1012. X    s->whatorbits = LEVEL_STAR;
  1013. X}
  1014. X
  1015. Xvoid 
  1016. Xinsert_sh_plan(pl, s)
  1017. X    planettype     *pl;
  1018. X    shiptype       *s;
  1019. X{
  1020. X    s->nextship = pl->ships;
  1021. X    pl->ships = s->number;
  1022. X    s->whatorbits = LEVEL_PLAN;
  1023. X}
  1024. X
  1025. Xvoid 
  1026. Xinsert_sh_ship(s, s2)
  1027. X    shiptype       *s;
  1028. X    shiptype       *s2;
  1029. X{
  1030. X    s->nextship = s2->ships;
  1031. X    s2->ships = s->number;
  1032. X    s->whatorbits = LEVEL_SHIP;
  1033. X    s->whatdest = LEVEL_SHIP;
  1034. X    s->destshipno = s2->number;
  1035. X}
  1036. X
  1037. Xvoid 
  1038. Xremove_sh_star(shiptype * s)
  1039. X{
  1040. X    int             sh;
  1041. X    shiptype       *s2;
  1042. X
  1043. X    getstar(&Stars[s->storbits], (int) s->storbits);
  1044. X    sh = Stars[s->storbits]->ships;
  1045. X
  1046. X    if (sh == s->number) {
  1047. X        Stars[s->storbits]->ships = s->nextship;
  1048. X        putstar(Stars[s->storbits], (int) (s->storbits));
  1049. X    } else {
  1050. X        while (sh != s->number) {
  1051. X            (void) getship(&s2, sh);
  1052. X            sh = s2->nextship;
  1053. X            if (sh != s->number)
  1054. X                free(s2);
  1055. X        }
  1056. X        s2->nextship = s->nextship;
  1057. X        putship(s2);
  1058. X        free(s2);
  1059. X    }
  1060. X    s->whatorbits = LEVEL_UNIV;
  1061. X    s->nextship = 0;
  1062. X}
  1063. X
  1064. Xvoid 
  1065. Xremove_sh_plan(shiptype * s)
  1066. X{
  1067. X    int             sh;
  1068. X    shiptype       *s2;
  1069. X    planettype     *p;
  1070. X
  1071. X    getplanet(&p, (int) s->storbits, (int) s->pnumorbits);
  1072. X    sh = p->ships;
  1073. X
  1074. X    if (sh == s->number) {
  1075. X        p->ships = s->nextship;
  1076. X        putplanet(p, (int) s->storbits, (int) s->pnumorbits);
  1077. X    } else {
  1078. X        while (sh != s->number) {
  1079. X            (void) getship(&s2, sh);
  1080. X            sh = s2->nextship;
  1081. X            if (sh != s->number)
  1082. X                free(s2);    /* don't free it if it is the
  1083. X                         * s2 we wa nt */
  1084. X        }
  1085. X        s2->nextship = s->nextship;
  1086. X        putship(s2);
  1087. X        free(s2);
  1088. X    }
  1089. X    free(p);
  1090. X    s->nextship = 0;
  1091. X    s->whatorbits = LEVEL_UNIV;
  1092. X}
  1093. X
  1094. Xvoid 
  1095. Xremove_sh_ship(shiptype * s, shiptype * ship)
  1096. X{
  1097. X    int             sh;
  1098. X    shiptype       *s2;
  1099. X    sh = ship->ships;
  1100. X
  1101. X    if (sh == s->number)
  1102. X        ship->ships = s->nextship;
  1103. X    else {
  1104. X        while (sh != s->number) {
  1105. X            (void) getship(&s2, sh);
  1106. X            sh = (int) (s2->nextship);
  1107. X            if (sh != s->number)
  1108. X                free(s2);
  1109. X        }
  1110. X        s2->nextship = s->nextship;
  1111. X        putship(s2);
  1112. X        free(s2);
  1113. X    }
  1114. X    s->nextship = 0;
  1115. X    s->whatorbits = LEVEL_UNIV;    /* put in limbo - wait for
  1116. X                     * insert_sh.. */
  1117. X}
  1118. X
  1119. Xdouble 
  1120. XGetComplexity(int ship)
  1121. X{
  1122. X    shiptype        s;
  1123. X
  1124. X    s.armor = Shipdata[ship][ABIL_ARMOR];
  1125. X    s.guns = Shipdata[ship][ABIL_PRIMARY] ? PRIMARY : NONE;
  1126. X    s.primary = Shipdata[ship][ABIL_GUNS];
  1127. X    s.primtype = Shipdata[ship][ABIL_PRIMARY];
  1128. X    s.secondary = Shipdata[ship][ABIL_GUNS];
  1129. X    s.sectype = Shipdata[ship][ABIL_SECONDARY] ? SECONDARY : NONE;
  1130. X    s.max_crew = Shipdata[ship][ABIL_MAXCREW];
  1131. X    s.max_resource = Shipdata[ship][ABIL_CARGO];
  1132. X    s.max_hanger = Shipdata[ship][ABIL_HANGER];
  1133. X    s.max_destruct = Shipdata[ship][ABIL_DESTCAP];
  1134. X    s.max_fuel = Shipdata[ship][ABIL_FUELCAP];
  1135. X    s.max_speed = Shipdata[ship][ABIL_SPEED];
  1136. X    s.build_type = ship;
  1137. X    s.mount = Shipdata[ship][ABIL_MOUNT];
  1138. X    s.hyper_drive.has = Shipdata[ship][ABIL_JUMP];
  1139. X    s.cloak = 0;
  1140. X    s.laser = Shipdata[ship][ABIL_LASER];
  1141. X    s.cew = 0;
  1142. X    s.cew_range = 0;
  1143. X    s.size = ship_size(&s);
  1144. X    s.base_mass = getmass(&s);
  1145. X    s.mass = getmass(&s);
  1146. X
  1147. X    return complexity(&s);
  1148. X}
  1149. X
  1150. Xint 
  1151. XShipCompare(int *s1, int *s2)
  1152. X{
  1153. X    return (int) (GetComplexity(*s1) - GetComplexity(*s2));
  1154. X}
  1155. X
  1156. Xint             ShipVector[NUMSTYPES];
  1157. Xvoid 
  1158. XSortShips(void)
  1159. X{
  1160. X    int             i;
  1161. X
  1162. X    for (i = 0; i < NUMSTYPES; i++)
  1163. X        ShipVector[i] = i;
  1164. X    qsort(ShipVector, NUMSTYPES, sizeof(int), ShipCompare);
  1165. X}
  1166. END_OF_FILE
  1167. if test 3663 -ne `wc -c <'server/lists.c'`; then
  1168.     echo shar: \"'server/lists.c'\" unpacked with wrong size!
  1169. fi
  1170. # end of 'server/lists.c'
  1171. fi
  1172. if test -f 'server/log.c' -a "${1}" != "-c" ; then 
  1173.   echo shar: Will not clobber existing file \"'server/log.c'\"
  1174. else
  1175. echo shar: Extracting \"'server/log.c'\" \(4332 characters\)
  1176. sed "s/^X//" >'server/log.c' <<'END_OF_FILE'
  1177. X#ident  "@(#)log.c    1.5 1/28/93 "
  1178. X/***********************************************
  1179. X * log.c
  1180. X *
  1181. X * Created: Fri Dec 11 03:50:49 EST 1992
  1182. X * Author:  J. Deragon (deragon@jethro.nyu.edu
  1183. X *
  1184. X * Version: 1.5 20:59:33
  1185. X *
  1186. X * Contains:
  1187. X *   clearlog()
  1188. X *   log()
  1189. X *   check_logsize()
  1190. X *
  1191. X ***********************************************/
  1192. X
  1193. X#include <errno.h>
  1194. X#include <fcntl.h>
  1195. X#include <varargs.h>
  1196. X#include <stdio.h>
  1197. X#include <sys/types.h>
  1198. X#include <sys/stat.h>
  1199. X#define EXTERN extern
  1200. X#include "vars.h"
  1201. X#include "files.h"
  1202. X
  1203. X
  1204. Xint             where;
  1205. X
  1206. X
  1207. X/*
  1208. X * clearlog:
  1209. X * 
  1210. X * arguments: override override is used upon startup, when true it will remove
  1211. X * (truncate) _all_ log files.  It is normall set to false. called by: main,
  1212. X * check_logsize
  1213. X * 
  1214. X * description:  Called once from main, upon startup to clear all the log files
  1215. X * to prevent disgustingly large log files from eating up the disk, and
  1216. X * called from check_logsize. If override is set to false, it will determine
  1217. X * the log to truncate from the global variable "where".
  1218. X * 
  1219. X * JPD Fri Dec 11 03:01:46 EST 1992
  1220. X */
  1221. X
  1222. Xclearlog(override)
  1223. X    int             override;
  1224. X{
  1225. X
  1226. X    if (override) {
  1227. X        fclose(fopen(ERRLOG, "w+"));
  1228. X        fclose(fopen(USLOG, "w+"));
  1229. X        fclose(fopen(UPLOG, "w+"));
  1230. X    } else {
  1231. X        switch (where) {
  1232. X        case ERRORLOG:
  1233. X            fclose(fopen(ERRLOG, "w+"));
  1234. X            loginfo(ERRORLOG, NOERRNO, "Clearing ERRORLOG");
  1235. X            break;
  1236. X        case USERLOG:
  1237. X            fclose(fopen(USLOG, "w+"));
  1238. X            loginfo(ERRORLOG, NOERRNO, "Clearing USERLOG");
  1239. X            break;
  1240. X        case UPDATELOG:
  1241. X            fclose(fopen(UPLOG, "w+"));
  1242. X            loginfo(ERRORLOG, NOERRNO, "Clearing UPDATE");
  1243. X            break;
  1244. X        }
  1245. X    }
  1246. X    /* simple enough eh? */
  1247. X}
  1248. X/* end of clearlog */
  1249. X
  1250. X/*
  1251. X * loginfo:
  1252. X * 
  1253. X * arguments: multiple - first is _always_ the log file that the error should be
  1254. X * written to.  Either ERRORLOG, USERLOG, or UPDATELOG. second arg is the
  1255. X * noerrno flag.  Set to false when we should ignore the errno.  (ie: when we
  1256. X * dont care about it) third arg is the data
  1257. X * 
  1258. X * called by: everyone!
  1259. X * 
  1260. X * description:  Called whenever something needs to be logged. The most frequent
  1261. X * logs are the USERLOG (when someone logs on) and UPDATELOG (details of
  1262. X * updates/segments)
  1263. X * 
  1264. X * JPD Fri Dec 11 03:01:46 EST 1992
  1265. X */
  1266. X
  1267. X
  1268. X/* VARARGS */
  1269. Xloginfo(va_alist)
  1270. Xva_dcl
  1271. X{
  1272. X    extern char    *index();
  1273. X    extern char    *sys_errlist[];
  1274. X    extern int      errno;
  1275. X    va_list         list;
  1276. X    long            now;
  1277. X    char            buf[512];
  1278. X    char            buf1[512];
  1279. X    char           *fmt;    /* The acutal data to be printed */
  1280. X    int             noerrno;/* Should we care about the errno? */
  1281. X    int             logf;
  1282. X    char           *error;
  1283. X    char           *p;
  1284. X    char           *logfile;/* the acutal log file name */
  1285. X
  1286. X
  1287. X    va_start(list);
  1288. X    where = va_arg(list, int);    /* Put is where? */
  1289. X    noerrno = va_arg(list, int);    /* Disregard errno? false yes, true
  1290. X                     * no */
  1291. X    fmt = va_arg(list, char *);    /* data */
  1292. X    vsprintf(buf, fmt, list);
  1293. X
  1294. X
  1295. X    /*
  1296. X     * We do this little bit to allow us an easy way to pass the
  1297. X     * filenames back and forth between clearlogs and log.  ie: Pass an
  1298. X     * int, instead of a (char *), so we can use switch.
  1299. X     */
  1300. X
  1301. X    switch (where) {
  1302. X    case ERRORLOG:
  1303. X        logfile = ERRLOG;
  1304. X        break;
  1305. X    case USERLOG:
  1306. X        logfile = USLOG;
  1307. X        break;
  1308. X    case UPDATELOG:
  1309. X        logfile = UPLOG;
  1310. X        break;
  1311. X    default:
  1312. X        break;
  1313. X    }
  1314. X
  1315. X    if ((p = index(buf, '\n')) != 0)    /* get rid of the newline */
  1316. X        *p = 0;
  1317. X
  1318. X    (void) time(&now);    /* for the timestamp */
  1319. X    error = "log";
  1320. X    if (errno != 0 && noerrno)
  1321. X        error = sys_errlist[errno];
  1322. X
  1323. X    (void) sprintf(buf1, "%s; (%s) %s", buf, error, ctime(&now));
  1324. X    if ((logf = open(logfile, O_WRONLY | O_CREAT | O_APPEND, 0666)) < 0)
  1325. X        return;
  1326. X
  1327. X    check_logsize(logf);    /* Make sure we dont hog space */
  1328. X
  1329. X    (void) write(logf, buf1, strlen(buf1));
  1330. X    (void) close(logf);
  1331. X    errno = 0;
  1332. X    va_end(list);
  1333. X}
  1334. X/* end of loginfo() */
  1335. X
  1336. X/*
  1337. X * check_logsize:
  1338. X * 
  1339. X * arguments: log_fd:  the log file descriptor (int).
  1340. X * 
  1341. X * called by: log (local to this file)
  1342. X * 
  1343. X * description:  Called whenever log attemps to write to a file. Before the
  1344. X * write it will check to see if the log is larger then the max log size
  1345. X * (default 100K).  If it is, it calls clearlog() to truncate the log.
  1346. X * 
  1347. X * JPD Fri Dec 11 03:01:46 EST 1992
  1348. X */
  1349. Xcheck_logsize(log_fd)
  1350. X    int             log_fd;
  1351. X{
  1352. X    struct stat     logstats;
  1353. X
  1354. X    (void) fstat(log_fd, &logstats);
  1355. X
  1356. X    if (logstats.st_size > MAX_LOGSIZE)
  1357. X        clearlog(0);
  1358. X
  1359. X}
  1360. X
  1361. X/* end of check_logsize */
  1362. END_OF_FILE
  1363. if test 4332 -ne `wc -c <'server/log.c'`; then
  1364.     echo shar: \"'server/log.c'\" unpacked with wrong size!
  1365. fi
  1366. # end of 'server/log.c'
  1367. fi
  1368. if test -f 'server/max.c' -a "${1}" != "-c" ; then 
  1369.   echo shar: Will not clobber existing file \"'server/max.c'\"
  1370. else
  1371. echo shar: Extracting \"'server/max.c'\" \(2653 characters\)
  1372. sed "s/^X//" >'server/max.c' <<'END_OF_FILE'
  1373. X/*
  1374. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  1375. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  1376. X * GB_copyright.h.
  1377. X * 
  1378. X * maxsupport() -- return how many people one sector can support compatibility()
  1379. X * -- return how much race is compatible with planet gravity() -- return
  1380. X * gravity for planet prin_ship_orbits() -- prints place ship orbits
  1381. X */
  1382. X
  1383. X#include "GB_copyright.h"
  1384. X#define EXTERN extern
  1385. X#include "vars.h"
  1386. X#include "power.h"
  1387. X#include "races.h"
  1388. X#include "ships.h"
  1389. X#include <math.h>
  1390. X
  1391. Xint             maxsupport(racetype *, sectortype *, double, int);
  1392. Xdouble          compatibility(planettype *, racetype *);
  1393. Xdouble          gravity(planettype *);
  1394. Xchar           *prin_ship_orbits(shiptype *);
  1395. X#include "proto.h"
  1396. X
  1397. Xint 
  1398. Xmaxsupport(reg racetype * r, reg sectortype * s, reg double c, reg int toxic)
  1399. X{
  1400. X    int             val;
  1401. X    double          a, b;
  1402. X
  1403. X    if (!r->likes[s->condition])
  1404. X        return 0.0;
  1405. X    a = ((double) s->eff + 1.0) * (double) s->fert;
  1406. X    b = (.01 * c);
  1407. X
  1408. X    val = (int) (a * b * .01 * (100.0 - (double) toxic));
  1409. X
  1410. X    return val;
  1411. X}
  1412. X
  1413. Xdouble 
  1414. Xcompatibility(reg planettype * planet, reg racetype * race)
  1415. X{
  1416. X    reg int         i; 
  1417. X    reg double      add;
  1418. X    double          sum, atmosphere = 1.0;
  1419. X
  1420. X    /* make an adjustment for planetary temperature */
  1421. X    add = 0.1 * ((double) planet->conditions[TEMP] - 
  1422. X            (double)race->conditions[TEMP]);
  1423. X    sum = 1.0 - (double) abs(add) / 100.0;
  1424. X
  1425. X    /* step through and report compatibility of each planetary gas */
  1426. X    for (i = TEMP + 1; i <= OTHER; i++) {
  1427. X        add = (double) planet->conditions[i] - (double) race->conditions[i];
  1428. X        atmosphere *= 1.0 - (double) abs(add) / 100.0;
  1429. X    }
  1430. X    sum *= atmosphere;
  1431. X    sum *= 100.0 - planet->conditions[TOXIC];
  1432. X
  1433. X    if (sum < 0.0)
  1434. X        return 0.0;
  1435. X    return (sum);
  1436. X}
  1437. X
  1438. Xdouble 
  1439. Xgravity(planettype * p)
  1440. X{
  1441. X    return (double) (p->Maxx) * (double) (p->Maxy) * GRAV_FACTOR;
  1442. X}
  1443. X
  1444. Xchar            Dispshiporbits_buf[PLACENAMESIZE + 13];
  1445. X
  1446. Xchar           *
  1447. Xprin_ship_orbits(shiptype * s)
  1448. X{
  1449. X    shiptype       *mothership;
  1450. X    char           *motherorbits;
  1451. X
  1452. X    switch (s->whatorbits) {
  1453. X    case LEVEL_UNIV:
  1454. X        sprintf(Dispshiporbits_buf, "/(%.0f,%.0f)", s->xpos, s->ypos);
  1455. X        break;
  1456. X    case LEVEL_STAR:
  1457. X        sprintf(Dispshiporbits_buf, "/%s", Stars[s->storbits]->name);
  1458. X        break;
  1459. X    case LEVEL_PLAN:
  1460. X        sprintf(Dispshiporbits_buf, "/%s/%s",
  1461. X            Stars[s->storbits]->name,
  1462. X            Stars[s->storbits]->pnames[s->pnumorbits]);
  1463. X        break;
  1464. X    case LEVEL_SHIP:
  1465. X        if (getship(&mothership, s->destshipno)) {
  1466. X            motherorbits = prin_ship_orbits(mothership);
  1467. X            strcpy(Dispshiporbits_buf, motherorbits);
  1468. X            free(mothership);
  1469. X        } else
  1470. X            strcpy(Dispshiporbits_buf, "/");
  1471. X        break;
  1472. X    default:
  1473. X        break;
  1474. X    }
  1475. X    return Dispshiporbits_buf;
  1476. X}
  1477. END_OF_FILE
  1478. if test 2653 -ne `wc -c <'server/max.c'`; then
  1479.     echo shar: \"'server/max.c'\" unpacked with wrong size!
  1480. fi
  1481. # end of 'server/max.c'
  1482. fi
  1483. if test -f 'server/misc.c' -a "${1}" != "-c" ; then 
  1484.   echo shar: Will not clobber existing file \"'server/misc.c'\"
  1485. else
  1486. echo shar: Extracting \"'server/misc.c'\" \(2794 characters\)
  1487. sed "s/^X//" >'server/misc.c' <<'END_OF_FILE'
  1488. X/*
  1489. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  1490. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  1491. X * GB_copyright.h.
  1492. X * 
  1493. X * scales used in production efficiency etc. input both: int 0-100 output both:
  1494. X * float 0.0 - 1.0 (logscaleOB 0.5 - .95)
  1495. X */
  1496. X
  1497. X#include "GB_copyright.h"
  1498. X#define EXTERN extern
  1499. X#include "vars.h"
  1500. X#include "races.h"
  1501. X#include "buffers.h"
  1502. X#include "fcntl.h"
  1503. X#include <math.h>
  1504. X
  1505. Xdouble          logscale(int);
  1506. X
  1507. Xdouble
  1508. Xlogscale(int x)
  1509. X{
  1510. X    /* return (x+5.0) / (x+10.0); */
  1511. X    return log10((double) x + 1.0) / 2.0;
  1512. X}
  1513. X
  1514. Xvoid
  1515. Xadjust_morale(racetype * winner, racetype * loser, int amount)
  1516. X{
  1517. X    winner->morale += amount;
  1518. X    loser->morale -= amount;
  1519. X    winner->points[loser->Playernum] += amount;
  1520. X}
  1521. X
  1522. Xvoid
  1523. Xload_star_data(void)
  1524. X{
  1525. X    int             s, t, i, j;
  1526. X    startype       *star_arena;
  1527. X    planettype     *planet_arena;
  1528. X    int             pcount = 0;
  1529. X
  1530. X    /* get star database */
  1531. X    Planet_count = 0;
  1532. X    getsdata(&Sdata);
  1533. X    star_arena = (startype *) malloc(Sdata.numstars * sizeof(startype));
  1534. X    for (s = 0; s < Sdata.numstars; s++) {
  1535. X        Stars[s] = &star_arena[s];    /* Initialize star pointers */
  1536. X    }
  1537. X    for (s = 0; s < Sdata.numstars; s++) {
  1538. X        getstar(&(Stars[s]), s);
  1539. X        pcount += Stars[s]->numplanets;
  1540. X    }
  1541. X
  1542. X    planet_arena = (planettype *) malloc(pcount * sizeof(planettype));
  1543. X
  1544. X    for (s = 0; s < Sdata.numstars; s++) {
  1545. X        for (t = 0; t < Stars[s]->numplanets; t++) {
  1546. X            planets[s][t] = &planet_arena[--pcount];
  1547. X            getplanet(&planets[s][t], s, t);
  1548. X            if (planets[s][t]->type != TYPE_ASTEROID)
  1549. X                Planet_count++;
  1550. X        }
  1551. X    }
  1552. X    /* initialize zoom factors */
  1553. X    for (i = 1; i <= Num_races; i++)
  1554. X        for (j = 0; j <= MAXGOVERNORS; j++) {
  1555. X            Dir[i - 1][j].zoom[0] = 1.0;
  1556. X            Dir[i - 1][j].zoom[1] = 0.5;
  1557. X            Dir[i - 1][j].lastx[0] = Dir[i - 1][j].lastx[1] = 0.0;
  1558. X            Dir[i - 1][j].lasty[0] = Dir[i - 1][j].lasty[1] = 0.0;
  1559. X        }
  1560. X}
  1561. X
  1562. Xvoid
  1563. Xload_race_data(void)
  1564. X{
  1565. X    int             i;
  1566. X    Num_races = Numraces();
  1567. X    for (i = 1; i <= Num_races; i++) {
  1568. X        getrace(&races[i - 1], i);    /* allocates into memory */
  1569. X        if (races[i - 1]->Playernum != i) {
  1570. X            races[i - 1]->Playernum = i;
  1571. X            putrace(races[i - 1]);
  1572. X        }
  1573. X    }
  1574. X}
  1575. X
  1576. Xvoid
  1577. Xwelcome_user(struct descriptor_data * d)
  1578. X{
  1579. X    FILE           *f;
  1580. X    char           *p;
  1581. X
  1582. X    sprintf(buf, "***   Welcome to Galactic Bloodshed %s ***\n", VERS);
  1583. X    queue_string(d, buf);
  1584. X
  1585. X    if ((f = fopen(WELCOME_FILE, "r")) != NULL) {
  1586. X        while (fgets(buf, sizeof buf, f)) {
  1587. X            for (p = buf; *p; p++)
  1588. X                if (*p == '\n') {
  1589. X                    *p = '\0';
  1590. X                    break;
  1591. X                }
  1592. X            queue_string(d, buf);
  1593. X            queue_string(d, "\n");
  1594. X        }
  1595. X        fclose(f);
  1596. X    }
  1597. X}
  1598. X
  1599. Xvoid
  1600. Xcheck_for_telegrams(int Playernum, int Governor)
  1601. X{
  1602. X    struct stat     sbuf;
  1603. X
  1604. X    sprintf(buf, "%s.%d.%d", TELEGRAMFL, Playernum, Governor);
  1605. X    stat(buf, &sbuf);
  1606. X    if (sbuf.st_size)
  1607. X        notify(Playernum, Governor,
  1608. X        "You have telegram(s) waiting. Use 'read' to read them.\n");
  1609. X}
  1610. END_OF_FILE
  1611. if test 2794 -ne `wc -c <'server/misc.c'`; then
  1612.     echo shar: \"'server/misc.c'\" unpacked with wrong size!
  1613. fi
  1614. # end of 'server/misc.c'
  1615. fi
  1616. if test -f 'user/autoshoot.c' -a "${1}" != "-c" ; then 
  1617.   echo shar: Will not clobber existing file \"'user/autoshoot.c'\"
  1618. else
  1619. echo shar: Extracting \"'user/autoshoot.c'\" \(4243 characters\)
  1620. sed "s/^X//" >'user/autoshoot.c' <<'END_OF_FILE'
  1621. X#ident  "@(#)autoshoot.c    1.5 2/1/93 "
  1622. X/*
  1623. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  1624. X * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat. Restrictions in
  1625. X * GB.c. autoshoot() -- shoot <-> retaliate routine Bombard() -- ship
  1626. X * bombards planet
  1627. X */
  1628. X
  1629. X#define EXTERN extern
  1630. X#include "vars.h"
  1631. X#include "ships.h"
  1632. X#include "races.h"
  1633. X#include "power.h"
  1634. X#include "doturn.h"
  1635. X#include "buffers.h"
  1636. X
  1637. Xextern long     Shipdata[NUMSTYPES][NUMABILS];
  1638. X
  1639. Xint             Bombard(shiptype *, planettype *, racetype *);
  1640. X#include "proto.h"
  1641. X
  1642. X/*
  1643. X * ship #shipno bombards planet, then alert whom it may concern.
  1644. X */
  1645. Xint 
  1646. XBombard(shiptype * ship, planettype * planet, racetype * r)
  1647. X{
  1648. X    shiptype       *s;
  1649. X    int             x, y, x2 = -1, y2, oldown, numdest = 0, found = 0;
  1650. X    int             i, sh;
  1651. X    int             ok;
  1652. X
  1653. X    /* for telegramming */
  1654. X    bzero((char *) Nuked, sizeof(Nuked));
  1655. X
  1656. X    /* check to see if PDNs are present */
  1657. X    ok = 1;
  1658. X    sh = planet->ships;
  1659. X    while (sh && ok) {
  1660. X        (void) getship(&s, sh);
  1661. X        ok = !(s->alive && s->type == OTYPE_PLANDEF && s->owner != ship->owner);
  1662. X        sh = s->nextship;
  1663. X        free(s);
  1664. X    }
  1665. X    if (!ok) {
  1666. X        sprintf(buf, "Bombardment of %s cancelled, PDNs are present.\n",
  1667. X            prin_ship_orbits(ship));
  1668. X        warn((int) ship->owner, (int) ship->governor, buf);
  1669. X        return 0;
  1670. X    }
  1671. X    getsmap(Smap, planet);
  1672. X
  1673. X    /* look for someone to bombard-check for war */
  1674. X    (void) Getxysect(planet, 0, 0, 1);    /* reset */
  1675. X    while (!found && Getxysect(planet, &x, &y, 0)) {
  1676. X        if (Sector(*planet, x, y).owner && Sector(*planet, x, y).owner != ship->owner
  1677. X            && (Sector(*planet, x, y).condition != WASTED)) {
  1678. X            if (isset(r->atwar, Sector(*planet, x, y).owner))
  1679. X                found = 1;
  1680. X            else
  1681. X                x2 = x, y2 = y;
  1682. X        }
  1683. X    }
  1684. X    if (x2 != -1) {
  1685. X        x = x2;        /* no one we're at war with; bomb someone
  1686. X                 * else. */
  1687. X        y = y2;
  1688. X        found = 1;
  1689. X    }
  1690. X    if (found) {
  1691. X        int             str;
  1692. X        str = MIN(Shipdata[ship->type][ABIL_GUNS] * (100 - ship->damage) / 100., ship->destruct);
  1693. X        /* save owner of destroyed sector */
  1694. X        if (str) {
  1695. X            bzero(Nuked, sizeof(Nuked));
  1696. X            oldown = Sector(*planet, x, y).owner;
  1697. X            ship->destruct -= str;
  1698. X            ship->mass -= str * MASS_DESTRUCT;
  1699. X
  1700. X            numdest = shoot_ship_to_planet(ship, planet, str,
  1701. X                    x, y, 0, 0, 0, long_buf, short_buf);
  1702. X            /* (0=dont get smap) */
  1703. X            if (numdest < 0)
  1704. X                numdest = 0;
  1705. X
  1706. X            /* tell the bombarding player about it.. */
  1707. X            sprintf(telegram_buf, "REPORT from ship #%d\n\n", ship->number);
  1708. X            strcat(telegram_buf, short_buf);
  1709. X            sprintf(buf, "sector %d,%d (owner %d).  %d sectors destroyed.\n",
  1710. X                x, y, oldown, numdest);
  1711. X            strcat(telegram_buf, buf);
  1712. X            notify((int) ship->owner, (int) ship->governor, telegram_buf);
  1713. X
  1714. X            /* notify other player. */
  1715. X            sprintf(telegram_buf, "ALERT from planet /%s/%s\n",
  1716. X                Stars[ship->storbits]->name,
  1717. X               Stars[ship->storbits]->pnames[ship->pnumorbits]);
  1718. X            sprintf(buf, "%c%d %s bombarded sector %d,%d; %d sectors destroyed.\n",
  1719. X                Shipltrs[ship->type], ship->number, ship->name, x, y, numdest);
  1720. X            strcat(telegram_buf, buf);
  1721. X            sprintf(buf, "%c%d %s [%d] bombards %s/%s\n",
  1722. X                Shipltrs[ship->type], ship->number, ship->name, ship->owner,
  1723. X                Stars[ship->storbits]->name,
  1724. X               Stars[ship->storbits]->pnames[ship->pnumorbits]);
  1725. X            for (i = 1; i <= Num_races; i++)
  1726. X                if (Nuked[i - 1] && i != ship->owner)
  1727. X                    warn(i, (int) Stars[ship->storbits]->governor[i - 1], telegram_buf);
  1728. X            post(buf, COMBAT);
  1729. X
  1730. X            /*
  1731. X             * enemy planet retaliates along with defending
  1732. X             * forces
  1733. X             */
  1734. X        } else {
  1735. X            /* no weapons! */
  1736. X            if (!ship->notified) {
  1737. X                ship->notified = 1;
  1738. X                sprintf(telegram_buf,
  1739. X                    "Bulletin\n\n %c%d %s has no weapons to bombard with.\n",
  1740. X                    Shipltrs[ship->type], ship->number, ship->name);
  1741. X                warn((int) ship->owner, (int) ship->governor, telegram_buf);
  1742. X            }
  1743. X        }
  1744. X
  1745. X        putsmap(Smap, planet);
  1746. X
  1747. X    } else {
  1748. X        /* there were no sectors worth bombing. */
  1749. X        if (!ship->notified) {
  1750. X            ship->notified = 1;
  1751. X            sprintf(telegram_buf, "Report from %c%d %s\n\n",
  1752. X                Shipltrs[ship->type], ship->number, ship->name);
  1753. X            sprintf(buf, "Planet /%s/%s has been saturation bombed.\n",
  1754. X                Stars[ship->storbits]->name,
  1755. X               Stars[ship->storbits]->pnames[ship->pnumorbits]);
  1756. X            strcat(telegram_buf, buf);
  1757. X            notify((int) ship->owner, (int) ship->governor, telegram_buf);
  1758. X        }
  1759. X    }
  1760. X    return numdest;
  1761. X
  1762. X}
  1763. END_OF_FILE
  1764. if test 4243 -ne `wc -c <'user/autoshoot.c'`; then
  1765.     echo shar: \"'user/autoshoot.c'\" unpacked with wrong size!
  1766. fi
  1767. # end of 'user/autoshoot.c'
  1768. fi
  1769. if test -f 'user/chan.c' -a "${1}" != "-c" ; then 
  1770.   echo shar: Will not clobber existing file \"'user/chan.c'\"
  1771. else
  1772. echo shar: Extracting \"'user/chan.c'\" \(3093 characters\)
  1773. sed "s/^X//" >'user/chan.c' <<'END_OF_FILE'
  1774. X#ident  "@(#)chan.c    1.3 2/1/93 "
  1775. X/***********************************************
  1776. X * chan.c
  1777. X *
  1778. X * Created: Wed Jan 27 20:56:42 EST 1993
  1779. X * Author:  John Paul Deragon
  1780. X *
  1781. X * Version: 1.3 00:14:44
  1782. X *
  1783. X * Contains: 
  1784. X *          
  1785. X *
  1786. X ***********************************************/
  1787. X
  1788. X#define EXTERN extern
  1789. X#include "GB_copyright.h"
  1790. X#include "vars.h"
  1791. X#include "races.h"
  1792. X#include "ships.h"
  1793. X#include "buffers.h"
  1794. X#include "power.h"
  1795. X#include "config.h"
  1796. X#include <stdio.h>
  1797. X#include <ctype.h>
  1798. X
  1799. Xvoid channel(int, int, int, int);
  1800. X#include "proto.h"
  1801. X
  1802. X#ifdef MULTIPLE_COMM_CHANNELS
  1803. Xvoid
  1804. Xchannel(int Playernum, int Governor, int AP, int startup)
  1805. X{
  1806. X    int            want;
  1807. X
  1808. X    if (argn < 2 || startup) 
  1809. X        goto dumpchannel;
  1810. X    else if (argn == 2) {
  1811. X        want = atoi(args[1]);
  1812. X        if (isset(races[Playernum -1]->governor[Governor].channel, want)) {
  1813. X            clrbit(races[Playernum -1]->governor[Governor].channel, want);
  1814. X            clrbit(races[Playernum -1]->governor[Governor].channel, 
  1815. X            want + DEFAULT_CHANNEL_MASK);
  1816. X        } else
  1817. X            setbit(races[Playernum -1]->governor[Governor].channel, want);
  1818. X
  1819. X        if (isset(races[Playernum -1]->governor[Governor].channel, 
  1820. X            want + DEFAULT_CHANNEL_MASK)) {
  1821. X            clrbit(races[Playernum -1]->governor[Governor].channel, 
  1822. X            want + DEFAULT_CHANNEL_MASK);
  1823. X            setbit(races[Playernum -1]->governor[Governor].channel, 
  1824. X            COMM_DEF_CHANNEL1);
  1825. X            notify(Playernum, Governor, "Setting default comm channel to 1\n");
  1826. X        }
  1827. X    } else if (argn == 3) {
  1828. X        want = atoi(args[1]);
  1829. X        if (match(args[2], "default")) {
  1830. X            clrbit(races[Playernum -1]->governor[Governor].channel, 
  1831. X            COMM_DEF_CHANNEL1);
  1832. X            clrbit(races[Playernum -1]->governor[Governor].channel,
  1833. X            COMM_DEF_CHANNEL2);
  1834. X            clrbit(races[Playernum -1]->governor[Governor].channel, 
  1835. X            COMM_DEF_CHANNEL3);
  1836. X            if (isclr(races[Playernum -1]->governor[Governor].channel, want)) {
  1837. X                setbit(races[Playernum -1]->governor[Governor].channel, want);
  1838. X                setbit(races[Playernum -1]->governor[Governor].channel,
  1839. X                    want + DEFAULT_CHANNEL_MASK);
  1840. X            } else
  1841. X                setbit(races[Playernum -1]->governor[Governor].channel, 
  1842. X                    want + DEFAULT_CHANNEL_MASK);
  1843. X        }
  1844. X    } else {
  1845. X        notify(Playernum, Governor, "Syntax: channel <channel> default\n");
  1846. X        return;
  1847. X    }
  1848. X        
  1849. X
  1850. Xdumpchannel:
  1851. X
  1852. X        notify(Playernum, Governor, "Channel Status:\n");
  1853. X        sprintf(buf, "         One: %s %s\n", 
  1854. X            (isset(races[Playernum -1]->governor[Governor].channel, 
  1855. X                COMM_CHANNEL1) ? "ON " : "OFF"),
  1856. X            (isset(races[Playernum -1]->governor[Governor].channel, 
  1857. X                COMM_DEF_CHANNEL1) ? "Default" : "      "));
  1858. X        notify(Playernum, Governor, buf); 
  1859. X        sprintf(buf, "         Two: %s %s\n", 
  1860. X            (isset(races[Playernum -1]->governor[Governor].channel, 
  1861. X                COMM_CHANNEL2) ? "ON " : "OFF"),
  1862. X            (isset(races[Playernum -1]->governor[Governor].channel, 
  1863. X                COMM_DEF_CHANNEL2) ? "Default" : "      "));
  1864. X        notify(Playernum, Governor, buf); 
  1865. X        sprintf(buf, "         Three: %s %s\n", 
  1866. X            (isset(races[Playernum -1]->governor[Governor].channel, 
  1867. X                COMM_CHANNEL3) ? "ON " : "OFF"),
  1868. X            (isset(races[Playernum -1]->governor[Governor].channel, 
  1869. X                COMM_DEF_CHANNEL3) ? "Default" : "      "));
  1870. X        notify(Playernum, Governor, buf); 
  1871. X
  1872. X}
  1873. X#endif
  1874. END_OF_FILE
  1875. if test 3093 -ne `wc -c <'user/chan.c'`; then
  1876.     echo shar: \"'user/chan.c'\" unpacked with wrong size!
  1877. fi
  1878. # end of 'user/chan.c'
  1879. fi
  1880. if test -f 'user/examine.c' -a "${1}" != "-c" ; then 
  1881.   echo shar: Will not clobber existing file \"'user/examine.c'\"
  1882. else
  1883. echo shar: Extracting \"'user/examine.c'\" \(2147 characters\)
  1884. sed "s/^X//" >'user/examine.c' <<'END_OF_FILE'
  1885. X/*
  1886. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  1887. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  1888. X * GB_copyright.h. examine -- check out an object
  1889. X */
  1890. X
  1891. X#include <strings.h>
  1892. X#include "GB_copyright.h"
  1893. X#define EXTERN extern
  1894. X#include "vars.h"
  1895. X#include "ships.h"
  1896. X#include "races.h"
  1897. X#include "power.h"
  1898. X#include "buffers.h"
  1899. Xextern long     Shipdata[NUMSTYPES][NUMABILS];
  1900. Xextern char    *Shipnames[];
  1901. X
  1902. Xvoid            examine(int, int, int);
  1903. X#include "proto.h"
  1904. X
  1905. Xvoid 
  1906. Xexamine(int Playernum, int Governor, int APcount)
  1907. X{
  1908. X    shiptype       *ship;
  1909. X    int             t, shipno;
  1910. X    FILE           *fd;
  1911. X    char            ch;
  1912. X
  1913. X    if (argn < 2) {
  1914. X        notify(Playernum, Governor, "Examine what?\n");
  1915. X        return;
  1916. X    }
  1917. X    sscanf(args[1] + (*args[1] == '#'), "%d", &shipno);
  1918. X
  1919. X    if (!getship(&ship, shipno)) {
  1920. X        return;
  1921. X    }
  1922. X    if (!ship->alive) {
  1923. X        sprintf(buf, "that ship is dead.\n");
  1924. X        notify(Playernum, Governor, buf);
  1925. X        free(ship);
  1926. X        return;
  1927. X    }
  1928. X    if (ship->whatorbits == LEVEL_UNIV || isclr(Stars[ship->storbits]->inhabited, Playernum)) {
  1929. X        sprintf(buf, "That ship it not visible to you.\n");
  1930. X        notify(Playernum, Governor, buf);
  1931. X        free(ship);
  1932. X        return;
  1933. X    }
  1934. X    if ((fd = fopen(EXAM_FL, "r")) == NULL) {
  1935. X        perror(EXAM_FL);
  1936. X        free(ship);
  1937. X        return;
  1938. X    }
  1939. X    /* look through ship data file */
  1940. X    for (t = 0; t <= ship->type; t++)
  1941. X        while (fgetc(fd) != '~');
  1942. X
  1943. X    /* look through ship data file */
  1944. X    sprintf(buf, "\n");
  1945. X    /* give report */
  1946. X    while ((ch = fgetc(fd)) != '~') {
  1947. X        sprintf(temp, "%c", ch);
  1948. X        strcat(buf, temp);
  1949. X    }
  1950. X    notify(Playernum, Governor, buf);
  1951. X    fclose(fd);
  1952. X
  1953. X    if (!ship->examined) {
  1954. X        if (ship->whatorbits == LEVEL_UNIV)
  1955. X            deductAPs(Playernum, Governor, APcount, 0, 1);    /* ded from sdata */
  1956. X        else
  1957. X            deductAPs(Playernum, Governor, APcount, (int) ship->storbits, 0);
  1958. X
  1959. X        ship->examined = 1;
  1960. X        putship(ship);
  1961. X    }
  1962. X    if (has_switch(ship)) {
  1963. X        sprintf(buf, "This device has an on/off switch that can be set with order.\n");
  1964. X        notify(Playernum, Governor, buf);
  1965. X    }
  1966. X    if (!ship->active) {
  1967. X        sprintf(buf, "This device has been irradiated;\nit's crew is dying and it cannot move for the time being.\n");
  1968. X        notify(Playernum, Governor, buf);
  1969. X    }
  1970. X    free(ship);
  1971. X}
  1972. END_OF_FILE
  1973. if test 2147 -ne `wc -c <'user/examine.c'`; then
  1974.     echo shar: \"'user/examine.c'\" unpacked with wrong size!
  1975. fi
  1976. # end of 'user/examine.c'
  1977. fi
  1978. if test -f 'user/vict.c' -a "${1}" != "-c" ; then 
  1979.   echo shar: Will not clobber existing file \"'user/vict.c'\"
  1980. else
  1981. echo shar: Extracting \"'user/vict.c'\" \(3281 characters\)
  1982. sed "s/^X//" >'user/vict.c' <<'END_OF_FILE'
  1983. X#ident  "@(#)vict.c    1.5 2/1/93 "
  1984. X/***********************************************
  1985. X * vict.c
  1986. X *
  1987. X * Created:
  1988. X * Author:  ??
  1989. X *
  1990. X * Version: 1.5 00:14:40
  1991. X *
  1992. X * Contains: victory()
  1993. X *           create_victory_list()
  1994. X *
  1995. X *
  1996. X ***********************************************/
  1997. X
  1998. X
  1999. X
  2000. X#include <errno.h>
  2001. X#include <time.h>
  2002. X#include <strings.h>
  2003. X
  2004. X#include "GB_copyright.h"
  2005. X#define EXTERN extern
  2006. X#include "vars.h"
  2007. X#include "ships.h"
  2008. X#include "races.h"
  2009. X#include "power.h"
  2010. X#include "buffers.h"
  2011. X
  2012. Xextern int      errno;
  2013. X
  2014. X/*
  2015. X * Prototypes
  2016. X */
  2017. Xvoid            victory(int, int);
  2018. Xvoid            create_victory_list(struct vic[MAXPLAYERS]);
  2019. Xint             victory_sort(struct vic *, struct vic *);
  2020. X#include "proto.h"
  2021. X
  2022. X/*
  2023. X * victory:
  2024. X * 
  2025. X * arguments: Playernum Playernum who called this function             Governor
  2026. X * Governor who called this function called by: main, check_logsize
  2027. X * 
  2028. X * description:  Called from process_commands
  2029. X * 
  2030. X * 
  2031. X */
  2032. Xvoid
  2033. Xvictory(int Playernum, int Governor)
  2034. X{
  2035. X    struct vic      vic[MAXPLAYERS];
  2036. X    racetype       *Race;
  2037. X    int             i;
  2038. X    int             count;
  2039. X    int             god = 0;
  2040. X
  2041. X    count = (argn > 1) ? atoi(args[1]) : Num_races;
  2042. X    if (count > Num_races)
  2043. X        count = Num_races;
  2044. X
  2045. X    create_victory_list(vic);
  2046. X
  2047. X    Race = races[Playernum - 1];
  2048. X    if (Race->God)
  2049. X        god = 1;
  2050. X
  2051. X    sprintf(buf, "----==== PLAYER RANKINGS ====----\n");
  2052. X    notify(Playernum, Governor, buf);
  2053. X    sprintf(buf, "%-4.4s %-15.15s %8s\n", "No.",
  2054. X        "Name", (god ? "Score" : ""));
  2055. X    notify(Playernum, Governor, buf);
  2056. X    for (i = 0; i < count; i++) {
  2057. X        if (god)
  2058. X            sprintf(buf, "%2d %c [%2d] %-15.15s %5d  %6.2f %3d %s %s\n",
  2059. X                i + 1, vic[i].Thing ? 'M' : ' ', vic[i].racenum,
  2060. X                vic[i].name, vic[i].rawscore,
  2061. X                vic[i].tech, vic[i].IQ, races[vic[i].racenum - 1]->password,
  2062. X               races[vic[i].racenum - 1]->governor[0].password);
  2063. X        else
  2064. X            sprintf(buf, "%2d   [%2d] %-15.15s\n", i + 1,
  2065. X                vic[i].racenum, vic[i].name);
  2066. X        notify(Playernum, Governor, buf);
  2067. X    }
  2068. X}
  2069. X
  2070. X/*
  2071. X * create_victory_list:
  2072. X * 
  2073. X * arguments: vic victory structure
  2074. X * 
  2075. X * called by: victory (local to this file)
  2076. X * 
  2077. X * description:  Puts together and sorts the races
  2078. X * 
  2079. X * 
  2080. X */
  2081. X
  2082. Xvoid
  2083. Xcreate_victory_list(struct vic vic[MAXPLAYERS])
  2084. X{
  2085. X    racetype       *vic_races[MAXPLAYERS];
  2086. X    int             i, valid_qsort;
  2087. X
  2088. X    for (i = 1; i <= Num_races; i++) {
  2089. X        vic_races[i - 1] = races[i - 1];
  2090. X        vic[i - 1].no_count = 0;
  2091. X    }
  2092. X
  2093. X    for (i = 1; i <= Num_races; i++) {
  2094. X        vic[i - 1].racenum = i;
  2095. X        strcpy(vic[i - 1].name, vic_races[i - 1]->name);
  2096. X        /* vic[i-1].rawscore = vic_races[i-1]->victory_score; */
  2097. X        vic[i - 1].rawscore = vic_races[i - 1]->morale;
  2098. X        vic[i - 1].tech = vic_races[i - 1]->tech;
  2099. X        vic[i - 1].Thing = vic_races[i - 1]->Metamorph;
  2100. X        vic[i - 1].IQ = vic_races[i - 1]->IQ;
  2101. X
  2102. X        if (vic_races[i - 1]->God || vic_races[i - 1]->Guest ||
  2103. X            vic_races[i - 1]->dissolved) {
  2104. X            vic[i - 1].no_count = 1;
  2105. X            valid_qsort = 0; 
  2106. X        } else 
  2107. X            valid_qsort = 1;
  2108. X    
  2109. X        
  2110. X    }
  2111. X    if (valid_qsort) 
  2112. X        qsort(vic, Num_races, sizeof(struct vic), victory_sort);
  2113. X}
  2114. X
  2115. X/*
  2116. X * victory_sort;
  2117. X * 
  2118. X * arguments: a, b victory structure
  2119. X * 
  2120. X * called by: create_victory_list (local to this file)
  2121. X * 
  2122. X * description:
  2123. X * 
  2124. X * 
  2125. X */
  2126. X
  2127. Xint 
  2128. Xvictory_sort(struct vic * a, struct vic * b)
  2129. X{
  2130. X    if (a->no_count)
  2131. X        return (1);
  2132. X    else if (b->no_count)
  2133. X        return (-1);
  2134. X    else
  2135. X        return (b->rawscore - a->rawscore);
  2136. X}
  2137. END_OF_FILE
  2138. if test 3281 -ne `wc -c <'user/vict.c'`; then
  2139.     echo shar: \"'user/vict.c'\" unpacked with wrong size!
  2140. fi
  2141. # end of 'user/vict.c'
  2142. fi
  2143. if test -f 'utils/Makefile.SH' -a "${1}" != "-c" ; then 
  2144.   echo shar: Will not clobber existing file \"'utils/Makefile.SH'\"
  2145. else
  2146. echo shar: Extracting \"'utils/Makefile.SH'\" \(3236 characters\)
  2147. sed "s/^X//" >'utils/Makefile.SH' <<'END_OF_FILE'
  2148. Xcase $CONFIG in
  2149. X'')
  2150. X    if test ! -f config.sh; then
  2151. X    ln ../config.sh . || \
  2152. X    ln ../../config.sh . || \
  2153. X    ln ../../../config.sh . || \
  2154. X    (echo "Can't find config.sh."; exit 1)
  2155. X    fi
  2156. X    . ./config.sh
  2157. X    ;;
  2158. Xesac
  2159. Xcase "$0" in
  2160. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  2161. Xesac
  2162. X
  2163. Xecho "Extracting utils/Makefile (with variable substitutions)"
  2164. Xcat >Makefile <<!GROK!THIS!
  2165. X#
  2166. X#  util level Makefile for the GB+ program
  2167. X#  This makefile will make the commands library routines
  2168. X#
  2169. X# Bug reports, patches, comments, suggestions should be sent to:
  2170. X#
  2171. X#    John Deragon deragon@jethro.cs.nyu.edu
  2172. X#
  2173. X# Revision 1.0  92/12/10 jpd
  2174. X# 
  2175. X#
  2176. X# Variables
  2177. X#    Variables established by Configure
  2178. XCC        =    $cc
  2179. XCCFLAGS        =    $ccflags $xencf
  2180. XCHGRP        =    $chgrp
  2181. XCHMOD        =    $chmod
  2182. XCP        =    $cp
  2183. XDEST        =    $bin
  2184. XECHO        =    $echo
  2185. XLFLAGS        =    $ldflags 
  2186. XLIB            =
  2187. XLIBS2        =
  2188. XLIBS        = -lcurses -ltermcap -lm
  2189. XLINT        =    $lint
  2190. XMV        =    $mv
  2191. XOPTIMIZE    =    $optimize
  2192. XRM        =     $rm -f
  2193. XAR        =     $ar
  2194. XRANLIB  =   $ranlib
  2195. XTOUCH        =    $touch
  2196. XPORT        =   $port
  2197. XHOST        =   $host
  2198. X
  2199. X!GROK!THIS!
  2200. X
  2201. Xcat >>Makefile <<'!NO!SUBS!'
  2202. X
  2203. X#    Variables you may want to manually edit
  2204. X#        If you want debug logging then you'll
  2205. X#        want to uncomment the following.
  2206. X#DEBUG        =    -DDEBUG
  2207. X
  2208. X#        If you're on an ACSnet system (Australia) then
  2209. X#        you'll want to uncomment the following.
  2210. X# DACSNET    =    -DACSNET
  2211. X
  2212. X#    Other general variables
  2213. XBIN        =    ../bin
  2214. XCFLAGS        =    $(CCFLAGS) $(OPTIMIZE) -I$(INCLDIR) $(DEBUG) $(DACSNET) 
  2215. XINCLDIR        =    ../hdrs
  2216. XLINTFLAGS    =    -I$(INCLDIR)
  2217. XSHELL        =    /bin/sh
  2218. X
  2219. X#     Lists
  2220. XENROL_SRC        =    enrol.c \
  2221. X                    files_shl.c \
  2222. X                    files_rw.c      \
  2223. X                    files.c \
  2224. X                    max.c   \
  2225. X                    perm.c  \
  2226. X                    rand.c  \
  2227. X                    shlmisc.c
  2228. X
  2229. X
  2230. XENROL_OBJ        =    enrol.o \
  2231. X                    files_shl.o \
  2232. X                    files_rw.o      \
  2233. X                    files.o \
  2234. X                    max.o   \
  2235. X                    perm.o  \
  2236. X                    rand.o  \
  2237. X                    shlmisc.o
  2238. X
  2239. XMAKEUNIV_SRC    =    makeuniv.c \
  2240. X                     makestar.c \
  2241. X                     makeplanet.c \
  2242. X                     rand.c \
  2243. X                     perm.c \
  2244. X                     files.c
  2245. X
  2246. XMAKEUNIV_OBJ    =    makeuniv.o \
  2247. X                     makestar.o\
  2248. X                     makeplanet.o \
  2249. X                     rand.o \
  2250. X                     perm.o \
  2251. X                     files.o
  2252. X
  2253. XRACEGEN_SRCS =       racegen.c
  2254. X
  2255. XGBRACEGEN_OBJS =    enroll.o \
  2256. X                    racegen.o   \
  2257. X                    files_shl.o \
  2258. X                    files_rw.o  \
  2259. X                    files.o \
  2260. X                    max.o   \
  2261. X                    perm.o  \
  2262. X                    rand.o  \
  2263. X                    GB_racegen.o    \
  2264. X                    shlmisc.o
  2265. X
  2266. X
  2267. XPSMAP_SRCS =         psmap.c
  2268. XPSMAP_OBJS =         psmap.o
  2269. X
  2270. XEXSHIP_SRCS =         exship.c
  2271. X
  2272. XEXSHIP_OBJS =        exship.o
  2273. X
  2274. X# Standard targets
  2275. Xall:        enrol makeuniv racegen psmap exship
  2276. X
  2277. X#    Dependencies and rules for compiling C programs
  2278. Xenrol:    $& $(ENROL_OBJ)
  2279. X        $(CC) $(LFLAGS) -o $@ $(ENROL_OBJ) $(LIBS) 
  2280. X
  2281. Xmakeuniv:    $& $(MAKEUNIV_OBJ)
  2282. X        $(CC) $(LFLAGS) -o $@ $(MAKEUNIV_OBJ) $(LIBS)
  2283. X
  2284. Xpsmap:    $& $(PSMAP_OBJS)
  2285. X        $(CC) $(LFLAGS) -o $@ $(PSMAP_OBJS)
  2286. X
  2287. Xexship:    $& $(EXSHIP_OBJS)
  2288. X        $(CC) $(LFLAGS) -o $@ $(EXSHIP_OBJS)
  2289. X
  2290. Xracegen.o:    racegen.c
  2291. X        $(CC) $(CFLAGS) -DENROLL racegen.c -c
  2292. XGBracegen: $(GBRACEGEN_OBJS)
  2293. X        $(CC) -o racegen $(GBRACEGEN_OBJS) -lm
  2294. X
  2295. Xclean:
  2296. X    rm -f $(ENROL_OBJ) $(MAKEUNIV_OBJ) $(RACEGEN_OBJS) $(PSMAP_OBJS)
  2297. X    rm -f  $(EXSHIP_OBJS) exship psmap enrol makeuniv racegen
  2298. X
  2299. Xinstall:
  2300. X    install enrol $(BIN)
  2301. X    install makeuniv $(BIN)
  2302. X    install racegen $(BIN)
  2303. X    install psmap $(BIN)
  2304. X    install exship $(BIN)
  2305. X
  2306. X
  2307. X!NO!SUBS!
  2308. END_OF_FILE
  2309. if test 3236 -ne `wc -c <'utils/Makefile.SH'`; then
  2310.     echo shar: \"'utils/Makefile.SH'\" unpacked with wrong size!
  2311. fi
  2312. # end of 'utils/Makefile.SH'
  2313. fi
  2314. if test -f 'utils/README_EXSHIP' -a "${1}" != "-c" ; then 
  2315.   echo shar: Will not clobber existing file \"'utils/README_EXSHIP'\"
  2316. else
  2317. echo shar: Extracting \"'utils/README_EXSHIP'\" \(2615 characters\)
  2318. sed "s/^X//" >'utils/README_EXSHIP' <<'END_OF_FILE'
  2319. X    This is a small utility to examine the ship database for Galactic
  2320. XBloodshed.  It can be used two ways:
  2321. X
  2322. X    a: run exship with no arguments, and it will scan through the entire
  2323. X       database, looking for ships whose cargo exceeds the maximum allowed.
  2324. X
  2325. X    b: run exship with a ship_number and it will display a more verbose
  2326. X       listing of the ships.  
  2327. X
  2328. X    The following are sample outputs from both cases...
  2329. X
  2330. X    tensha%: exship
  2331. X    Number of ships in database is 5
  2332. X    Problem with ship number 1
  2333. X                Owner: 1
  2334. X                Governor: 0
  2335. X                Name: Tester
  2336. X                Type: @
  2337. X
  2338. X                popn: 10         max_popn: 10:
  2339. X                troops: 0        max_troops: 10
  2340. X         -----> resources: 600   max_resources: 500
  2341. X                destruct: 100    max_destruct: 100
  2342. X                fuel: 1000       max_fuel: 1000
  2343. X                speed: 0         max_speed: 0
  2344. X                hanger: 0        max_hanger: 0
  2345. X    I found a total of 1 bad ships out of 5
  2346. X    All Done
  2347. X-----
  2348. X    
  2349. X  As you can see there is a problem with the ship [denoted by the ----->]
  2350. X  in which the ship has more resources loaded then it should have.  It also
  2351. X  at the top of the screen will display the number of ships in the database.
  2352. X
  2353. X
  2354. X  When run with a argument, the following is the output:
  2355. X
  2356. X    tensha%: exship 1
  2357. X    Number of ships in database is 5
  2358. X    Ship Number: 1  Ship Type: @    Ship Owner: 1   Ship Governor 0
  2359. X    Ship Name: Tester
  2360. X
  2361. X    Crew: 10          Troops: 0             Armor: 20
  2362. X    Size: 25          Base Mass: 100.0      Base Tech: 100.0
  2363. X    Destruct: 100     Resources: 600        Crystals: 0
  2364. X    Fuel: 4.1f
  2365. X
  2366. X    Guns:   Primary: 10 L
  2367. X        Secondary:  10 L
  2368. X
  2369. X    Nextship: 2              (ALIVE)
  2370. X    All Done
  2371. X
  2372. X-----
  2373. X    
  2374. X    When run with n argument, it displays a short formatted output of
  2375. Xthe ship.
  2376. X
  2377. X
  2378. X-----
  2379. X
  2380. X    Compliling information:
  2381. X
  2382. X    This program has only been tested on a Suns running Sun OS 4.1.1, and
  2383. X    compiled succesfully with the Sun compilier and gcc 1.42.
  2384. X
  2385. X    compile with the following line:
  2386. X
  2387. X    gcc -I/work/GB/hdrs -g -o exship exship.c    
  2388. X
  2389. X    but change /work/GB/hdrs to be the location where the compiler can
  2390. X    find the ships.h and shipdata.h files. (these files are part of the GB
  2391. X    release)
  2392. X
  2393. X
  2394. X    This is something I hacked together very very quickly to just fix
  2395. X    a few problems with the database.  It is not meant to be a catch all
  2396. X    for database problems.   If I have some time in the future, I will
  2397. X    add new bells and whistles.  Feel free to modify this source, and if
  2398. X    you make any improvements, please email them back to me, so I can 
  2399. X    merge them into the next version.
  2400. X
  2401. X
  2402. X    John Paul Deragon
  2403. X    deragon@jethro.nyu.edu
  2404. X    Fri Jan  1 21:58:49 EST 1993
  2405. END_OF_FILE
  2406. if test 2615 -ne `wc -c <'utils/README_EXSHIP'`; then
  2407.     echo shar: \"'utils/README_EXSHIP'\" unpacked with wrong size!
  2408. fi
  2409. # end of 'utils/README_EXSHIP'
  2410. fi
  2411. echo shar: End of archive 20 \(of 21\).
  2412. cp /dev/null ark20isdone
  2413. MISSING=""
  2414. 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
  2415.     if test ! -f ark${I}isdone ; then
  2416.     MISSING="${MISSING} ${I}"
  2417.     fi
  2418. done
  2419. if test "${MISSING}" = "" ; then
  2420.     echo You have unpacked all 21 archives.
  2421.     echo "Now type './buildfiles.sh'"
  2422.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2423. else
  2424.     echo You still need to unpack the following archives:
  2425.     echo "        " ${MISSING}
  2426. fi
  2427. ##  End of shell archive.
  2428. exit 0
  2429.