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 * rese.c: Reset (lower) commodity prices
29 * Known contributors to this file:
38 #include "commodity.h"
58 pr("The market is disabled.\n");
63 p = getstarg(player->argp[1], "Which lot : ", buf);
67 getcomm(number_set, &comm);
68 if (comm.com_owner != player->cnum && !player->god) {
69 pr("That's not your lot.\n");
72 if (comm.com_maxbidder != player->cnum && !player->god) {
73 pr("Some one already has a bid out on that\n");
76 p = getstarg(player->argp[2], "New (lower) price: ", buf);
79 if (!check_comm_ok(&comm))
81 price = (float)atof(p);
83 getsect(comm.sell_x, comm.sell_y, §);
84 if (!player->owner && !player->god) {
85 pr("The destination sector must be one of yours\n");
89 if (!(p = getstring("Really destroy that lot? ", buf)))
91 if (!check_comm_ok(&comm))
93 if (*p == 'Y' || *p == 'y') {
95 putcomm(number_set, &comm);
96 pr("Goods destroyed.\n");
101 if (sect.sct_type != SCT_HARBR && sect.sct_type != SCT_WAREH) {
102 pr("That sector is not available for receiving goods.\n");
105 if (sect.sct_effic < 60) {
106 pr("The destination sector must be at least 60%% efficient.\n");
109 if (CANT_HAPPEN(comm.com_type <= I_NONE || comm.com_type > I_MAX)) {
110 pr("The goods have been eaten by a grue.");
113 m = sect.sct_item[comm.com_type];
114 m = m + comm.com_amount;
117 sect.sct_item[comm.com_type] = m;
120 putcomm(number_set, &comm);
121 pr("The goods have been returned to your trading post.\n");
124 if (price >= comm.com_price) {
125 pr("You can only lower the price.\n");
129 pr("New price must be greater than or equal to zero.\n");
132 comm.com_price = price;
134 comm.com_markettime = now;
135 if (!putcomm(number_set, &comm)) {
136 pr("Problems with the commodities file, call the Deity\n");