]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/fuel.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / commands / fuel.c
index ffd1c9f402f6aa3aa5131c617da0b038ab6ae920..103e5bac9fe4babbffad2f76b89979b7ed728a21 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-2006, 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.
  *
  *  ---
  *
@@ -31,6 +31,8 @@
  *     
  */
 
+#include <config.h>
+
 #include "misc.h"
 #include "player.h"
 #include "plague.h"
@@ -132,8 +134,7 @@ fuel(void)
            mp = &mchr[(int)item.ship.shp_type];
 
            harbor = 0;
-           if (sect.sct_type == SCT_HARBR
-               || IS_BIG_CITY(sect.sct_type)) {
+           if (sect_has_dock(&sect)) {
                harbor = 1;
                oil_amt = sect.sct_item[I_OIL];
                pet_amt = sect.sct_item[I_PETROL];
@@ -172,8 +173,8 @@ fuel(void)
                       xyas(sect.sct_x, sect.sct_y, player->cnum));
                    continue;
                }
-               move_amt = min(tot_fuel, fuel_amt);
-               move_amt = min(move_amt, max_amt);
+               move_amt = MIN(tot_fuel, fuel_amt);
+               move_amt = MIN(move_amt, max_amt);
 
                if (move_amt == 0)
                    continue;
@@ -185,21 +186,21 @@ fuel(void)
                    extra = ((float)move_amt / 5.0) - (move_amt / 5);
                    if (extra > 0.0)
                        sect.sct_item[I_PETROL]
-                           = max((pet_amt - move_amt / 5) - 1, 0);
+                           = MAX((pet_amt - move_amt / 5) - 1, 0);
                    else
                        sect.sct_item[I_PETROL]
-                           = max((pet_amt - move_amt / 5), 0);
+                           = MAX((pet_amt - move_amt / 5), 0);
                } else {
                    sect.sct_item[I_PETROL] = 0;
                    move_amt -= pet_amt * 5;
                    extra = ((float)move_amt / 50.0) - (move_amt / 50);
-                   sect.sct_item[I_OIL] = max(oil_amt - move_amt / 50, 0);
+                   sect.sct_item[I_OIL] = MAX(oil_amt - move_amt / 50, 0);
                    if (extra > 0.0)
                        sect.sct_item[I_OIL]
-                           = max((oil_amt - move_amt / 50) - 1, 0);
+                           = MAX((oil_amt - move_amt / 50) - 1, 0);
                    else
                        sect.sct_item[I_OIL]
-                           = max((oil_amt - move_amt / 50), 0);
+                           = MAX((oil_amt - move_amt / 50), 0);
                }
 
                /* load plague */
@@ -248,8 +249,8 @@ fuel(void)
                    continue;
                }
                tot_fuel = oil_amt * 50 + pet_amt * 5;
-               move_amt = min(tot_fuel, fuel_amt);
-               move_amt = min(move_amt, max_amt);
+               move_amt = MIN(tot_fuel, fuel_amt);
+               move_amt = MIN(move_amt, max_amt);
 
                if (move_amt == 0)
                    continue;
@@ -261,22 +262,22 @@ fuel(void)
                    extra = ((float)move_amt / 5.0) - (move_amt / 5);
                    if (extra > 0.0)
                        item2.ship.shp_item[I_PETROL]
-                           = max((pet_amt - move_amt / 5) - 1, 0);
+                           = MAX((pet_amt - move_amt / 5) - 1, 0);
                    else
                        item2.ship.shp_item[I_PETROL]
-                           = max((pet_amt - move_amt / 5), 0);
+                           = MAX((pet_amt - move_amt / 5), 0);
                } else {
                    item2.ship.shp_item[I_PETROL] = 0;
                    move_amt -= pet_amt * 5;
                    extra = ((float)move_amt / 50.0) - (move_amt / 50);
                    item2.ship.shp_item[I_OIL]
-                       = max(oil_amt - (move_amt / 50), 0);
+                       = MAX(oil_amt - (move_amt / 50), 0);
                    if (extra > 0.0)
                        item2.ship.shp_item[I_OIL]
-                           = max((oil_amt - move_amt / 50) - 1, 0);
+                           = MAX((oil_amt - move_amt / 50) - 1, 0);
                    else
                        item2.ship.shp_item[I_OIL]
-                           = max((oil_amt - move_amt / 50), 0);
+                           = MAX((oil_amt - move_amt / 50), 0);
                }
 
                /* load plague */
