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 * rese.c: Reset (lower) commodity prices
30 * Known contributors to this file:
49 #include <math.h> /* bailey@math-cs.kent.edu */
50 #include "commodity.h"
69 pr("The market is disabled.\n");
74 if ((p = getstarg(player->argp[1], "Which lot : ", buf)) == 0
78 getcomm(number_set, &comm);
79 if (comm.com_owner != player->cnum && !player->god) {
80 pr("That's not your lot.\n");
83 if (comm.com_maxbidder != player->cnum && !player->god) {
84 pr("Some one already has a bid out on that\n");
87 if ((p = getstarg(player->argp[2], "New (lower) price: ", buf)) == 0
90 if (!check_comm_ok(&comm))
92 price = (float)atof(p);
94 getsect(comm.sell_x, comm.sell_y, §);
95 if (!player->owner && !player->god) {
96 pr("The destination sector must be one of yours\n");
100 if ((p = getstring("Really destroy that lot? ", buf)) == 0)
102 if (!check_comm_ok(&comm))
104 if (*p == 'Y' || *p == 'y') {
106 putcomm(number_set, &comm);
107 pr("Goods destroyed.\n");
112 if (sect.sct_type != SCT_HARBR && sect.sct_type != SCT_WAREH) {
113 pr("That sector is not available for receiving goods.\n");
116 if (sect.sct_effic < 60) {
117 pr("The destination sector must be at least 60%% efficient.\n");
120 ix = whichitem(comm.com_type);
121 sect.sct_x = comm.sell_x;
122 sect.sct_y = comm.sell_y;
123 m = getvar(ix->i_vtype, (char *)§, EF_SECTOR);
124 m = m + comm.com_amount;
127 putvar(ix->i_vtype, m, (char *)§, EF_SECTOR);
130 putcomm(number_set, &comm);
131 pr("The goods have been returned to your trading post\n");
134 if (price >= comm.com_price) {
135 pr("You can only lower the price.\n");
139 pr("New price must be greater than or equal to zero.\n");
142 comm.com_price = price;
144 comm.com_markettime = now;
145 if ((int)price < comm.com_maxprice)
146 comm.com_maxprice = (int)price;
147 if (!putcomm(number_set, &comm)) {
148 pr("Problems with the commodities file, Call the Deity\n");