(ship_bomb, deli, do_demo, fuel, grin, look_ship)
(ltend, multifire, quite_bigdef, mine, landmine) (do_loan, prod, printdiff, sell, sona, stre) (tend, fire_dchrg, vers, work, ac_planedamage) (ac_shipflak, ask_off, get_mine_dsupport, att_fight) (ask_move_in_off, detonate, sd, land_gun) (land_unitgun, lnd_fort_interdiction, lnd_fortify) (perform_mission, pln_mine, pln_mobcost) (retreat_ship1, retreat_land1, shp_sweep) (shp_fort_interdiction, shp_missle_defense) (new_work, growfood, upd_land, land_repair) (get_materials, do_mob_ship, do_mob_land) (load_it, unload_it, prod_plane, produce) (guerrilla, upd_buildeff, spread_fallout) (upd_ship, ship_repair, min, dmin, MIN): Remove min() and dmin() functions and replace with a MIN macro in misc.h. Remove local MIN macros and use the new one in misc.h. This change removes the need for the special case for _WIN32. (fuel, look_ship, multifire, mission, sona) (plane_sona, ef_open, player_accept, player_main) (ac_dog, att_get_combat, calc_mobcost) (ask_move_in_off, intelligence_report) (build_mission_list_type, perform_mission) (show_mission, use_supply, dodistribute) (allocate_memory, max, dmax, MAX): Remove max() and dmax() functions and replace with a MAX macro in misc.h. Remove local MAX macros and use the new one in misc.h. This change removes the need for the special case for _WIN32.
This commit is contained in:
parent
b89de57d51
commit
04a8b84592
48 changed files with 152 additions and 251 deletions
|
@ -146,7 +146,7 @@ int
|
|||
new_work(struct sctstr *sp, int delta)
|
||||
{
|
||||
if (sp->sct_type == sp->sct_newtype)
|
||||
return min(rollover_avail_max, sp->sct_avail) + delta;
|
||||
return MIN(rollover_avail_max, sp->sct_avail) + delta;
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ growfood(struct sctstr *sp, short *vec, int work, int etu)
|
|||
|
||||
food_workers = work * fcrate;
|
||||
food_fertil = etu * sp->sct_fertil * fgrate;
|
||||
food = min(food_workers, food_fertil);
|
||||
food = MIN(food_workers, food_fertil);
|
||||
if (food > ITEM_MAX - vec[I_FOOD])
|
||||
food = ITEM_MAX - vec[I_FOOD];
|
||||
/*
|
||||
|
|
|
@ -55,10 +55,6 @@
|
|||
|
||||
int mil_dbl_pay;
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) ((x) > (y) ? (y) : (x))
|
||||
#endif
|
||||
|
||||
static int landrepair(struct lndstr *, struct natstr *,
|
||||
int *, int);
|
||||
static void upd_land(struct lndstr *lp, int etus,
|
||||
|
@ -144,8 +140,8 @@ upd_land(struct lndstr *lp, int etus,
|
|||
mult = 2;
|
||||
if (lcp->l_flags & L_ENGINEER)
|
||||
mult *= 3;
|
||||
/* cost = -(mult * etus * dmin(0.0, money_land * LND_COST(lcp->l_cost, lp->lnd_tech - lcp->l_tech)));*/
|
||||
cost = -(mult * etus * dmin(0.0, money_land * lcp->l_cost));
|
||||
/* cost = -(mult * etus * MIN(0.0, money_land * LND_COST(lcp->l_cost, lp->lnd_tech - lcp->l_tech)));*/
|
||||
cost = -(mult * etus * MIN(0.0, money_land * lcp->l_cost));
|
||||
if ((np->nat_priorities[PRI_LMAINT] == 0 || np->nat_money < cost)
|
||||
&& !player->simulation) {
|
||||
if ((eff = lp->lnd_effic - etus / 5) < LAND_MINEFF) {
|
||||
|
|
|
@ -41,10 +41,6 @@
|
|||
#include "common.h"
|
||||
#include "subs.h"
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) ((x) > (y) ? (y) : (x))
|
||||
#endif
|
||||
|
||||
void
|
||||
get_materials(struct sctstr *sp, int *bp, int *mvec, int check)
|
||||
/* only check if found=0, remove them=1 */
|
||||
|
|
|
@ -365,7 +365,7 @@ do_mob_ship(struct shpstr *sp, int etus)
|
|||
d *= (double)mchr[(int)sp->shp_type].m_fuelu;
|
||||
d /= (double)fuel_mult;
|
||||
sp->shp_fuel -= (u_char)ldround(d, 1);
|
||||
sp->shp_fuel = (u_char)min(sp->shp_fuel,
|
||||
sp->shp_fuel = (u_char)MIN(sp->shp_fuel,
|
||||
mchr[(int)sp->shp_type].m_fuelc);
|
||||
sp->shp_mobil += (s_char)total_add;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ do_mob_land(struct lndstr *lp, int etus)
|
|||
d *= (double)lp->lnd_fuelu;
|
||||
d /= (double)fuel_mult;
|
||||
lp->lnd_fuel -= (u_char)ldround(d, 1);
|
||||
lp->lnd_fuel = (u_char)min(lp->lnd_fuel, lp->lnd_fuelc);
|
||||
lp->lnd_fuel = (u_char)MIN(lp->lnd_fuel, lp->lnd_fuelc);
|
||||
if (total_add + lp->lnd_mobil > land_mob_max) {
|
||||
total_add = land_mob_max - lp->lnd_mobil;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ load_it(struct shpstr *sp, struct sctstr *psect, int i)
|
|||
if (!abs_max)
|
||||
return 0; /* can't load the ship, skip to the end. */
|
||||
|
||||
max_amt = min(sect_amt, max_amt - ship_amt);
|
||||
max_amt = MIN(sect_amt, max_amt - ship_amt);
|
||||
if (max_amt <= 0 && (ship_amt != abs_max)) {
|
||||
sp->shp_autonav |= AN_LOADING;
|
||||
return 0;
|
||||
|
@ -199,7 +199,7 @@ unload_it(struct shpstr *sp)
|
|||
if (comm == I_CIVIL)
|
||||
ship_amt--; /* This leaves 1 civs on board the ship */
|
||||
|
||||
max_amt = min(ship_amt, ITEM_MAX - sect_amt);
|
||||
max_amt = MIN(ship_amt, ITEM_MAX - sect_amt);
|
||||
if (max_amt <= 0)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -49,10 +49,6 @@
|
|||
#include "common.h"
|
||||
#include "gen.h"
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) ((x) > (y) ? (y) : (x))
|
||||
#endif
|
||||
|
||||
int
|
||||
prod_plane(int etus, int natnum, int *bp, int buildem)
|
||||
|
||||
|
@ -133,7 +129,7 @@ prod_plane(int etus, int natnum, int *bp, int buildem)
|
|||
if (buildem == 0) {
|
||||
/* flight pay is 5x the pay received by other military */
|
||||
start_money = np->nat_money;
|
||||
cost = -(mult * etus * dmin(0.0, desc->pl_cost * money_plane));
|
||||
cost = -(mult * etus * MIN(0.0, desc->pl_cost * money_plane));
|
||||
if ((np->nat_priorities[PRI_PMAINT] == 0 ||
|
||||
np->nat_money < cost) && !player->simulation) {
|
||||
if ((eff = pp->pln_effic - etus / 5) < PLANE_MINEFF) {
|
||||
|
|
|
@ -169,9 +169,9 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
|||
}
|
||||
}
|
||||
|
||||
/* The min() here is to take care of integer rounding errors */
|
||||
/* The MIN() here is to take care of integer rounding errors */
|
||||
if (p_e > 0.0) {
|
||||
return min(work, (int)(unit_work * material_consume / p_e));
|
||||
return MIN(work, (int)(unit_work * material_consume / p_e));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ guerrilla(struct sctstr *sp)
|
|||
logerror("%d Che targeted at country %d retiring", che, target);
|
||||
sp->sct_che = 0;
|
||||
sp->sct_che_target = 0;
|
||||
sp->sct_item[I_CIVIL] = min(civ + che, ITEM_MAX);
|
||||
sp->sct_item[I_CIVIL] = MIN(civ + che, ITEM_MAX);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ upd_buildeff(struct natstr *np, struct sctstr *sp, int *workp,
|
|||
+ (vec[I_MILIT] * 2 / 5.0) + vec[I_UW];
|
||||
*workp = roundavg((etu * (*workp)) / 100.0);
|
||||
|
||||
buildeff_work = min((int)(*workp / 2), buildeff_work);
|
||||
buildeff_work = MIN((int)(*workp / 2), buildeff_work);
|
||||
}
|
||||
}
|
||||
if (np->nat_priorities[*desig]) {
|
||||
|
@ -247,7 +247,7 @@ spread_fallout(struct sctstr *sp, int etus)
|
|||
inc = roundavg(etus * fallout_spread * (sp->sct_fallout)) - 1;
|
||||
if (inc < 0)
|
||||
inc = 0;
|
||||
ap->sct_fallout = min(ap->sct_fallout + inc, FALLOUT_MAX);
|
||||
ap->sct_fallout = MIN(ap->sct_fallout + inc, FALLOUT_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,10 +54,6 @@
|
|||
#include "lost.h"
|
||||
#include "budg.h"
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) ((x) > (y) ? (y) : (x))
|
||||
#endif
|
||||
|
||||
static int shiprepair(struct shpstr *, struct natstr *,
|
||||
int *, int);
|
||||
static void upd_ship(struct shpstr *, int,
|
||||
|
@ -144,7 +140,7 @@ upd_ship(struct shpstr *sp, int etus,
|
|||
mult = 1;
|
||||
if (np->nat_level[NAT_TLEV] < sp->shp_tech * 0.85)
|
||||
mult = 2;
|
||||
cost = -(mult * etus * dmin(0.0, money_ship * mp->m_cost));
|
||||
cost = -(mult * etus * MIN(0.0, money_ship * mp->m_cost));
|
||||
if ((np->nat_priorities[PRI_SMAINT] == 0 || np->nat_money < cost)
|
||||
&& !player->simulation) {
|
||||
if ((eff = sp->shp_effic - etus / 5) < SHIP_MINEFF) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue