2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
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.
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, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * projects/authors will amend these files as needed.
28 * mult.c: Set per-nation list of price multipliers
30 * Known contributors to this file:
43 #include <math.h> /* bailey@math-cs.kent.edu */
45 static void multsingle(natid us, natid them, struct natstr *natp);
55 pr("The market is disabled.\n");
58 pr("The mult command is no longer used.\n");
59 if (!snxtitem(&ni, EF_NATION, player->argp[1]))
62 pr("Unable to read commodity file; get help!\n");
66 while (!player->aborted && nxtitem(&ni, (s_char *)&nat)) {
67 if ((nat.nat_stat & STAT_NORM) == 0)
69 multsingle(player->cnum, (natid)ni.cur, &nat);
72 pr("%d nation multipliers changed\n", nats);
77 * Set the multipler for a single country.
80 multsingle(natid us, natid them, struct natstr *natp)
87 sprintf(prompt, "%s (%7.3f) : ", natp->nat_cnam, multread(us, them));
88 p = getstarg(player->argp[2], prompt, buf);
89 if (p == 0 || *p == 0)
91 if ((price = atof(p)) == 0.0)
94 if ((price == HUGE) || (price > 1000000.0)) /* Inf causes overflow. */
96 if (price > 1000000.0)
98 price = 1000000.0; /* bailey@math-cs.kent.edu */
102 if (price <= minmult)
104 if (price >= maxmult)
106 if (commread() < 0) {
107 pr("Unable to re-read commodity file; get help!\n");
110 multset(them, price);
111 if (commwrite() < 0) {
112 pr("Unable to write out commodity file; get help!\n");