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

« back to all changes in this revision

Viewing changes to planetlist.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2008-09-26 21:44:49 UTC
  • Revision ID: james.westby@ubuntu.com-20080926214449-ylybi4033uv3lz2q
Tags: upstream-3.2.8
ImportĀ upstreamĀ versionĀ 3.2.8

Show diffs side-by-side

added added

removed removed

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