/*
* 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
*
* ---
*
- * 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.
*
* ---
*
*
*/
+#include <config.h>
+
#include "misc.h"
#include "player.h"
#include "plague.h"
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(§)) {
harbor = 1;
oil_amt = sect.sct_item[I_OIL];
pet_amt = sect.sct_item[I_PETROL];
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;
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 */
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;
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 */
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;
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 */
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;
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 */