/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
*
* ---
*
- * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- * related information and legal notices. It is expected that any future
- * projects/authors will amend these files as needed.
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
*
* ---
*
* Steve McClure, 1996
*/
-#include "misc.h"
-#include "xy.h"
-#include "file.h"
-#include "sect.h"
-#include "item.h"
-#include "nsc.h"
-#include "nat.h"
-#include "plane.h"
-#include "ship.h"
-#include <math.h> /* bailey@math-cs.kent.edu */
+#include <config.h>
+
+#include "commands.h"
#include "commodity.h"
+#include "item.h"
#include "land.h"
-#include "player.h"
-#include "commands.h"
#include "optlist.h"
-/*#define EF_COMM 10*/
+#include "plane.h"
+#include "ship.h"
/*
* format: sell <COMMODITY> <SECTS> <NUMBER> <PRICE>
time_t now;
int ii = 0;
coord x, y;
- s_char buf[1024];
+ char buf[1024];
if (!opt_MARKET) {
pr("The market is disabled.\n");
return RET_FAIL;
}
number_sub = 0;
- if ((p = getstarg(player->argp[3], "Amount: ", buf)) == 0 || *p == 0)
+ if ((p = getstarg(player->argp[3], "Quantity: ", buf)) == 0 || *p == 0)
return RET_SYN;
if (!check_sect_ok(§))
return RET_FAIL;
pr("Military control required to sell goods.\n");
return RET_FAIL;
}
- if ((amt = sect.sct_item[ip->i_vtype]) == 0) {
+ if ((amt = sect.sct_item[ip->i_uid]) == 0) {
pr("You don't have any %s to sell there.\n", ip->i_name);
return RET_FAIL;
}
if (number_set >= 0)
- com = min(number_set, amt);
+ com = MIN(number_set, amt);
else
com = amt + number_set;
if (com <= 0)
amt -= com;
pr("Sold %d %s at %s (%d left)\n", com, ip->i_name,
xyas(sect.sct_x, sect.sct_y, player->cnum), amt);
- sect.sct_item[ip->i_vtype] = amt;
+ sect.sct_item[ip->i_uid] = amt;
putsect(§);
if (totalcom > 0) {
for (ii = 0; getcomm(ii, &comm); ii++) {
if (getcomm(ii, &comm) == 0)
ef_extend(EF_COMM, 1);
(void)time(&now);
- comm.com_type = ip->i_vtype;
+ comm.com_type = ip->i_uid;
comm.com_owner = player->cnum;
comm.com_price = price;
comm.com_maxbidder = player->cnum;