]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/sell.c
Update copyright notice.
[empserver] / src / lib / commands / sell.c
index fef8bcd9c25aa95530aaec0b5482ca0f6d91d568..02725736ad9a5e27dde33a2a8f457a3a331dcf43 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2004, 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
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  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 "var.h"
-#include "sect.h"
-#include "item.h"
-#include "nsc.h"
-#include "nat.h"
-#include "nuke.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 "trade.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>
@@ -76,7 +66,7 @@ sell(void)
     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");
@@ -110,7 +100,7 @@ sell(void)
        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(&sect))
        return RET_FAIL;
@@ -132,12 +122,12 @@ sell(void)
        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)
@@ -146,7 +136,7 @@ sell(void)
     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(&sect);
     if (totalcom > 0) {
        for (ii = 0; getcomm(ii, &comm); ii++) {
@@ -156,7 +146,7 @@ sell(void)
        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;