@@ -333,8 +334,8 @@ fuel(void)
                       xyas(sect.sct_x, sect.sct_y, player->cnum));
                    continue;
                }
-               move_amt = min(tot_fuel, fuel_amt);
-               move_amt = min(move_amt, max_amt);
+               move_amt = MIN(tot_fuel, fuel_amt);
+               move_amt = MIN(move_amt, max_amt);
 
                if (move_amt == 0)
                    continue;
@@ -346,21 +347,21 @@ fuel(void)
                    extra = ((float)move_amt / 5.0) - (move_amt / 5);
                    if (extra > 0.0)
                        sect.sct_item[I_PETROL]
-                           = max((pet_amt - move_amt / 5) - 1, 0);
+                           = MAX((pet_amt - move_amt / 5) - 1, 0);
                    else
                        sect.sct_item[I_PETROL]
-                           = max((pet_amt - move_amt / 5), 0);
+                           = MAX((pet_amt - move_amt / 5), 0);
                } else {
                    sect.sct_item[I_PETROL] = 0;
                    move_amt -= pet_amt * 5;
                    extra = ((float)move_amt / 50.0) - (move_amt / 50);
-                   sect.sct_item[I_OIL] = max(oil_amt - move_amt / 50, 0);
+                   sect.sct_item[I_OIL] = MAX(oil_amt - move_amt / 50, 0);
                    if (extra > 0.0)
                        sect.sct_item[I_OIL]
-                           = max((oil_amt - move_amt / 50) - 1, 0);
+                           = MAX((oil_amt - move_amt / 50) - 1, 0);
                    else
                        sect.sct_item[I_OIL]
-                           = max((oil_amt - move_amt / 50), 0);
+                           = MAX((oil_amt - move_amt / 50), 0);
                }
 
                /* load plague */
@@ -410,8 +411,8 @@ fuel(void)
                    continue;
                }
                tot_fuel = oil_amt * 50 + pet_amt * 5;
-               move_amt = min(tot_fuel, fuel_amt);
-               move_amt = min(move_amt, max_amt);
+               move_amt = MIN(tot_fuel, fuel_amt);
+               move_amt = MIN(move_amt, max_amt);
 
                if (move_amt == 0)
                    continue;
@@ -423,22 +424,22 @@ fuel(void)
                    extra = ((float)move_amt / 5.0) - (move_amt / 5);
                    if (extra > 0.0)
                        item2.land.lnd_item[I_PETROL]
-                           = max((pet_amt - move_amt / 5) - 1, 0);
+                           = MAX((pet_amt - move_amt / 5) - 1, 0);
                    else
                        item2.land.lnd_item[I_PETROL]
-                           = max((pet_amt - move_amt / 5), 0);
+                           = MAX((pet_amt - move_amt / 5), 0);
                } else {
                    item2.land.lnd_item[I_PETROL] = 0;
                    move_amt -= pet_amt * 5;
                    extra = ((float)move_amt / 50.0) - (move_amt / 50);
                    item2.land.lnd_item[I_OIL]
-                       = max(oil_amt - move_amt / 50, 0);
+                       = MAX(oil_amt - move_amt / 50, 0);
                    if (extra > 0.0)
                        item2.land.lnd_item[I_OIL]
-                           = max((oil_amt - move_amt / 50) - 1, 0);
+                           = MAX((oil_amt - move_amt / 50) - 1, 0);
                    else
                        item2.land.lnd_item[I_OIL]
-                           = max((oil_amt - move_amt / 50), 0);
+                           = MAX((oil_amt - move_amt / 50), 0);
                }
 
                /* load plague */