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 * rese.c: Reset (lower) commodity prices
29 * Known contributors to this file:
38 #include "commodity.h"
55 pr("The market is disabled.\n");
60 p = getstarg(player->argp[1], "Which lot : ", buf);
64 getcomm(number_set, &comm);
65 if (comm.com_owner != player->cnum && !player->god) {
66 pr("That's not your lot.\n");
69 if (comm.com_maxbidder != player->cnum && !player->god) {
70 pr("Some one already has a bid out on that\n");
73 p = getstarg(player->argp[2], "New (lower) price: ", buf);
76 if (!check_comm_ok(&comm))
78 price = (float)atof(p);
80 getsect(comm.sell_x, comm.sell_y, §);
81 if (!player->owner && !player->god) {
82 pr("The destination sector must be one of yours\n");
86 if (!(p = getstring("Really destroy that lot? ", buf)))
88 if (!check_comm_ok(&comm))
90 if (*p == 'Y' || *p == 'y') {
92 putcomm(number_set, &comm);
93 pr("Goods destroyed.\n");
98 if (sect.sct_type != SCT_HARBR && sect.sct_type != SCT_WAREH) {
99 pr("That sector is not available for receiving goods.\n");
102 if (sect.sct_effic < 60) {
103 pr("The destination sector must be at least 60%% efficient.\n");
106 if (CANT_HAPPEN(comm.com_type <= I_NONE || comm.com_type > I_MAX)) {
107 pr("The goods have been eaten by a grue.");
110 m = sect.sct_item[comm.com_type];
111 m = m + comm.com_amount;
114 sect.sct_item[comm.com_type] = m;
117 putcomm(number_set, &comm);
118 pr("The goods have been returned to your trading post.\n");
121 if (price >= comm.com_price) {
122 pr("You can only lower the price.\n");
126 pr("New price must be greater than or equal to zero.\n");
129 comm.com_price = price;
131 comm.com_markettime = now;
132 if (!putcomm(number_set, &comm)) {
133 pr("Problems with the commodities file, call the Deity\n");