~ubuntu-branches/ubuntu/trusty/netrek-client-cow/trusty

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "config.h"
#include "copyright.h"

#include <stdio.h>

#include "Wlib.h"
#include "defs.h"
#include "struct.h"
#include "data.h"

static char *teamname[9] =
{
  "IND",
  "FED",
  "ROM",
  "",
  "KLI",
  "",
  "",
  "",
  "ORI"
};

/* * Open a window which contains all the planets and their current *
 * statistics.  Players will not know about planets that their team * has not
 * orbited. */

void    planetlist(void)
{
  register int i;
  register int k = 0;
  char    buf[BUFSIZ];
  register struct planet *j;

  /* W_ClearWindow(planetw); */
  (void) sprintf(buf, "Planet Name      own armies REPAIR FUEL AGRI CORE info");
  W_WriteText(planetw, 2, 1, textColor, buf, strlen(buf), W_RegularFont);
  k = 2;
  for (i = 0, j = &planets[i]; i < MAXPLANETS; i++, j++)
    {
      if (j->pl_info & me->p_team)
	{
	  (void) sprintf(buf, "%-16s %3s %3d    %6s %4s %4s %4s %c%c%c%c",
			 j->pl_name,
			 teamname[j->pl_owner],
			 j->pl_armies,
			 (j->pl_flags & PLREPAIR ? "REPAIR" : "      "),
			 (j->pl_flags & PLFUEL ? "FUEL" : "    "),
			 (j->pl_flags & PLAGRI ? "AGRI" : "    "),
			 (j->pl_flags & PLCORE ? "CORE" : "    "),
			 (j->pl_info & FED ? 'F' : ' '),
			 (j->pl_info & ROM ? 'R' : ' '),
			 (j->pl_info & KLI ? 'K' : ' '),
			 (j->pl_info & ORI ? 'O' : ' '));
	  W_WriteText(planetw, 2, k++, planetColor(j), buf, strlen(buf),
		      planetFont(j));
	}
      else
	{
	  (void) sprintf(buf, "%-16s",
			 j->pl_name);
	  W_WriteText(planetw, 2, k++, unColor, buf, strlen(buf),
		      W_RegularFont);
	}
    }
}