comparison src/struct.h @ 8:0836fb919dfa

First entry of Paradise Server 2.9 patch 10 Beta
author darius
date Sat, 06 Dec 1997 04:37:05 +0000
parents
children
comparison
equal deleted inserted replaced
7:814de70c9f67 8:0836fb919dfa
1 /*--------------------------------------------------------------------------
2 NETREK II -- Paradise
3
4 Permission to use, copy, modify, and distribute this software and its
5 documentation, or any derivative works thereof, for any NON-COMMERCIAL
6 purpose and without fee is hereby granted, provided that this copyright
7 notice appear in all copies. No representations are made about the
8 suitability of this software for any purpose. This software is provided
9 "as is" without express or implied warranty.
10
11 Xtrek Copyright 1986 Chris Guthrie
12 Netrek (Xtrek II) Copyright 1989 Kevin P. Smith
13 Scott Silvey
14 Paradise II (Netrek II) Copyright 1993 Larry Denys
15 Kurt Olsen
16 Brandon Gillespie
17 --------------------------------------------------------------------------*/
18
19 #ifndef struct_h_
20 #define struct_h_
21
22
23 #include "defs.h"
24
25
26
27
28
29 /*-----------------------------SHIP STRUCTURE------------------------------*/
30
31 enum ship_types_e
32 {
33 SCOUT, DESTROYER, CRUISER, BATTLESHIP, ASSAULT, STARBASE, ATT,
34 JUMPSHIP, FRIGATE, WARBASE, LIGHTCRUISER, CARRIER, UTILITY, PATROL
35
36 #if 1
37 #define NUM_TYPES 14 /* this is less clean, but cc has a */
38 /* problem with using an enum constant */
39 /* as an array dimension. POS compiler. */
40 #else
41 NUM_TYPES
42 #endif
43 };
44
45 struct drivestat
46 {
47 /* various drive type statistics */
48 int acc; /* acceleration */
49 int dec; /* decelleration */
50 int cost; /* fuel cost */
51 int maxspeed; /* maximum speed */
52 int etemp; /* engine temperature */
53 };
54
55 struct weaponstat
56 {
57 short damage; /* damage potential */
58 short speed; /* speed for missiles, range for beams */
59 short cost; /* fuel cost */
60 short fuse; /* how long they last */
61 short wtemp; /* weapon temperature cost */
62 short wtemp_halfarc; /* Arc the penalty is calculated from */
63 short wtemp_factor; /* Penalty Factor 1-16 of wtemp caused */
64 short count; /* how many we can have airborne */
65 short aux; /* aux field */
66 /* aux is turn rate for torps and plasmas. */
67 };
68
69 struct ship
70 {
71
72 short s_type; /* ship type, defined with the number */
73 short s_alttype; /* This MUST be a legal vanilla bronco type */
74 char s_name[32]; /* ship's name */
75
76 /* engine characteristics */
77 int s_turns; /* ship\'s turning */
78 #undef s_imp /* bloody obsolete header files */
79 struct drivestat s_imp; /* impulse drive stats */
80 struct drivestat s_after; /* impulse drive stats */
81 struct drivestat s_warp; /* impulse drive stats */
82 int s_warpinitcost; /* fuel charge to initialize warp */
83 int s_warpinittime; /* time to initialize warp */
84 int s_warpprepspeed; /* speed while initializing warp */
85
86 short s_mass; /* to guage affect of tractor beams */
87
88 /* tractor characteristics */
89 short s_tractstr; /* Strength of tractor beam */
90 float s_tractrng; /* tractor range */
91 int s_tractcost; /* fuel used by tractors */
92 int s_tractetemp; /* e-temp caused by tractors */
93
94 struct weaponstat s_torp; /* torp characteristics */
95 struct weaponstat s_phaser; /* phaser characteristics */
96 struct weaponstat s_missile; /* missile characteristics */
97 struct weaponstat s_plasma; /* plasma characteristics */
98 short s_missilestored; /* how many missiles can we store? */
99
100 /* Raynfala's Butt Torp Code. Gjor's Ship Patch for his code to do it */
101 /* for each ship. */
102
103 short s_torp_penalty_halfarc;
104 short s_torp_penalty_factor;
105
106 int s_maxwpntemp; /* max W-temp */
107 short s_wpncoolrate; /* weapon cool rate */
108
109 int s_maxegntemp; /* max engine temp */
110 short s_egncoolrate; /* engine cool rate */
111
112 /* fuel characteristics */
113 int s_maxfuel; /* ship's maximum fuel */
114 short s_recharge; /* speed fuel recharges */
115 int s_mingivefuel; /* ship must have this much to give fuel */
116 int s_takeonfuel; /* how fast ship takes on fuel */
117
118 short s_expldam; /* damage done by ship's explosion (assuming
119 * his fuel tank is empty) */
120 short s_fueldam; /* the amount of _additional_ damage that
121 * this ship's explosion does with a full
122 * tank */
123
124 /* miscellaneous army stats */
125 float s_armyperkill; /* the number of armies per kill */
126 short s_maxarmies; /* max armies ship can carry */
127 int s_bomb; /* bomb damage ship can do */
128
129 /* hull, shield and repair stats */
130 short s_repair; /* ship's repair rate */
131 int s_maxdamage; /* maximum damage ship can take */
132 int s_maxshield; /* maximum shield value */
133 int s_shieldcost; /* cost in fuel of shields being up */
134
135 short s_detcost; /* fuel cost of detting */
136 int s_detdist; /* fuel cost of detting */
137 short s_cloakcost; /* base fuel cost of cloaking */
138
139 short s_scanrange; /* range of the ship's scanners */
140
141 short s_numports; /* how many docking ports do we have? */
142
143 char s_letter; /* the letter used to enter as that ship */
144 char s_desig1; /* the designation used (such as A, in AS */
145 char s_desig2; /* the designation used (such as S, in AS */
146
147 short s_bitmap; /* the bitmap to use */
148 short s_width; /* width of bitmap */
149 short s_height; /* height of bitmap */
150
151 /* ship requisition limitations */
152 int s_timer; /* value to set timer to get another ship */
153 int s_maxnum; /* maximum number of these per team */
154 int s_rank; /* minimum rank for this sucker */
155 int s_numdefn; /* number of player necessary */
156 int s_numplan; /* number of planets */
157
158 long s_nflags; /* attributes for ship type, SFN flags */
159 };
160
161 /*
162 * ATTENTION!!! Changes to these flags should be mirrored in structdesc.c
163 */
164 /* For s_nflags field */
165 #if 0
166 #define SFNDOCKON (1<< 0) /* specify a ship to docked on */
167 #define SFNCANDOCK (1<< 1) /* specify a ship can dock */
168 #else
169 #define SFNUNDOCKABLE (1<< 0) /* this ship can not dock with another */
170 #define SFNCANORBIT (1<< 1) /* specify a ship can orbit */
171 #endif
172 #define SFNCANWARP (1<< 2) /* this ship can go warp */
173 #define SFNCANFUEL (1<< 3) /* base can give docked ships fuel */
174 #define SFNCANREPAIR (1<< 4) /* base can repair docked ships */
175 #define SFNCANREFIT (1<< 5) /* base allows a refit while docked */
176 #define SFNARMYNEEDKILL (1<< 6) /* does ship need kills to carry */
177
178 #define SFNHASPHASERS (1<< 7) /* this ship has phasers */
179
180 #define SFNPLASMASTYLE (1<< 8) /* style of firing plasmas */
181
182 #define SFNMASSPRODUCED (1<< 9) /* ship can appear docked to an SB or UT */
183
184 #define SFNPLASMAARMED (1<<10)
185 #define SFNHASMISSILE (1<<11)
186
187 #define SFNHASFIGHTERS (1<<12) /* ship has a fighter bay */
188
189 #if 0
190 #define allows_docking(s_ship) ((s_ship).s_nflags & SFNDOCKON)
191 #define can_dock(s_ship) ((s_ship).s_nflags & SFNCANDOCK)
192 #else
193 #define allows_docking(s_ship) ((s_ship).s_numports>0)
194 #define can_dock(s_ship) ((s_ship).s_numports==0 && !((s_ship).s_nflags&SFNUNDOCKABLE))
195 #endif
196 /*-------------------------------------------------------------------------*/
197
198
199
200
201
202
203
204 /*----------------------------STATS STRUCTURE------------------------------*/
205
206 struct stats
207 {
208 int st_genocides; /* number of genocides participated in */
209 float st_tmaxkills; /* max kills ever */
210 float st_di; /* total destruction inflicted for all time */
211 int st_tkills; /* Kills in tournament play */
212 int st_tlosses; /* Losses in tournament play */
213 int st_tarmsbomb; /* Tournament armies bombed */
214 int st_tresbomb; /* resources bombed off */
215 int st_tdooshes; /* armies killed while being carried */
216 int st_tplanets; /* Tournament planets conquered */
217 int st_tticks; /* Tournament ticks */
218 /* SB/WB/JS stats are entirely separate */
219 int st_sbkills; /* Kills as starbase */
220 int st_sblosses; /* Losses as starbase */
221 int st_sbticks; /* Time as starbase */
222 float st_sbmaxkills; /* Max kills as starbase */
223 int st_wbkills; /* Kills as warbase */
224 int st_wblosses; /* Losses as warbase */
225 int st_wbticks; /* Time as warbase */
226 float st_wbmaxkills; /* Max kills as warbase */
227 int st_jsplanets; /* planets assisted with in JS */
228 int st_jsticks; /* ticks played as a JS */
229 long st_lastlogin; /* Last time this player was played */
230 int st_flags; /* Misc option flags */
231 int st_cluesuccess; /* how many times you passed a clue check */
232 char st_pad[92]; /* space for expansion */
233 int st_rank; /* Ranking of the player */
234 int st_royal; /* royaly, specialty, rank */
235 };
236
237 /*
238 * These are for the flags field and control the preset options of the
239 * players client.
240 */
241 #if 0
242 #define ST_MAPMODE 0x001
243 #define ST_NAMEMODE 0x002
244 #define ST_SHOWSHIELDS 0x004
245 #endif
246 #define ST_NOBITMAPS (1<<0)
247 #define ST_KEEPPEACE (1<<3)
248 #if 0
249 #define ST_SHOWLOCAL 0x010 /* two bits for these two */
250 #define ST_SHOWGLOBAL 0x040
251 #endif
252 #define ST_CYBORG (1<<8)
253
254 /* initial value to put in flags */
255 #define ST_INITIAL ST_KEEPPEACE
256 /*
257 * ST_MAPMODE+ST_NAMEMODE+ST_SHOWSHIELDS+ \
258 * ST_KEEPPEACE+ST_SHOWLOCAL*2+ST_SHOWGLOBAL*2;
259 */
260
261 /*-------------------------------------------------------------------------*/
262
263
264
265
266
267
268
269 /*---------------------------VARIOUS STRUCTURES----------------------------*/
270
271 /*
272 * This is used to indicate various things about the game and to hold global
273 * stats about it. All stats are only updated while in t-mode.
274 */
275 struct status
276 {
277 int active; /* for interfacing with people who */
278 unsigned int wait, count; /* want to get into the game */
279 unsigned int number, request, answer;
280 unsigned char tourn; /* Tournament mode? */
281 unsigned long dooshes; /* total number of armies dooshed */
282 unsigned long armsbomb; /* all t-mode armies bombed */
283 unsigned long resbomb; /* resources bombed */
284 unsigned long planets; /* all t-mode planets taken */
285 unsigned long kills; /* all t-mode kills made */
286 unsigned long losses; /* all t-mode losses */
287 unsigned long genocides; /* number of genocides */
288 unsigned long sbkills; /* total kills in SB's */
289 unsigned long sblosses; /* total losses in Sb's */
290 unsigned long sbtime; /* total time in SB's */
291 unsigned long wbkills; /* kills in warbases */
292 unsigned long wblosses; /* losses in warbases */
293 unsigned long wbtime; /* total time played in wb's */
294 unsigned long jsplanets; /* total planets taken by jump ships */
295 unsigned long jstime; /* total time in a jump ship */
296 unsigned long time; /* t-mode time */
297 unsigned long timeprod; /* t-mode ship ticks--sort of like */
298 /* manhours in t-mode */
299 unsigned long clock; /* clock used for timestamping */
300 int nukegame; /* set to PID of daemon */
301 int gameup; /* is game up */
302 };
303
304 /*
305 * Some of the stuff above belongs in struct status2
306 */
307
308 struct league_team
309 {
310 int index; /* team index, not mask. -1 means captain
311 * hasn't chosen yet */
312 int captain; /* player number of captain */
313 char name[32];
314 int timeouts_left; /* NYI */
315 int ready;
316 int desirepause; /* do we want to pause the game? */
317
318 struct
319 {
320 int regulation; /* game length */
321 int overtime;
322 int maxplayers; /* max players per team */
323 int galaxyreset; /* do we want to reset the galaxy? */
324 int restart; /* should we restart team selection? */
325 } desired;
326 };
327
328 struct status2
329 {
330 #ifdef LEAGUE_SUPPORT
331 int league; /* are we playing league? 0 means no. 1 means
332 * we're prepping (captains choose sides). 2
333 * means we're almost there. 3 means we're in
334 * regulation league play. 4 means we're in
335 * overtime */
336 int leagueticksleft; /* ticks left in game play */
337
338 struct league_team home, away;
339
340 int timeout_timeleft; /* ticks left in a timeout */
341 int awaypassed; /* does the away team get first choice? this
342 * becomes 1 if they PASS */
343 int paused; /* contains 0 if the game is not paused.
344 * contains the number of ticks left before
345 * return to normal play if already paused */
346 int pausemsgfuse; /* a fuse that prints out a reminder every
347 * few seconds */
348 #endif
349 int starttourn;
350 int newgalaxy;
351 int nontteamlock;
352 };
353
354
355 /*
356 * used for the request field of status. These are used for a client
357 * querying the queue to see if he can get in
358 */
359
360 enum queue_request_type_e
361 {
362 REQFREE, REQWHO, REQDEAD
363 };
364
365 /*
366 * This structure is used to hold various info that each team has, such as
367 * how long before a certain ship type is done with construction.
368 */
369 struct team
370 {
371 char nickname[32]; /* he is now a %s */
372 char name[32]; /* come join the %s */
373 char letter; /* 1-letter abbrev */
374 char shortname[4]; /* 3-letter abbrev */
375
376 int s_turns[NUM_TYPES]; /* turns till another ship is legal */
377 int s_surrender; /* minutes until this team surrenders */
378 int s_plcount; /* how many planets this team owns */
379 int s_plcountold; /* the old planet count */
380 };
381
382
383 /*
384 * this is used for getting a player name and password and fetching a players
385 * stats
386 */
387 struct statentry
388 {
389 char name[16]; /* player's name */
390 char password[16]; /* player's password */
391 struct stats stats; /* player's stats */
392 };
393
394 /* Used by the function that computes ratings */
395 struct rating
396 {
397 float battle;
398 float strategy;
399 float special;
400
401 float bombrat;
402 float planetrat;
403 float resrat;
404 float offrat;
405 float dooshrat;
406 float ratio;
407
408 float sbrat;
409 float wbrat;
410 float jsrat;
411 };
412
413 /*-------------------------------------------------------------------------*/
414
415
416
417
418
419
420
421 /*-----------------------------PLAYER STRUCTURE----------------------------*/
422
423 #define MAXPORTS 6 /* maximum number of docking bays a ship type
424 * can have */
425
426 /* These are defines for the p_whydead field of the player structure */
427 enum why_dead_e
428 {
429 KNOREASON,
430 KQUIT, /* Player quit */
431 KTORP, /* killed by torp */
432 KPHASER, /* killed by phaser */
433 KPLANET, /* killed by planet */
434 KSHIP, /* killed by other ship */
435 KDAEMON, /* killed by dying daemon */
436 KWINNER, /* killed by a winner */
437 KGHOST, /* killed because a ghost */
438 KGENOCIDE, /* killed by genocide */
439 KPROVIDENCE, /* killed by a hacker */
440 KPLASMA, /* killed by a plasma torpedo */
441 KTOURNEND, /* killed by the end of the tourn */
442 KOVER, /* killed by overtime */
443 KTOURNSTART, /* killed by the start of the tournament */
444 KBINARY, /* killed by improper client */
445 KMISSILE, /* killed by a missile */
446 KASTEROID /* smashed by an asteroid */
447 };
448
449 /* These are number defines for the player structs p_status field */
450 enum player_status_e
451 {
452 PFREE, /* player slot is not filled */
453 POUTFIT, /* player in process of being ghost busted */
454 PALIVE, /* player is alive */
455 PEXPLODE, /* player is in process of exploding */
456 PDEAD, /* player is dead */
457 PTQUEUE, /* player is on the tournament queue */
458 POBSERVE /* player is observing the game */
459 };
460
461
462 struct player
463 {
464 int p_no; /* player number in player array */
465 int p_updates; /* Number of updates ship has survived */
466 enum player_status_e p_status;/* Player status */
467 char p_observer; /* is the player only an observer? */
468 unsigned int p_flags; /* Player flags */
469 char p_name[16]; /* name of player */
470 char p_login[16]; /* as much of user name and site we can hold */
471 char p_monitor[16]; /* Monitor being played on */
472 struct ship p_ship; /* Personal ship statistics */
473 int p_x; /* players x coord in the galaxy */
474 int p_y; /* player y coord in the galaxy */
475
476 unsigned char p_dir; /* Real direction */
477 int p_subdir; /* fraction direction change */
478 unsigned char p_desdir; /* desired direction */
479
480 int p_speed; /* Real speed */
481 int p_subspeed; /* Fractional speed */
482 short p_desspeed; /* Desired speed */
483 short p_warpdesspeed; /* Desired warp speed, after prep [BDyess] */
484
485 short p_team; /* Team I'm on */
486 enum HomeAway
487 {
488 NEITHER, HOME, AWAY
489 } p_homeaway;
490 char p_spyable; /* can you watch this player? */
491 char p_teamspy; /* (mask) what teams can this player watch? */
492
493 int p_damage; /* Current damage */
494 int p_subdamage; /* Fractional damage repair */
495
496 int p_shield; /* Current shield power */
497 int p_subshield; /* Fractional shield recharge */
498
499 short p_cloakphase; /* Drawing stage of cloaking engage/disengage */
500
501 short p_ntorp; /* Number of torps flying */
502 short p_nplasmatorp; /* Number of plasma torps active */
503 short p_nthingys; /* number of thingys we own. */
504 long p_specweap; /* which special weapons we're packing */
505
506 char p_hostile; /* Who my torps will hurt */
507 char p_swar; /* Who am I at sticky war with */
508
509 float p_kills; /* Enemies killed */
510 short p_planet; /* Planet orbiting or locked onto */
511 char p_orbitdir; /* direction you are orbiting the planet in */
512 short p_playerl; /* Player locked onto */
513 short p_armies; /* armies player is carrying */
514
515 int p_fuel; /* fuel player's ship currently has */
516 short p_explode; /* Keeps track of final explosion */
517
518 int p_etemp; /* player's current engine temp */
519 int p_subetemp; /* fractional part of E-temp */
520 short p_etime; /* timer for coming out of E-temp */
521
522 int p_wtemp; /* current weapon temp */
523 short p_wtime; /* timer for coming out of W-temp */
524
525 enum why_dead_e p_whydead; /* Tells you why you died */
526 short p_whodead; /* Tells you who killed you */
527 struct stats p_stats; /* player statistics */
528 short p_planets; /* planets taken this game */
529 short p_armsbomb; /* armies bombed this game */
530 short p_resbomb; /* resources bombed */
531 short p_dooshes; /* armies being carried killed */
532 int p_ghostbuster; /* ??????????????? */
533 int p_docked; /* If SB, # docked to, else no base host */
534 int p_port[MAXPORTS]; /* If SB, pno of ship docked to that port,
535 * else p_port[0] = port # docked to on host. */
536 short p_tractor; /* What player is in tractor lock */
537 int p_pos; /* My position in the player file */
538 char p_full_hostname[32]; /* full hostname 4/13/92 TC */
539 #if 0
540 int p_planfrac; /* for getting fractional credit for */
541 int p_bombfrac; /* bombing and planet taking */
542 #endif
543 int p_warptime; /* timer for warp countdown */
544 int p_jsdock; /* to keep track of undocking from JS */
545 int p_lastjs; /* player number of last JS ridden on */
546 int p_lastman; /* flag used to beam up last men */
547
548 int p_lastrefit; /* what shipyard you last refitted at (plno) */
549 /* ping stuff */
550 int p_avrt; /* average round trip time */
551 int p_stdv; /* standard deviation in round trip time */
552 int p_pkls; /* packet loss (input/output) */
553
554 /* clue checking goop */
555 int p_cluecountdown;
556 int p_cluedelay;
557
558 int p_ntspid; /* proc ID of ntserv in control of this slot */
559 int p_zone; /* total warp zone bonus/penalty [BDyess] */
560
561 #ifdef RC_DISTRESS
562 int gen_distress; /* generate generic distress messages for
563 * client */
564 #endif
565 };
566
567 /* These are defines that used for the player struct's p_flags field */
568 #define PFSHIELD (1<< 0) /* shields are raised */
569 #define PFREPAIR (1<< 1) /* player in repair mode */
570 #define PFBOMB (1<< 2) /* player is bombing */
571 #define PFORBIT (1<< 3) /* player is orbiting */
572 #define PFCLOAK (1<< 4) /* player is cloaked */
573 #define PFWEP (1<< 5) /* player is weapon temped */
574 #define PFENG (1<< 6) /* player is engine temped */
575 #define PFROBOT (1<< 7) /* player is a robot */
576 #define PFBEAMUP (1<< 8) /* player is beaming up */
577 #define PFBEAMDOWN (1<< 9) /* player is beaming down */
578 #define PFSELFDEST (1<<10) /* player is self destructing */
579 #define PFGREEN (1<<11) /* player at green alert */
580 #define PFYELLOW (1<<12) /* player is at yellow alert */
581 #define PFRED (1<<13) /* player is at red alert */
582 #define PFPLOCK (1<<14) /* Locked on a player */
583 #define PFPLLOCK (1<<15) /* Locked on a planet */
584 #define PFCOPILOT (1<<16) /* Allow copilots */
585 #define PFWAR (1<<17) /* computer reprogramming for war */
586 #define PFPRACTR (1<<18) /* practice type robot (no kills) */
587 #define PFDOCK (1<<19) /* true if docked to a starbase */
588 #define PFREFIT (1<<20) /* true if about to refit */
589 #define PFREFITTING (1<<21) /* true if currently refitting */
590 #define PFTRACT (1<<22) /* tractor beam activated */
591 #define PFPRESS (1<<23) /* pressor beam activated */
592 #define PFDOCKOK (1<<24) /* docking permission */
593 #define PFSEEN (1<<25) /* seen by enemy on galactic map? */
594 #define PFWARPPREP (1<<26) /* in warp prep */
595 #define PFWARP (1<<27) /* ship warping */
596 #define PFAFTER (1<<28) /* after burners on */
597 #define PFWPSUSPENDED (1<<29) /* warp prep suspended [BDyess] */
598 #define PFSNAKE (1<<30) /* it's a space snake */
599 #define PFBIRD (1<<31) /* it's a space bird */
600 /*-------------------------------------------------------------------------*/
601
602
603
604
605
606
607
608 /*-----------------------------TORP STRUCTURE-------------------------------*/
609
610
611 /* For status field of torp structure */
612 enum torp_status_e
613 {
614 TFREE, /* torp is not being fired */
615 TMOVE, /* torp is moving with wobble */
616 TEXPLODE, /* torp is in the process of exploding */
617 TDET, /* torp is being detted */
618 TOFF, /* torp is off ??? */
619 TSTRAIGHT, /* Non-wobbling torp */
620 TRETURN, /* torp is returning to owner (fighters) */
621 TLAND /* torp gets recovered */
622 };
623
624 struct basetorp
625 {
626 int bt_no;
627 enum torp_status_e bt_status;
628 int bt_owner;
629 int bt_x, bt_y;
630 unsigned char bt_dir;
631 int bt_damage;
632 int bt_speed;
633 int bt_fuse;
634 char bt_war;
635 char bt_team;
636 char bt_whodet; /* who detonated... */
637 };
638
639
640 struct torp
641 {
642 struct basetorp t_base;
643 #define t_no t_base.bt_no
644 #define t_status t_base.bt_status
645 #define t_owner t_base.bt_owner
646 #define t_x t_base.bt_x
647 #define t_y t_base.bt_y
648 #define t_dir t_base.bt_dir
649 #define t_damage t_base.bt_damage
650 #define t_speed t_base.bt_speed
651 #define t_fuse t_base.bt_fuse
652 #define t_war t_base.bt_war
653 #define t_team t_base.bt_team
654 #define t_whodet t_base.bt_whodet
655 short t_turns; /* rate of change of direction if tracking */
656 };
657
658 /*-------------------------------------------------------------------------*/
659
660 struct missile
661 {
662 struct basetorp ms_base;
663 #define ms_no ms_base.bt_no
664 #define ms_status ms_base.bt_status
665 #define ms_owner ms_base.bt_owner
666 #define ms_x ms_base.bt_x
667 #define ms_y ms_base.bt_y
668 #define ms_dir ms_base.bt_dir
669 #define ms_damage ms_base.bt_damage
670 #define ms_speed ms_base.bt_speed
671 #define ms_fuse ms_base.bt_fuse
672 #define ms_war ms_base.bt_war
673 #define ms_team ms_base.bt_team
674 #define ms_whodet ms_base.bt_whodet
675 short ms_turns;
676 short ms_locked;
677 short ms_type; /* A missile, fighter, or mine */
678 short fi_hasfired; /* has the fighter fired a torp? */
679 };
680 /* defines for ms_type */
681 #define MISSILETHINGY 0
682 #define FIGHTERTHINGY 1
683 #define MINETHINGY 2
684
685 enum thingy_type
686 {
687 TT_NONE,
688 TT_WARP_BEACON
689 };
690
691 struct warp_beacon
692 {
693 int owner;
694 int x, y;
695 };
696
697 struct thingy
698 {
699 enum thingy_type type;
700 union
701 {
702 struct warp_beacon wbeacon;
703 } u;
704 };
705
706
707
708 /*---------------------------PLASMA TORP STRUCTURE-------------------------*/
709 /* For the plasma status field */
710 struct plasmatorp
711 {
712 struct basetorp pt_base;
713 #define pt_no pt_base.bt_no
714 #define pt_status pt_base.bt_status
715 #define PTFREE TFREE
716 #define PTMOVE TMOVE
717 #define PTEXPLODE TEXPLODE
718 #define PTDET TDET
719 #define pt_owner pt_base.bt_owner
720 #define pt_x pt_base.bt_x
721 #define pt_y pt_base.bt_y
722 #define pt_dir pt_base.bt_dir
723 #define pt_damage pt_base.bt_damage
724 #define pt_speed pt_base.bt_speed
725 #define pt_fuse pt_base.bt_fuse
726 #define pt_war pt_base.bt_war
727 #define pt_team pt_base.bt_team
728 #define pt_whodet pt_base.bt_whodet
729 short pt_turns; /* ticks turned per cycle */
730 };
731
732
733 /*-------------------------------------------------------------------------*/
734
735
736
737
738
739
740
741 /*-----------------------------PHASER STRUCTURE---------------------------*/
742
743 struct phaser
744 {
745 int ph_status; /* What it's up to */
746 unsigned char ph_dir; /* direction */
747 int ph_target; /* Who's being hit (for drawing) */
748 int ph_x, ph_y; /* For when it hits a torp */
749 int ph_fuse; /* Life left for drawing */
750 int ph_damage; /* Damage inflicted on victim */
751 };
752
753 /* for phaser's status field */
754 #define PHFREE 0x00 /* phaser not being fired */
755 #define PHHIT (1<<0) /* When it hits a person */
756 #define PHMISS (1<<1) /* phaser missed */
757 #define PHHIT2 (1<<2) /* When it hits a plasma */
758
759 /*-------------------------------------------------------------------------*/
760
761
762
763
764
765
766
767 /*-----------------------------PLANET STRUCTURE---------------------------*/
768
769 /* This structure is used to hold what each team knows about a planet */
770 struct teaminfo
771 { /* to hold what a team knows about a planet */
772 int owner; /* planet's owner */
773 int armies; /* number of armies team knows about */
774 int flags; /* flags team knows about */
775 int timestamp; /* time info was taken */
776 };
777
778 struct planet
779 { /* all info about a planet */
780 int pl_no; /* planet number */
781 int pl_flags; /* attributes of planet */
782 int pl_owner; /* the current owner of the planet */
783
784 int pl_x; /* planet's coords */
785 int pl_y; /* use the move_planet function to change
786 * them */
787 int pl_radius; /* distance from sun */
788 float pl_angle; /* angular position relative to sun */
789 int pl_system; /* planetary system number, 0 = no system */
790
791 char pl_name[16]; /* name of the planet */
792 char pl_namelen; /* name's length--Cuts back on strlen's */
793 #if 1
794 char pl_hostile;
795 #else
796 char pl_torbit; /* teams currently in orbit */
797 #endif
798 int pl_tshiprepair; /* repair and shipyard growth timer */
799 int pl_tagri; /* agri growth timer */
800 int pl_tfuel; /* fuel depot growth timer */
801 int pl_armies; /* armies curently on planet */
802 int pl_warning; /* timer so that planets don't talk too much */
803 int pl_hinfo; /* which races have info on planet */
804 struct teaminfo pl_tinfo[MAXTEAM + 1]; /* to hold information for
805 * races */
806 int pl_trevolt; /* timer for planet revolting */
807 /* space grid support stuff */
808 int pl_next, pl_prev; /* doubly linked list of planet numbers */
809 int pl_gridnum; /* to hold grid square number */
810 };
811
812 /* defines for the pl_flags field of planet struct */
813 #if 0
814 #define PLHOME 0x000100 /* These 4 flags no longer are */
815 #define PLCOUP 0x000200 /* used in the server */
816 #define PLCHEAP 0x000400
817 #define PLCORE 0x000800
818 #define PLREPAIR 0x001010 /* planet can repair ships */
819 #define PLFUEL 0x002020 /* planet has fuel depot */
820 #define PLAGRI 0x004040 /* agricultural thingies built here */
821 #define PLSHIPYARD 0x008000 /* planet has a shipyard on it */
822 #define PLORESMASK 0x000070 /* mask for original resource flags */
823 #define PLRESMASK 0x00F000 /* to mask off all but resource bits */
824 #define PLRESSHIFT 12 /* bit to shift right by for resources */
825 #define PLSTAR 0x010000 /* planet is actually a star */
826 #define PLREDRAW 0x000080 /* Player close for redraw */
827 #define PLPOISON 0x000000 /* poison atmosphere, no army growth */
828 #define PLATYPE3 0x020000 /* slightly toxic, very slow army growth */
829 #define PLATYPE2 0x040000 /* thin atmosphere, slow army growth */
830 #define PLATYPE1 0x060000 /* normal human atmosphere, normal growth */
831 #define PLATMASK 0x060000 /* to mask off everything but atmos bits */
832 #define PLATSHIFT 17 /* number of right bit shifts for atmos bits */
833 #define PLBARREN 0X000000 /* rocky barren surface */
834 #define PLDILYTH 0x080000 /* dilythium deposits on the planet */
835 #define PLMETAL 0x100000 /* metal deposits on the planet */
836 #define PLARABLE 0x200000 /* planet has farmland */
837 #define PLSURMASK 0x380000 /* number of surface combinations */
838 #define PLSURSHIFT 19 /* number of bit shift to surface */
839 #define PLPARADISE 0x400000 /* Paradise server flag set to 1 for P server */
840 #else
841
842 /*
843 * pl_flags is an int of 32 bits:
844 *
845 * bits 16 and 23 currently define the type of the planet. The interpretation
846 * of the other bits is dependent upon the planet type.
847 *
848 * Here is the interpretation for a planet bits 0..3
849 * n bits 4..6 planetary facilities (REPAIR,FUEL,AGRI) bit
850 * 7 redraw (archaic, recyclable?) bits 8..11
851 * ld flags (archaic, recyclable?) bits 12..15 paradise
852 * planetary facilities (REPAIR,FUEL,AGRI,SHIPY) bit 16
853 * osmic object type (also bit 23) bits 17,18 planet
854 * atmosphere type bits 19..21 planetary surface properties
855 * (DILYTH,METAL,ARABLE) bit 22 paradise planet flag
856 * (why?) bit 23 cosmic object type (also bit 16) bits
857 * 24..31 currently unallocated (8 bits to play with)
858 *
859 * Asteroids are NYI but here is a draft standard: bits 12,15
860 * acilities (REPAIR,FUEL,SHIPY) bit 20 surface
861 * properties (DILYTH,METAL) other bits currently unallocated
862 *
863 */
864
865 /*
866 * facilities, bits 4..6 and 12..15 valid for planets and asteroids
867 */
868 #define PLREPAIR ((1<<12) | (1<<4)) /* planet can repair ships */
869 #define PLFUEL ((1<<13) | (1<<5)) /* planet has fuel depot */
870 #define PLAGRI ((1<<14) | (1<<6)) /* agricultural thingies built here */
871 #define PLSHIPYARD ((1<<15)) /* planet has a shipyard on it */
872 #define PLORESMASK (0x7<<4) /* mask for original resource flags */
873 #define PLRESSHIFT 12 /* bit to shift right by for resources */
874 #define PLRESMASK (0xF<<PLRESSHIFT) /* to mask off all but resource bits */
875
876 #define PLREDRAW (1<<7) /* Player close for redraw */
877
878 #define PLHOME (1<< 8) /* These 4 flags no longer are */
879 #define PLCOUP (1<< 9) /* used in the server */
880 #define PLCHEAP (1<<10)
881 #define PLCORE (1<<11)
882
883 /* cosmic object types, bits 16, 23, and 24 */
884 #define PLPLANET 0 /* object is a planet */
885 #define PLSTAR (1<<16) /* object is a star */
886 #define PLAST (1<<23) /* object is an asteroid NYI */
887 #define PLNEB ((1<<16)|(1<<23)) /* object is a nebula NYI */
888 #define PLBHOLE (1<<24) /* object is a black hole NYI */
889 #define PLPULSAR ((1<<16)| (1<<24)) /* object is a pulsar NYI */
890 #define PLUK1 ( (1<<23)|(1<<24)) /* future expansion NYI */
891 #define PLWHOLE ((1<<16)|(1<<23)|(1<<24)) /* object is a wormhole */
892 #define PLTYPEMASK ((1<<16)|(1<<23)|(1<<24)) /* mask to extract object
893 * type */
894 #define PL_TYPE(p) ( (p).pl_flags & PLTYPEMASK )
895
896 /*
897 * Atmosphere Types, bits 17 and 18. Valid for planets.
898 */
899 #define PLATSHIFT 17 /* number of right bit shifts for atmos bits */
900 #define PLPOISON (0<<PLATSHIFT) /* poison atmosphere, no army growth */
901 #define PLATYPE3 (1<<PLATSHIFT) /* slightly toxic, very slow army
902 * growth */
903 #define PLATYPE2 (2<<PLATSHIFT) /* thin atmosphere, slow army growth */
904 #define PLATYPE1 (3<<PLATSHIFT) /* normal human atmosphere, normal
905 * growth */
906 #define PLATMASK (0x3<<PLATSHIFT) /* to mask off everything but atmos
907 * bits */
908
909 /*
910 * Surface Properties, bits 19..21 Valid for planets and asteroids.
911 */
912 #define PLBARREN 0 /* rocky barren surface */
913 #define PLSURSHIFT 19 /* number of bit shift to surface */
914 #define PLDILYTH (1<<(PLSURSHIFT+0)) /* dilythium deposits on the planet */
915 #define PLMETAL (1<<(PLSURSHIFT+1)) /* metal deposits on the planet */
916 #define PLARABLE (1<<(PLSURSHIFT+2)) /* planet has farmland */
917 #define PLSURMASK (0x7<<PLSURSHIFT) /* number of surface combinations */
918
919
920 #define PLPARADISE (1<<22) /* Paradise server flag set to 1 for P server */
921
922 #endif
923 /*-------------------------------------------------------------------------*/
924
925
926 /*----------------------T E R R A I N S T R U C T S----------------------*/
927 /* Data */
928 struct t_unit
929 {
930 int alt1; /* alt1, alt2 are currently unused in the
931 * client */
932 int alt2; /* according to MDM (5/16/95) */
933 char types; /* modify the packet code as well if these
934 * are put */
935 }; /* back in, as well as the structs in
936 * packets.h */
937
938 /* Flags */
939 #define T_EMPTY_SPACE 0x00
940 #define T_ASTEROIDS 0x01
941 #define T_NEBULA 0x02
942 #define T_RADIATION 0x04
943 #define T_EXPANSN1 0x08
944 #define T_EXPANSN2 0x10
945 #define T_EXPANSN3 0x20
946 #define T_EXPANSN4 0x40
947 #define T_EXPANSN5 0x80
948
949 /*-------------------------------------------------------------------------*/
950
951
952 /*-----------------------------MESSAGE STRUCTS-----------------------------*/
953
954 struct message
955 {
956 int m_no; /* message number in array of messgs */
957 int m_flags; /* flags for message type */
958 int m_time; /* time message sent???? */
959 int m_recpt; /* who it should be sent to */
960 char m_data[80]; /* the message string */
961 int m_from; /* who it is from */
962 };
963
964 /*
965 * for m_flags field -- lower five bits used for what kind of group the
966 * message is sent to
967 */
968 #define MVALID (1<<0) /* the message is valid--has not been sent */
969 #define MINDIV (1<<1) /* sent to an individual */
970 #define MTEAM (1<<2) /* sent to a team */
971 #define MALL (1<<3) /* sent to eveyone */
972
973 /* order these by importance (0x100 - 0x400) */
974 /*
975 * many of these are not used by the client, so their incorrect value doesn't
976 * matter. however we should note that the packet only has a width of 8 bits
977 * for the type field, and many of these flags are > 8 bits wide --eld
978 */
979
980 #define MGOD ( 1<<4) /* sent to god -- misc.c, socket.c */
981 #define MGENO ( 1<<5) /* genocide message -- conquer.c */
982 #define MCONQ ( 2<<5) /* conquer message -- planets.c */
983 #define MTAKE ( 1<<5) /* planet taken message -- player.c */
984 #define MDEST ( 2<<5) /* planet destroyed message -- player.c */
985 #define MKILLA ( 5<<5) /* a person killed -- dutil.c, snakemove.c */
986 #define MBOMB ( 3<<5) /* bombarding planet -- planets.c */
987 #define MKILLP ( 7<<5) /* a person killed -- NOT USED */
988 #define MKILL ( 8<<5) /* a person killed -- NOT USED */
989 #define MLEAVE ( 9<<5) /* player leaving game message -- main.c */
990 #define MJOIN (10<<5) /* player joining game -- enter.c */
991 #define MGHOST (11<<5) /* player ghostbusted -- daemonII.c */
992 #define MCOUP1 (12<<5) /* a coup occured -- NOT USED */
993 #define MCOUP2 (13<<5) /* -- NOT USED */
994 #define MDISTR (14<<5) /* flag for a distress message */
995 #define MMASK (0xf<<5) /* bits in the flags field should be sent --
996 *
997 /* message control structure */
998 struct mctl
999 { /* used to keep track of position in */
1000 int mc_current; /* array we put our last message */
1001 };
1002
1003 /*-------------------------------------------------------------------------*/
1004
1005
1006
1007 struct rsa_key
1008 {
1009 unsigned char client_type[KEY_SIZE];
1010 unsigned char architecture[KEY_SIZE];
1011 unsigned char global[KEY_SIZE];
1012 unsigned char public[KEY_SIZE];
1013 };
1014
1015
1016 /*
1017 * RCD stuff, from bronco server 2.7pl13.
1018 */
1019 #ifdef RC_DISTRESS
1020 struct distress
1021 {
1022 unsigned char sender;
1023 unsigned char dam, shld, arms, wtmp, etmp, fuelp, sts;
1024 unsigned char wtmpflag, etempflag, cloakflag, distype, macroflag, ttype;
1025 unsigned char close_pl, close_en, target, tclose_pl, tclose_en, pre_app,
1026 i;
1027 unsigned char close_j, close_fr, tclose_j, tclose_fr;
1028 unsigned char cclist[6]; /* CC list */
1029 unsigned char preappend[80]; /* text which we pre- or append */
1030 };
1031
1032 /*
1033 * macro management
1034 */
1035 struct dmacro_list
1036 {
1037 char c;
1038 char *name;
1039 char *macro;
1040 };
1041
1042 /*
1043 * distress types
1044 */
1045 enum dist_type
1046 {
1047 /* help me do series */
1048 take = 1, ogg, bomb, space_control, help1, help2, help3, help4,
1049
1050 /* doing series */
1051 escorting, ogging, bombing, controlling, doing1, doing2, doing3, doing4,
1052
1053 /* other info series */
1054 free_beer, /* player x is totally hosed now */
1055 no_gas, /* player x has no gas */
1056 crippled, /* player x is crippled but may have fuel */
1057 pickup, /* player x picked up armies */
1058 pop, /* there was a pop somewhere */
1059 carrying, /* I am carrying */
1060 other1, other2,
1061
1062 /* just a generic distress call */
1063 generic
1064 };
1065
1066 /*
1067 * targets of messages
1068 */
1069 enum target_type
1070 {
1071 none,
1072 planet,
1073 player
1074 };
1075
1076 /*
1077 * from bronco server2.7pl3
1078 */
1079 /*
1080 * The General distress has format:
1081 *
1082 * A 'E' will do byte1-8 inclusive. Macros can do more but haven't been
1083 * implemented that way yet.
1084 *
1085 * byte1: xxyzzzzz where zzzzz is dist_type, xx is target_type and y is 1 if
1086 * this is a macro and not just a simple distress (a simple distress will
1087 * ONLY send ship info like shields, armies, status, location, etc.)
1088 *
1089 * byte2: 1fff ffff - f = percentage fuel remaining (0-100) byte3: 1ddd dddd - %
1090 * damage byte4: 1sss ssss - % shields remaining byte5: 1eee eeee - % etemp
1091 * byte6: 1www wwww - % wtemp byte7: 100a aaaa - armies carried byte8: (lsb
1092 * of me->p_status) & 0x80 byte9: 1ppp pppp - planet closest to me byte10:
1093 * 1eee eeee - enemy closest to me
1094 *
1095 * Byte 11 and on are only sent if y (from byte 1) is = 1 although even for
1096 * simplest case (y=0) we should send byte14+ = 0x80 and then a null so that
1097 * in future we can send a cc list and pre/append text byte11: 1ttt tttt -
1098 * target (either player number or planet number) byte12: 1ppp pppp - planet
1099 * closest to target byte13: 1eee eeee - enemy closest to target byte14+: cc
1100 * list (each player to cc this message to is 11pp ppp) cc list is terminated
1101 * by 1000 0000 or 0100 0000 ) pre-pend append byte15++: the text to pre
1102 * or append .. depending on termination above. text is null terminated and
1103 * the last thing in this distress
1104 */
1105
1106 #endif /* RCD */
1107
1108 struct command_handler
1109 {
1110 char *command;
1111 int tag;
1112 char *desc;
1113 int (*handler) ();
1114 };
1115
1116 #ifdef VOTING
1117 struct vote_handler
1118 {
1119 char *type;
1120 int tag;
1121 int minpass;
1122 int start;
1123 char *desc;
1124 int frequency;
1125 int (*handler) ();
1126 };
1127
1128 #define VC_ALL 0x0001 /* Majority Vote */
1129 #define VC_TEAM 0x0002 /* Team Vote */
1130 #define VC_GLOG 0x0010 /* Write Votes to God Log */
1131 #define VC_PLAYER 0x0020 /* Each player can be voted on, like eject */
1132
1133
1134 #endif
1135
1136 /*-------------------------SOME CLIENT STRUCTURES--------------------------*/
1137
1138 /* used to tell what planet or player mouse is pointing to */
1139 struct obtype
1140 {
1141 int o_type; /* mouse pointing to a player or planet */
1142 int o_num; /* the player or planet number */
1143 };
1144
1145 /* used in the o_type structure */
1146 #define PLANETTYPE 1 /* mouse on planet */
1147 #define PLAYERTYPE 2 /* mouse on player */
1148
1149
1150 /* used to hold a players rank */
1151 struct rank
1152 {
1153 int genocides; /* minimum number of genocides */
1154 float di; /* minimum destruction inflicted */
1155 float battle; /* minimum battle ratings */
1156 float strategy; /* minimum strategy ratings */
1157 float specship; /* minimum total ratings in a specialty */
1158 /* ship SB + WB + JS */
1159 char *name; /* name of this rank */
1160 };
1161
1162
1163 struct royalty
1164 {
1165 char *name; /* name of rank */
1166 };
1167
1168 /*-------------------------------------------------------------------------*/
1169
1170
1171
1172 #endif
1173
1174 /*---------END OF FILE---------*/