return 0;
}
if (n != ioq->bsize)
- buf = (char *)realloc(buf, n);
+ buf = realloc(buf, n);
ioq_write(ioq, buf, n);
return 1;
}
bid = atof(p);
if (bid <= 0)
return RET_FAIL;
- if (natp->nat_money < (bid * comm.com_amount * buytax)) {
+ if (natp->nat_money < bid * comm.com_amount * buytax) {
pr("This purchase would cost %.2f, %.2f more than you have.\n",
bid * comm.com_amount * buytax,
bid * comm.com_amount * buytax - natp->nat_money);
for (q = 0; getcomm(q, &comt); q++) {
if (comt.com_maxbidder == player->cnum &&
comt.com_owner != 0 && comt.com_owner != player->cnum) {
- tally += (comt.com_price * comt.com_amount) * buytax;
+ tally += comt.com_price * comt.com_amount * buytax;
}
}
canspend = natp->nat_money - tally;
getcomm(o, &comm);
- if ((bid * comm.com_amount * buytax) > canspend) {
+ if (bid * comm.com_amount * buytax > canspend) {
pr("You have overextended yourself in the market\n");
pr("You can not bid on the current items at that price.\n");
return RET_OK;
qty, ip->i_name, n);
return RET_FAIL;
}
- if ((bid * comm.com_amount) > natp->nat_money) {
+ if (bid * comm.com_amount > natp->nat_money) {
pr("You don't have that much to spend!\n");
return RET_FAIL;
}
int dist;
drange = techfact(lookland->lnd_tech, lookland->lnd_spy);
- drange = (drange * ((double)lookland->lnd_effic / 100.0));
+ drange *= lookland->lnd_effic / 100.0;
range = ldround(drange, 1);
if (range == 0)
shots = gun;
guneff = seagun(fship.shp_effic, shots);
dam = (int)guneff;
- shell -= ldround(((double)shots) / 2.0, 1);
+ shell -= ldround(shots / 2.0, 1);
fship.shp_item[I_SHELL] = shell;
if (opt_NOMOBCOST == 0)
fship.shp_mobil = MAX(fship.shp_mobil - 15, -100);
dam = (int)landunitgun(fland.lnd_effic, fland.lnd_dam, gun,
fland.lnd_ammo, shell);
if (target == targ_ship) {
- if (chance(((double)fland.lnd_acc) / 100.0))
- dam = ldround(((double)dam / 2.0), 1);
+ if (chance(fland.lnd_acc / 100.0))
+ dam = ldround(dam / 2.0, 1);
}
use_supply(&fland);
resupply_commod(&fland, I_SHELL); /* Get more shells */
prb *= prb;
if (chance(prb)) {
pr("Wind deflects shell%s.\n", splur(shots));
-/* dam = (int)((double)dam / 2.0);*/
+/* dam = (int)(dam / 2.0);*/
dam *= (90 - (random() % 11)) / 100.0;
if (dam < 0)
dam = 0;
pr("\nDefenders fire back!\n");
first = 0;
}
- dam = (odds * (double)fp->defdam);
+ dam = odds * fp->defdam;
if (fp->type == targ_ship) {
vict = fp->victim;
return RET_FAIL;
}
- mobused = ldround((mission_mob_cost * (double)mobmax), 1);
+ mobused = ldround(mission_mob_cost * (double)mobmax, 1);
while (nxtitem(&ni, &item)) {
gp = (struct genitem *)&item;
if (!snxtsct(&ns, cp))
return RET_SYN;
tech = tfact(player->cnum, 8.0);
- if (tech > ((double)WORLD_Y / 4.0))
- tech = ((double)WORLD_Y / 4.0);
- if (tech > ((double)WORLD_X / 8.0))
- tech = ((double)WORLD_X / 8.0);
+ if (tech > WORLD_Y / 4.0)
+ tech = WORLD_Y / 4.0;
+ if (tech > WORLD_X / 8.0)
+ tech = WORLD_X / 8.0;
while (nxtsct(&ns, §)) {
if (sect.sct_type != SCT_RADAR)
continue;
tf = 0.0;
pr("%s at ", prship(&ship));
tech = techfact(ship.shp_tech,
- (double)mchr[(int)ship.shp_type].m_vrnge);
- if (tech > ((double)WORLD_Y / 2.0))
- tech = ((double)WORLD_Y / 2.0);
- if (tech > ((double)WORLD_X / 4.0))
- tech = ((double)WORLD_X / 4.0);
+ mchr[(int)ship.shp_type].m_vrnge);
+ if (tech > WORLD_Y / 2.0)
+ tech = WORLD_Y / 2.0;
+ if (tech > WORLD_X / 4.0)
+ tech = WORLD_X / 4.0;
radmap(ship.shp_x, ship.shp_y, ship.shp_effic,
(int)tech, tf);
}
tf = 0.0;
pr("%s at ", prland(&land));
tech = techfact(land.lnd_tech, land.lnd_spy);
- if (tech > ((double)WORLD_Y / 2.0))
- tech = ((double)WORLD_Y / 2.0);
- if (tech > ((double)WORLD_X / 4.0))
- tech = ((double)WORLD_X / 4.0);
+ if (tech > WORLD_Y / 2.0)
+ tech = WORLD_Y / 2.0;
+ if (tech > WORLD_X / 4.0)
+ tech = WORLD_X / 4.0;
radmap(land.lnd_x, land.lnd_y, land.lnd_effic,
(int)tech, tf);
}
continue;
}
/* catch spy N/200 chance, N = # military */
- caught = chance((double)dsect.sct_item[I_MILIT] / 200.0);
+ caught = chance(dsect.sct_item[I_MILIT] / 200.0);
own = dsect.sct_own;
/* determine spyee relations with spyer */
relat = getrel(getnatp(own), player->cnum);
return;
/* ok, all set.. now, we shoot */
- shells -= ldround(((double)gun) / 2.0, 1);
+ shells -= ldround(gun / 2.0, 1);
sp->shp_item[I_SHELL] = shells;
putship(sp->shp_uid, sp);
/* Note, the best you can get is a 1.0 here. */
if (do_bonus == MOB_ROAD) {
- d = d / (1.0 + ((double)sp->sct_road / 122.0));
+ d = d / (1.0 + sp->sct_road / 122.0);
} else if (do_bonus == MOB_RAIL) {
- d = d / (1.0 + ((double)sp->sct_rail / 100.0));
+ d = d / (1.0 + sp->sct_rail / 100.0);
} else {
if (d < 2.0)
d = 2.0;
if (d < 1.0)
d = 1.0;
if (dchr[sp->sct_type].d_mcst < 25)
- d = (d * 100.0 - (double)sp->sct_effic) / 500.0;
-/* d = (200.0 + (d - 3.0) * (double)sp->sct_effic) / 500.0;*/
+ d = (d * 100.0 - sp->sct_effic) / 500.0;
+/* d = (200.0 + (d - 3.0) * sp->sct_effic) / 500.0;*/
else
- d = (d * 10.0 - (double)sp->sct_effic) / 115;
+ d = (d * 10.0 - sp->sct_effic) / 115;
if (d <= 0.0 || d < MIN_MOBCOST)
return MIN_MOBCOST;
static double
bp_seccost(struct as_coord from, struct as_coord to, void *pp)
{
- return (double)mapdist((coord)from.x, (coord)from.y,
- (coord)to.x, (coord)to.y);
+ return mapdist((coord)from.x, (coord)from.y,
+ (coord)to.x, (coord)to.y);
}
/*
{
double roll;
- roll = (random() & 0x7fff);
+ roll = random() & 0x7fff;
if (d > roll / 32768.0)
return 1;
int
roll(int n)
{
- return (random() % n) + 1;
+ return 1 + random() % n;
}
/*
landgun(int effic, int guns)
{
double d;
- double g = (double)MIN(guns, 7);
+ double g = MIN(guns, 7);
- d = ((double)(random() % 30) + 20.0) * ((double)g / 7.0);
- d *= (double)effic;
- d /= 100.0;
+ d = (random() % 30 + 20.0) * (g / 7.0);
+ d *= effic / 100.0;
return d;
}
d = 0.0;
while (guns--)
- d += 10.0 + (double)(random() % 6);
- d *= (double)effic * 0.01;
+ d += 10.0 + random() % 6;
+ d *= effic * 0.01;
return d;
}
shots = MIN(shots, guns);
while (shots-- > 0)
- d += 5.0 + (double)(random() % 6);
- d *= (double)effic * 0.01;
+ d += 5.0 + random() % 6;
+ d *= effic * 0.01;
if (shells < ammo && ammo != 0)
d *= (double)shells / (double)ammo;
return d;
eff_eq = 100;
llp->land.lnd_effic = 0;
} else {
- eff_eq =
- ldround((((double)cas * 100.0) / (double)llp->lcp->l_mil), 1);
+ eff_eq = ldround(cas * 100.0 / llp->lcp->l_mil, 1);
llp->land.lnd_effic -= eff_eq;
lnd_submil(&llp->land, cas);
}
memset(buf1, 0, sizeof(buf1));
memset(buf2, 0, sizeof(buf2));
memset(buf3, 0, sizeof(buf3));
- if (chance((double)(spy + lp->lnd_vis) / 10.0)) {
+ if (chance((spy + lp->lnd_vis) / 10.0)) {
if (destination == player->cnum)
pr("%s %s", mess, prland(lp));
else
estimate = lp->lnd_item[I_MILIT];
- if (chance((double)(spy + lp->lnd_vis) / 20.0)) {
-
+ if (chance((spy + lp->lnd_vis) / 20.0)) {
if (destination == player->cnum)
pr(" (eff %d, mil %d",
roundintby(lp->lnd_effic, 5),
roundintby(lp->lnd_item[I_MILIT], 10));
estimate = lp->lnd_item[I_MILIT] * lp->lnd_effic / 100.0;
- if (chance((double)(spy + lp->lnd_vis) / 20.0)) {
+ if (chance((spy + lp->lnd_vis) / 20.0)) {
int t;
t = lp->lnd_tech - 20 + roll(40);
t = MAX(t, 0);
llp = malloc(sizeof(struct llist));
llp->lcp = lcp;
llp->land = land;
- llp->mobil = (double)land.lnd_mobil;
+ llp->mobil = land.lnd_mobil;
emp_insque(&llp->queue, list);
}
}
if (land.lnd_x != allx || land.lnd_y != ally)
*togetherp = 0;
if (land.lnd_mobil + 1 < (int)llp->mobil) {
- llp->mobil = (double)land.lnd_mobil;
+ llp->mobil = land.lnd_mobil;
}
if (llp->mobil < *minmobp)
*minmobp = llp->mobil;
if (!totdam || !(count = lnd_count(list)))
return 0;
- dam = ldround(((double)totdam / (double)count), 1);
+ dam = ldround((double)totdam / count, 1);
for (qp = list->q_back; qp != list; qp = next) {
next = qp->q_back;
llp = (struct llist *)qp;
struct sctstr sect;
getsect(lp->lnd_x, lp->lnd_y, §);
- return (int)(((double)lp->lnd_effic / 100.0) *
- (10 + dchr[sect.sct_type].d_dstr * 2 +
- (double)lp->lnd_spd / 2.0 - lp->lnd_vis));
+ return (int)((lp->lnd_effic / 100.0) *
+ (10 + dchr[sect.sct_type].d_dstr * 2 + lp->lnd_spd / 2.0
+ - lp->lnd_vis));
}
static int
bridge heads, bridges and highways have built-in highways bonus
because they are a 1, and this will discount that. */
- smobcost = (double)sector_mcost(sp, mobtype);
+ smobcost = sector_mcost(sp, mobtype);
if (smobcost < 0.01)
smobcost = 0.01;
dam2 = ldround(landunitgun(lp->lnd_effic, lp->lnd_dam, gun,
lp->lnd_ammo, shell), 1);
if (sect.sct_type == SCT_WATER) {
- double dam3 = (double)dam2;
- if (chance(((double)lp->lnd_acc) / 100.0))
- dam2 = ldround((dam3 / 2.0), 1);
+ if (chance(lp->lnd_acc / 100.0))
+ dam2 = ldround(dam2 / 2.0, 1);
}
dam += dam2;
if (sect.sct_type == SCT_WATER)
if (!(mcp->m_flags & M_DCH) && !(mcp->m_flags & M_SUBT))
continue;
vrange = techfact(sp->shp_tech, mcp->m_vrnge);
- vrange *= (double)sp->shp_effic / 200.0;
+ vrange *= sp->shp_effic / 200.0;
if (md > vrange)
continue;
/* can't look all the time */
pr(" %4d", plus);
} else if (gp->mission == MI_ESCORT) {
pr(" ");
- pr(" %4d", (int)(item.plane.pln_range / 2.0));
+ pr(" %4d", item.plane.pln_range / 2);
} else
pr(" ");
if (gp->mission)
for (qp = interceptors.q_forw; qp != (&interceptors);
qp = qp->q_forw)
tcount++;
- tcount -= (count * 2);
+ tcount -= count * 2;
/* Just in case there are more incoming than we have */
if (tcount < 0)
tcount = 0;
double sect_mcost;
double total_mcost;
double mv_cost;
- double mobility = (double)start->sct_mobil;
+ double mobility = start->sct_mobil;
int dir;
int intcost;
int takedam = *dam;
if (takedam && chance(weight / 100.0) &&
((curx != oldx) || (cury != oldy)))
*dam += ground_interdict(curx, cury, player->cnum,
- "commodities");
+ "commodities");
if (*dam >= 100)
break;
}
if (!(pcp->pl_flags & P_SWEEP)) /* if it isn't an sweep plane */
continue;
- if (chance(((double)(100 - pp->pln_acc)) / 100.0)) {
+ if (chance((100.0 - pp->pln_acc) / 100.0)) {
pr("Sweep! in %s\n",
xyas(sect.sct_x, sect.sct_y, pp->pln_own));
mines_there--;
while (nxtitem(&ni, &land)) {
if (land.lnd_own == 0)
continue;
- if (!chance((double)land.lnd_effic / 20.0))
+ if (!chance(land.lnd_effic / 20.0))
continue;
if (++crackle == 100)
crackle = 0;
while (nxtitem(&ni, &land)) {
if (land.lnd_own == 0)
continue;
- if (!chance((double)land.lnd_effic / 20.0))
+ if (!chance(land.lnd_effic / 20.0))
continue;
if (first) {
mlp = malloc(sizeof(struct mlist));
mlp->mcp = mcp;
mlp->ship = ship;
- mlp->mobil = (double)ship.shp_mobil;
+ mlp->mobil = ship.shp_mobil;
emp_insque(&mlp->queue, list);
}
}
if (ship.shp_x != allx || ship.shp_y != ally)
*togetherp = 0;
if (ship.shp_mobil + 1 < (int)mlp->mobil) {
- mlp->mobil = (double)ship.shp_mobil;
+ mlp->mobil = ship.shp_mobil;
}
if (mlp->mobil < *minmobp)
*minmobp = mlp->mobil;
if (!totdam
|| !(count = shp_count(list, wantflags, nowantflags, x, y)))
return 0;
- dam = ldround(((double)totdam / (double)count), 1);
+ dam = ldround((double)totdam / count, 1);
for (qp = list->q_back; qp != list; qp = next) {
next = qp->q_back;
mlp = (struct mlist *)qp;
vis = sp->shp_visib;
getsect(sp->shp_x, sp->shp_y, §);
- onsea = (sect.sct_type == SCT_WATER);
+ onsea = sect.sct_type == SCT_WATER;
if (mcp->m_flags & M_SUB)
vis *= 4;
- return (int)(((double)sp->shp_effic / 100.0) *
- (20 + (double)sp->shp_speed * onsea / 2.0 - vis));
+ return (int)((sp->shp_effic / 100.0) *
+ (20 + sp->shp_speed * onsea / 2.0 - vis));
}
static int
/* now calculate the odds */
gun = MIN(ship.shp_item[I_GUN], ship.shp_glim);
- eff = (double)ship.shp_effic / 100.0;
- teff =
- (((double)ship.shp_tech) / (((double)ship.shp_tech) + 200.0));
+ eff = ship.shp_effic / 100.0;
+ teff = ship.shp_tech / (ship.shp_tech + 200.0);
/* raise 4.5 for better interception -KHS */
hitchance = (int)(gun * eff * teff * 4.5) - hardtarget;
if (hitchance < 0)
mlp = malloc(sizeof(struct mlist));
mlp->mcp = &mchr[(int)sp->shp_type];
mlp->ship = *sp;
- mlp->mobil = (double)sp->shp_mobil;
+ mlp->mobil = sp->shp_mobil;
emp_insque(&mlp->queue, &list);
sprintf(buf, "%s", prship(&mlp->ship));
}
if (opt_FUEL && type == I_PETROL) {
- int fuel_needed = (lp->lnd_fuelu * (((float)etu_per_update
- * land_mob_scale)) / 10.0);
+ int fuel_needed = lp->lnd_fuelu
+ * ((float)etu_per_update * land_mob_scale) / 10.0;
while ((lp->lnd_fuel < fuel_needed) && lp->lnd_item[I_PETROL]) {
lp->lnd_fuel += 10;
packing = ip->i_pkg[dp->d_pkg];
if (packing > 1 && sect.sct_effic < 60)
packing = 1;
- weight = ((double)ip->i_lbs / (double)packing);
+ weight = (double)ip->i_lbs / packing;
mobcost = move_cost * weight;
if (mobcost > 0)
- can_move = ((double)sect.sct_mobil / mobcost);
+ can_move = (double)sect.sct_mobil / mobcost;
else
can_move = sect.sct_item[type] - minimum;
if (can_move > sect.sct_item[type] - minimum)
packing = ip->i_pkg[dp->d_pkg];
if (packing > 1 && sect.sct_effic < 60)
packing = 1;
- weight = ((double)ip->i_lbs / (double)packing);
+ weight = (double)ip->i_lbs / packing;
mobcost = move_cost * weight;
if (mobcost > 0)
- can_move = ((double)sect.sct_mobil / mobcost);
+ can_move = (double)sect.sct_mobil / mobcost;
else
can_move = ship.shp_item[type] - minimum;
if (can_move > ship.shp_item[type] - minimum)
min = get_minimum(&land, type);
ip = &ichr[type];
- weight = ((double)ip->i_lbs);
+ weight = ip->i_lbs;
mobcost = move_cost * weight;
if (mobcost > 0)
- can_move = ((double)land.lnd_mobil / mobcost);
+ can_move = (double)land.lnd_mobil / mobcost;
else
can_move = land.lnd_item[type] - min;
if (can_move > land.lnd_item[type] - min)
case I_FOOD:
if (opt_NOFOOD)
return 0; /* no food reqd, get out */
- want = (((double)etu_per_update * eatrate) *
- (double)lp->lnd_item[I_MILIT]) + 1;
+ want = (double)etu_per_update * eatrate * lp->lnd_item[I_MILIT] + 1;
break;
case I_SHELL:
want = lp->lnd_ammo;
/*
* return the amount of pet we'd need to get to
* enough fuel for 1 update
- *
*/
case I_PETROL:
if (opt_FUEL == 0)
return 0;
- want = (lp->lnd_fuelu * (((float)etu_per_update *
- land_mob_scale)) / 10.0);
+ want = lp->lnd_fuelu * ((float)etu_per_update * land_mob_scale)
+ / 10.0;
want -= lp->lnd_fuel;
if (want > 0) {
- double d;
- d = (double)want / 10.0;
- want = (int)d;
+ want = want / 10;
if (want == 0)
want++;
}
fuel = lp->lnd_fuel;
if (fuel < fuel_needed) {
petrol_needed =
- ldround(((double)(fuel_needed - fuel) / 10.0), 1);
+ ldround((fuel_needed - fuel) / 10.0, 1);
petrol = keeppetrol = lp->lnd_item[I_PETROL];
if (petrol < petrol_needed) {
lp->lnd_item[I_PETROL] = 0;
if (fuel < fuel_needed) {
petrol_needed =
- ldround(((double)(fuel_needed - fuel) / 10.0), 1);
+ ldround((fuel_needed - fuel) / 10.0, 1);
petrol = lp->lnd_item[I_PETROL];
}
supply ships in port, or supply units */
int needed;
- needed = ldround((double)(1 + etu * people * eatrate), 1);
+ needed = ldround(1.0 + etu * people * eatrate, 1);
/* Now, find some food */
vec[I_FOOD] = supply_commod(sp->sct_own,
/* opt_FUEL in force */
if (mchr[(int)sp->shp_type].m_fuelu == 0) {
- value = sp->shp_mobil + ((float)etus * ship_mob_scale);
+ value = sp->shp_mobil + (float)etus * ship_mob_scale;
if (value > ship_mob_max)
value = ship_mob_max;
sp->shp_mobil = (signed char)value;
} else {
can_add = ship_mob_max - sp->shp_mobil;
- if (can_add > ((float)etus * ship_mob_scale))
- can_add = ((float)etus * ship_mob_scale);
- have_fuel_for = ldround((((double)sp->shp_fuel /
- (double)mchr[(int)sp->shp_type].m_fuelu)
- * (double)fuel_mult), 1);
+ if (can_add > (float)etus * ship_mob_scale)
+ can_add = (float)etus * ship_mob_scale;
+ have_fuel_for = ldround(((double)sp->shp_fuel /
+ (double)mchr[(int)sp->shp_type].m_fuelu)
+ * (double)fuel_mult, 1);
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
- d = (double)need;
- d *= (double)mchr[(int)sp->shp_type].m_fuelu;
- d /= (double)fuel_mult;
+ d = need;
+ d *= mchr[(int)sp->shp_type].m_fuelu;
+ d /= fuel_mult;
d /= 5.0;
- if ((d - (int)d) > 0.0)
+ if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
sp->shp_fuel += newfuel * 5;
}
- have_fuel_for = ldround((((double)sp->shp_fuel /
- (double)mchr[(int)sp->shp_type].m_fuelu)
- * (double)fuel_mult), 1);
+ have_fuel_for = ldround(((double)sp->shp_fuel /
+ (double)mchr[(int)sp->shp_type].m_fuelu)
+ * (double)fuel_mult, 1);
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
- d = (double)need;
- d *= (double)mchr[(int)sp->shp_type].m_fuelu;
- d /= (double)fuel_mult;
+ d = need;
+ d *= mchr[(int)sp->shp_type].m_fuelu;
+ d /= fuel_mult;
d /= 50.0;
- if ((d - (int)d) > 0.0)
+ if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
sp->shp_fuel += newfuel * 50;
}
- have_fuel_for = ldround((((double)sp->shp_fuel /
- (double)mchr[(int)sp->shp_type].m_fuelu)
- * (double)fuel_mult), 1);
+ have_fuel_for = ldround(((double)sp->shp_fuel /
+ (double)mchr[(int)sp->shp_type].m_fuelu)
+ * (double)fuel_mult, 1);
if (can_add > have_fuel_for)
total_add = have_fuel_for;
else
total_add = can_add;
- d = (double)total_add;
- d *= (double)mchr[(int)sp->shp_type].m_fuelu;
- d /= (double)fuel_mult;
+ d = total_add;
+ d *= mchr[(int)sp->shp_type].m_fuelu;
+ d /= fuel_mult;
sp->shp_fuel -= ldround(d, 1);
sp->shp_fuel = MIN(sp->shp_fuel, mchr[(int)sp->shp_type].m_fuelc);
sp->shp_mobil += total_add;
can_add = land_mob_max - lp->lnd_mobil;
- if (can_add > ((float)etus * land_mob_scale))
- can_add = ((float)etus * land_mob_scale);
+ if (can_add > (float)etus * land_mob_scale)
+ can_add = (float)etus * land_mob_scale;
have_fuel_for = (lp->lnd_fuel / lp->lnd_fuelu) * fuel_mult;
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
- d = (double)need;
- d *= (double)lp->lnd_fuelu;
- d /= (double)fuel_mult;
+ d = need;
+ d *= lp->lnd_fuelu;
+ d /= fuel_mult;
d /= 5.0;
- if ((d - (int)d) > 0.0)
+ if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(lp->lnd_own, lp->lnd_x, lp->lnd_y,
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
- d = (double)need;
- d *= (double)lp->lnd_fuelu;
- d /= (double)fuel_mult;
+ d = need;
+ d *= lp->lnd_fuelu;
+ d /= fuel_mult;
d /= 50.0;
- if ((d - (int)d) > 0.0)
+ if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(lp->lnd_own, lp->lnd_x, lp->lnd_y,
total_add = have_fuel_for;
} else
total_add = can_add;
- d = (double)total_add;
- d *= (double)lp->lnd_fuelu;
- d /= (double)fuel_mult;
+ d = total_add;
+ d *= lp->lnd_fuelu;
+ d /= fuel_mult;
lp->lnd_fuel -= ldround(d, 1);
lp->lnd_fuel = MIN(lp->lnd_fuel, lp->lnd_fuelc);
lp->lnd_mobil += total_add;
mlp = malloc(sizeof(struct mlist));
mlp->mcp = mchr + sp->shp_type;
mlp->ship = *sp;
- mlp->mobil = (double)sp->shp_mobil;
+ mlp->mobil = sp->shp_mobil;
emp_insque(&mlp->queue, &ship_list);
quit = 1; /* setup loop, we want to check it 1 time. */
if (opt_FUEL == 0)
return;
getship(sp->shp_uid, sp); /* refresh */
- /* fill with petro */
+ /* fill with petrol */
maxfuel = mchr[(int)sp->shp_type].m_fuelc;
- d = (double)maxfuel / 5.0;
- if ((d - (int)d > 0.0))
+ d = maxfuel / 5.0;
+ if (d - (int)d > 0.0)
d++;
need = (int)d;
}
add_fuel = 0;
/* fill with oil */
- d = (double)(maxfuel - totalfuel) / 50.0;
- if ((d - (int)d > 0.0))
+ d = (maxfuel - totalfuel) / 50.0;
+ if (d - (int)d > 0.0)
d++;
need = (int)d;
plg_num = 100.0 * etus;
plg_denom = (np->nat_level[NAT_RLEV] + 100.0) *
(*ptime + etus + 1.0);
- pct_left = 1.0 - (double)(plg_num / plg_denom);
+ pct_left = 1.0 - plg_num / plg_denom;
if (pct_left < 0.2)
pct_left = 0.2;
vec[I_CIVIL] = vec[I_CIVIL] * pct_left;
if (n < 0)
n = 0;
sp->sct_work = n;
- if (chance((double)work_red / 1000.0)) {
+ if (chance(work_red / 1000.0)) {
/*
* small chance of rebellion...
* if work_red is (max) 67,
if (etus > 24)
etus = 24;
- decay = roundavg(((decay_per_etu + 6.0) * fallout_spread) *
+ decay = roundavg((decay_per_etu + 6.0) * fallout_spread *
(double)etus * (double)sp->sct_fallout);
sp->sct_fallout = decay < sp->sct_fallout ? sp->sct_fallout - decay : 0;
sp->shp_item[I_MILIT],
sp->shp_item[I_UW],
ITEM_MAX)
- * (double)sp->shp_effic / 100.0
- * (double)sectp->sct_oil / 100.0
+ * sp->shp_effic / 100.0
+ * sectp->sct_oil / 100.0
* prod_eff(product, sp->shp_tech));
max_oil = mp->m_item[I_OIL];
if (sp->shp_item[I_OIL] + oil_gained > max_oil)
header, shutdown_pending);
} else if (shutdown_pending % 60 == 0) {
pr_wall("%sThe server will be shutting down %d hours from now.\n",
- header, (int)(shutdown_pending / 60));
+ header, shutdown_pending / 60);
}
}
empth_sleep(now + 60);