1 #include "config.h"
2 #include "copyright.h"
3
4 #include <stdio.h>
5
6 #include "Wlib.h"
7 #include "defs.h"
8 #include "struct.h"
9 #include "data.h"
10
11 static char *teamname[9] =
12 {
13 "IND",
14 "FED",
15 "ROM",
16 "",
17 "KLI",
18 "",
19 "",
20 "",
21 "ORI"
22 };
23
24 /* * Open a window which contains all the planets and their current *
25 * statistics. Players will not know about planets that their team * has not
26 * orbited. */
27
planetlist(void)28 void planetlist(void)
29 {
30 register int i;
31 register int k = 0;
32 char buf[BUFSIZ];
33 register struct planet *j;
34
35 /* W_ClearWindow(planetw); */
36 (void) sprintf(buf, "Planet Name own armies REPAIR FUEL AGRI CORE info");
37 W_WriteText(planetw, 2, 1, textColor, buf, strlen(buf), W_RegularFont);
38 k = 2;
39 for (i = 0, j = &planets[i]; i < MAXPLANETS; i++, j++)
40 {
41 if (j->pl_info & me->p_team)
42 {
43 (void) sprintf(buf, "%-16s %3s %3d %6s %4s %4s %4s %c%c%c%c",
44 j->pl_name,
45 teamname[j->pl_owner],
46 j->pl_armies,
47 (j->pl_flags & PLREPAIR ? "REPAIR" : " "),
48 (j->pl_flags & PLFUEL ? "FUEL" : " "),
49 (j->pl_flags & PLAGRI ? "AGRI" : " "),
50 (j->pl_flags & PLCORE ? "CORE" : " "),
51 (j->pl_info & FED ? 'F' : ' '),
52 (j->pl_info & ROM ? 'R' : ' '),
53 (j->pl_info & KLI ? 'K' : ' '),
54 (j->pl_info & ORI ? 'O' : ' '));
55 W_WriteText(planetw, 2, k++, planetColor(j), buf, strlen(buf),
56 planetFont(j));
57 }
58 else
59 {
60 (void) sprintf(buf, "%-16s",
61 j->pl_name);
62 W_WriteText(planetw, 2, k++, unColor, buf, strlen(buf),
63 W_RegularFont);
64 }
65 }
66 }
67