2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2013, 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:
42 * format: setres thing <sect> <#>
51 struct nstr_sect nstr;
55 what = getstarg(player->argp[1],
56 "Give what (iron, gold, oil, uranium, fertility, owner, eff., mob., work, avail., oldown, mines)? ",
63 if (!snxtsct(&nstr, player->argp[2]))
65 while (nxtsct(&nstr, §) > 0) {
66 p = getstarg(player->argp[3], "What value : ", buf);
70 if (!check_sect_ok(§))
74 current = sect.sct_min;
80 if (sect.sct_own != 0)
81 resnoise(§, "Iron ore content", sect.sct_min, current);
82 sect.sct_min = (unsigned char)current;
85 current = sect.sct_gmin;
91 if (sect.sct_own != 0)
92 resnoise(§, "Gold content", sect.sct_gmin, current);
93 sect.sct_gmin = (unsigned char)current;
98 current = sect.sct_oil;
104 if (sect.sct_own != 0)
105 resnoise(§, "Oil content", sect.sct_oil, current);
106 sect.sct_oil = (unsigned char)current;
109 if ((amt < 0) || (amt > MAXNOC - 1))
111 pr("Owner of %s changed from %s (#%d) to %s (#%d).\n",
112 xyas(sect.sct_x, sect.sct_y, player->cnum),
113 cname(sect.sct_own), sect.sct_own, cname(amt), amt);
115 wu(player->cnum, sect.sct_own,
116 "Sector %s lost to deity intervention\n",
117 xyas(sect.sct_x, sect.sct_y, sect.sct_own));
120 wu(player->cnum, amt,
121 "Sector %s gained from deity intervention\n",
122 xyas(sect.sct_x, sect.sct_y, amt));
123 sect.sct_own = (natid)amt;
126 if ((amt < 0) || (amt > MAXNOC - 1))
128 pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
129 xyas(sect.sct_x, sect.sct_y, player->cnum),
130 cname(sect.sct_oldown),
131 sect.sct_oldown, cname(amt), amt);
132 sect.sct_oldown = (natid)amt;
140 current = sect.sct_effic;
146 pr("Efficiency in %s changed to %d.\n",
147 xyas(sect.sct_x, sect.sct_y, player->cnum), current);
148 sect.sct_effic = current;
153 current = sect.sct_mines;
157 if (current > MINES_MAX)
159 if (sect.sct_own != 0 && sect.sct_own == sect.sct_oldown)
160 resnoise(§, "Mines", sect.sct_mines, current);
161 sect.sct_mines = current;
164 current = sect.sct_mobil;
170 pr("Mobility in %s changed to %d.\n",
171 xyas(sect.sct_x, sect.sct_y, player->cnum), current);
172 sect.sct_mobil = current;
180 current = sect.sct_avail;
186 pr("Available in %s changed to %d.\n",
187 xyas(sect.sct_x, sect.sct_y, player->cnum), current);
188 sect.sct_avail = (short)current;
191 current = sect.sct_work;
197 pr("Work in %s changed to %d.\n",
198 xyas(sect.sct_x, sect.sct_y, player->cnum), current);
199 sect.sct_work = (unsigned char)current;
202 current = sect.sct_fertil;
208 if (sect.sct_own != 0)
209 resnoise(§, "Fertility content", sect.sct_fertil, current);
210 sect.sct_fertil = (unsigned char)current;
213 current = sect.sct_uran;
219 if (sect.sct_own != 0)
220 resnoise(§, "Uranium content", sect.sct_uran, current);
221 sect.sct_uran = (unsigned char)current;
233 resbenefit(natid who, int good)
240 nreport(player->cnum, N_AIDS, who, 1);
243 nreport(player->cnum, N_HURTS, who, 1);
248 resnoise(struct sctstr *sptr, char *name, int old, int new)
250 pr("%s of %s changed from %d to %d\n",
251 name, xyas(sptr->sct_x, sptr->sct_y, player->cnum), old, new);
254 "%s in %s was changed from %d to %d by an act of %s\n",
255 name, xyas(sptr->sct_x, sptr->sct_y, sptr->sct_own),
256 old, new, cname(player->cnum));
257 resbenefit(sptr->sct_own, (old < new));