]> git.pond.sub.org Git - empserver/blob - src/lib/commands/star.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / commands / star.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See files README, COPYING and CREDITS in the root of the source
23  *  tree for related information and legal notices.  It is expected
24  *  that future projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  star.c: Start a sector producing
29  * 
30  *  Known contributors to this file:
31  *     Thomas Ruschak, 1992
32  *     Steve McClure, 1998
33  */
34
35 #include <config.h>
36
37 #include "misc.h"
38 #include "player.h"
39 #include "xy.h"
40 #include "sect.h"
41 #include "nsc.h"
42 #include "nat.h"
43 #include "path.h"
44 #include "file.h"
45 #include "commands.h"
46
47 static void start_hdr(void);
48
49 int
50 start(void)
51 {
52     struct sctstr sect;
53     int nsect;
54     struct nstr_sect nstr;
55
56     if (!snxtsct(&nstr, player->argp[1]))
57         return RET_SYN;
58     prdate();
59     nsect = 0;
60     while (nxtsct(&nstr, &sect)) {
61         if (!player->owner)
62             continue;
63         if (nsect++ == 0)
64             start_hdr();
65         if (player->god)
66             pr("%3d ", sect.sct_own);
67         prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
68         pr(" %c", dchr[sect.sct_type].d_mnem);
69         if (sect.sct_newtype != sect.sct_type)
70             pr("%c", dchr[sect.sct_newtype].d_mnem);
71         else
72             pr(" ");
73         pr("%4d%%", sect.sct_effic);
74
75         pr(" will be updated normally.\n");
76         if (sect.sct_off != 0) {
77             sect.sct_off = 0;
78             putsect(&sect);
79         }
80     }
81     if (nsect == 0) {
82         if (player->argp[1])
83             pr("%s: No sector(s)\n", player->argp[1]);
84         else
85             pr("%s: No sector(s)\n", "");
86         return RET_FAIL;
87     } else
88         pr("%d sector%s\n", nsect, splur(nsect));
89     return 0;
90 }
91
92 static void
93 start_hdr(void)
94 {
95     if (player->god)
96         pr("    ");
97     pr("PRODUCTION STARTING\n");
98     if (player->god)
99         pr("own ");
100     pr("  sect        eff\n");
101 }