]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/payo.c
Update copyright notice
[empserver] / src / lib / commands / payo.c
index 37c54adf2106177cdc81f14508d5c129daf8f3d5..10944e95ccc8ab22f4700bc8bbf52b820f78601f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, 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.
  *
  *  ---
  *
  *     Thomas Ruschak, 1992
  */
 
-#include "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "sect.h"
-#include "ship.h"
-#include "nat.h"
-#include "nsc.h"
-#include "file.h"
+#include <config.h>
+
 #include "commands.h"
 #include "optlist.h"
+#include "ship.h"
 
 int
 payo(void)
@@ -61,13 +56,9 @@ payo(void)
        return RET_SYN;
 
     nships = 0;
-    while (nxtitem(&ni, (s_char *)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (!player->owner || ship.shp_own == 0)
            continue;
-       if (ship.shp_type < 0 || ship.shp_type > shp_maxno) {
-           pr("bad ship type %d (#%d)\n", ship.shp_type, ni.cur);
-           continue;
-       }
        mp = &mchr[(int)ship.shp_type];
 
        if (!(mp->m_flags & M_TRADE))
@@ -101,14 +92,14 @@ payo(void)
        if (dist < trade_1_dist)
            cash = 0;
        else if (dist < trade_2_dist)
-           cash = (1.0 + trade_1 * ((float)dist));
+           cash = 1.0 + trade_1 * dist;
        else if (dist < trade_3_dist)
-           cash = (1.0 + trade_2 * ((float)dist));
+           cash = 1.0 + trade_2 * dist;
        else
-           cash = (1.0 + trade_3 * ((float)dist));
+           cash = 1.0 + trade_3 * dist;
 
        cash *= mp->m_cost;
-       cash *= (((float)ship.shp_effic) / 100.0);
+       cash *= ship.shp_effic / 100.0;
 
        if (sect.sct_own && (sect.sct_own != ship.shp_own))
            cash *= (1.0 + trade_ally_bonus);