2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2009, 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 files README, COPYING and CREDITS in the root of the source
23 * tree for related information and legal notices. It is expected
24 * that future projects/authors will amend these files as needed.
28 * rese.c: Reset (lower) commodity prices
30 * Known contributors to this file:
39 #include "commodity.h"
59 pr("The market is disabled.\n");
64 p = getstarg(player->argp[1], "Which lot : ", buf);
68 getcomm(number_set, &comm);
69 if (comm.com_owner != player->cnum && !player->god) {
70 pr("That's not your lot.\n");
73 if (comm.com_maxbidder != player->cnum && !player->god) {
74 pr("Some one already has a bid out on that\n");
77 p = getstarg(player->argp[2], "New (lower) price: ", buf);
80 if (!check_comm_ok(&comm))
82 price = (float)atof(p);
84 getsect(comm.sell_x, comm.sell_y, §);
85 if (!player->owner && !player->god) {
86 pr("The destination sector must be one of yours\n");
90 if (!(p = getstring("Really destroy that lot? ", buf)))
92 if (!check_comm_ok(&comm))
94 if (*p == 'Y' || *p == 'y') {
96 putcomm(number_set, &comm);
97 pr("Goods destroyed.\n");
102 if (sect.sct_type != SCT_HARBR && sect.sct_type != SCT_WAREH) {
103 pr("That sector is not available for receiving goods.\n");
106 if (sect.sct_effic < 60) {
107 pr("The destination sector must be at least 60%% efficient.\n");
110 if (CANT_HAPPEN(comm.com_type <= I_NONE || comm.com_type > I_MAX)) {
111 pr("The goods have been eaten by a grue.");
114 m = sect.sct_item[comm.com_type];
115 m = m + comm.com_amount;
118 sect.sct_item[comm.com_type] = m;
121 putcomm(number_set, &comm);
122 pr("The goods have been returned to your trading post.\n");
125 if (price >= comm.com_price) {
126 pr("You can only lower the price.\n");
130 pr("New price must be greater than or equal to zero.\n");
133 comm.com_price = price;
135 comm.com_markettime = now;
136 if (!putcomm(number_set, &comm)) {
137 pr("Problems with the commodities file, Call the Deity\n");