3
|
1 /* $Id: struct.h,v 1.1.1.1 1997/12/06 05:41:31 darius Exp $ */
|
|
2
|
|
3 /*
|
|
4 * struct.h for the client of an xtrek socket protocol.
|
|
5 *
|
|
6 * Most of the unneeded stuff in the structures has been thrown away.
|
|
7 */
|
|
8
|
|
9 #ifndef struct_h_
|
|
10 #define struct_h_
|
|
11
|
|
12 #include "copyright.h"
|
|
13 #include "Wlib.h"
|
|
14 #include "defs.h"
|
|
15 #include "packets.h"
|
|
16
|
|
17 #ifdef HOCKEY
|
|
18 /* hockey struct [BDyess] */
|
|
19 struct hockeyLine {
|
|
20 int vertical; /* vertical or horizontal flag */
|
|
21 W_Color color;
|
|
22 int pos, end1, end2; /* x or y constant and two endpoints */
|
|
23 };
|
|
24 #endif /*HOCKEY*/
|
|
25
|
|
26 /* ratings struct [BDyess] */
|
|
27 struct ratings {
|
|
28 float r_offrat; /* offense rating */
|
|
29 float r_planetrat; /* planets rating */
|
|
30 float r_bombrat; /* bombing rating */
|
|
31 float r_defrat; /* defense rating */
|
|
32 float r_resrat; /* resource rating */
|
|
33 float r_dooshrat; /* doosh rating */
|
|
34 float r_stratrat; /* strategy rating */
|
|
35 float r_batrat; /* battle rating */
|
|
36 float r_sbrat; /* sb rating */
|
|
37 float r_wbrat; /* wb rating */
|
|
38 float r_jsrat; /* js rating */
|
|
39 int r_jsplanets; /* js planets */
|
|
40 int r_resources; /* total resources bombed */
|
|
41 int r_armies; /* total armies bombed */
|
|
42 int r_planets; /* total planets taken */
|
|
43 int r_dooshes; /* total armies dooshed */
|
|
44 float r_specrat; /* special ship rating */
|
|
45 float r_di; /* damage inflicted */
|
|
46 float r_ratio; /* ratio, kills/losses */
|
|
47 int r_kills; /* kills */
|
|
48 int r_losses; /* losses */
|
|
49 float r_ratings; /* total ratings */
|
|
50 float r_killsPerHour; /* kills/hour */
|
|
51 float r_lossesPerHour; /* losses/hour */
|
|
52 float r_maxkills; /* max kills */
|
|
53 int r_genocides; /* number of genocides */
|
|
54 };
|
|
55
|
|
56 /* messageWindow structure [BDyess] */
|
|
57 struct messageWin {
|
|
58 W_Window window;
|
|
59 int flags;
|
|
60 struct messageNode *head, *curHead;
|
|
61 };
|
|
62
|
|
63 /* stuff yanked from COW-lite for rc_distress [BDyess] */
|
|
64 struct distress {
|
|
65 unsigned char sender;
|
|
66 unsigned char dam, shld, arms, wtmp, etmp, fuelp, sts;
|
|
67 unsigned char wtmpflag, etempflag, cloakflag, distype, macroflag;
|
|
68 unsigned char close_pl, close_en, tclose_pl, tclose_en, pre_app, i;
|
|
69 unsigned char close_j, close_fr, tclose_j, tclose_fr;
|
|
70 unsigned char cclist[6]; /* allow us some day to cc a message up to 5
|
|
71 people */
|
|
72 /* sending this to the server allows the server to do the cc action */
|
|
73 /* otherwise it would have to be the client ... less BW this way */
|
|
74 char preappend[80]; /* text which we pre or append */
|
|
75 };
|
|
76
|
|
77 enum dist_type {
|
|
78 /* help me do series */
|
|
79 take = 1, ogg, bomb, space_control,
|
|
80 save_planet,
|
|
81 base_ogg,
|
|
82 help3, help4,
|
|
83
|
|
84 /* doing series */
|
|
85 escorting, ogging, bombing, controlling,
|
|
86 asw,
|
|
87 asbomb,
|
|
88 doing3, doing4,
|
|
89
|
|
90 /* other info series */
|
|
91 free_beer, /* ie. player x is totally hosed now */
|
|
92 no_gas, /* ie. player x has no gas */
|
|
93 crippled, /* ie. player x is way hurt but may have gas */
|
|
94 pickup, /* player x picked up armies */
|
|
95 pop, /* there was a pop somewhere */
|
|
96 carrying, /* I am carrying */
|
|
97 other1, other2,
|
|
98
|
|
99 /* just a generic distress call */
|
|
100 generic
|
|
101 };
|
|
102
|
|
103 /* The General distress has format:
|
|
104
|
|
105 byte1: 00yzzzzz
|
|
106 where zzzzz is dist_type, and y is 1 if this is a more complicated macro
|
|
107 and not just a simple distress (a simple distress will ONLY send ship
|
|
108 info like shields, armies, status, location, etc.). I guess y=1 can be for !
|
|
109 future expansion.
|
|
110
|
|
111 byte2: 1fff ffff - f = percentage fuel remaining (0-100)
|
|
112 byte3: 1ddd dddd - % damage
|
|
113 byte4: 1sss ssss - % shields remaining
|
|
114 byte5: 1eee eeee - % etemp
|
|
115 byte6: 1www wwww - % wtemp
|
|
116 byte7: 100a aaaa - armies carried
|
|
117 byte8: (lsb of me->p_status) & 0x80
|
|
118 byte9: 1ppp pppp - planet closest to me
|
|
119 byte10: 1eee eeee - enemy closest to me
|
|
120 byte11: 1ppp pppp - planet closest to target
|
|
121 byte12: 1eee eeee - enemy closest to target
|
|
122 byte13: 1ttt tttt - tclose_j
|
|
123 byte14: 1jjj jjjj - close_j
|
|
124 byte15: 1fff ffff - tclose_fr
|
|
125 byte16: 1ccc cccc - close_fr
|
|
126 byte17+: cc list (each player to cc this message to is 11pp ppp)
|
|
127 cc list is terminated by 0x80 (pre-pend) or 0100 0000 (append) )
|
|
128 byte18++: the text to pre or append .. depending on termination above.
|
|
129 text is null terminated and the last thing in this distress
|
|
130 */
|
|
131
|
|
132 struct macro_list {
|
|
133 int type;
|
|
134 char key;
|
|
135 char who;
|
|
136 char *string;
|
|
137 };
|
|
138
|
|
139 struct dmacro_list {
|
|
140 unsigned char c;
|
|
141 char *name;
|
|
142 char *macro;
|
|
143 };
|
|
144 /* end rc_distress stuff [BDyess] */
|
|
145
|
|
146 struct status {
|
|
147 unsigned char tourn; /* Tournament mode? */
|
|
148 /* These stats only updated during tournament mode */
|
|
149 unsigned int armsbomb, planets, kills, losses, time;
|
|
150 /* Use long for this, so it never wraps */
|
|
151 unsigned long timeprod;
|
|
152 };
|
|
153
|
|
154 struct status2 { /* paradise status struct */
|
|
155 int active; /* for interfacing with people who */
|
|
156 unsigned int wait, count; /* want to get into the game */
|
|
157 unsigned int number, request, answer;
|
|
158 unsigned char tourn; /* Tournament mode? */
|
|
159 unsigned long dooshes; /* total number of armies dooshed */
|
|
160 unsigned long armsbomb; /* all t-mode armies bombed */
|
|
161 unsigned long resbomb; /* resources bombed */
|
|
162 unsigned long planets; /* all t-mode planets taken */
|
|
163 unsigned long kills; /* all t-mode kills made */
|
|
164 unsigned long losses; /* all t-mode losses */
|
|
165 unsigned long genocides; /* number of genocides */
|
|
166 unsigned long sbkills; /* total kills in SB's */
|
|
167 unsigned long sblosses; /* total losses in Sb's */
|
|
168 unsigned long sbtime; /* total time in SB's */
|
|
169 unsigned long wbkills; /* kills in warbases */
|
|
170 unsigned long wblosses; /* losses in warbases */
|
|
171 unsigned long wbtime; /* total time played in wb's */
|
|
172 unsigned long jsplanets; /* total planets taken by jump ships */
|
|
173 unsigned long jstime; /* total time in a jump ship */
|
|
174 unsigned long time; /* t-mode time */
|
|
175 unsigned long timeprod; /* t-mode ship ticks--sort of like */
|
|
176 /* manhours in t-mode */
|
|
177 int gameup; /* is game up */
|
|
178 unsigned long clock; /* clock for planet info timestamp */
|
|
179 };
|
|
180
|
|
181
|
|
182 #ifdef METASERVER
|
|
183 /* metaserver window struct */
|
|
184 struct servers {
|
|
185 char address[LINE];
|
|
186 int port;
|
|
187 int time;
|
|
188 int players;
|
|
189 int status;
|
|
190 int RSA_client;
|
|
191 char typeflag;
|
|
192 char hilited;
|
|
193 };
|
|
194 #endif /* METASERVER */
|
|
195
|
|
196 /* MOTD structures */
|
|
197 struct piclist {
|
|
198 int page;
|
|
199 W_Icon thepic;
|
|
200 int x, y;
|
|
201 int width, height;
|
|
202 struct piclist *next;
|
|
203 };
|
|
204 struct page {
|
|
205 struct list *text;
|
|
206 struct page *next;
|
|
207 struct page *prev;
|
|
208 int first;
|
|
209 int page;
|
|
210 };
|
|
211
|
|
212 #define PFREE 0
|
|
213 #define POUTFIT 1
|
|
214 #define PALIVE 2
|
|
215 #define PEXPLODE 3
|
|
216 #define PDEAD 4
|
|
217 #define PTQUEUE 5
|
|
218 #define POBSERVE 6
|
|
219
|
|
220 #define PFSHIELD (1<< 0) /* shields are raised */
|
|
221 #define PFREPAIR (1<< 1) /* player in repair mode */
|
|
222 #define PFBOMB (1<< 2) /* player is bombing */
|
|
223 #define PFORBIT (1<< 3) /* player is orbiting */
|
|
224 #define PFCLOAK (1<< 4) /* player is cloaked */
|
|
225 #define PFWEP (1<< 5) /* player is weapon temped */
|
|
226 #define PFENG (1<< 6) /* player is engine temped */
|
|
227 #define PFROBOT (1<< 7) /* player is a robot */
|
|
228 #define PFBEAMUP (1<< 8) /* player is beaming up */
|
|
229 #define PFBEAMDOWN (1<< 9) /* player is beaming down */
|
|
230 #define PFSELFDEST (1<<10) /* player is self destructing */
|
|
231 #define PFGREEN (1<<11) /* player at green alert */
|
|
232 #define PFYELLOW (1<<12) /* player is at yellow alert */
|
|
233 #define PFRED (1<<13) /* player is at red alert */
|
|
234 #define PFPLOCK (1<<14) /* Locked on a player */
|
|
235 #define PFPLLOCK (1<<15) /* Locked on a planet */
|
|
236 #define PFCOPILOT (1<<16) /* Allow copilots */
|
|
237 #define PFWAR (1<<17) /* computer reprogramming for war */
|
|
238 #define PFPRACTR (1<<18) /* practice type robot (no kills) */
|
|
239 #define PFDOCK (1<<19) /* true if docked to a starbase */
|
|
240 #define PFREFIT (1<<20) /* true if about to refit */
|
|
241 #define PFREFITTING (1<<21) /* true if currently refitting */
|
|
242 #define PFTRACT (1<<22) /* tractor beam activated */
|
|
243 #define PFPRESS (1<<23) /* pressor beam activated */
|
|
244 #define PFDOCKOK (1<<24) /* docking permission */
|
|
245 #define PFSEEN (1<<25) /* seen by enemy on galactic map? */
|
|
246 #define PFWARPPREP (1<<26) /* in warp prep [BDyess] */
|
|
247 #define PFWARP (1<<27) /* ship warping */
|
|
248 #define PFAFTER (1<<28) /* after burners on */
|
|
249 #define PFWPSUSPENDED (1<<29) /* warp prep suspended [BDyess] */
|
|
250 #define PFSNAKE (1<<30) /* it's a space snake */
|
|
251 #define PFBIRD (1<<31) /* it's a space bird */
|
|
252
|
|
253 enum why_dead {
|
|
254 KNOREASON, KQUIT, KTORP, KPHASER, KPLANET,
|
|
255 KSHIP, KDAEMON, KWINNER, KGHOST, KGENOCIDE,
|
|
256 KPROVIDENCE, KPLASMA, KTOURNEND, KOVER, KTOURNSTART,
|
|
257 KBADBIN, KMISSILE, KASTEROID
|
|
258 };
|
|
259
|
|
260 #define DEFAULT -1
|
|
261 #define SCOUT 0
|
|
262 #define DESTROYER 1
|
|
263 #define CRUISER 2
|
|
264 #define BATTLESHIP 3
|
|
265 #define ASSAULT 4
|
|
266 #define STARBASE 5
|
|
267 #define ATT 6
|
|
268 #define GALAXY 6 /* galaxy ships now supported - they look
|
|
269 extremely similar to flagships :) [BDyess] */
|
|
270 #define JUMPSHIP 7
|
|
271 #define FLAGSHIP 8
|
|
272 #define WARBASE 9
|
|
273 #define LIGHTCRUISER 10
|
|
274 #define CARRIER 11
|
|
275 #define UTILITY 12
|
|
276 #define PATROL 13
|
|
277 #define PUCK 14
|
|
278 /*#define NUM_TYPES 14*/
|
|
279
|
|
280 struct shiplist {
|
|
281 struct ship *ship;
|
|
282 struct shiplist *prev, *next;
|
|
283 };
|
|
284
|
|
285 struct ship {
|
|
286 int s_phaserrange;
|
|
287 int s_maxspeed;
|
|
288 int s_maxfuel;
|
|
289 int s_maxshield;
|
|
290 int s_maxdamage;
|
|
291 int s_maxegntemp;
|
|
292 int s_maxwpntemp;
|
|
293 short s_maxarmies;
|
|
294 short s_type;
|
|
295 int s_torpspeed;
|
|
296 char s_letter;
|
|
297 /* char s_name[16]; */
|
|
298 char s_desig[2];
|
|
299 short s_bitmap;
|
|
300 unsigned char s_keymap[256];
|
|
301 unsigned char s_buttonmap[12];
|
|
302 };
|
|
303
|
|
304 struct ship_shape {
|
|
305 int nviews;
|
|
306 W_Icon *bmap;
|
|
307 W_Icon shield;
|
|
308 int width, height;
|
|
309 };
|
|
310
|
|
311 struct stats {
|
|
312 double st_maxkills; /* max kills ever */
|
|
313 int st_kills; /* how many kills */
|
|
314 int st_losses; /* times killed */
|
|
315 int st_armsbomb; /* armies bombed */
|
|
316 int st_planets; /* planets conquered */
|
|
317 int st_ticks; /* Ticks I've been in game */
|
|
318 int st_tkills; /* Kills in tournament play */
|
|
319 int st_tlosses; /* Losses in tournament play */
|
|
320 int st_tarmsbomb; /* Tournament armies bombed */
|
|
321 int st_tplanets; /* Tournament planets conquered */
|
|
322 int st_tticks; /* Tournament ticks */
|
|
323 /* SB stats are entirely separate */
|
|
324 int st_sbkills; /* Kills as starbase */
|
|
325 int st_sblosses; /* Losses as starbase */
|
|
326 int st_sbticks; /* Time as starbase */
|
|
327 double st_sbmaxkills; /* Max kills as starbase */
|
|
328 long st_lastlogin; /* Last time this player was played */
|
|
329 int st_flags; /* Misc option flags */
|
|
330 #if 0
|
|
331 unsigned char st_keymap[256]; /* keymap for this player */
|
|
332 #endif
|
|
333 int st_rank; /* Ranking of the player */
|
|
334 };
|
|
335
|
|
336
|
|
337 struct stats2 { /* paradise stats */
|
|
338 int st_genocides; /* number of genocides participated in */
|
|
339 float st_tmaxkills; /* max kills ever */
|
|
340 float st_di; /* total destruction inflicted for all time */
|
|
341 int st_tkills; /* Kills in tournament play */
|
|
342 int st_tlosses; /* Losses in tournament play */
|
|
343 int st_tarmsbomb; /* Tournament armies bombed */
|
|
344 int st_tresbomb; /* resources bombed off */
|
|
345 int st_tdooshes; /* armies killed while being carried */
|
|
346 int st_tplanets; /* Tournament planets conquered */
|
|
347 int st_tticks; /* Tournament ticks */
|
|
348 /* SB/WB/JS stats are entirely separate */
|
|
349 int st_sbkills; /* Kills as starbase */
|
|
350 int st_sblosses; /* Losses as starbase */
|
|
351 int st_sbticks; /* Time as starbase */
|
|
352 float st_sbmaxkills; /* Max kills as starbase */
|
|
353 int st_wbkills; /* Kills as warbase */
|
|
354 int st_wblosses; /* Losses as warbase */
|
|
355 int st_wbticks; /* Time as warbase */
|
|
356 float st_wbmaxkills; /* Max kills as warbase */
|
|
357 int st_jsplanets; /* planets assisted with in JS */
|
|
358 int st_jsticks; /* ticks played as a JS */
|
|
359 long st_lastlogin; /* Last time this player was played */
|
|
360 int st_flags; /* Misc option flags */
|
|
361 unsigned char st_keymap[256]; /* keymap for this player */
|
|
362 int st_rank; /* Ranking of the player */
|
|
363 int st_royal; /* royaly, specialty, rank */
|
|
364 };
|
|
365
|
|
366 #define ST_NOBITMAPS (1<<0)
|
|
367 #define ST_KEEPPEACE (1<<3)
|
|
368
|
|
369 struct player {
|
|
370 int p_no;
|
|
371 int p_updates; /* Number of updates ship has survived */
|
|
372 int p_status; /* Player status */
|
|
373 unsigned int p_flags; /* Player flags */
|
|
374 char p_name[16];
|
|
375 char p_login[16];
|
|
376 char p_monitor[16]; /* Monitor being played on */
|
|
377 char p_mapchars[2]; /* Cache for map window image */
|
|
378 struct ship *p_ship; /* Personal ship statistics */
|
|
379 int p_x;
|
|
380 int p_y;
|
|
381 unsigned char p_dir; /* Real direction */
|
|
382 unsigned char p_desdir; /* desired direction */
|
|
383 int p_subdir; /* fraction direction change */
|
|
384 int p_speed; /* Real speed */
|
|
385 short p_desspeed; /* Desired speed */
|
|
386 int p_subspeed; /* Fractional speed */
|
|
387 short p_teami; /* Team I'm on */
|
|
388 int p_damage; /* Current damage */
|
|
389 int p_subdamage; /* Fractional damage repair */
|
|
390 int p_shield; /* Current shield power */
|
|
391 int p_subshield; /* Fractional shield recharge */
|
|
392 short p_cloakphase; /* Drawing stage of cloaking
|
|
393 engage/disengage. */
|
|
394 short p_ntorp; /* Number of torps flying */
|
|
395 short p_ndrone; /* Number of drones .. why was this missing? */
|
|
396 short p_totmissiles; /* number of total missiles [Bill Dyess] */
|
|
397 short p_nplasmatorp; /* Number of plasma torps active */
|
|
398 char p_hostile; /* Who my torps will hurt */
|
|
399 char p_swar; /* Who am I at sticky war with */
|
|
400 float p_kills; /* Enemies killed */
|
|
401 short p_planet; /* Planet orbiting or locked onto */
|
|
402 short p_playerl; /* Player locked onto */
|
|
403 #ifdef ARMY_SLIDER
|
|
404 int p_armies; /* XXX: for stats */
|
|
405 #else
|
|
406 short p_armies;
|
|
407 #endif /* ARMY_SLIDER */
|
|
408 int p_fuel;
|
|
409 short p_explode; /* Keeps track of final explosion */
|
|
410 int p_etemp;
|
|
411 short p_etime;
|
|
412 int p_wtemp;
|
|
413 short p_wtime;
|
|
414 short p_whydead; /* Tells you why you died */
|
|
415 short p_whodead; /* Tells you who killed you */
|
|
416 struct stats p_stats; /* player statistics */
|
|
417 struct stats2 p_stats2; /* Paradise stats */
|
|
418 short p_genoplanets; /* planets taken since last genocide */
|
|
419 short p_genoarmsbomb; /* armies bombed since last genocide */
|
|
420 short p_planets; /* planets taken this game */
|
|
421 short p_armsbomb; /* armies bombed this game */
|
|
422 int p_docked; /* If starbase, # docked to, else pno base
|
|
423 host */
|
|
424 int p_port[4]; /* If starbase, pno of ship docked to that
|
|
425 port, else p_port[0] = port # docked to on
|
|
426 host. */
|
|
427 short p_tractor; /* What player is in tractor lock */
|
|
428 int p_pos; /* My position in the player file */
|
|
429 };
|
|
430
|
|
431 struct statentry {
|
|
432 char name[16], password[16];
|
|
433 struct stats stats;
|
|
434 };
|
|
435
|
|
436 /* Torpedo states */
|
|
437
|
|
438 #define TFREE 0
|
|
439 #define TMOVE 1
|
|
440 #define TEXPLODE 2
|
|
441 #define TDET 3
|
|
442 #define TOFF 4
|
|
443 #define TSTRAIGHT 5 /* Non-wobbling torp */
|
|
444
|
|
445 struct torp {
|
|
446 int t_no;
|
|
447 int t_status; /* State information */
|
|
448 int t_owner;
|
|
449 int t_x;
|
|
450 int t_y;
|
|
451 unsigned char t_dir; /* direction */
|
|
452 short t_turns; /* rate of change of direction if tracking */
|
|
453 int t_damage; /* damage for direct hit */
|
|
454 int t_speed; /* Moving speed */
|
|
455 int t_fuse; /* Life left in current state */
|
|
456 char t_war; /* enemies */
|
|
457 char t_team; /* launching team */
|
|
458 char t_whodet; /* who detonated... */
|
|
459 char frame; /* frame of animation [BDyess] */
|
|
460 };
|
|
461
|
|
462 struct thingy {
|
|
463 int t_no;
|
|
464 int t_shape; /* State information */
|
|
465 int t_owner;
|
|
466 int t_x;
|
|
467 int t_y;
|
|
468 unsigned char t_dir; /* direction */
|
|
469 int t_speed; /* Moving speed */
|
|
470 int t_fuse; /* Life left in current state */
|
|
471 char t_war; /* enemies */
|
|
472 };
|
|
473
|
|
474 /* Plasma Torpedo states */
|
|
475
|
|
476 #define PTFREE 0
|
|
477 #define PTMOVE 1
|
|
478 #define PTEXPLODE 2
|
|
479 #define PTDET 3
|
|
480
|
|
481 struct plasmatorp {
|
|
482 int pt_no;
|
|
483 int pt_status; /* State information */
|
|
484 int pt_owner;
|
|
485 int pt_x;
|
|
486 int pt_y;
|
|
487 unsigned char pt_dir; /* direction */
|
|
488 short pt_turns; /* ticks turned per cycle */
|
|
489 int pt_damage; /* damage for direct hit */
|
|
490 int pt_speed; /* Moving speed */
|
|
491 int pt_fuse; /* Life left in current state */
|
|
492 char pt_war; /* enemies */
|
|
493 char pt_team; /* launching team */
|
|
494 };
|
|
495
|
|
496 #define PHFREE 0x00
|
|
497 #define PHHIT 0x01 /* When it hits a person */
|
|
498 #define PHMISS 0x02
|
|
499 #define PHHIT2 0x04 /* When it hits a photon */
|
|
500 #ifdef CHECK_DROPPED
|
|
501 #define PHGHOST 0x80 /* fuse has exceeded longest received so far */
|
|
502 #endif
|
|
503 struct phaser {
|
|
504 int ph_status; /* What it's up to */
|
|
505 unsigned char ph_dir; /* direction */
|
|
506 int ph_target; /* Who's being hit (for drawing) */
|
|
507 int ph_x, ph_y; /* For when it hits a torp */
|
|
508 int ph_fuse; /* Life left for drawing */
|
|
509 int ph_damage; /* Damage inflicted on victim */
|
|
510 };
|
|
511
|
|
512 /* An important note concerning planets: The game assumes that
|
|
513 the planets are in a 'known' order. Ten planets per team,
|
|
514 the first being the home planet.
|
|
515 */
|
|
516
|
|
517 /* defines for the pl_flags field of planet struct */
|
|
518
|
|
519 /*
|
|
520 pl_flags is an int of 32 bits:
|
|
521
|
|
522 bits 16 and 23 currently define the type of the planet. The
|
|
523 interpretation of the other bits is dependent upon the planet
|
|
524 type.
|
|
525
|
|
526 Here is the interpretation for a planet
|
|
527 bits 0..3 unknown
|
|
528 bits 4..6 planetary facilities (REPAIR,FUEL,AGRI)
|
|
529 bit 7 redraw (archaic, recyclable?)
|
|
530 bits 8..11 old flags (archaic, recyclable?)
|
|
531 bits 12..15 paradise planetary facilities
|
|
532 (REPAIR,FUEL,AGRI,SHIPY)
|
|
533 bit 16 cosmic object type (also bit 23)
|
|
534 bits 17,18 planet atmosphere type
|
|
535 bits 19..21 planetary surface properties
|
|
536 (DILYTH,METAL,ARABLE)
|
|
537 bit 22 paradise planet flag (why?)
|
|
538 bit 23 cosmic object type (also bit 16)
|
|
539 bits 24..31 currently unallocated (8 bits to play with)
|
|
540
|
|
541 Asteroids are NYI but here is a draft standard:
|
|
542 bits 12,15 facilities
|
|
543 (REPAIR,FUEL,SHIPY)
|
|
544 bit 20 surface properties
|
|
545 (DILYTH,METAL)
|
|
546 other bits currently unallocated
|
|
547
|
|
548 */
|
|
549
|
|
550 /* facilities, bits 4..6 and 12..15
|
|
551 valid for planets and asteroids */
|
|
552 #define PLREPAIR ((1<<12) | (1<<4)) /* planet can repair ships */
|
|
553 #define PLFUEL ((1<<13) | (1<<5)) /* planet has fuel depot */
|
|
554 #define PLAGRI ((1<<14) | (1<<6)) /* agricultural thingies built here */
|
|
555 #define PLSHIPYARD ((1<<15)) /* planet has a shipyard on it */
|
|
556 #define PLORESMASK (0x7<<4) /* mask for original resource flags */
|
|
557 #define PLRESSHIFT 12 /* bit to shift right by for resources */
|
|
558 #define PLRESMASK (0xF<<PLRESSHIFT) /* to mask off all but resource bits */
|
|
559
|
|
560 #define PLREDRAW (1<<7) /* Player close for redraw */
|
|
561
|
|
562 #define PLHOME (1<< 8) /* These 4 flags no longer are */
|
|
563 #define PLCOUP (1<< 9) /* used in the server */
|
|
564 #define PLCHEAP (1<<10)
|
|
565 #define PLCORE (1<<11)
|
|
566
|
|
567 /* cosmic object types, bits 16 and 23, and 24 */
|
|
568 #define PLPLANET 0 /* object is a planet */
|
|
569 #define PLSTAR (1<<16) /* object is a star */
|
|
570 #define PLAST (1<<23) /* object is an asteroid NYI */
|
|
571 #define PLNEB ((1<<16)|(1<<23)) /* object is a nebula NYI */
|
|
572 #define PLBHOLE (1<<24) /* object is a black hole NYI */
|
|
573 #define PLPULSAR ((1<<16)|(1<<24)) /* object is a pulsar NYI */
|
|
574 #define PLUK1 ((1<<23)|(1<<24)) /* future expansion */
|
|
575 #define PLWHOLE ((1<<16)|(1<<23)|(1<<24)) /* object is a wormhole */
|
|
576 #define PLTYPEMASK ((1<<16)|(1<<23)|(1<<24)) /* mask to extract object
|
|
577 type */
|
|
578 #define PL_TYPE(p) ( (p).pl_flags & PLTYPEMASK )
|
|
579
|
|
580 /* Atmosphere Types, bits 17 and 18.
|
|
581 Valid for planets.
|
|
582 */
|
|
583 #define PLATSHIFT 17 /* number of right bit shifts for atmos bits */
|
|
584 #define PLPOISON (0<<PLATSHIFT) /* poison atmosphere, no army growth */
|
|
585 #define PLATYPE3 (1<<PLATSHIFT) /* slightly toxic, very slow army
|
|
586 growth */
|
|
587 #define PLATYPE2 (2<<PLATSHIFT) /* thin atmosphere, slow army growth */
|
|
588 #define PLATYPE1 (3<<PLATSHIFT) /* normal human atmosphere, normal
|
|
589 growth */
|
|
590 #define PLATMASK (0x3<<PLATSHIFT) /* to mask off everything but atmos
|
|
591 bits */
|
|
592
|
|
593 /* Surface Properties, bits 19..21
|
|
594 Valid for planets and asteroids.
|
|
595 */
|
|
596 #define PLBARREN 0 /* rocky barren surface */
|
|
597 #define PLSURSHIFT 19 /* number of bit shift to surface */
|
|
598 #define PLDILYTH (1<<(PLSURSHIFT+0)) /* dilythium deposits on the planet */
|
|
599 #define PLMETAL (1<<(PLSURSHIFT+1)) /* metal deposits on the planet */
|
|
600 #define PLARABLE (1<<(PLSURSHIFT+2)) /* planet has farmland */
|
|
601 #define PLSURMASK (0x7<<PLSURSHIFT) /* number of surface combinations */
|
|
602
|
|
603
|
|
604 #define PLPARADISE (1<<22) /* Paradise server flag set to 1 for P server */
|
|
605
|
|
606
|
|
607 struct planet {
|
|
608 int pl_no;
|
|
609 int pl_flags; /* State information */
|
|
610 int pl_owner;
|
|
611 int pl_x;
|
|
612 int pl_y;
|
|
613 char pl_name[16];
|
|
614 int pl_namelen; /* Cuts back on strlen's */
|
|
615 int pl_armies;
|
|
616 int pl_info; /* Teams which have info on planets */
|
|
617 int pl_deadtime; /* Time before planet will support life */
|
|
618 int pl_couptime; /* Time before coup may take place */
|
|
619 int pl_timestamp; /* time the info was taken */
|
|
620 };
|
|
621
|
|
622 struct t_unit {
|
|
623 /* int alt1;*/
|
|
624 /* int alt2;*/ /* Terrain types. */
|
|
625 char types;
|
|
626 };
|
|
627
|
|
628 /* Terrain types */
|
|
629 #define T_EMPTY_SPACE 0x00
|
|
630 #define T_ASTEROIDS 0x01
|
|
631 #define T_NEBULA 0x02
|
|
632 #define T_RADIATION 0x04
|
|
633 #define T_EXPANSN1 0x08
|
|
634 #define T_EXPANSN2 0x10
|
|
635 #define T_EXPANSN3 0x20
|
|
636 #define T_EXPANSN4 0x40
|
|
637 #define T_EXPANSN5 0x80
|
|
638
|
|
639 struct _clearzone {
|
|
640 int x, y;
|
|
641 int width, height;
|
|
642 };
|
|
643
|
|
644 #ifndef SHORT_PACKETS
|
|
645 #define MVALID 0x01
|
|
646 #define MINDIV 0x02
|
|
647 #define MTEAM 0x04
|
|
648 #define MALL 0x08
|
|
649 #define MGOD 0x10
|
|
650 #define MCAST 0x18 /* not an offial packet type. only */
|
|
651 /* used in smessage to stay orthogonal */
|
|
652 #else
|
|
653 #define MVALID 0x01
|
|
654 #define MGOD 0x10
|
|
655 #define MMOO 0x12
|
|
656
|
|
657 #ifdef TOOLS
|
|
658 #define MTOOLS 0x14
|
|
659 #endif
|
|
660
|
|
661 /* order flags by importance (0x100 - 0x400) */
|
|
662 /* restructuring of message flags to squeeze them all into 1 byte - jmn */
|
|
663 /* hopefully quasi-back-compatible:
|
|
664 MVALID, MINDIV, MTEAM, MALL, MGOD use up 5 bits. this leaves us 3 bits.
|
|
665 since the server only checks for those flags when deciding message
|
|
666 related things and since each of the above cases only has 1 flag on at
|
|
667 a time we can overlap the meanings of the flags */
|
|
668
|
|
669 #define MINDIV 0x02
|
|
670 /* these go with MINDIV flag */
|
|
671 #ifdef STDBG
|
|
672 #define MDBG 0x20
|
|
673 #endif
|
|
674 #define MCONFIG 0x40 /* config messages from server */
|
|
675 #define MDIST 0x60 /* flag distress messages - client thing
|
|
676 really but stick it in here for
|
|
677 consistency */
|
|
678 #define MCAST 0x18 /* not an offial packet type. only */
|
|
679 /* used in smessage.c to stay orthogonal */
|
|
680
|
|
681 #define MTEAM 0x04
|
|
682 /* these go with MTEAM flag */
|
|
683 #define MTAKE 0x20
|
|
684 #define MDEST 0x40
|
|
685 #define MBOMB 0x60
|
|
686 #define MCOUP1 0x80
|
|
687 #define MCOUP2 0xA0
|
|
688 #define MDISTR 0xC0
|
|
689
|
|
690 #define MALL 0x08
|
|
691 /* these go with MALL flag */
|
|
692 #define MGENO 0x20 /* MGENO is not used in INL server but
|
|
693 belongs here */
|
|
694 #define MCONQ 0x20 /* not enought bits to distinguish
|
|
695 MCONQ/MGENO :-( */
|
|
696 #define MKILLA 0x40
|
|
697 #define MKILLP 0x60
|
|
698 #define MKILL 0x80
|
|
699 #define MLEAVE 0xA0
|
|
700 #define MJOIN 0xC0
|
|
701 #define MGHOST 0xE0
|
|
702 /* MMASK not used in INL server */
|
|
703
|
|
704 /* to flag multi-line macros */
|
|
705 #define MMACRO 0x80
|
|
706
|
|
707 #define MWHOMSK 0x1f /* mask with this to find who msg to */
|
|
708 #define MWHATMSK 0xe0 /* mask with this to find what message about */
|
|
709
|
|
710 /* old flags...
|
|
711 #define MVALID 0x01
|
|
712 #define MINDIV 0x02
|
|
713 #define MTEAM 0x04
|
|
714 #define MALL 0x08
|
|
715 #define MGOD 0x10
|
|
716
|
|
717 #define MGENO 0x100 order these by importance (0x100 - 0x400)
|
|
718 #define MCONQ 0x110
|
|
719 #define MTAKE 0x120
|
|
720 #define MDEST 0x130
|
|
721 #define MKILLA 0x200
|
|
722 #define MBOMB 0x210
|
|
723 #define MKILLP 0x220
|
|
724 #define MKILL 0x230
|
|
725 #define MLEAVE 0x300
|
|
726 #define MJOIN 0x310
|
|
727 #define MGHOST 0x320
|
|
728 #define MCOUP1 0x330
|
|
729 #define MCOUP2 0x340 end of old flags */
|
|
730 #endif
|
|
731
|
|
732 struct message {
|
|
733 int m_no;
|
|
734 int m_flags;
|
|
735 int m_time;
|
|
736 int m_recpt;
|
|
737 char m_data[80];
|
|
738 };
|
|
739
|
|
740 /* message control structure */
|
|
741
|
|
742 struct mctl {
|
|
743 int mc_current;
|
|
744 };
|
|
745
|
|
746 /* This is a structure used for objects returned by mouse pointing */
|
|
747
|
|
748 #define PLANETTYPE 0x1
|
|
749 #define PLAYERTYPE 0x2
|
|
750
|
|
751 struct obtype {
|
|
752 int o_type;
|
|
753 int o_num;
|
|
754 };
|
|
755
|
|
756 struct id {
|
|
757 char *name;
|
|
758 int team;
|
|
759 int number;
|
|
760 int type;
|
|
761 char mapstring[4];
|
|
762 };
|
|
763
|
|
764 struct rank {
|
|
765 float hours, ratings, defense;
|
|
766 char *name;
|
|
767 };
|
|
768
|
|
769 struct rank2 { /* Paradise ranks */
|
|
770 int genocides; /* minimum number of genocides */
|
|
771 float di; /* minimum destruction inflicted */
|
|
772 float battle; /* minimum battle ratings */
|
|
773 float strategy; /* minimum strategy ratings */
|
|
774 float specship; /* minimum total ratings in a specialty */
|
|
775 /* ship SB + WB + JS */
|
|
776 char *name; /* name of this rank */
|
|
777 };
|
|
778
|
|
779
|
|
780 struct royalty { /* Paradise royalty ranks */
|
|
781 char *name; /* name of rank */
|
|
782 };
|
|
783
|
|
784 struct plupdate {
|
|
785
|
|
786 int plu_update;
|
|
787 int plu_x, plu_y;
|
|
788 };
|
|
789
|
|
790 #ifdef MACROS
|
|
791 #define MACSINGLE 1
|
|
792 #define MACRCD 2
|
|
793 #define MACMULTI 4
|
|
794 struct macro {
|
|
795 char flags; /* WAS isSingleMacro; now, uses above flags */
|
|
796 INT8 to; /* if to team, rom, etc put here or -1 */
|
|
797 char specialto; /* player nearest mouse, etc here */
|
|
798 struct macro *next; /* for multi-line macros, points to a struct
|
|
799 *distress if MACRCD flag set. -JR */
|
|
800 char *string; /* string to be sent, % escapes intact */
|
|
801 };
|
|
802 #endif /* MACROS */
|
|
803
|
|
804 struct stringlist {
|
|
805 char *string;
|
|
806 char *value;
|
|
807 struct stringlist *next, *prev;
|
|
808 int searched;
|
|
809 };
|
|
810 #endif
|