2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure, Markus Armbruster
6 * Empire 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 3 of the License, or
9 * (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * See files README, COPYING and CREDITS in the root of the source
22 * tree for related information and legal notices. It is expected
23 * that future projects/authors will amend these files as needed.
27 * setsect.c: Give resources to a country
29 * Known contributors to this file:
43 * format: setres thing <sect> <#>
52 struct nstr_sect nstr;
56 what = getstarg(player->argp[1],
57 "Give what (iron, gold, oil, uranium, fertility, owner, eff., mob., work, avail., oldown, mines)? ",
64 if (!snxtsct(&nstr, player->argp[2]))
66 while (nxtsct(&nstr, §) > 0) {
67 p = getstarg(player->argp[3], "What value : ", buf);
74 current = sect.sct_min;
80 if (sect.sct_own != 0)
81 resnoise(§, 1, "Iron ore content",
82 (int)sect.sct_min, current);
83 sect.sct_min = (unsigned char)current;
86 current = sect.sct_gmin;
92 if (sect.sct_own != 0)
93 resnoise(§, 1, "Gold content",
94 (int)sect.sct_gmin, current);
95 sect.sct_gmin = (unsigned char)current;
100 current = sect.sct_oil;
106 if (sect.sct_own != 0)
107 resnoise(§, 1, "Oil content",
108 (int)sect.sct_oil, current);
109 sect.sct_oil = (unsigned char)current;
112 if ((amt < 0) || (amt > MAXNOC - 1))
114 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
115 xyas(sect.sct_x, sect.sct_y, player->cnum),
116 cname(sect.sct_own), sect.sct_own, cname(amt), amt);
118 wu(player->cnum, sect.sct_own,
119 "Sector %s lost to deity intervention\n",
120 xyas(sect.sct_x, sect.sct_y, sect.sct_own));
123 wu(player->cnum, amt,
124 "Sector %s gained from deity intervention\n",
125 xyas(sect.sct_x, sect.sct_y, amt));
126 sect.sct_own = (natid)amt;
129 if ((amt < 0) || (amt > MAXNOC - 1))
131 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
132 xyas(sect.sct_x, sect.sct_y, player->cnum),
133 cname(sect.sct_oldown),
134 sect.sct_oldown, cname(amt), amt);
135 sect.sct_oldown = (natid)amt;
143 current = sect.sct_effic;
149 pr("Efficiency in %s changed to %d.\n",
150 xyas(sect.sct_x, sect.sct_y, player->cnum), current);
151 sect.sct_effic = current;
156 current = sect.sct_mines;
160 if (current > MINES_MAX)
162 if (sect.sct_own != 0)
163 resnoise(§, 1, "Mines", sect.sct_mines, current);
164 sect.sct_mines = current;
167 current = sect.sct_mobil;
173 pr("Mobility in %s changed to %d.\n",
174 xyas(sect.sct_x, sect.sct_y, player->cnum), current);
175 sect.sct_mobil = current;
183 current = sect.sct_avail;
189 pr("Available in %s changed to %d.\n",
190 xyas(sect.sct_x, sect.sct_y, player->cnum), current);
191 sect.sct_avail = (short)current;
194 current = sect.sct_work;
200 pr("Work in %s changed to %d.\n",
201 xyas(sect.sct_x, sect.sct_y, player->cnum), current);
202 sect.sct_work = (unsigned char)current;
205 current = sect.sct_fertil;
211 if (sect.sct_own != 0)
212 resnoise(§, 1, "Fertility content",
213 (int)sect.sct_fertil, current);
214 sect.sct_fertil = (unsigned char)current;
217 current = sect.sct_uran;
223 if (sect.sct_own != 0)
224 resnoise(§, 1, "Uranium content",
225 (int)sect.sct_uran, current);
226 sect.sct_uran = (unsigned char)current;
238 resbenefit(natid who, int good)
245 nreport(player->cnum, N_AIDS, who, 1);
248 nreport(player->cnum, N_HURTS, who, 1);
253 resnoise(struct sctstr *sptr, int public_amt, char *name, int old,
258 pr("%s of %s changed from %d to %d\n",
259 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
261 (void)sprintf(p, "changed from %d to %d", old, new);
263 (void)sprintf(p, "%s", old < new ? "increased" : "decreased");
266 "%s in %s was %s by an act of %s\n",
267 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
268 p, cname(player->cnum));
269 resbenefit(sptr->sct_own, (old < new));