home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume17 / gbp / part16 < prev    next >
Encoding:
Internet Message Format  |  1993-03-20  |  55.5 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: v17i028:  gbp - Galactic Bloodshed+, an empire-like war game, Part16/21
  5. Message-ID: <4556@master.CNA.TEK.COM>
  6. Date: 12 Feb 93 17:32:38 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1598
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1707
  11.  
  12. Submitted-by: deragon@harpo.cs.nyu.edu (Seeker)
  13. Posting-number: Volume 17, Issue 28
  14. Archive-name: gbp/Part16
  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 16 (of 21)."
  27. # Contents:  hdrs/csp.h hdrs/shipdata.h hdrs/ships.h hdrs/vars.h
  28. #   user/cs.c user/declare.c
  29. # Wrapped by billr@saab on Fri Feb 12 09:14:29 1993
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'hdrs/csp.h' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'hdrs/csp.h'\"
  33. else
  34. echo shar: Extracting \"'hdrs/csp.h'\" \(1748 characters\)
  35. sed "s/^X//" >'hdrs/csp.h' <<'END_OF_FILE'
  36. X/*
  37. X * csp.h: Contains the defines for all the Client-Server Protocol (CSP)
  38. X *        numbers.
  39. X *
  40. X * Version 1.2
  41. X *
  42. X * Please send any modifications of this file to:
  43. X *    ekoffler@darkwing.uoregon.edu 
  44. X *    deragon@jethro.nyu.edu
  45. X *
  46. X */
  47. X
  48. X
  49. X/* character to be found in column 0 of a CSP output line */
  50. X# define CSP_CLIENT            '|'
  51. X
  52. X/* identifier sent by client to server when sending a command/request */
  53. X# define CSP_SERVER            "CSP"
  54. X
  55. X/* VERSION */
  56. X# define CSP_VERSION_INFO               10      /* version XX */
  57. X# define CSP_VERSION_OPTIONS            11      /* options set YY */
  58. X
  59. X/* LOGIN */
  60. X# define CSP_CLIENT_ON            30    /* client mode on      */
  61. X# define CSP_CLIENT_OFF            31    /* client mode off     */
  62. X
  63. X/* UPDATE/SEGMENT/RESET */
  64. X
  65. X/* update/segment info */            
  66. X# define CSP_UPDATE_START        50    /* update started */
  67. X# define CSP_UPDATE_END            51    /* update finshed */
  68. X# define CSP_SEGMENT_START        52    /* segment started */
  69. X# define CSP_SEGMENT_END        53    /* segment finished */
  70. X# define CSP_RESET_START        54    /* reset started */
  71. X# define CSP_RESET_END            55    /* reset finished */
  72. X
  73. X/* SURVEY */
  74. X
  75. X/* client_survey command */
  76. X# define CSP_SURVEY_INTRO               101     /* planet info */
  77. X# define CSP_SURVEY_SECTOR              102     /* sector info */
  78. X# define CSP_SURVEY_END                 103     /* end of command(EOC) */
  79. X
  80. X/* COMMANDS */
  81. X
  82. X# define CSP_LOGIN_COMMAND        1101    /* login command   */
  83. X# define CSP_VERSION_COMMAND        1102    /* version command */
  84. X# define CSP_SURVEY_COMMAND        1103    /* imap command    */
  85. X
  86. X/* ERRORS */
  87. X
  88. X# define CSP_ERR            9900    /* error           */
  89. X# define CSP_ERR_TOO_MANY_ARGS        9901    /* too many args   */
  90. X# define CSP_ERR_TOO_FEW_ARGS        9902    /* too few args    */
  91. X# define CSP_ERR_UNKNOWN_COMMAND    9903    /* unknown command */
  92. X
  93. X
  94. END_OF_FILE
  95. if test 1748 -ne `wc -c <'hdrs/csp.h'`; then
  96.     echo shar: \"'hdrs/csp.h'\" unpacked with wrong size!
  97. fi
  98. # end of 'hdrs/csp.h'
  99. fi
  100. if test -f 'hdrs/shipdata.h' -a "${1}" != "-c" ; then 
  101.   echo shar: Will not clobber existing file \"'hdrs/shipdata.h'\"
  102. else
  103. echo shar: Extracting \"'hdrs/shipdata.h'\" \(9773 characters\)
  104. sed "s/^X//" >'hdrs/shipdata.h' <<'END_OF_FILE'
  105. X#ident  "@(#)shipdata.h    1.7 2/1/93 "
  106. X
  107. X#include "config.h"
  108. X/*
  109. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
  110. X * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
  111. X * Restrictions in GB.c.
  112. X */
  113. X
  114. Xchar Shipltrs[]={ 'p','s','X','D','B','I','C','d','f','e','H','S','O','c',
  115. X    't','+','M','=','E','-','a','g','h','@','l','w',':','G','F',
  116. X    'T','[','^','P', 'q', 'K', 'Y', 'W', 'J', '&', 'R', 'b', 'L', 'm' };
  117. X
  118. X/* table for [ABIL_BUILD]. (bd). sum the numbers to get the correct value.
  119. X/*      1 To allow it to be built on a planet.
  120. X/*      2 For building by warships (d, B, C,..). Currently only for Space Probe.
  121. X/*      Mines used to be this way too. Built in hanger of building ship.
  122. X/*      4 For building by Shuttles, Cargo ship, Habitats, etc.
  123. X/*        Also forces construction on the outside of the ship. Not in hanger.
  124. X/*      8 For building in Factories. Built on planet, or in hanger of carrying
  125. X/*        ship (Habitat).
  126. X/*     16 For building in Habitats. Used by Pods for instance. Also used by
  127. X/*        Factories. Built inside Habitat. */
  128. X
  129. X/* table for [ABIL_CONSTRUCT]. (cn). sum the numbers to get the correct value.
  130. X/*      1 To allow it to build like a planet.
  131. X/*      2 For building like warships (d, B, C,..).
  132. X/*      4 For building like Shuttles, Cargo ship, Habitats, etc.
  133. X/*      8 For building like Factories.
  134. X/*     16 For building like Habitats. */
  135. X
  136. X/* Changes here to use the new build routine using above tables.  Maarten
  137. X/* Also changed:
  138. X/*   - Pods, Factories, Weapons Plants, Terraforming Devices,
  139. X/*     Orbital Mind Control Lasers and Government Centers can 
  140. X/*     be built inside Habitats.
  141. X/*   - Probes, and other type 2 ships (currently none), are now built inside
  142. X/*     ships, requiring hanger space. This gives more incentive to keep some
  143. X/*     hanger space in the big warships.
  144. X/*   - The big space stations (Habitats, Stations, and Orbital Assault
  145. X/*     Platforms) can now build Probes as well.
  146. X
  147. X /*   - Habitats and Stations had their ability to use a crystal mount removed.
  148. X/*     Since they cannot use it in any way, it was rather useless. It only
  149. X/*     confused the required resources to build the ship, though this has been
  150. X/*     taken care of too.
  151. X/*   - Orbital Mind Control Lasers having 10 guns of caliber 0 seemed strange.
  152. X/*     Now 0 guns. Also removed the 100 destruct carrying capacity. Added 25
  153. X/*     cargo space so it can repair itself. */
  154. X
  155. X
  156. Xlong Shipdata[NUMSTYPES][NUMABILS] = {
  157. X   /*  tech  carg  bay  dest guns prim sec fuelcap  crw arm  cst mt jp ld sw sp dm  bd   cn mod las cew clk god prg port rep pay dock*/
  158. X#ifdef SUPER_PODS
  159. X/*SPd*/   0,   0,    0,   0,   0,   0,  0,    20,    1,  0,   9,  0, 0, 1, 0, 3,  0,  1,  0, 0,  0,  0,  0,  0,   1,  0,  1,  0, 1,
  160. X#else
  161. X/*SPd*/   0,   0,    0,   0,   0,   0,  0,    20,    1,  0,   1,  0, 0, 1, 0, 2,  0,  1,  0, 0,  0,  0,  0,  0,   1,  0,  1,  0, 1,
  162. X#endif
  163. X/*Shu*/  10,  25,    2,   2,   1,   1,  0,    20,   10,  0,   2,  0, 0, 1, 0, 4,  0,  8,  4, 1,  0,  0,  0,  0,   1,  0,  0,  1, 1,
  164. X/*Car*/ 250, 600,  200, 800,  30,   3,  2,  1000,   30,  5,  30,  1, 1, 0, 0, 4, 50, 20,  2, 1,  1,  1,  0,  0,   1,  0,  1,  1, 1,
  165. X/*Drn*/ 300, 500,   10, 500,  60,   3,  2,   500,   60, 10,  40,  1, 1, 1, 0, 6, 50,  8,  2, 1,  1,  1,  0,  0,   1,  0,  0,  1, 1,
  166. X/*BB */ 200, 235,   10, 400,  30,   3,  2,   200,   30,  7,  20,  1, 1, 1, 0, 6, 50,  8,  2, 1,  1,  1,  0,  0,   1,  0,  0,  1, 1,
  167. X/*Int*/ 150, 110,    5, 120,  20,   2,  2,   200,   20,  3,  15,  1, 1, 1, 0, 6, 50,  8,  2, 1,  1,  1,  0,  0,   1,  0,  0,  1, 1,
  168. X/*CA */ 150, 165,    5, 300,  20,   3,  2,   120,   20,  5,  10,  1, 1, 1, 0, 6, 50,  8,  2, 1,  1,  1,  0,  0,   1,  0,  0,  1, 1,
  169. X/*DD */ 100, 110,    5, 120,  15,   2,  2,    80,   15,  3,   5,  1, 1, 1, 0, 6, 50,  8,  2, 1,  1,  1,  0,  0,   1,  0,  0,  1, 1,
  170. X/*FF */ 100,   0,    0,  40,  20,   2,  1,    10,    1,  2,   1,  1, 1, 1, 0, 9,  0,  8,  2, 1,  1,  1,  0,  0,   1,  0,  1,  1, 1,
  171. X/*Exp*/  40,  10,    0,  15,   5,   2,  0,    35,    5,  1,   2,  1, 1, 1, 0, 6,  0,  8,  0, 1,  1,  0,  0,  0,   1,  0,  0,  1, 1,
  172. X/*Hab*/ 100,5000,   10, 500,  20,   2,  1,  2000,  2000, 3,  50,  0, 0, 0, 1, 4, 75, 20, 18, 1,  0,  0,  0,  0,   1,  1,  1,  1, 1,
  173. X/*Stn*/ 100,5000,   10, 250,  20,   2,  0,  2000,   50,  1,  10,  0, 0, 0, 0, 4, 75, 20,  6, 1,  0,  0,  0,  0,   1,  1,  1,  1, 1,
  174. X/*OSP*/ 200,1400,   20,1000,  50,   3,  2,  2000,  200,  5,  40,  1, 1, 0, 0, 4, 75, 20,  6, 1,  1,  1,  0,  0,   1,  0,  1,  1, 1,
  175. X/*Crg*/ 100,1000,    5,1000,  10,   1,  0,  1000,  100,  2,  10,  1, 1, 1, 0, 4,  0,  8,  4, 1,  0,  0,  0,  0,   1,  0,  0,  1, 1,
  176. X/*Tnk*/ 100, 200,    5, 200,  10,   1,  0,  5000,   10,  2,  10,  1, 1, 1, 0, 4,  0,  8,  2, 1,  0,  0,  0,  0,   1,  0,  0,  1, 1,
  177. X/*SMn*/  50,   0,    0,  25,   0,   0,  0,    20,    0,  1,  30,  0, 0, 1, 1, 2,  0,  8,  0, 1,  0,  0,  0,  0,   1,  0,  0,  0, 1,
  178. X   /*  tech  carg  bay  dest guns prim sec fuelcap  crw arm  cst mt jp ld sw sp dm  bd  cn mod las cew clk god prg port rep pay dock*/
  179. X/*mir*/ 100, 200,    0,  10,   1,   1,  0,    20,    5,  0, 100,  0, 0, 0, 0, 2, 75, 20,  0, 0,  0,  0,  0,  0,   1,  0,  1,  1, 1,
  180. X/*Stc*/  50,   0,    0,   0,   0,   0,  0,    20,    2,  0,  20,  1, 1, 1, 0, 4,  0,  8,  0, 1,  0,  0,  0,  0,   1,  0,  0,  1, 1,
  181. X/*Tsc*/   5,   0,    0,   0,   0,   0,  0,     0,    2,  0,   2,  0, 0, 1, 0, 0,  0,  1,  0, 0,  0,  0,  0,  0,   1,  0,  1,  0, 0,
  182. X/*T-R*/ 200,   0,    0,   0,   0,   0,  0,  1000,    5,  0,  20,  1, 0, 1, 1, 2,  0,  1,  0, 0,  0,  0,  0,  0,   0,  0,  1,  0, 1,
  183. X/*APr*/  80,   0,    0,   0,   0,   0,  0,   200,   10,  1,  20,  0, 0, 1, 1, 0,  0,  1,  0, 0,  0,  0,  0,  0,   1,  0,  1,  0, 0,
  184. X/* CD*/  40,   0,    0,   0,   0,   0,  0,     1,    0,  0,  10,  0, 0, 1, 1, 1,  0,  1,  0, 0,  0,  0,  0,  0,   1,  0,  1,  0, 1,
  185. X/*Grn*/  40,   0,    0,   0,   0,   0,  0,     1,    0,  0,  10,  0, 0, 1, 0, 1,  0,  1,  0, 0,  0,  0,  0,  0,   1,  0,  1,  0, 1,
  186. X/*Gov*/   0, 500,    0, 100,  10,   1,  0,  1000,   10, 20, 500,  0, 0, 1, 0, 0, 75, 17,  0, 0,  0,  0,  0,  0,   1,  1,  1,  0, 0,
  187. X/*OMCL*/350,  25,    0,   0,   0,   0,  0,   100,    2,  1,  50,  0, 0, 1, 1, 4,  0, 17,  0, 0,  0,  0,  0,  0,   0,  0,  0,  0, 1,
  188. X/*TWC*/   0,   0,    0,   0,   0,   0,  0,    20,    0,  0,   5,  0, 0, 1, 0, 4,  0,  1,  0, 0,  0,  0,  0,  0,   1,  0,  0,  0, 1,
  189. X/*Prb*/ 150,   0,    0,   0,   0,   0,  0,    20,    0,  0,  10,  0, 0, 1, 0, 9,  0, 19,  0, 0,  0,  0,  0,  0,   1,  0,  0,  0, 1,
  190. X   /*  tech  carg  bay  dest guns prim sec fuelcap  crw arm  cst mt jp ld sw sp dm  bd  cn mod las cew clk god prg port rep pay dock*/
  191. X/*GRL */100,  50,    0, 120,  20,   1,  0,     0,   40,  3,  30,  0, 0, 1, 1, 0, 75,  1,  0, 1,  0,  1,  0,  0,   1,  0,  1,  1, 1,
  192. X/*Fac*/   0,  50,    0,   0,   0,   0,  0,     0,   20,  0,  20,  0, 0, 1, 1, 0, 75, 17,  8, 0,  0,  0,  0,  0,   1,  0,  1,  1, 0,
  193. X/*TFD*/  50,  40,    5,   0,   0,   0,  0,   200,   20,  1,  20,  1, 0, 1, 1, 4,  0, 17,  0, 1,  0,  0,  0,  0,   1,  0,  1,  1, 1,
  194. X/*TD */ 200,1000,    0,1000,   0,   0,  0,  1000,   100,  0, 300, 0, 0, 1, 1, 0, 50,  1,  0, 0,  0,  0,  0,  0,   1,  0,  1,  0, 0,
  195. X/*Mis*/  50,   0,    0,  10,   0,   0,  0,     5,     0,  0,   5, 0, 0, 0, 1, 6,  0,  8,  0, 1,  0,  0,  0,  0,   1,  0,  0,  0, 1,
  196. X/*PDN*/ 200,  50,    0, 500,  20,   3,  0,     0,    50, 10, 100, 0, 0, 1, 1, 0, 75,  1,  0, 1,  0,  0,  0,  0,   1,  0,  1,  1, 0,
  197. X   /*  tech  carg  bay  dest guns prim sec fuelcap  crw arm  cst mt jp ld sw sp dm  bd  cn mod las cew clk god prg port rep pay dock*/
  198. X/*Qua*/   0,   0,    0,   0,  0,   0,  0,   200,    50,  1,  10,  0, 0, 1, 1, 0,  0,  1,  0, 1,  0,  0,  0,  0,   1,  0,  1,  1, 0,
  199. X/*Plo*/   5,   0,    0,   0,  0,   0,  0,   200,    10,  1,  10,  0, 0, 1, 1, 0,  0,  1,  0, 1,  0,  0,  0,  0,   1,  0,  0,  0, 1,
  200. X/*Dom*/  10, 100,    0,   0,  0,   0,  0,     0,    20,  1,  10,  0, 0, 1, 1, 0,  0,  1,  0, 1,  0,  0,  0,  0,   1,  0,  1,  0, 1,
  201. X/*Wea*/   0, 500,    0,   0,  0,   0,  0,   500,    20,  5,  20,  0, 0, 1, 0, 0, 75, 17,  0, 0,  0,  0,  0,  0,   1,  0,  1,  0, 1,
  202. X/*Port*/  0,   0,    0,   0,  0,   0,  0,     0,   100,  3,  50,  0, 0, 1, 0, 0, 75,  1,  0, 1,  0,  0,  0,  0,   1,  1,  1,  1, 1,
  203. X/*ABM*/ 100,   5,    0,  50,  5,   1,  0,     0,     5,  5,  50,  0, 0, 1, 1, 0, 50,  1,  0, 1,  0,  0,  0,  0,   1,  0,  1,  1, 0,
  204. X   /*  tech  carg  bay  dest guns prim sec fuelcap  crw arm  cst mt jp ld sw sp dm  bd  cn mod las cew clk god prg port rep pay dock*/
  205. X/*AFV*/  50,   5,    0,  20,  2,   1,  0,    20,     1,  2,  20,  0, 0, 0, 0, 0,  0,  8,  0, 1,  0,  0,  0,  0,   1,  0,  1,  1, 1,
  206. X/*Bun*/  10, 100,   20, 100,  0,   0,  0,   100,   100, 15, 100,  0, 0, 0, 0, 0, 50,  1,  0, 1,  0,  0,  0,  0,   1,  0,  1,  1, 0,
  207. X/*Lnd*/ 150, 100,   10, 200, 10,   3,  0,   100,   500,  7,  50,  1, 1, 1, 0, 2, 50,  8,  0, 1,  0,  0,  0,  0,   1,  0,  1,  1, 0, 
  208. X/*Swp*/ 100,  25,    2,  80,  8,   1,  1,    80,     8,  3,  23,  1, 1, 1, 0, 5, 50,  8,  2, 1,  1,  1,  1,  0,   1,  0,  0,  0, 1
  209. X};
  210. X
  211. Xchar *Shipnames[NUMSTYPES] = {
  212. X   "Spore pod",
  213. X   "Shuttle",
  214. X   "Carrier",
  215. X   "Dreadnaught",
  216. X   "Battleship",
  217. X   "Interceptor",
  218. X   "Cruiser",
  219. X   "Destroyer",
  220. X   "Fighter Group",
  221. X   "Explorer",
  222. X   "Habitat",
  223. X   "Station",
  224. X   "Ob Asst Pltfrm",
  225. X   "Cargo Ship",
  226. X   "Tanker",
  227. X   "Space Mine",
  228. X   "Space Mirror",
  229. X   "Space Telescope",
  230. X   "Ground Telescope",
  231. X   "* T-R beam",
  232. X   "Atmosph Processor",
  233. X   "Dust Canister",
  234. X   "Greenhouse Gases",
  235. X   "Govrnmnt. Center",
  236. X   "Mind Control Lsr",
  237. X   "Tox Waste Canistr",
  238. X   "Space Probe",
  239. X   "Gamma Ray Laser",
  240. X   "Factory",
  241. X   "Terraform Device",
  242. X   "AVPM Transporter",
  243. X   "Missile",
  244. X   "Planet Def Net",
  245. X   "Quarry",
  246. X   "Space Plow",
  247. X   "Dome",
  248. X   "Weapons Plant",
  249. X   "Space Port",
  250. X   "ABM Battery",
  251. X   "Mech",
  252. X   "Bunker",
  253. X   "Lander",
  254. X   "Mine Sweeper"
  255. X   };
  256. END_OF_FILE
  257. if test 9773 -ne `wc -c <'hdrs/shipdata.h'`; then
  258.     echo shar: \"'hdrs/shipdata.h'\" unpacked with wrong size!
  259. fi
  260. # end of 'hdrs/shipdata.h'
  261. fi
  262. if test -f 'hdrs/ships.h' -a "${1}" != "-c" ; then 
  263.   echo shar: Will not clobber existing file \"'hdrs/ships.h'\"
  264. else
  265. echo shar: Extracting \"'hdrs/ships.h'\" \(10183 characters\)
  266. sed "s/^X//" >'hdrs/ships.h' <<'END_OF_FILE'
  267. X#ident  "@(#)ships.h    1.4 1/19/93 "
  268. X
  269. X#include "config.h"
  270. X
  271. X/*
  272. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
  273. X * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
  274. X * Restrictions in GB.c.
  275. X */
  276. X#define LIGHT        1
  277. X#define MEDIUM        2
  278. X#define HEAVY        3
  279. X#define NONE        0
  280. X#define PRIMARY        1
  281. X#define SECONDARY    2
  282. X
  283. X#define STYPE_POD    0
  284. X#define STYPE_SHUTTLE     1
  285. X#define STYPE_CARRIER   2
  286. X#define STYPE_DREADNT    3
  287. X#define STYPE_BATTLE     4
  288. X#define STYPE_INTCPT    5
  289. X#define STYPE_CRUISER    6
  290. X#define STYPE_DESTROYER 7
  291. X#define STYPE_FIGHTER     8
  292. X#define STYPE_EXPLORER     9
  293. X#define STYPE_HABITAT     10
  294. X#define STYPE_STATION    11
  295. X#define STYPE_OAP    12
  296. X#define STYPE_CARGO     13
  297. X#define STYPE_TANKER     14
  298. X#define STYPE_MINE    15
  299. X#define STYPE_MIRROR    16
  300. X#define OTYPE_STELE    17
  301. X#define OTYPE_GTELE    18
  302. X#define OTYPE_TRACT 19    
  303. X#define OTYPE_AP    20
  304. X#define OTYPE_CANIST    21
  305. X#define OTYPE_GREEN    22
  306. X#define OTYPE_GOV    23
  307. X#define OTYPE_OMCL    24
  308. X#define OTYPE_TOXWC    25
  309. X#define OTYPE_PROBE    26
  310. X#define OTYPE_GR    27
  311. X#define OTYPE_FACTORY    28
  312. X#define OTYPE_TERRA    29
  313. X#define OTYPE_TRANSDEV    30
  314. X#define STYPE_MISSILE    31
  315. X#define OTYPE_PLANDEF    32
  316. X#define OTYPE_QUARRY    33
  317. X#define OTYPE_PLOW    34
  318. X#define OTYPE_DOME        35
  319. X#define OTYPE_WPLANT    36
  320. X#define OTYPE_PORT    37
  321. X#define OTYPE_ABM    38
  322. X#define OTYPE_AFV    39
  323. X#define OTYPE_BUNKER    40
  324. X#define STYPE_LANDER    41
  325. X#define STYPE_SWEEPER   42
  326. X
  327. X#define ABIL_TECH     0
  328. X#define ABIL_CARGO    1
  329. X#define ABIL_HANGER    2
  330. X#define ABIL_DESTCAP     3
  331. X#define ABIL_GUNS     4
  332. X#define ABIL_PRIMARY    5
  333. X#define ABIL_SECONDARY    6
  334. X#define ABIL_FUELCAP     7
  335. X#define ABIL_MAXCREW     8
  336. X#define ABIL_ARMOR     9
  337. X#define ABIL_COST     10
  338. X#define ABIL_MOUNT    11
  339. X#define ABIL_JUMP    12
  340. X#define ABIL_CANLAND    13
  341. X#define ABIL_HASSWITCH    14
  342. X#define ABIL_SPEED    15
  343. X#define ABIL_DAMAGE    16
  344. X#define ABIL_BUILD    17
  345. X#define ABIL_CONSTRUCT    18
  346. X#define ABIL_MOD    19
  347. X#define ABIL_LASER    20
  348. X#define ABIL_CEW    21
  349. X#define ABIL_CLOAK    22
  350. X#define ABIL_GOD    23    /* only diety can build these objects */
  351. X#define ABIL_PROGRAMMED 24
  352. X#define ABIL_PORT    25
  353. X#define ABIL_REPAIR    26
  354. X#define ABIL_MAINTAIN    27
  355. X#define ABIL_CANDOCK    28  /* allows ship to be docked with another -jpd- */
  356. X
  357. X#define NUMSTYPES     (STYPE_SWEEPER+1)
  358. X#define NUMABILS     (ABIL_CANDOCK+1)
  359. X
  360. X#define SHIP_NAMESIZE    18
  361. X
  362. X
  363. X
  364. Xtypedef struct ship shiptype;
  365. Xtypedef struct place placetype;
  366. X
  367. X
  368. Xstruct ship {
  369. X    unsigned short number;    /* ship knows its own number */
  370. X    unsigned char owner;      /* owner of ship */
  371. X    unsigned char governor;     /* subordinate that controls the ship */
  372. X    char name[SHIP_NAMESIZE];        /* name of ship (optional) */
  373. X    char class[SHIP_NAMESIZE];        /* class of ship - designated by players */
  374. X
  375. X    unsigned char race;        /* race type - used when you gain alien
  376. X                   ships during revolts and whatnot - usually
  377. X                   equal to owner */
  378. X    double xpos;
  379. X    double ypos;
  380. X    double fuel;
  381. X    double mass;
  382. X    unsigned char land_x, land_y;
  383. X
  384. X    unsigned short destshipno;        /* destination ship # */
  385. X    unsigned short nextship;        /* next ship in linked list */
  386. X    unsigned short ships;        /* ships landed on it */
  387. X
  388. X    unsigned char armor;
  389. X    unsigned short size;
  390. X
  391. X    unsigned short max_crew;
  392. X    unsigned short max_resource;
  393. X    unsigned short max_destruct;
  394. X    unsigned short max_fuel;
  395. X    unsigned short max_speed;
  396. X    unsigned short build_type;    /* for factories - type of ship it makes */
  397. X    unsigned short build_cost;
  398. X
  399. X    double base_mass;
  400. X    double tech;        /* engineering technology rating */
  401. X    double complexity;    /* complexity rating */
  402. X    
  403. X    unsigned short destruct;         /* stuff it's carrying */
  404. X    unsigned short resource;
  405. X    unsigned short popn;            /* crew */
  406. X    unsigned short troops;            /* marines */
  407. X    unsigned short crystals;
  408. X
  409. X    /* special ship functions (10 bytes) */
  410. X    union {
  411. X        struct {        /* if the ship is a Space Mirror */
  412. X        unsigned short shipno;    /* aimed at what ship */
  413. X        unsigned char snum;        /* aimed at what star */
  414. X        char intensity;        /* intensity of aiming */
  415. X        unsigned char pnum;      /* aimed at what planet */
  416. X        unsigned char level;    /* aimed at what level */
  417. X        unsigned char dummy[4];     /* unused bytes */
  418. X    } aimed_at;
  419. X    struct {    /* spore pods */
  420. X        unsigned char decay;
  421. X        unsigned char temperature;
  422. X        unsigned char dummy[8];
  423. X    } pod;
  424. X    struct {    /* dust canisters, greenhouse gases */
  425. X        unsigned char count;
  426. X        unsigned char dummy[9];
  427. X    } timer;
  428. X    struct {    /* missiles */
  429. X        unsigned char x;
  430. X        unsigned char y;
  431. X        unsigned char scatter;
  432. X        unsigned char dummy[7];
  433. X    } impact;
  434. X    struct {    /* mines */
  435. X        unsigned short radius;
  436. X        unsigned char dummy[8];
  437. X    } trigger;
  438. X    struct {    /* terraformers */
  439. X        unsigned char index;
  440. X        unsigned char dummy[9];
  441. X    } terraform;
  442. X    struct {    /* AVPM */
  443. X        unsigned short target;
  444. X        unsigned char dummy[8];
  445. X    } transport;
  446. X    struct {    /* toxic waste containers */
  447. X        unsigned char toxic;
  448. X        unsigned char dummy[9];
  449. X    } waste;
  450. X    } special;
  451. X    
  452. X    short who_killed;    /* who killed the ship */
  453. X
  454. X    struct {
  455. X    unsigned on : 1;    /* toggles navigate mode */
  456. X    unsigned speed : 4; /* speed for navigate command */
  457. X    unsigned turns : 15;/* number turns left in maneuver */
  458. X    unsigned bearing : 9; /* course */
  459. X    unsigned dummy : 3;
  460. X    } navigate;
  461. X    
  462. X    struct {
  463. X    double maxrng;           /* maximum range for autoshoot */
  464. X    unsigned on     :  1; /* toggle on/off */
  465. X    unsigned planet  :  1; /* planet defender */
  466. X    unsigned self     :  1; /* retaliate if attacked */
  467. X    unsigned evade     :  1; /* evasive action */
  468. X    unsigned ship     : 14; /* ship it is protecting */
  469. X    unsigned dummy     :  6;
  470. X    } protect;
  471. X
  472. X
  473. X/* special systems */
  474. X    unsigned char mount;      /* has a crystal mount */
  475. X    struct {
  476. X    unsigned char charge;
  477. X    unsigned ready : 1;
  478. X    unsigned on : 1;
  479. X    unsigned has : 1;
  480. X    unsigned dummy : 5;
  481. X    } hyper_drive;
  482. X    unsigned char cew;              /* CEW strength */
  483. X    unsigned short cew_range;    /* CEW (confined-energy-weapon) range */
  484. X    unsigned char cloak;           /* has cloaking device */
  485. X    unsigned char laser;    /* has a laser */
  486. X    unsigned char focus;    /* focused laser mode */
  487. X    unsigned char fire_laser;    /* retaliation strength for lasers */
  488. X    
  489. X    unsigned char storbits;    /* what star # orbits */
  490. X    unsigned char deststar;    /* destination star */
  491. X    unsigned char destpnum;    /* destination planet */
  492. X    unsigned char pnumorbits;    /* # of planet if orbiting */
  493. X    unsigned char whatdest;    /* where going (same as Dir) */
  494. X    unsigned char whatorbits;    /* where orbited (same as Dir) */
  495. X
  496. X    unsigned char damage;    /* amt of damage */
  497. X    unsigned char rad;        /* radiation level */
  498. X    unsigned char retaliate;
  499. X    unsigned short target;
  500. X    
  501. X    unsigned char type;        /* what type ship is */
  502. X    unsigned char speed;           /* what speed to travel at 0-9 */
  503. X
  504. X    unsigned active: 1;               /* tells whether the ship is active */
  505. X    unsigned alive : 1;        /* ship is alive */
  506. X    unsigned mode : 1;
  507. X    unsigned bombard : 1;    /* bombard planet we're orbiting */
  508. X    unsigned mounted : 1;    /* has a crystal mounted */
  509. X    unsigned cloaked : 1;    /* is cloaked ship */
  510. X    unsigned sheep : 1;        /* is under influence of mind control */
  511. X    unsigned docked : 1;    /* is landed on a planet or docked */
  512. X    unsigned notified : 1;     /* has been notified of something */
  513. X    unsigned examined : 1;    /* has been examined */
  514. X    unsigned on : 1;        /* on or off */
  515. X    unsigned autoscrap : 1; /* Domes and quarries autoscrap when done */
  516. X    unsigned nodock : 1;    /* can be docked/loaded on another ship */
  517. X    unsigned dummy3 : 3;
  518. X
  519. X
  520. X    unsigned int threshload[TH_CRYSTALS+1]; /* autoload r, d, f, x */
  521. X
  522. X    unsigned char merchant;    /* this contains the route number */
  523. X    unsigned char guns;        /* current gun system which is active */
  524. X    unsigned char primary;    /* describe primary gun system */
  525. X    unsigned char primtype;
  526. X    unsigned char secondary;    /* describe secondary guns */
  527. X    unsigned char sectype;
  528. X
  529. X    unsigned short hanger;    /* amount of hanger space used */
  530. X    unsigned short max_hanger;  /* total hanger space */
  531. X};
  532. X
  533. Xstruct place {        /* used in function return for finding place */
  534. X    unsigned char snum;
  535. X    unsigned char pnum;
  536. X    unsigned short shipno;
  537. X    shiptype *shipptr;
  538. X    unsigned char level;    /* .level: same as Dir */
  539. X    unsigned char err;        /* if error */
  540. X};
  541. X
  542. X
  543. X /* can takeoff & land, is mobile, etc. */
  544. X#define speed_rating(s) ((s)->max_speed)
  545. X
  546. X /* has an on/off switch */
  547. X#define has_switch(s) (Shipdata[(s)->type][ABIL_HASSWITCH])
  548. X
  549. X /* can bombard planets */
  550. X#define can_bombard(s) \
  551. X    (Shipdata[(s)->type][ABIL_GUNS] && ((s)->type != STYPE_MINE))
  552. X
  553. X/* can navigate */
  554. X#define can_navigate(s) (Shipdata[(s)->type][ABIL_SPEED] > 0 && (s)->type != OTYPE_TERRA)
  555. X
  556. X /* can aim at things. */
  557. X#define can_aim(s) ((s)->type>=STYPE_MIRROR && (s)->type<=OTYPE_TRACT)
  558. X
  559. X/* macros to get ship stats */
  560. X#define Armor(s) ( ((s)->type==OTYPE_FACTORY) ? Shipdata[(s)->type][ABIL_ARMOR] : (s)->armor*(100-(s)->damage)/100)
  561. X#define Guns(s) ( ((s)->guns==NONE) ? 0 : ((s)->guns==PRIMARY ? (s)->primary : (s)->secondary))
  562. X#define Max_crew(s) ( ((s)->type==OTYPE_FACTORY) ? Shipdata[(s)->type][ABIL_MAXCREW] - (s)->troops : (s)->max_crew - (s)->troops)
  563. X#define Max_mil(s) ( ((s)->type==OTYPE_FACTORY) ? Shipdata[(s)->type][ABIL_MAXCREW] - (s)->popn : (s)->max_crew - (s)->popn)
  564. X#define Max_resource(s) ( ((s)->type==OTYPE_FACTORY) ? Shipdata[(s)->type][ABIL_CARGO] : (s)->max_resource)
  565. X#define Max_crystals(s) (127)
  566. X#define Max_fuel(s) ( ((s)->type==OTYPE_FACTORY) ? Shipdata[(s)->type][ABIL_FUELCAP] : (s)->max_fuel)
  567. X#define Max_destruct(s) ( ((s)->type==OTYPE_FACTORY) ? Shipdata[(s)->type][ABIL_DESTCAP] : (s)->max_destruct)
  568. X#define Max_speed(s) ( ((s)->type==OTYPE_FACTORY) ? Shipdata[(s)->type][ABIL_SPEED] : (s)->max_speed)
  569. X#define Cost(s) ( ((s)->type==OTYPE_FACTORY) ? 2*(s)->build_cost*(s)->on + Shipdata[(s)->type][ABIL_COST ] : (s)->build_cost)
  570. X#define Mass(s) ((s)->mass)
  571. X#define Sight(s) ( ((s)->type==OTYPE_PROBE) || (s)->popn)
  572. X#define Retaliate(s) ( (s)->retaliate)
  573. X#define Size(s) ((s)->size)
  574. X#define Body(s) ((s)->size-(s)->max_hanger)
  575. X#define Hanger(s) ((s)->max_hanger - (s)->hanger)
  576. X#define Repair(s) ( ((s)->type==OTYPE_FACTORY) ? (s)->on : Max_crew(s))
  577. X
  578. Xextern long Shipdata[NUMSTYPES][NUMABILS];
  579. Xextern char Shipltrs[];
  580. Xextern char *Shipnames[];
  581. X
  582. XEXTERN shiptype **ships;
  583. X
  584. X
  585. END_OF_FILE
  586. if test 10183 -ne `wc -c <'hdrs/ships.h'`; then
  587.     echo shar: \"'hdrs/ships.h'\" unpacked with wrong size!
  588. fi
  589. # end of 'hdrs/ships.h'
  590. fi
  591. if test -f 'hdrs/vars.h' -a "${1}" != "-c" ; then 
  592.   echo shar: Will not clobber existing file \"'hdrs/vars.h'\"
  593. else
  594. echo shar: Extracting \"'hdrs/vars.h'\" \(10522 characters\)
  595. sed "s/^X//" >'hdrs/vars.h' <<'END_OF_FILE'
  596. X#ident  "@(#)vars.h    1.4 1/6/93 "
  597. X/*
  598. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, 
  599. X * smq@ucscb.ucsc.edu, mods by people in GB.c, enroll.dat.
  600. X * Restrictions in GB.c.
  601. X * vars.h --
  602. X *  main bunch of variables 
  603. X */
  604. X
  605. X#include "files.h"
  606. X#include "tweakables.h"
  607. X#include "config.h"
  608. X#include <sys/types.h>
  609. X#include <sys/file.h>
  610. X#include <stdio.h>
  611. X
  612. Xunsigned long segments;    /* number of movement segments (global variable) */
  613. X#define MAX_ROUTES 4    /* Shipping routes - DON'T change this */
  614. X                        /* unless you know what you are doing */
  615. X
  616. X#define TH_RESOURCE 0   /* THRESHLOADING STUFF */
  617. X#define TH_DESTRUCT 1
  618. X#define TH_FUEL 2
  619. X#define TH_CRYSTALS 3
  620. X
  621. X
  622. X#define LEVEL_UNIV 0
  623. X#define LEVEL_STAR 1
  624. X#define LEVEL_PLAN 2
  625. X#define LEVEL_SHIP 3
  626. X
  627. X#define MAXPLAYERS 64
  628. X#define MAXSTRLEN 2047
  629. X#define HUGESTRLEN (2*MAXSTRLEN+1)
  630. X#define SMALLSTR 31
  631. X
  632. X#define ANN        0
  633. X#define BROADCAST    1
  634. X#define SHOUT        2
  635. X#define THINK        3
  636. X
  637. X#define COMM_CHANNEL1     1
  638. X#define COMM_CHANNEL2     2
  639. X#define COMM_CHANNEL3     3
  640. X
  641. X#define DEFAULT_CHANNEL_MASK 10
  642. X#define COMM_DEF_CHANNEL1     11
  643. X#define COMM_DEF_CHANNEL2     12
  644. X#define COMM_DEF_CHANNEL3     13
  645. X
  646. X/* Used for the log() function.  Determine if we look at errno
  647. X * or just use the default errno which is "log"
  648. X */
  649. X#define NOERRNO        0  
  650. X#define WANTERRNO   1
  651. X
  652. X#define ERRORLOG    0
  653. X#define USERLOG     1
  654. X#define UPDATELOG   2
  655. X
  656. X#define UPDATE_START     1
  657. X#define UPDATE_END         2
  658. X#define SEGMENT_START    3
  659. X#define SEGMENT_END     4
  660. X#define RESET_START        5
  661. X#define RESET_END          6
  662. X
  663. X
  664. Xtypedef char hugestr[HUGESTRLEN];
  665. X
  666. Xlong random();
  667. X
  668. Xtypedef struct sector sectortype;
  669. Xtypedef struct planet planettype;
  670. Xtypedef struct star startype;
  671. Xtypedef struct commod commodtype;
  672. X
  673. Xstruct plinfo {                /* planetary stockpiles */
  674. X      unsigned short fuel;        /* fuel for powering things */
  675. X      unsigned short destruct;       /* destructive potential */
  676. X      unsigned short resource;        /* resources in storage */
  677. X      unsigned long popn;
  678. X      unsigned long troops;
  679. X      unsigned short crystals;
  680. X
  681. X      unsigned short prod_res;    /* shows last update production */
  682. X      unsigned short prod_fuel;
  683. X      unsigned short prod_dest;
  684. X      unsigned short prod_crystals;
  685. X      unsigned long prod_money;
  686. X      double prod_tech;
  687. X
  688. X      unsigned short tech_invest;
  689. X      unsigned short numsectsowned;
  690. X
  691. X      unsigned char comread;        /* combat readiness (mobilization)*/
  692. X      unsigned char mob_set;        /* mobilization target */
  693. X      unsigned char tox_thresh;        /* min to build a waste can */
  694. X
  695. X      unsigned char explored;
  696. X      unsigned char autorep;
  697. X      unsigned char tax;    /* tax rate */
  698. X      unsigned char newtax;    /* new tax rate (after update) */
  699. X      unsigned char guns;    /* number of planet guns (mob/5) */
  700. X
  701. X      /* merchant shipping parameters */
  702. X      struct {
  703. X      unsigned char set;    /* does the planet have orders? */
  704. X      unsigned char dest_star;    /* star that ship has to go to next */
  705. X      unsigned char dest_planet;    /* planet destination */
  706. X      unsigned char load;    /* bit-field commodities to be loaded there */
  707. X      unsigned char unload;    /* unloaded commodities */
  708. X      unsigned char x,y;    /* location that ship has to land on */
  709. X      } route[MAX_ROUTES];  /* i am allowing up to four routes per planet */
  710. X
  711. X      unsigned long mob_points;
  712. X      double est_production;    /* estimated production */
  713. X      unsigned long dummy[3];
  714. X};
  715. X
  716. X#define M_FUEL        0x1
  717. X#define M_DESTRUCT     0x2
  718. X#define M_RESOURCES    0x4
  719. X#define M_CRYSTALS    0x8
  720. X#define Fuel(x)        ((x) & M_FUEL)
  721. X#define Destruct(x)    ((x) & M_DESTRUCT)
  722. X#define Resources(x)    ((x) & M_RESOURCES)
  723. X#define Crystals(x)    ((x) & M_CRYSTALS)
  724. X
  725. Xstruct commod {
  726. X    char owner;
  727. X    char governor;
  728. X    char type;
  729. X    unsigned short amount;
  730. X    unsigned char dummy;
  731. X    unsigned char deliver; /* whether the lot is ready for shipping or not */
  732. X    unsigned long bid;
  733. X    unsigned char bidder;
  734. X    unsigned char bidder_gov;
  735. X    unsigned char star_from;    /* where the stuff originated from */
  736. X    unsigned char planet_from;
  737. X    unsigned char star_to;    /* where it goes to */
  738. X    unsigned char planet_to;
  739. X};
  740. X
  741. Xstruct sector {
  742. X    unsigned char eff;        /* efficiency (0-100) */
  743. X    unsigned char fert;        /* max popn is proportional to this */
  744. X    unsigned char mobilization;    /* percent popn is mobilized for war */
  745. X    unsigned char crystals;
  746. X    unsigned short resource;
  747. X    
  748. X    unsigned short popn;
  749. X    unsigned short troops;    /* troops (additional combat value) */
  750. X
  751. X    unsigned char owner;    /* owner of place */
  752. X    unsigned char race;        /* race type occupying sector
  753. X                   (usually==owner) - makes things more
  754. X                   realistic when alien races revolt and
  755. X                   you gain control of them! */
  756. X    unsigned char type;        /* underlying sector geology */
  757. X    unsigned char condition;    /* environmental effects */
  758. X    unsigned long dummy2;
  759. X};
  760. X
  761. X
  762. Xstruct planet {
  763. X    int sectormappos;        /* file posn for sector map */
  764. X
  765. X    double xpos, ypos;        /* x,y relative to orbit */
  766. X    unsigned short ships;       /* first ship in orbit (to be changed) */
  767. X    unsigned char Maxx, Maxy;        /* size of map */
  768. X
  769. X    struct plinfo info[MAXPLAYERS];     /* player info */
  770. X    short conditions[TOXIC+1];  /* atmospheric conditions for terraforming */
  771. X
  772. X    unsigned long popn;
  773. X    unsigned long troops;
  774. X    unsigned long maxpopn;            /* maximum population */
  775. X    unsigned long total_resources;
  776. X    
  777. X    unsigned char slaved_to;
  778. X    unsigned char type;        /* what type planet is */
  779. X    unsigned char expltimer;    /* timer for explorations */
  780. X
  781. X    unsigned char explored;
  782. X
  783. X    unsigned long dummy[2];
  784. X};
  785. X
  786. Xstruct star {
  787. X    unsigned short ships;    /* 1st ship in orbit */
  788. X    char name[NAMESIZE];    /* name of star */
  789. X    char governor[MAXPLAYERS];    /* which subordinate maintains the system */
  790. X    unsigned char AP[MAXPLAYERS];    /* action pts alotted */
  791. X    unsigned long explored[2];     /* who's been here 64 bits*/
  792. X    unsigned long inhabited[2];    /* who lives here now 64 bits*/
  793. X    double xpos,ypos;
  794. X
  795. X    unsigned char numplanets;        /* # of planets in star system */
  796. X    char pnames[MAXPLANETS][NAMESIZE];     /* names of planets */
  797. X    unsigned long planetpos[MAXPLANETS];/* file posns of planets */
  798. X
  799. X    unsigned char stability;    /* how close to nova it is */
  800. X    unsigned char nova_stage;    /* stage of nova */
  801. X    unsigned char temperature;  /* factor which expresses how hot the star is*/
  802. X    double gravity;        /* attraction of star in "Standards". */
  803. X
  804. X    long dummy[2];        /* dummy bits for development */
  805. X};
  806. X
  807. X
  808. X
  809. X    /* this data will all be read at once */
  810. Xstruct stardata {
  811. X    unsigned short numstars;        /* # of stars */
  812. X    unsigned short ships;        /* 1st ship in orbit */
  813. X    unsigned char  AP[MAXPLAYERS];    /* Action pts for each player */
  814. X    unsigned long dummy[2];
  815. X};
  816. X
  817. XEXTERN struct stardata Sdata;
  818. X
  819. Xstruct directory {
  820. X    unsigned char level;    /* what directory level */
  821. X    unsigned char snum;        /* what star system obj # (level=0) */
  822. X    unsigned char pnum;        /* number of planet */
  823. X    unsigned short shipno;    /* # of ship */
  824. X    char prompt[3*NAMESIZE+5];    /* just to be safe */
  825. X    double lastx[2], lasty[2], zoom[2];    /* last coords for zoom */
  826. X};
  827. X
  828. Xstruct vic {
  829. X  unsigned char racenum;
  830. X  char   name[RNAMESIZE];
  831. X  unsigned long no_count;
  832. X  char    sleep;
  833. X  double tech;
  834. X  int Thing;
  835. X  int IQ;
  836. X  long rawscore;
  837. X  long login;
  838. X};
  839. X
  840. Xstruct text_block {
  841. X    int      nchars;
  842. X    struct text_block  *nxt;
  843. X    char      *start;
  844. X    char      *buf;
  845. X};
  846. X
  847. Xstruct text_queue {
  848. X    struct text_block *head;
  849. X    struct text_block **tail;
  850. X};
  851. X
  852. X
  853. Xstruct descriptor_data {
  854. X    int descriptor;
  855. X    int connected;
  856. X    int God;        /* deity status */
  857. X    int Playernum;  /* race */
  858. X    int Governor;       /* governor/subcommander */
  859. X    char *output_prefix;
  860. X    char *output_suffix;
  861. X    int output_size;
  862. X    struct text_queue output;
  863. X    struct text_queue input;
  864. X    char *raw_input;
  865. X    char *raw_input_at;
  866. X    long last_time;
  867. X    int quota;
  868. X    struct descriptor_data *next;
  869. X    struct descriptor_data **prev;
  870. X};
  871. X
  872. Xstruct descriptor_data *descriptor_list;
  873. X
  874. X
  875. X
  876. XEXTERN struct directory Dir[MAXPLAYERS][MAXGOVERNORS+1];
  877. X
  878. XEXTERN sectortype Smap[(MAX_X+1)*(MAX_Y+1) + 1];
  879. X
  880. Xextern char *malloc();
  881. X
  882. XEXTERN unsigned char Nuked[MAXPLAYERS];
  883. XEXTERN unsigned long StarsInhab[NUMSTARS];
  884. XEXTERN unsigned long StarsExpl[NUMSTARS];
  885. XEXTERN startype *Stars[NUMSTARS];
  886. XEXTERN unsigned short Sdatanumships[MAXPLAYERS];
  887. XEXTERN unsigned long Sdatapopns[MAXPLAYERS];
  888. XEXTERN unsigned short starnumships[NUMSTARS][MAXPLAYERS];
  889. XEXTERN unsigned long starpopns[NUMSTARS][MAXPLAYERS];
  890. X
  891. XEXTERN unsigned long tot_resdep, prod_eff, prod_res[MAXPLAYERS];
  892. XEXTERN unsigned long prod_fuel[MAXPLAYERS], prod_destruct[MAXPLAYERS];
  893. XEXTERN unsigned long prod_crystals[MAXPLAYERS], prod_money[MAXPLAYERS];
  894. XEXTERN unsigned long tot_captured, prod_mob;
  895. XEXTERN unsigned long avg_mob[MAXPLAYERS];
  896. XEXTERN unsigned char sects_gained[MAXPLAYERS], sects_lost[MAXPLAYERS];
  897. XEXTERN unsigned char Claims;
  898. XEXTERN unsigned char adr;
  899. XEXTERN char junk[2][256];
  900. X
  901. XEXTERN planettype *planets[NUMSTARS][MAXPLANETS];
  902. XEXTERN unsigned char ground_assaults[MAXPLAYERS][MAXPLAYERS][NUMSTARS];
  903. XEXTERN unsigned long inhabited[NUMSTARS][2];
  904. XEXTERN double Compat[MAXPLAYERS];
  905. XEXTERN unsigned long Num_races, Num_ships, Num_commods;
  906. XEXTERN unsigned long Planet_count;
  907. XEXTERN unsigned long newslength[4];
  908. XEXTERN char args[MAXARGS][COMMANDSIZE];
  909. XEXTERN int argn;
  910. X
  911. XEXTERN long    next_update_time;   /* When will next update be... approximately */
  912. XEXTERN long    next_segment_time;  /* When will next segment be... approximately */
  913. XEXTERN long    last_update_time;
  914. XEXTERN long    last_segment_time;
  915. XEXTERN int     update_time;        /* Interval between updates */
  916. X
  917. XEXTERN int nsegments_done;     /* How many movements have we done so far? */
  918. XEXTERN int nupdates_done;          /* number of updates so far */
  919. X
  920. XEXTERN long clk;
  921. X
  922. X
  923. X
  924. X/* bit routines stolen from UNIX <sys/param.h> */
  925. X#define setbit(a, i)    ((a)[(i)/32] |= ((i)<32 ? 1<<(i) : 1<<(i)-32))
  926. X#define clrbit(a, i)    ((a)[(i)/32] &= ~((i)<32 ? 1<<(i) : 1<<(i)-32))
  927. X#define isset(a, i)    ((a)[(i)/32] & ((i)<32 ? 1<<(i) : 1<<(i)-32))
  928. X#define isclr(a, i)    (!isset((a), (i)))
  929. X
  930. X#ifdef DEBUG        /* for debugging option */
  931. X#define malloc(s)    DEBUGmalloc(s, __FILE__, __LINE__)
  932. X#define free(s)        DEBUGfree(s)
  933. X#define realloc(p,s)    DEBUGrealloc(p, s, __FILE__, __LINE__)
  934. X
  935. X#define getrace(a,b,c)    DEBUGgetrace(a,b,c,__FILE__,__LINE__)
  936. X#define getstar(a,b,c)    DEBUGgetstar(a,b,c,__FILE__,__LINE__)
  937. X#define getplanet(a,b,c)    DEBUGgetplanet(a,b,c,__FILE__,__LINE__)
  938. X#define getship(a,b,c)    DEBUGgetship(a,b,c,__FILE__,__LINE__)
  939. X#define getcommod(a,b,c)    DEBUGgetcommod(a,b,c,__FILE__,__LINE__)
  940. X#endif
  941. X
  942. X#define success(x) (int_rand(1,100) <= (x))
  943. END_OF_FILE
  944. if test 10522 -ne `wc -c <'hdrs/vars.h'`; then
  945.     echo shar: \"'hdrs/vars.h'\" unpacked with wrong size!
  946. fi
  947. # end of 'hdrs/vars.h'
  948. fi
  949. if test -f 'user/cs.c' -a "${1}" != "-c" ; then 
  950.   echo shar: Will not clobber existing file \"'user/cs.c'\"
  951. else
  952. echo shar: Extracting \"'user/cs.c'\" \(9593 characters\)
  953. sed "s/^X//" >'user/cs.c' <<'END_OF_FILE'
  954. X/*
  955. X * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky,
  956. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. Restrictions in
  957. X * GB_copyright.h. cs.c -- change scope (directory)
  958. X */
  959. X
  960. X#include "GB_copyright.h"
  961. X#define EXTERN extern
  962. X#include "vars.h"
  963. X#include "ships.h"
  964. X#include "races.h"
  965. X#include "power.h"
  966. X#include "buffers.h"
  967. X
  968. Xvoid            center(int, int, int);
  969. Xvoid            do_prompt(int, int);
  970. Xvoid            cs(int, int, int);
  971. X#include "proto.h"
  972. X
  973. Xvoid 
  974. Xcenter(int Playernum, int Governor, int APcount)
  975. X{
  976. X    placetype       where;
  977. X
  978. X    where = Getplace(Playernum, Governor, args[1], 1);
  979. X
  980. X    if (where.err) {
  981. X        sprintf(buf, "cs: bad scope.\n");
  982. X        notify(Playernum, Governor, buf);
  983. X        return;
  984. X    } else if (where.level == LEVEL_SHIP) {
  985. X        notify(Playernum, Governor, "CHEATER!!!\n");
  986. X        return;
  987. X    }
  988. X    Dir[Playernum - 1][Governor].lastx[1] = Stars[where.snum]->xpos;
  989. X    Dir[Playernum - 1][Governor].lasty[1] = Stars[where.snum]->ypos;
  990. X}
  991. X
  992. Xvoid 
  993. Xdo_prompt(int Playernum, int Governor)
  994. X{
  995. X    shiptype       *s, *s2;
  996. X
  997. X    if (Dir[Playernum - 1][Governor].level == LEVEL_UNIV) {
  998. X        sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] / )\n", Sdata.AP[Playernum - 1]);
  999. X    } else if (Dir[Playernum - 1][Governor].level == LEVEL_STAR) {
  1000. X        sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /%s )\n",
  1001. X        Stars[Dir[Playernum - 1][Governor].snum]->AP[Playernum - 1],
  1002. X            Stars[Dir[Playernum - 1][Governor].snum]->name);
  1003. X    } else if (Dir[Playernum - 1][Governor].level == LEVEL_PLAN) {
  1004. X        sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /%s/%s )\n",
  1005. X        Stars[Dir[Playernum - 1][Governor].snum]->AP[Playernum - 1],
  1006. X            Stars[Dir[Playernum - 1][Governor].snum]->name,
  1007. X            Stars[Dir[Playernum - 1][Governor].snum]->pnames[Dir[Playernum - 1][Governor].pnum]);
  1008. X    } else if (Dir[Playernum - 1][Governor].level == LEVEL_SHIP) {
  1009. X        (void) getship(&s, Dir[Playernum - 1][Governor].shipno);
  1010. X        switch (s->whatorbits) {
  1011. X        case LEVEL_UNIV:
  1012. X            sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /#%d )\n",
  1013. X                Sdata.AP[Playernum - 1], Dir[Playernum - 1][Governor].shipno);
  1014. X            break;
  1015. X        case LEVEL_STAR:
  1016. X            sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /%s/#%d )\n",
  1017. X                Stars[s->storbits]->AP[Playernum - 1],
  1018. X                Stars[s->storbits]->name,
  1019. X                Dir[Playernum - 1][Governor].shipno);
  1020. X            break;
  1021. X        case LEVEL_PLAN:
  1022. X            sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /%s/%s/#%d )\n",
  1023. X                Stars[s->storbits]->AP[Playernum - 1],
  1024. X                Stars[s->storbits]->name,
  1025. X                Stars[s->storbits]->pnames[Dir[Playernum - 1][Governor].pnum],
  1026. X                Dir[Playernum - 1][Governor].shipno);
  1027. X            break;
  1028. X            /*
  1029. X             * I put this mess in because of non-functioning
  1030. X             * prompts when you are in a ship within a ship, or
  1031. X             * deeper. I am certain this can be done more
  1032. X             * elegantly (a lot more) but I don't feel like
  1033. X             * trying that right now. right now I want it to
  1034. X             * function. Maarten
  1035. X             */
  1036. X        case LEVEL_SHIP:
  1037. X            (void) getship(&s2, (int) s->destshipno);
  1038. X            switch (s2->whatorbits) {
  1039. X            case LEVEL_UNIV:
  1040. X                sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /#%d/#%d )\n",
  1041. X                    Sdata.AP[Playernum - 1], s->destshipno, Dir[Playernum - 1][Governor].shipno);
  1042. X                break;
  1043. X            case LEVEL_STAR:
  1044. X                sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /%s/#%d/#%d )\n",
  1045. X                      Stars[s->storbits]->AP[Playernum - 1],
  1046. X                    Stars[s->storbits]->name,
  1047. X                    s->destshipno,
  1048. X                    Dir[Playernum - 1][Governor].shipno);
  1049. X                break;
  1050. X            case LEVEL_PLAN:
  1051. X                sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /%s/%s/#%d/#%d )\n",
  1052. X                      Stars[s->storbits]->AP[Playernum - 1],
  1053. X                    Stars[s->storbits]->name,
  1054. X                    Stars[s->storbits]->pnames[Dir[Playernum - 1][Governor].pnum],
  1055. X                    s->destshipno,
  1056. X                    Dir[Playernum - 1][Governor].shipno);
  1057. X                break;
  1058. X            case LEVEL_SHIP:
  1059. X                while (s2->whatorbits == LEVEL_SHIP) {
  1060. X                    free(s2);
  1061. X                    (void) getship(&s2, (int) s2->destshipno);
  1062. X                }
  1063. X                switch (s2->whatorbits) {
  1064. X                case LEVEL_UNIV:
  1065. X                    sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] / /../#%d/#%d )\n",
  1066. X                        Sdata.AP[Playernum - 1], s->destshipno, Dir[Playernum - 1][Governor].shipno);
  1067. X                    break;
  1068. X                case LEVEL_STAR:
  1069. X                    sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /%s/ /../#%d/#%d )\n",
  1070. X                        Stars[s->storbits]->AP[Playernum - 1],
  1071. X                        Stars[s->storbits]->name,
  1072. X                        s->destshipno,
  1073. X                    Dir[Playernum - 1][Governor].shipno);
  1074. X                    break;
  1075. X                case LEVEL_PLAN:
  1076. X                    sprintf(Dir[Playernum - 1][Governor].prompt, " ( [%d] /%s/%s/ /../#%d/#%d )\n",
  1077. X                        Stars[s->storbits]->AP[Playernum - 1],
  1078. X                        Stars[s->storbits]->name,
  1079. X                        Stars[s->storbits]->pnames[Dir[Playernum - 1][Governor].pnum],
  1080. X                        s->destshipno,
  1081. X                    Dir[Playernum - 1][Governor].shipno);
  1082. X                    break;
  1083. X                default:
  1084. X                    break;
  1085. X                }
  1086. X                free(s2);
  1087. X                break;
  1088. X            default:
  1089. X                break;
  1090. X            }
  1091. X        }
  1092. X        free(s);
  1093. X    }
  1094. X}
  1095. X
  1096. Xvoid 
  1097. Xcs(int Playernum, int Governor, int APcount)
  1098. X{
  1099. X    placetype       where;
  1100. X    planettype     *planet;
  1101. X    shiptype       *s;
  1102. X    racetype       *Race;
  1103. X
  1104. X    Race = races[Playernum - 1];
  1105. X
  1106. X    if (argn == 1) {
  1107. X        /* chdir to def scope */
  1108. X        Dir[Playernum - 1][Governor].level = Race->governor[Governor].deflevel;
  1109. X        if ((Dir[Playernum - 1][Governor].snum = Race->governor[Governor].defsystem)
  1110. X            >= Sdata.numstars)
  1111. X            Dir[Playernum - 1][Governor].snum = Sdata.numstars - 1;
  1112. X        if ((Dir[Playernum - 1][Governor].pnum = Race->governor[Governor].defplanetnum) >= Stars[Dir[Playernum - 1][Governor].snum]->numplanets)
  1113. X            Dir[Playernum - 1][Governor].pnum = Stars[Dir[Playernum - 1][Governor].snum]->numplanets - 1;
  1114. X        Dir[Playernum - 1][Governor].shipno = 0;
  1115. X        Dir[Playernum - 1][Governor].lastx[0] = Dir[Playernum - 1][Governor].lasty[0] = 0.0;
  1116. X        Dir[Playernum - 1][Governor].lastx[1] = Stars[Dir[Playernum - 1][Governor].snum]->xpos;
  1117. X        Dir[Playernum - 1][Governor].lasty[1] = Stars[Dir[Playernum - 1][Governor].snum]->ypos;
  1118. X        return;
  1119. X    } else if (argn == 2) {
  1120. X        /* chdir to specified scope */
  1121. X
  1122. X        where = Getplace(Playernum, Governor, args[1], 0);
  1123. X
  1124. X        if (where.err) {
  1125. X            sprintf(buf, "cs: bad scope.\n");
  1126. X            notify(Playernum, Governor, buf);
  1127. X            Dir[Playernum - 1][Governor].lastx[0] = Dir[Playernum - 1][Governor].lasty[0] = 0.0;
  1128. X            return;
  1129. X        }
  1130. X        /* fix lastx, lasty coordinates */
  1131. X
  1132. X        switch (Dir[Playernum - 1][Governor].level) {
  1133. X        case LEVEL_UNIV:
  1134. X            Dir[Playernum - 1][Governor].lastx[0] = Dir[Playernum - 1][Governor].lasty[0] = 0.0;
  1135. X            break;
  1136. X        case LEVEL_STAR:
  1137. X            if (where.level == LEVEL_UNIV) {
  1138. X                Dir[Playernum - 1][Governor].lastx[1] = Stars[Dir[Playernum - 1][Governor].snum]->xpos;
  1139. X                Dir[Playernum - 1][Governor].lasty[1] = Stars[Dir[Playernum - 1][Governor].snum]->ypos;
  1140. X            } else
  1141. X                Dir[Playernum - 1][Governor].lastx[0] = Dir[Playernum - 1][Governor].lasty[0] = 0.0;
  1142. X            break;
  1143. X        case LEVEL_PLAN:
  1144. X            getplanet(&planet, Dir[Playernum - 1][Governor].snum, Dir[Playernum - 1][Governor].pnum);
  1145. X            if (where.level == LEVEL_STAR && where.snum == Dir[Playernum - 1][Governor].snum) {
  1146. X                Dir[Playernum - 1][Governor].lastx[0] = planet->xpos;
  1147. X                Dir[Playernum - 1][Governor].lasty[0] = planet->ypos;
  1148. X            } else if (where.level == LEVEL_UNIV) {
  1149. X                Dir[Playernum - 1][Governor].lastx[1] = Stars[Dir[Playernum - 1][Governor].snum]->xpos + planet->xpos;
  1150. X                Dir[Playernum - 1][Governor].lasty[1] = Stars[Dir[Playernum - 1][Governor].snum]->ypos + planet->ypos;
  1151. X            } else
  1152. X                Dir[Playernum - 1][Governor].lastx[0] = Dir[Playernum - 1][Governor].lasty[0] = 0.0;
  1153. X            free(planet);
  1154. X            break;
  1155. X        case LEVEL_SHIP:
  1156. X            (void) getship(&s, Dir[Playernum - 1][Governor].shipno);
  1157. X            if (!s->docked) {
  1158. X                switch (where.level) {
  1159. X                case LEVEL_UNIV:
  1160. X                    Dir[Playernum - 1][Governor].lastx[1] = s->xpos;
  1161. X                    Dir[Playernum - 1][Governor].lasty[1] = s->ypos;
  1162. X                    break;
  1163. X                case LEVEL_STAR:
  1164. X                    if (s->whatorbits >= LEVEL_STAR && s->storbits == where.snum) {
  1165. X                        /*
  1166. X                         * we are going UP from the
  1167. X                         * ship.. change last
  1168. X                         */
  1169. X                        Dir[Playernum - 1][Governor].lastx[0] = s->xpos - Stars[s->storbits]->xpos;
  1170. X                        Dir[Playernum - 1][Governor].lasty[0] = s->ypos - Stars[s->storbits]->ypos;
  1171. X                    } else
  1172. X                        Dir[Playernum - 1][Governor].lastx[0] = Dir[Playernum - 1][Governor].lasty[0] = 0.0;
  1173. X                    break;
  1174. X                case LEVEL_PLAN:
  1175. X                    if (s->whatorbits == LEVEL_PLAN && s->storbits == where.snum
  1176. X                        && s->pnumorbits == where.pnum) {
  1177. X                        /* same */
  1178. X                        getplanet(&planet, (int) s->storbits, (int) s->pnumorbits);
  1179. X                        Dir[Playernum - 1][Governor].lastx[0] = s->xpos - Stars[s->storbits]->xpos - planet->xpos;
  1180. X                        Dir[Playernum - 1][Governor].lasty[0] = s->ypos - Stars[s->storbits]->ypos - planet->ypos;
  1181. X                        free(planet);
  1182. X                    } else
  1183. X                        Dir[Playernum - 1][Governor].lastx[0] = Dir[Playernum - 1][Governor].lasty[0] = 0.0;
  1184. X                    break;
  1185. X                case LEVEL_SHIP:
  1186. X                    Dir[Playernum - 1][Governor].lastx[0] = Dir[Playernum - 1][Governor].lasty[0] = 0.0;
  1187. X                    break;
  1188. X                default:
  1189. X                    break;
  1190. X                }
  1191. X            } else
  1192. X                Dir[Playernum - 1][Governor].lastx[0] = Dir[Playernum - 1][Governor].lasty[0] = 0.0;
  1193. X            free(s);
  1194. X            break;
  1195. X        default:
  1196. X            break;
  1197. X        }
  1198. X        Dir[Playernum - 1][Governor].level = where.level;
  1199. X        Dir[Playernum - 1][Governor].snum = where.snum;
  1200. X        Dir[Playernum - 1][Governor].pnum = where.pnum;
  1201. X        Dir[Playernum - 1][Governor].shipno = where.shipno;
  1202. X    } else if (argn == 3 && args[1][1] == 'd') {
  1203. X        /* make new def scope */
  1204. X        where = Getplace(Playernum, Governor, args[2], 0);
  1205. X
  1206. X        if (!where.err && where.level != LEVEL_SHIP) {
  1207. X            Race->governor[Governor].deflevel = where.level;
  1208. X            Race->governor[Governor].defsystem = where.snum;
  1209. X            Race->governor[Governor].defplanetnum = where.pnum;
  1210. X            putrace(Race);
  1211. X
  1212. X            sprintf(buf, "New home system is %s\n", Dispplace(Playernum, Governor, &where));
  1213. X        } else {
  1214. X            sprintf(buf, "cs: bad home system.\n");
  1215. X        }
  1216. X    }
  1217. X}
  1218. END_OF_FILE
  1219. if test 9593 -ne `wc -c <'user/cs.c'`; then
  1220.     echo shar: \"'user/cs.c'\" unpacked with wrong size!
  1221. fi
  1222. # end of 'user/cs.c'
  1223. fi
  1224. if test -f 'user/declare.c' -a "${1}" != "-c" ; then 
  1225.   echo shar: Will not clobber existing file \"'user/declare.c'\"
  1226. else
  1227. echo shar: Extracting \"'user/declare.c'\" \(9628 characters\)
  1228. sed "s/^X//" >'user/declare.c' <<'END_OF_FILE'
  1229. X/*
  1230. X * * Galactic Bloodshed, copyright (c) 1989 by Robert P. Chansky, *
  1231. X * smq@ucscb.ucsc.edu, mods by people in GB_copyright.h. * Restrictions in
  1232. X * GB_copyright.h. * declare.c -- declare alliance, neutrality, war, the
  1233. X * basic thing.
  1234. X */
  1235. X
  1236. X#include "GB_copyright.h"
  1237. X#define EXTERN extern
  1238. X#include "vars.h"
  1239. X#include "ships.h"
  1240. X#include "races.h"
  1241. X#include "power.h"
  1242. X#include "buffers.h"
  1243. X#include <signal.h>
  1244. X#include <ctype.h>
  1245. X
  1246. Xvoid            invite(int, int, int, int);
  1247. Xvoid            declare(int, int, int);
  1248. Xvoid            vote(int, int, int);
  1249. Xvoid            show_votes(int, int);
  1250. Xvoid            pledge(int, int, int, int);
  1251. X
  1252. X#include "proto.h"
  1253. X
  1254. X/* invite people to join your alliance block */
  1255. Xvoid 
  1256. Xinvite(int Playernum, int Governor, int APcount, int mode)
  1257. X{
  1258. X    int             n;
  1259. X    racetype       *Race, *alien;
  1260. X
  1261. X    if (Governor) {
  1262. X        notify(Playernum, Governor, "Only leaders may invite.\n");
  1263. X        return;
  1264. X    }
  1265. X    if (!(n = GetPlayer(args[1]))) {
  1266. X        sprintf(buf, "No such player.\n");
  1267. X        notify(Playernum, Governor, buf);
  1268. X        return;
  1269. X    }
  1270. X    if (n == Playernum) {
  1271. X        notify(Playernum, Governor, "Not needed, you are the leader.\n");
  1272. X        return;
  1273. X    }
  1274. X    Race = races[Playernum - 1];
  1275. X    alien = races[n - 1];
  1276. X    if (mode) {
  1277. X        setbit(Blocks[Playernum - 1].invite, n);
  1278. X        sprintf(buf, "%s [%d] has invited you to join %s\n", Race->name,
  1279. X            Playernum, Blocks[Playernum - 1].name);
  1280. X        warn_race(n, buf);
  1281. X        sprintf(buf, "%s [%d] has been invited to join %s [%d]\n",
  1282. X             alien->name, n, Blocks[Playernum - 1].name, Playernum);
  1283. X        warn_race(Playernum, buf);
  1284. X    } else {
  1285. X        clrbit(Blocks[Playernum - 1].invite, n);
  1286. X        sprintf(buf, "You have been blackballed from %s [%d]\n",
  1287. X            Blocks[Playernum - 1].name, Playernum);
  1288. X        warn_race(n, buf);
  1289. X        sprintf(buf, "%s [%d] has been blackballed from %s [%d]\n",
  1290. X             alien->name, n, Blocks[Playernum - 1].name, Playernum);
  1291. X        warn_race(Playernum, buf);
  1292. X    }
  1293. X    post(buf, DECLARATION);
  1294. X
  1295. X    Putblock(Blocks);
  1296. X}
  1297. X
  1298. X/* declare that you wish to be included in the alliance block */
  1299. Xvoid 
  1300. Xpledge(int Playernum, int Governor, int APcount, int mode)
  1301. X{
  1302. X    int             n;
  1303. X    racetype       *alien, *Race;
  1304. X
  1305. X    if (Governor) {
  1306. X        notify(Playernum, Governor, "Only leaders may pledge.\n");
  1307. X        return;
  1308. X    }
  1309. X    if (!(n = GetPlayer(args[1]))) {
  1310. X        sprintf(buf, "No such player.\n");
  1311. X        notify(Playernum, Governor, buf);
  1312. X        return;
  1313. X    }
  1314. X    if (n == Playernum) {
  1315. X        notify(Playernum, Governor, "Not needed, you are the leader.\n");
  1316. X        return;
  1317. X    }
  1318. X    Race = races[Playernum - 1];
  1319. X    alien = races[n - 1];
  1320. X    if (mode) {
  1321. X        setbit(Blocks[n - 1].pledge, Playernum);
  1322. X        sprintf(buf, "%s [%d] has pledged %s.\n", Race->name,
  1323. X            Playernum, Blocks[n - 1].name);
  1324. X        warn_race(n, buf);
  1325. X        sprintf(buf, "You have pledged allegiance to %s.\n",
  1326. X            Blocks[n - 1].name);
  1327. X        warn_race(Playernum, buf);
  1328. X
  1329. X        switch (int_rand(1, 20)) {
  1330. X        case 1:
  1331. X            sprintf(buf, "%s [%d] joins the band wagon and pledges allegiance to %s [%d]!\n",
  1332. X                  Race->name, Playernum, Blocks[n - 1].name, n);
  1333. X            break;
  1334. X        default:
  1335. X            sprintf(buf, "%s [%d] pledges allegiance to %s [%d].\n",
  1336. X                  Race->name, Playernum, Blocks[n - 1].name, n);
  1337. X            break;
  1338. X        }
  1339. X    } else {
  1340. X        clrbit(Blocks[n - 1].pledge, Playernum);
  1341. X        sprintf(buf, "%s [%d] has quit %s [%d].\n", Race->name,
  1342. X            Playernum, Blocks[n - 1].name, n);
  1343. X        warn_race(n, buf);
  1344. X        sprintf(buf, "You have quit %s\n", Blocks[n - 1].name);
  1345. X        warn_race(Playernum, buf);
  1346. X
  1347. X        switch (int_rand(1, 20)) {
  1348. X        case 1:
  1349. X            sprintf(buf, "%s [%d] calls %s [%d] a bunch of geeks and QUITS!\n",
  1350. X                  Race->name, Playernum, Blocks[n - 1].name, n);
  1351. X        default:
  1352. X            sprintf(buf, "%s [%d] has QUIT %s [%d]!\n",
  1353. X                  Race->name, Playernum, Blocks[n - 1].name, n);
  1354. X            break;
  1355. X        }
  1356. X    }
  1357. X
  1358. X    post(buf, DECLARATION);
  1359. X
  1360. X    compute_power_blocks();
  1361. X    Putblock(Blocks);
  1362. X}
  1363. X
  1364. Xvoid 
  1365. Xdeclare(int Playernum, int Governor, int APcount)
  1366. X{
  1367. X    int             n, d_mod;
  1368. X    racetype       *Race, *alien;
  1369. X
  1370. X    if (Governor) {
  1371. X        notify(Playernum, Governor, "Only leaders may declare.\n");
  1372. X        return;
  1373. X    }
  1374. X    if (!(n = GetPlayer(args[1]))) {
  1375. X        sprintf(buf, "No such player.\n");
  1376. X        notify(Playernum, Governor, buf);
  1377. X        return;
  1378. X    }
  1379. X    /* look in sdata for APs first */
  1380. X    /* enufAPs would print something */
  1381. X    if ((int) Sdata.AP[Playernum - 1] >= APcount) {
  1382. X        deductAPs(Playernum, Governor, APcount, 0, 1);
  1383. X        /* otherwise use current star */
  1384. X    } else if ((Dir[Playernum - 1][Governor].level == LEVEL_STAR ||
  1385. X            Dir[Playernum - 1][Governor].level == LEVEL_PLAN) &&
  1386. X           enufAP(Playernum, Governor, Stars[Dir[Playernum - 1][Governor].snum]->AP[Playernum - 1], APcount)) {
  1387. X        deductAPs(Playernum, Governor, APcount, Dir[Playernum - 1][Governor].snum, 0);
  1388. X    } else {
  1389. X        sprintf(buf, "You don't have enough AP's (%d)\n", APcount);
  1390. X        notify(Playernum, Governor, buf);
  1391. X        return;
  1392. X    }
  1393. X
  1394. X    Race = races[Playernum - 1];
  1395. X    alien = races[n - 1];
  1396. X
  1397. X    switch (*args[2]) {
  1398. X    case 'a':
  1399. X        setbit(Race->allied, n);
  1400. X        clrbit(Race->atwar, n);
  1401. X        if (success(5)) {
  1402. X            sprintf(buf, "But would you want your sister to marry one?\n");
  1403. X            notify(Playernum, Governor, buf);
  1404. X        } else {
  1405. X            sprintf(buf, "Good for you.\n");
  1406. X            notify(Playernum, Governor, buf);
  1407. X        }
  1408. X        sprintf(buf, " Player #%d (%s) has declared an alliance with you!\n",
  1409. X            Playernum, Race->name);
  1410. X        warn_race(n, buf);
  1411. X        sprintf(buf, "%s [%d] declares ALLIANCE with %s [%d].\n",
  1412. X            Race->name, Playernum, alien->name, n);
  1413. X        d_mod = 30;
  1414. X        if (argn > 3)
  1415. X            sscanf(args[3], "%d", &d_mod);
  1416. X        d_mod = MAX(d_mod, 30);
  1417. X        break;
  1418. X    case 'n':
  1419. X        clrbit(Race->allied, n);
  1420. X        clrbit(Race->atwar, n);
  1421. X        sprintf(buf, "Done.\n");
  1422. X        notify(Playernum, Governor, buf);
  1423. X
  1424. X        sprintf(buf, " Player #%d (%s) has declared neutrality with you!\n", Playernum, Race->name);
  1425. X        warn_race(n, buf);
  1426. X        sprintf(buf, "%s [%d] declares a state of neutrality with %s [%d].\n",
  1427. X            Race->name, Playernum, alien->name, n);
  1428. X        d_mod = 30;
  1429. X        break;
  1430. X    case 'w':
  1431. X        setbit(Race->atwar, n);
  1432. X        clrbit(Race->allied, n);
  1433. X        if (success(4)) {
  1434. X            sprintf(buf, "Your enemies flaunt their secondary male reproductive glands in your\ngeneral direction.\n");
  1435. X            notify(Playernum, Governor, buf);
  1436. X        } else {
  1437. X            sprintf(buf, "Give 'em hell!\n");
  1438. X            notify(Playernum, Governor, buf);
  1439. X        }
  1440. X        sprintf(buf, " Player #%d (%s) has declared war against you!\n", Playernum, Race->name);
  1441. X        warn_race(n, buf);
  1442. X        switch (int_rand(1, 5)) {
  1443. X        case 1:
  1444. X            sprintf(buf, "%s [%d] declares WAR on %s [%d].\n",
  1445. X                Race->name, Playernum, alien->name, n);
  1446. X            break;
  1447. X        case 2:
  1448. X            sprintf(buf, "%s [%d] has had enough of %s [%d] and declares WAR!\n",
  1449. X                Race->name, Playernum, alien->name, n);
  1450. X            break;
  1451. X        case 3:
  1452. X            sprintf(buf, "%s [%d] decided that it is time to declare WAR on %s [%d]!\n",
  1453. X                Race->name, Playernum, alien->name, n);
  1454. X            break;
  1455. X        case 4:
  1456. X            sprintf(buf, "%s [%d] had no choice but to declare WAR against %s [%d]!\n",
  1457. X                Race->name, Playernum, alien->name, n);
  1458. X            break;
  1459. X        case 5:
  1460. X            sprintf(buf, "%s [%d] says 'screw it!' and declares WAR on %s [%d]!\n",
  1461. X                Race->name, Playernum, alien->name, n);
  1462. X            break;
  1463. X        default:
  1464. X            break;
  1465. X        }
  1466. X        d_mod = 30;
  1467. X        break;
  1468. X    default:
  1469. X        notify(Playernum, Governor, "I don't understand.\n");
  1470. X        return;
  1471. X    }
  1472. X
  1473. X    post(buf, DECLARATION);
  1474. X    warn_race(Playernum, buf);
  1475. X
  1476. X    /* They, of course, learn more about you */
  1477. X    alien->translate[Playernum - 1] = MIN(alien->translate[Playernum - 1] + d_mod, 100);
  1478. X
  1479. X    putrace(alien);
  1480. X    putrace(Race);
  1481. X}
  1482. X
  1483. X#ifdef VOTING
  1484. Xvoid 
  1485. Xvote(int Playernum, int Governor, int APcount)
  1486. X{
  1487. X    int             i;
  1488. X    racetype       *Race;
  1489. X    int             check, nvotes, nays, yays;
  1490. X
  1491. X    Race = races[Playernum - 1];
  1492. X
  1493. X    if (Race->God) {
  1494. X        sprintf(buf, "Your vote doesn't count, however, here is the count.\n");
  1495. X        notify(Playernum, Governor, buf);
  1496. X        show_votes(Playernum, Governor);
  1497. X        return;
  1498. X    }
  1499. X    if (Race->Guest) {
  1500. X        sprintf(buf, "You are not allowed to vote, but, here is the count.\n");
  1501. X        notify(Playernum, Governor, buf);
  1502. X        show_votes(Playernum, Governor);
  1503. X        return;
  1504. X    }
  1505. X    if (argn > 2) {
  1506. X        check = 0;
  1507. X        if (match(args[1], "update")) {
  1508. X            i = strlen(args[2]);
  1509. X            if (match(args[2], "go")) {
  1510. X                Race->votes |= VOTE_UPDATE_GO;
  1511. X                check = 1;
  1512. X            } else if (match(args[2], "wait"))
  1513. X                Race->votes &= ~VOTE_UPDATE_GO;
  1514. X            else {
  1515. X                sprintf(buf, "No such update choice '%s'\n", args[2]);
  1516. X                notify(Playernum, Governor, buf);
  1517. X                return;
  1518. X            }
  1519. X        } else {
  1520. X            sprintf(buf, "No such vote '%s'\n", args[1]);
  1521. X            notify(Playernum, Governor, buf);
  1522. X            return;
  1523. X        }
  1524. X        putrace(Race);
  1525. X
  1526. X        if (check) {
  1527. X            /*
  1528. X             * Ok...someone voted yes.  Tally them all up and see
  1529. X             * if
  1530. X             */
  1531. X            /* we should do something. */
  1532. X            nays = 0;
  1533. X            yays = 0;
  1534. X            nvotes = 0;
  1535. X            for (Playernum = 1; Playernum <= Num_races; Playernum++) {
  1536. X                Race = races[Playernum - 1];
  1537. X                if (Race->God || Race->Guest)
  1538. X                    continue;
  1539. X                nvotes++;
  1540. X                if (Race->votes & VOTE_UPDATE_GO)
  1541. X                    yays++;
  1542. X                else
  1543. X                    nays++;
  1544. X            }
  1545. X            /* Is Update/Movement vote unanimous now? */
  1546. X            if (nvotes > 0 && nvotes == yays && nays == 0) {
  1547. X                /* Do it... */
  1548. X                do_next_thing();
  1549. X            }
  1550. X        }
  1551. X    } else {
  1552. X        sprintf(buf, "Your vote on updates is %s\n",
  1553. X            (Race->votes & VOTE_UPDATE_GO) ? "go" : "wait");
  1554. X        notify(Playernum, Governor, buf);
  1555. X        show_votes(Playernum, Governor);
  1556. X    }
  1557. X}
  1558. X
  1559. Xvoid 
  1560. Xshow_votes(int Playernum, int Governor)
  1561. X{
  1562. X    int             nvotes, nays, yays, pnum;
  1563. X    racetype       *Race;
  1564. X
  1565. X    nays = yays = nvotes = 0;
  1566. X    for (pnum = 1; pnum <= Num_races; pnum++) {
  1567. X        Race = races[pnum - 1];
  1568. X        if (Race->God || Race->Guest)
  1569. X            continue;
  1570. X        nvotes++;
  1571. X        if (Race->votes & VOTE_UPDATE_GO) {
  1572. X            yays++;
  1573. X            sprintf(buf, "  %s voted go.\n", Race->name);
  1574. X        } else {
  1575. X            nays++;
  1576. X            sprintf(buf, "  %s voted wait.\n", Race->name);
  1577. X        }
  1578. X        if (races[Playernum - 1]->God)
  1579. X            notify(Playernum, Governor, buf);
  1580. X    }
  1581. X    sprintf(buf, "  Total votes = %d, Go = %d, Wait = %d.\n", nvotes, yays, nays);
  1582. X    notify(Playernum, Governor, buf);
  1583. X}
  1584. X#endif
  1585. END_OF_FILE
  1586. if test 9628 -ne `wc -c <'user/declare.c'`; then
  1587.     echo shar: \"'user/declare.c'\" unpacked with wrong size!
  1588. fi
  1589. # end of 'user/declare.c'
  1590. fi
  1591. echo shar: End of archive 16 \(of 21\).
  1592. cp /dev/null ark16isdone
  1593. MISSING=""
  1594. 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
  1595.     if test ! -f ark${I}isdone ; then
  1596.     MISSING="${MISSING} ${I}"
  1597.     fi
  1598. done
  1599. if test "${MISSING}" = "" ; then
  1600.     echo You have unpacked all 21 archives.
  1601.     echo "Now type './buildfiles.sh'"
  1602.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1603. else
  1604.     echo You still need to unpack the following archives:
  1605.     echo "        " ${MISSING}
  1606. fi
  1607. ##  End of shell archive.
  1608. exit 0
  1609.