Remove option FUEL

The abstract idea of tying ships and land units to a logistical tether
is sound, the concrete implementation as option FUEL is flawed.  It
adds too much busy-work to the game to be enjoyable.  It hasn't been
enabled in a public game for years.  The code implementing it is ugly,
repetitive, and a burden to maintain.

Remove selector fuel from ship_ca[] and land_ca[], and selectors
fuelc, fuelu from mchr_ca[] and lchr_ca[].  Remove fields fuelc, fuelu
from ship.config and land.config.

Remove command fuel from player_coms[].

Deprecate edit key 'B' in doship(), dounit(), and don't show it in
pr_ship(), pr_land().

Drop opt_FUEL code from build_ship(), shi(), sdump(), ship_damage(),
show_ship_stats(), do_mob_ship(), nav_ship(), build_land(), land(),
ldump(), land_damage(), show_land_stats(), do_mob_land(),
resupply_all(), resupply_commod(), get_minimum(), has_supply(),
unit_list(), vers().

Remove opt_FUEL, fuel_mult, struct shpstr member shp_fuel, struct
mchrstr members m_fuelc and m_fuelu, M_OILER, struct lndstr member
lnd_fuel, struct lchrstr members l_fuelc and l_fuelu, fuel(), and
auto_fuel_ship().
This commit is contained in:
Markus Armbruster 2008-05-12 09:25:20 +02:00
parent 3cc80e83c3
commit 3b4de2feb1
42 changed files with 124 additions and 984 deletions

View file

@ -374,7 +374,6 @@ build_ship(struct sctstr *sp, struct mchrstr *mp, short *vec, int tlev)
ship.shp_orig_own = player->cnum;
ship.shp_orig_x = sp->sct_x;
ship.shp_orig_y = sp->sct_y;
ship.shp_fuel = mchr[(int)ship.shp_type].m_fuelc;
ship.shp_rflags = 0;
memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
shp_set_tech(&ship, tlev);
@ -490,7 +489,6 @@ build_land(struct sctstr *sp, struct lchrstr *lp, short *vec, int tlev)
land.lnd_nland = 0;
land.lnd_harden = 0;
land.lnd_retreat = morale_base;
land.lnd_fuel = lp->l_fuelc;
land.lnd_nxlight = 0;
land.lnd_rflags = 0;
memset(land.lnd_rpath, 0, sizeof(land.lnd_rpath));

View file

@ -346,7 +346,6 @@ pr_land(struct lndstr *land)
pr("Tech <t>: %d\t\t", land->lnd_tech);
pr("Army <a>: %.1s\n", &land->lnd_army);
pr("Fortification <F>: %d\t", land->lnd_harden);
pr("Fuel <B>: %d\n", land->lnd_fuel);
pr("Land unit <Y>: %d\n", land->lnd_land);
pr("Ship <S>: %d\t\t", land->lnd_ship);
pr("Radius <P>: %d\n", land->lnd_rad_max);
@ -386,9 +385,6 @@ pr_ship(struct shpstr *ship)
pr("Efficiency <E>: %d\n", ship->shp_effic);
pr("Mobility <M>: %d\t\t", ship->shp_mobil);
pr("Fleet <F>: %.1s\n", &ship->shp_fleet);
/* could depend on opt_FUEL - but a deity might want to set this
up before enabling the option */
pr("Fuel <B>: %d\n", ship->shp_fuel);
pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
ship->shp_rpath, ship->shp_rflags);
pr("Plague Stage <a>: %d\t\t",ship->shp_pstage);
@ -810,7 +806,7 @@ doship(char op, int arg, char *p, struct shpstr *ship)
ship->shp_mobil = arg;
break;
case 'B':
ship->shp_fuel = errcheck(arg, 0, 255);
warn_deprecated(op);
break;
case 'F':
if (p[0] == '~')
@ -928,7 +924,7 @@ dounit(char op, int arg, char *p, struct lndstr *land)
land->lnd_harden = errcheck(arg, 0, 255);
break;
case 'B':
land->lnd_fuel = errcheck(arg, 0, 255);
warn_deprecated(op);
break;
case 'S':
land->lnd_ship = arg;

View file

@ -1,454 +0,0 @@
/*
* Empire - A multi-player, client/server Internet based war game.
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* ---
*
* 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.
*
* ---
*
* fuel.c: fuel ships/land units
*
* Known contributors to this file:
*
*/
#include <config.h>
#include <ctype.h>
#include "commands.h"
#include "empobj.h"
#include "optlist.h"
#include "plague.h"
int
fuel(void)
{
static int shp_or_lnd[] = { EF_SHIP, EF_LAND, EF_BAD };
struct nstr_item ni;
union empobj_storage item, item2;
int type;
struct mchrstr *mp;
struct lchrstr *lcp;
char *p;
int fueled;
int land_fuel, ship_fuel;
int oil_amt, pet_amt, fuel_amt, tot_fuel, max_amt;
int move_amt;
double extra;
struct sctstr sect;
struct natstr *natp;
int harbor, sector;
int fuelled_ship = -1;
struct nstr_item tender, ltender;
char prompt[128];
char buf[1024];
if (opt_FUEL == 0) {
pr("Option 'FUEL' not enabled\n");
return RET_SYN;
}
if ((p =
getstarg(player->argp[1], "Ship or land unit (s,l)? ", buf)) == 0)
return RET_SYN;
type = ef_byname_from(p, shp_or_lnd);
if (type < 0) {
pr("Ships or land units only! (s, l)\n");
return RET_SYN;
}
sprintf(prompt, "%s(s)? ", ef_nameof(type));
p = getstarg(player->argp[2], prompt, buf);
if (!snxtitem(&ni, type, p))
return RET_SYN;
if (isdigit(*p))
fuelled_ship = atoi(p);
p = getstarg(player->argp[3], "Amount: ", buf);
if (p == 0 || *p == 0)
return RET_SYN;
fuel_amt = atoi(p);
if (fuel_amt <= 0) {
pr("Fuel amount must be positive!\n");
return RET_FAIL;
}
while (nxtitem(&ni, &item)) {
fueled = 0;
if (type == EF_SHIP) {
if (item.ship.shp_own != player->cnum) {
int rel;
if (item.ship.shp_uid != fuelled_ship)
continue;
natp = getnatp(player->cnum);
rel = getrel(natp, item.ship.shp_own);
if (rel < FRIENDLY)
continue;
}
if (!getsect(item.ship.shp_x, item.ship.shp_y, &sect))
continue;
if (!item.ship.shp_own)
continue;
if (shp_check_nav(&sect, &item.ship) == CN_LANDLOCKED) {
pr("%s is landlocked and cannot be fueled.\n",
prship(&item.ship));
continue;
}
mp = &mchr[(int)item.ship.shp_type];
harbor = 0;
if (sect_has_dock(&sect)) {
harbor = 1;
oil_amt = sect.sct_item[I_OIL];
pet_amt = sect.sct_item[I_PETROL];
if ((oil_amt + pet_amt) == 0)
harbor = 0;
if (sect.sct_effic < 2) {
pr("The harbor at %s is not 2%% efficient yet.\n",
xyas(item.ship.shp_x, item.ship.shp_y,
player->cnum));
harbor = 0;
}
if ((sect.sct_own != player->cnum) && sect.sct_own)
harbor = 0;
}
if ((mp->m_fuelu == 0) && (item.ship.shp_own == player->cnum)) {
pr("%s does not use fuel!\n", prship(&item.ship));
continue;
}
if (harbor) {
ship_fuel = item.ship.shp_fuel;
oil_amt = sect.sct_item[I_OIL];
pet_amt = sect.sct_item[I_PETROL];
max_amt = mp->m_fuelc - ship_fuel;
if (max_amt == 0) {
pr("%s already has a full fuel load.\n",
prship(&item.ship));
continue;
}
tot_fuel = (oil_amt * 50 + pet_amt * 5);
if (tot_fuel == 0) {
pr("No fuel in the harbor at %s!\n",
xyas(sect.sct_x, sect.sct_y, player->cnum));
continue;
}
move_amt = MIN(tot_fuel, fuel_amt);
move_amt = MIN(move_amt, max_amt);
if (move_amt == 0)
continue;
item.ship.shp_fuel += move_amt;
fueled = 1;
if ((pet_amt * 5) >= move_amt) {
extra = move_amt / 5.0 - move_amt / 5;
if (extra > 0.0)
sect.sct_item[I_PETROL]
= MAX((pet_amt - move_amt / 5) - 1, 0);
else
sect.sct_item[I_PETROL]
= MAX((pet_amt - move_amt / 5), 0);
} else {
sect.sct_item[I_PETROL] = 0;
move_amt -= pet_amt * 5;
extra = move_amt / 50.0 - move_amt / 50;
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);
else
sect.sct_item[I_OIL]
= MAX((oil_amt - move_amt / 50), 0);
}
/* load plague */
if (sect.sct_pstage == PLG_INFECT
&& item.ship.shp_pstage == PLG_HEALTHY)
item.ship.shp_pstage = PLG_EXPOSED;
putsect(&sect);
putship(item.ship.shp_uid, &item.ship);
} else { /* not in a harbor */
if (!player->argp[4])
pr("%s is not in a supplied, efficient harbor\n",
prship(&item.ship));
if (!snxtitem(&tender, EF_SHIP,
getstarg(player->argp[4], "Oiler? ", buf)))
continue;
if (!check_ship_ok(&item.ship))
continue;
if (!nxtitem(&tender, &item2))
continue;
if (!(mchr[(int)item2.ship.shp_type].m_flags & M_OILER)) {
pr("%s is not an oiler!\n", prship(&item2.ship));
continue;
}
if (item2.ship.shp_own != player->cnum) {
pr("You don't own that oiler!\n");
continue;
}
if ((item2.ship.shp_x != item.ship.shp_x) ||
(item2.ship.shp_y != item.ship.shp_y)) {
pr("Not in the same sector!\n");
continue;
}
ship_fuel = item.ship.shp_fuel;
oil_amt = item2.ship.shp_item[I_OIL];
pet_amt = item2.ship.shp_item[I_PETROL];
max_amt = mp->m_fuelc - ship_fuel;
if (max_amt == 0) {
pr("%s already has a full fuel load.\n",
prship(&item.ship));
continue;
}
tot_fuel = oil_amt * 50 + pet_amt * 5;
move_amt = MIN(tot_fuel, fuel_amt);
move_amt = MIN(move_amt, max_amt);
if (move_amt == 0)
continue;
item.ship.shp_fuel += move_amt;
fueled = 1;
if ((pet_amt * 5) >= move_amt) {
extra = 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);
else
item2.ship.shp_item[I_PETROL]
= MAX((pet_amt - move_amt / 5), 0);
} else {
item2.ship.shp_item[I_PETROL] = 0;
move_amt -= pet_amt * 5;
extra = move_amt / 50.0 - move_amt / 50;
item2.ship.shp_item[I_OIL]
= 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);
else
item2.ship.shp_item[I_OIL]
= MAX((oil_amt - move_amt / 50), 0);
}
/* load plague */
if (item2.ship.shp_pstage == PLG_INFECT
&& item.ship.shp_pstage == PLG_HEALTHY)
item.ship.shp_pstage = PLG_EXPOSED;
putship(item.ship.shp_uid, &item.ship);
/* quick hack -KHS */
if (item.ship.shp_uid == item2.ship.shp_uid)
item2.ship.shp_fuel = item.ship.shp_fuel;
putship(item2.ship.shp_uid, &item2.ship);
}
pr("%s", prship(&item.ship));
} else {
if (item.land.lnd_own != player->cnum)
continue;
if (!getsect(item.land.lnd_x, item.land.lnd_y, &sect))
continue;
if (!player->owner)
continue;
lcp = &lchr[(int)item.land.lnd_type];
sector = 1;
oil_amt = sect.sct_item[I_OIL];
pet_amt = sect.sct_item[I_PETROL];
if ((oil_amt + pet_amt) == 0)
sector = 0;
if (lcp->l_fuelu == 0
&& (item.land.lnd_own == player->cnum)) {
pr("%s does not use fuel!\n", prland(&item.land));
continue;
}
if (sector) {
land_fuel = item.land.lnd_fuel;
oil_amt = sect.sct_item[I_OIL];
pet_amt = sect.sct_item[I_PETROL];
max_amt = lcp->l_fuelc - land_fuel;
if (max_amt == 0) {
pr("%s already has a full fuel load.\n",
prland(&item.land));
continue;
}
tot_fuel = (oil_amt * 50 + pet_amt * 5);
if (tot_fuel == 0) {
pr("No fuel in the sector at %s!\n",
xyas(sect.sct_x, sect.sct_y, player->cnum));
continue;
}
move_amt = MIN(tot_fuel, fuel_amt);
move_amt = MIN(move_amt, max_amt);
if (move_amt == 0)
continue;
item.land.lnd_fuel += move_amt;
fueled = 1;
if ((pet_amt * 5) >= move_amt) {
extra = move_amt / 5.0 - move_amt / 5;
if (extra > 0.0)
sect.sct_item[I_PETROL]
= MAX((pet_amt - move_amt / 5) - 1, 0);
else
sect.sct_item[I_PETROL]
= MAX((pet_amt - move_amt / 5), 0);
} else {
sect.sct_item[I_PETROL] = 0;
move_amt -= pet_amt * 5;
extra = move_amt / 50.0 - move_amt / 50;
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);
else
sect.sct_item[I_OIL]
= MAX((oil_amt - move_amt / 50), 0);
}
/* load plague */
if (sect.sct_pstage == PLG_INFECT
&& item.land.lnd_pstage == PLG_HEALTHY)
item.land.lnd_pstage = PLG_EXPOSED;
putsect(&sect);
putland(item.land.lnd_uid, &item.land);
} else { /* not in a sector */
if (!player->argp[4])
pr("%s is not in a supplied sector\n",
prland(&item.land));
if (!snxtitem(&ltender, EF_LAND,
getstarg(player->argp[4], "Supply unit? ",
buf)))
continue;
if (!check_land_ok(&item.land))
continue;
if (!nxtitem(&ltender, &item2))
continue;
if (!(lchr[(int)item2.land.lnd_type].l_flags & L_SUPPLY)) {
pr("%s is not a supply unit!\n", prland(&item2.land));
continue;
}
if (item2.land.lnd_own != player->cnum) {
pr("You don't own that unit!\n");
continue;
}
if ((item2.land.lnd_x != item.land.lnd_x) ||
(item2.land.lnd_y != item.land.lnd_y)) {
pr("Not in the same sector!\n");
continue;
}
land_fuel = item.land.lnd_fuel;
oil_amt = item2.land.lnd_item[I_OIL];
pet_amt = item2.land.lnd_item[I_PETROL];
max_amt = lcp->l_fuelc - land_fuel;
if (max_amt == 0) {
pr("%s already has a full fuel load.\n",
prland(&item.land));
continue;
}
tot_fuel = oil_amt * 50 + pet_amt * 5;
move_amt = MIN(tot_fuel, fuel_amt);
move_amt = MIN(move_amt, max_amt);
if (move_amt == 0)
continue;
item.land.lnd_fuel += move_amt;
fueled = 1;
if ((pet_amt * 5) >= move_amt) {
extra = 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);
else
item2.land.lnd_item[I_PETROL]
= MAX((pet_amt - move_amt / 5), 0);
} else {
item2.land.lnd_item[I_PETROL] = 0;
move_amt -= pet_amt * 5;
extra = move_amt / 50.0 - move_amt / 50;
item2.land.lnd_item[I_OIL]
= 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);
else
item2.land.lnd_item[I_OIL]
= MAX((oil_amt - move_amt / 50), 0);
}
/* load plague */
if (item2.land.lnd_pstage == PLG_INFECT
&& item.land.lnd_pstage == PLG_HEALTHY)
item.land.lnd_pstage = PLG_EXPOSED;
putland(item.land.lnd_uid, &item.land);
/* quick hack -KHS */
if (item2.land.lnd_uid == item.land.lnd_uid)
item2.land.lnd_fuel = item.land.lnd_fuel;
putland(item2.land.lnd_uid, &item2.land);
}
pr("%s", prland(&item.land));
}
if (fueled) {
pr(" takes on %d fuel in %s\n",
move_amt,
xyas(item.ship.shp_x, item.ship.shp_y, player->cnum));
if (player->cnum != item.ship.shp_own)
wu(0, item.ship.shp_own,
"%s takes on %d fuel in %s courtesy of %s\n",
prship(&item.ship),
move_amt,
xyas(item.ship.shp_x, item.ship.shp_y,
item.ship.shp_own), cname(player->cnum));
}
}
return RET_OK;
}

View file

@ -60,8 +60,6 @@ land(void)
if (player->god)
pr("own ");
pr(" # unit type x,y a eff mil frt mu fd");
if (opt_FUEL)
pr(" fl");
pr(" tch retr rd xl ln carry\n");
}
if (land.lnd_off)
@ -77,8 +75,6 @@ land(void)
pr("%4d", land.lnd_harden);
pr("%4d", land.lnd_mobil);
pr("%4d", land.lnd_item[I_FOOD]);
if (opt_FUEL)
pr("%3d", land.lnd_fuel);
pr("%4d ", land.lnd_tech);
pr("%3d%%", land.lnd_retreat);
pr("%3d", land.lnd_rad_max);

View file

@ -337,10 +337,7 @@ ldump(void)
pr(" %d", land.lnd_item[I_FOOD]);
break;
case 10:
if (opt_FUEL)
pr(" %d", land.lnd_fuel);
else
pr(" 0");
pr(" 0");
break;
case 11:
pr(" %d", land.lnd_tech);

View file

@ -315,10 +315,7 @@ sdump(void)
pr(" %d", ship.shp_mobil);
break;
case 15:
if (opt_FUEL)
pr(" %d", ship.shp_fuel);
else
pr(" 0");
pr(" 0");
break;
case 16:
pr(" %d", ship.shp_tech);

View file

@ -59,8 +59,6 @@ shi(void)
pr("own ");
pr("shp# ship type x,y fl eff civ mil uw fd pn"
" he xl ln mob");
if (opt_FUEL)
pr(" fuel");
pr(" tech\n");
}
if (ship.shp_off)
@ -83,8 +81,6 @@ shi(void)
pr("%3d", ship.shp_nxlight);
pr("%3d", ship.shp_nland);
pr("%4d", ship.shp_mobil);
if (opt_FUEL)
pr("%5d", ship.shp_fuel);
pr("%5d\n", ship.shp_tech);
if (ship.shp_name[0] != 0) {
if (player->god)

View file

@ -162,9 +162,6 @@ vers(void)
pr("The starting mobility when acquiring a sector or unit is %d.\n",
-(etu_per_update / sect_mob_neg_factor));
pr("\n");
if (opt_FUEL)
pr("For ships and land units, fuelu makes %d mobility.\n\n",
fuel_mult);
pr("Ships on autonavigation may use %i cargo holds per ship.\n", TMAX);
if (opt_TRADESHIPS) {
pr("Trade-ships that go at least %d sectors get a return of %.1f%% per sector.\n",

View file

@ -102,9 +102,6 @@ double people_damage = 1.00; /* Civs/mil/uw take this fraction of damage */
double collateral_dam = 0.10; /* Side effect damage to sector */
double assault_penalty = 0.50; /* attack factor for para & assault troops */
/* opt_FUEL */
int fuel_mult = 10; /* 1 fuel = 10 mob */
float land_grow_scale = 2.0; /* how fast eff grows for land units (xETUS) */
float ship_grow_scale = 3.0; /* how fast eff grows for ships (xETUS) */
float plane_grow_scale = 2.0; /* how fast eff grows for planes (xETUS) */

View file

@ -70,29 +70,29 @@ type name l_b h_b tech cost ...
/config
config land-chr
type name att def vul spd vis spy rma frg acc dam amm aaf fuelc fuelu nxl nla ...
0 "cav cavalry" 1.2 0.5 80 32 18 4 3 0 0 0 0 0 0 0 0 0
1 "linf light infantry" 1.0 1.5 60 28 15 2 1 0 0 0 1 1 0 0 0 0
2 "inf infantry" 1.0 1.5 60 25 15 2 1 0 0 0 0 0 0 0 0 0
3 "mtif motor inf" 1.2 2.2 60 33 17 1 3 0 0 0 2 3 13 1 0 0
4 "mif mech inf" 1.5 2.5 50 33 17 1 3 0 0 0 2 3 13 1 0 0
5 "mar marines" 1.4 2.4 60 25 14 2 1 0 0 0 1 2 0 0 0 0
6 "sup supply" 0.1 0.2 80 25 20 1 0 0 0 0 0 0 0 0 0 0
7 "tra train" 0.0 0.0 120 10 25 3 0 0 0 0 0 0 0 0 5 12
8 "spy infiltrator" 0.0 0.0 80 32 18 4 3 0 0 0 0 0 0 0 0 0
9 "com commando" 0.0 0.0 80 32 18 4 3 0 0 0 0 0 0 0 0 0
10 "aau aa unit" 0.5 1.0 60 18 20 1 1 0 0 0 1 2 0 0 0 0
11 "art artillery" 0.1 0.4 70 18 20 1 0 8 50 5 2 1 0 0 0 0
12 "lat lt artillery" 0.2 0.6 60 30 18 1 1 5 10 3 1 1 0 0 0 0
13 "hat hvy artillery" 0.0 0.2 60 12 20 1 0 11 99 8 4 1 0 0 0 0
14 "mat mech artillery" 0.2 0.6 50 35 17 1 1 8 35 6 3 3 13 1 0 0
15 "eng engineer" 1.2 2.4 50 25 14 2 1 0 0 0 1 1 0 0 0 0
16 "meng mech engineer" 1.8 3.5 45 33 15 3 3 0 0 0 1 5 25 2 0 0
17 "lar lt armor" 2.0 1.0 50 42 15 4 4 0 0 0 1 2 25 1 0 0
18 "har hvy armor" 2.0 0.8 50 18 17 1 1 0 0 0 2 1 10 2 0 0
19 "arm armor" 3.0 1.5 40 33 16 2 2 0 0 0 1 2 13 1 0 0
20 "sec security" 1.0 2.0 60 25 15 2 1 0 0 0 1 1 0 0 0 0
21 "rad radar unit" 0.0 0.0 50 33 15 3 0 0 0 0 0 2 25 2 1 0
type name att def vul spd vis spy rma frg acc dam amm aaf nxl nla ...
0 "cav cavalry" 1.2 0.5 80 32 18 4 3 0 0 0 0 0 0 0
1 "linf light infantry" 1.0 1.5 60 28 15 2 1 0 0 0 1 1 0 0
2 "inf infantry" 1.0 1.5 60 25 15 2 1 0 0 0 0 0 0 0
3 "mtif motor inf" 1.2 2.2 60 33 17 1 3 0 0 0 2 3 0 0
4 "mif mech inf" 1.5 2.5 50 33 17 1 3 0 0 0 2 3 0 0
5 "mar marines" 1.4 2.4 60 25 14 2 1 0 0 0 1 2 0 0
6 "sup supply" 0.1 0.2 80 25 20 1 0 0 0 0 0 0 0 0
7 "tra train" 0.0 0.0 120 10 25 3 0 0 0 0 0 0 5 12
8 "spy infiltrator" 0.0 0.0 80 32 18 4 3 0 0 0 0 0 0 0
9 "com commando" 0.0 0.0 80 32 18 4 3 0 0 0 0 0 0 0
10 "aau aa unit" 0.5 1.0 60 18 20 1 1 0 0 0 1 2 0 0
11 "art artillery" 0.1 0.4 70 18 20 1 0 8 50 5 2 1 0 0
12 "lat lt artillery" 0.2 0.6 60 30 18 1 1 5 10 3 1 1 0 0
13 "hat hvy artillery" 0.0 0.2 60 12 20 1 0 11 99 8 4 1 0 0
14 "mat mech artillery" 0.2 0.6 50 35 17 1 1 8 35 6 3 3 0 0
15 "eng engineer" 1.2 2.4 50 25 14 2 1 0 0 0 1 1 0 0
16 "meng mech engineer" 1.8 3.5 45 33 15 3 3 0 0 0 1 5 0 0
17 "lar lt armor" 2.0 1.0 50 42 15 4 4 0 0 0 1 2 0 0
18 "har hvy armor" 2.0 0.8 50 18 17 1 1 0 0 0 2 1 0 0
19 "arm armor" 3.0 1.5 40 33 16 2 2 0 0 0 1 2 0 0
20 "sec security" 1.0 2.0 60 25 15 2 1 0 0 0 1 1 0 0
21 "rad radar unit" 0.0 0.0 50 33 15 3 0 0 0 0 0 2 1 0
/config
config land-chr

View file

@ -242,7 +242,6 @@ struct castr ship_ca[] = {
{"follow", fldoff(shp_follow), NSC_SHORT, 0, NULL, EF_BAD, 0},
{"name", fldoff(shp_name), NSC_STRINGY, MAXSHPNAMLEN, NULL,
EF_BAD, 0},
{"fuel", fldoff(shp_fuel), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"nchoppers", fldoff(shp_nchoppers), NSC_UCHAR, 0, NULL,
EF_BAD, NSC_EXTRA},
{"nxlight", fldoff(shp_nxlight), NSC_UCHAR, 0, NULL,
@ -276,8 +275,6 @@ struct castr mchr_ca[] = {
{"glim", fldoff(m_glim), NSC_INT, 0, NULL, EF_BAD, 0},
{"nxlight", fldoff(m_nxlight), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"nchoppers", fldoff(m_nchoppers), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"fuelc", fldoff(m_fuelc), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"fuelu", fldoff(m_fuelu), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"tech", fldoff(m_tech), NSC_INT, 0, NULL, EF_BAD, 0},
{"cost", fldoff(m_cost), NSC_INT, 0, NULL, EF_BAD, 0},
{"flags", fldoff(m_flags), NSC_LONG, 0, NULL,
@ -336,7 +333,6 @@ struct castr land_ca[] = {
{"ship", fldoff(lnd_ship), NSC_SHORT, 0, NULL, EF_BAD, 0},
{"harden", fldoff(lnd_harden), NSC_CHAR, 0, NULL, EF_BAD, 0},
{"retreat", fldoff(lnd_retreat), NSC_SHORT, 0, NULL, EF_BAD, 0},
{"fuel", fldoff(lnd_fuel), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"nxlight", fldoff(lnd_nxlight), NSC_UCHAR, 0, NULL,
EF_BAD, NSC_EXTRA},
{"rflags", fldoff(lnd_rflags), NSC_INT, 0, NULL,
@ -364,8 +360,6 @@ struct castr land_ca[] = {
{"spy", fldoff(l_spy), NSC_INT, 0, nsc_lchr, EF_BAD, NSC_EXTRA},
{"rmax", fldoff(l_rad), NSC_INT, 0, nsc_lchr, EF_BAD, NSC_EXTRA},
{"ammo", fldoff(l_ammo), NSC_INT, 0, nsc_lchr, EF_BAD, NSC_EXTRA},
{"fuelc", fldoff(l_fuelc), NSC_UCHAR, 0, nsc_lchr, EF_BAD, NSC_EXTRA},
{"fuelu", fldoff(l_fuelu), NSC_UCHAR, 0, nsc_lchr, EF_BAD, NSC_EXTRA},
{"maxlight", fldoff(l_nxlight), NSC_UCHAR, 0, nsc_lchr,
EF_BAD, NSC_EXTRA},
{NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
@ -393,8 +387,6 @@ struct castr lchr_ca[] = {
{"dam", fldoff(l_dam), NSC_INT, 0, NULL, EF_BAD, 0},
{"ammo", fldoff(l_ammo), NSC_INT, 0, NULL, EF_BAD, 0},
{"aaf", fldoff(l_aaf), NSC_INT, 0, NULL, EF_BAD, 0},
{"fuelc", fldoff(l_fuelc), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"fuelu", fldoff(l_fuelu), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"nxlight", fldoff(l_nxlight), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"nland", fldoff(l_nland), NSC_UCHAR, 0, NULL, EF_BAD, 0},
{"flags", fldoff(l_flags), NSC_LONG, 0, NULL,

View file

@ -42,7 +42,6 @@ int opt_BLITZ = 1;
int opt_BRIDGETOWERS = 1;
int opt_EASY_BRIDGES = 1;
int opt_FALLOUT = 1;
int opt_FUEL = 0;
int opt_GODNEWS = 1;
int opt_GO_RENEW = 0;
int opt_GUINEA_PIGS = 0;

View file

@ -90,44 +90,44 @@ type name l_b h_b tech cost ...
/config
config ship-chr
type name arm spe vis vrn frn gli nla npl nch nxl fuelc fuelu ...
0 "fb fishing boat" 10 10 15 2 0 0 0 0 0 0 0 0
1 "ft fishing trawler" 10 25 15 2 0 0 0 0 0 0 20 1
2 "cs cargo ship" 20 25 35 3 0 0 2 0 0 1 0 0
3 "os ore ship" 20 25 35 3 0 0 0 0 0 1 30 1
4 "ss slave ship" 20 10 35 3 0 0 0 0 0 1 0 0
5 "ts trade ship" 20 25 35 3 0 0 0 0 0 1 30 1
6 "frg frigate" 50 25 25 3 1 1 2 0 0 1 0 0
7 "oe oil exploration boat" 10 25 15 2 0 0 0 0 0 0 20 1
8 "od oil derrick" 30 15 65 3 0 0 0 0 0 2 0 0
9 "pt patrol boat" 10 38 10 2 1 1 0 0 0 0 4 1
10 "lc light cruiser" 50 30 30 5 6 3 2 0 0 1 40 1
11 "hc heavy cruiser" 70 30 30 5 8 4 4 0 0 1 30 1
12 "tt troop transport" 60 20 35 3 1 2 2 0 0 1 0 0
13 "bb battleship" 95 25 35 6 10 7 2 0 0 1 50 2
14 "bbc battlecruiser" 55 30 35 6 10 6 2 0 0 1 60 2
15 "tk tanker" 75 25 45 3 0 0 0 0 0 1 30 1
16 "ms minesweeper" 10 25 15 2 0 0 0 0 0 0 20 1
17 "dd destroyer" 45 35 20 4 6 3 1 0 0 1 30 1
18 "sb submarine" 25 20 5 4 3 3 0 0 0 0 30 1
19 "sbc cargo submarine" 50 30 2 3 0 0 0 0 0 0 50 2
20 "cal light carrier" 60 30 40 5 2 2 0 20 20 4 50 2
21 "car aircraft carrier" 80 35 40 7 2 2 0 40 40 10 120 3
22 "can nuc carrier" 100 45 40 9 2 2 0 60 4 20 0 0
23 "ls landing ship" 40 30 30 2 0 0 6 0 0 2 30 1
24 "af asw frigate" 50 35 30 5 2 2 0 0 0 4 40 1
25 "na nuc attack sub" 45 40 3 6 5 3 0 0 0 0 0 0
26 "ad asw destroyer" 60 40 35 6 8 3 0 0 2 10 80 2
27 "nm nuc miss sub" 55 35 2 6 0 0 0 20 0 0 0 0
28 "msb missile sub" 35 30 3 3 0 0 0 10 0 0 30 1
29 "mb missile boat" 15 40 15 3 2 2 0 10 0 0 7 1
30 "mf missile frigate" 50 35 30 5 2 2 0 20 0 2 30 1
31 "mc missile cruiser" 70 35 35 8 8 6 0 40 8 8 35 1
32 "aac aa cruiser" 80 35 30 6 1 8 4 0 0 1 60 2
33 "agc aegis cruiser" 80 35 30 6 1 16 0 32 2 30 0 0
34 "ncr nuc cruiser" 100 45 35 6 14 7 0 20 2 10 0 0
35 "nas nuc asw cruiser" 80 45 35 9 10 4 0 0 8 25 0 0
36 "nsp nuc supply ship" 40 45 35 6 0 0 2 0 2 10 0 0
type name arm spe vis vrn frn gli nla npl nch nxl ...
0 "fb fishing boat" 10 10 15 2 0 0 0 0 0 0
1 "ft fishing trawler" 10 25 15 2 0 0 0 0 0 0
2 "cs cargo ship" 20 25 35 3 0 0 2 0 0 1
3 "os ore ship" 20 25 35 3 0 0 0 0 0 1
4 "ss slave ship" 20 10 35 3 0 0 0 0 0 1
5 "ts trade ship" 20 25 35 3 0 0 0 0 0 1
6 "frg frigate" 50 25 25 3 1 1 2 0 0 1
7 "oe oil exploration boat" 10 25 15 2 0 0 0 0 0 0
8 "od oil derrick" 30 15 65 3 0 0 0 0 0 2
9 "pt patrol boat" 10 38 10 2 1 1 0 0 0 0
10 "lc light cruiser" 50 30 30 5 6 3 2 0 0 1
11 "hc heavy cruiser" 70 30 30 5 8 4 4 0 0 1
12 "tt troop transport" 60 20 35 3 1 2 2 0 0 1
13 "bb battleship" 95 25 35 6 10 7 2 0 0 1
14 "bbc battlecruiser" 55 30 35 6 10 6 2 0 0 1
15 "tk tanker" 75 25 45 3 0 0 0 0 0 1
16 "ms minesweeper" 10 25 15 2 0 0 0 0 0 0
17 "dd destroyer" 45 35 20 4 6 3 1 0 0 1
18 "sb submarine" 25 20 5 4 3 3 0 0 0 0
19 "sbc cargo submarine" 50 30 2 3 0 0 0 0 0 0
20 "cal light carrier" 60 30 40 5 2 2 0 20 20 4
21 "car aircraft carrier" 80 35 40 7 2 2 0 40 40 10
22 "can nuc carrier" 100 45 40 9 2 2 0 60 4 20
23 "ls landing ship" 40 30 30 2 0 0 6 0 0 2
24 "af asw frigate" 50 35 30 5 2 2 0 0 0 4
25 "na nuc attack sub" 45 40 3 6 5 3 0 0 0 0
26 "ad asw destroyer" 60 40 35 6 8 3 0 0 2 10
27 "nm nuc miss sub" 55 35 2 6 0 0 0 20 0 0
28 "msb missile sub" 35 30 3 3 0 0 0 10 0 0
29 "mb missile boat" 15 40 15 3 2 2 0 10 0 0
30 "mf missile frigate" 50 35 30 5 2 2 0 20 0 2
31 "mc missile cruiser" 70 35 35 8 8 6 0 40 8 8
32 "aac aa cruiser" 80 35 30 6 1 8 4 0 0 1
33 "agc aegis cruiser" 80 35 30 6 1 16 0 32 2 30
34 "ncr nuc cruiser" 100 45 35 6 14 7 0 20 2 10
35 "nas nuc asw cruiser" 80 45 35 9 10 4 0 0 8 25
36 "nsp nuc supply ship" 40 45 35 6 0 0 2 0 2 10
/config
config ship-chr
@ -147,14 +147,14 @@ type name civ mil she gun pet iro dus bar foo oil lcm hcm
12 "tt troop transport" 0 120 20 4 0 0 0 0 120 0 0 0 0 0 (semi-land)
13 "bb battleship" 0 200 200 10 0 0 0 0 900 0 0 0 0 0 ()
14 "bbc battlecruiser" 0 180 100 10 0 0 0 0 400 0 0 0 0 0 ()
15 "tk tanker" 30 5 0 0 990 0 0 0 200 990 0 0 25 0 (oiler supply)
15 "tk tanker" 30 5 0 0 990 0 0 0 200 990 0 0 25 0 (supply)
16 "ms minesweeper" 0 10 100 1 0 0 0 0 90 0 0 0 0 0 (mine sweep canal)
17 "dd destroyer" 0 60 40 4 0 0 0 0 80 0 0 0 0 0 (dchrg sonar mine)
18 "sb submarine" 0 25 36 5 0 0 0 0 80 0 0 0 0 0 (torp sonar mine sub)
19 "sbc cargo submarine" 5 10 104 20 100 0 0 0 900 0 500 300 0 0 (sonar sub oiler supply)
19 "sbc cargo submarine" 5 10 104 20 100 0 0 0 900 0 500 300 0 0 (sonar sub supply)
20 "cal light carrier" 0 175 250 4 300 0 0 0 180 0 0 0 0 0 (plane)
21 "car aircraft carrier" 0 350 500 4 500 0 0 0 900 0 0 0 0 0 (plane)
22 "can nuc carrier" 0 350 999 4 999 0 0 0 900 0 0 0 0 0 (plane oiler supply)
22 "can nuc carrier" 0 350 999 4 999 0 0 0 900 0 0 0 0 0 (plane supply)
23 "ls landing ship" 0 400 10 1 0 0 0 0 300 0 0 0 0 0 (land)
24 "af asw frigate" 0 60 60 4 0 0 0 0 120 0 0 0 0 0 (torp dchrg sonar sub-torp)
25 "na nuc attack sub" 0 25 60 6 0 0 0 0 500 0 0 0 0 0 (torp sonar min sub sub-torp)

View file

@ -276,7 +276,6 @@ struct symbol ship_chr_flags[] = {
{M_SUBT, "sub-torp"},
{M_TRADE, "trade"},
{M_SEMILAND, "semi-land"},
{M_OILER, "oiler"},
{M_SUPPLY, "supply"},
{M_CANAL, "canal"},
{M_ANTIMISSILE, "anti-missile"},

View file

@ -114,8 +114,6 @@ struct cmndstr player_coms[] = {
{"follow <leader> <SHIPS>", 1, foll, C_MOD, NORM + CAP},
{"force", 0, force, C_MOD, GOD},
{"fortify <UNITS> <MOB>", 1, fort, C_MOD, NORM},
{"fuel <s|l> <SHIP/FLEET | UNIT/ARMY> <AMOUNT> [<OILER>]",
1, fuel, C_MOD, NORM},
{"give <COMM> <SECT> <NUM>", 0, give, C_MOD, GOD},
{"grind <SECT> <NUM>", 1, grin, C_MOD, NORM + MONEY + CAP},
{"harden <PLANES> <NUM>", 2, hard, C_MOD, NORM + MONEY + CAP},

View file

@ -74,8 +74,6 @@ ship_damage(struct shpstr *sp, int dam)
sp->shp_effic = damage((int)sp->shp_effic, dam);
if (sp->shp_mobil > 0)
sp->shp_mobil = damage((int)sp->shp_mobil, dam);
if (opt_FUEL && sp->shp_fuel)
sp->shp_fuel = damage((int)sp->shp_fuel, dam);
item_damage(dam, sp->shp_item);
}
@ -101,8 +99,6 @@ land_damage(struct lndstr *lp, int dam)
lp->lnd_effic = damage((int)lp->lnd_effic, dam);
if (lp->lnd_mobil > 0)
lp->lnd_mobil = damage((int)lp->lnd_mobil, dam);
if (opt_FUEL && lp->lnd_fuel)
lp->lnd_fuel = damage((int)lp->lnd_fuel, dam);
item_damage(dam, lp->lnd_item);
}
}

View file

@ -244,18 +244,12 @@ show_ship_stats(int tlev)
int scount;
pr("%25s s v s r f l p h x", "");
if (opt_FUEL)
pr(" fuel");
pr("\n");
pr("%25s p i p n i n l e p", "");
if (opt_FUEL)
pr(" c/u");
pr("\n");
pr("%25s def d s y g r d n l l", "");
if (opt_FUEL)
pr(" ");
pr("\n");
@ -275,8 +269,6 @@ show_ship_stats(int tlev)
pr("%2d ", mp->m_nplanes);
pr("%2d ", mp->m_nchoppers);
pr("%2d ", mp->m_nxlight);
if (opt_FUEL)
pr("%3d/%1d ", mp->m_fuelc, mp->m_fuelu);
pr("\n");
}
}
@ -445,9 +437,9 @@ show_land_stats(int tlev)
struct lchrstr *lcp;
int lcount;
pr("%25s s v s r r a f a a x l\n", "");
pr("%25s p i p a n c i m a f f p n\n", "");
pr("%25s att def vul d s y d g c r m f c u l d\n", "");
pr("%25s s v s r r a f a a x l\n", "");
pr("%25s p i p a n c i m a p n\n", "");
pr("%25s att def vul d s y d g c r m f l d\n", "");
make_new_list(tlev, EF_LAND);
for (lcount = 0; lcount < lookup_list_cnt; lcount++) {
@ -463,9 +455,6 @@ show_land_stats(int tlev)
pr("%2d %2d %2d %2d %2d ",
l_frg(lcp, tlev), l_acc(lcp, tlev), l_dam(lcp, tlev),
lcp->l_ammo, lcp->l_aaf);
pr("%2d %2d %2d %2d ",
lcp->l_fuelc, lcp->l_fuelu, lcp->l_nxlight, lcp->l_nland);
pr("\n");
}
}

View file

@ -48,8 +48,7 @@ static int s_commod(int, int, int, i_type, int, int);
/*
* We want to get enough guns to be maxed out, enough shells to
* fire once, one update's worth of food, enough fuel for
* one update.
* fire once, one update's worth of food.
*
* Firts, try to forage in the sector
* Second look for a warehouse or headquarters to leech
@ -67,8 +66,6 @@ resupply_all(struct lndstr *lp)
if (!opt_NOFOOD)
resupply_commod(lp, I_FOOD);
resupply_commod(lp, I_SHELL);
if (opt_FUEL)
resupply_commod(lp, I_PETROL);
}
/*
@ -104,18 +101,6 @@ resupply_commod(struct lndstr *lp, i_type type)
putship(lp->lnd_ship, &ship);
}
}
if (opt_FUEL && type == I_PETROL) {
int fuel_needed = lchr[lp->lnd_type].l_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;
if (lp->lnd_fuel > lchr[lp->lnd_type].l_fuelc)
lp->lnd_fuel = lchr[lp->lnd_type].l_fuelc;
lp->lnd_item[I_PETROL]--;
}
}
}
/*
@ -413,8 +398,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
/*
* We want to get enough shells to fire once,
* one update's worth of food, enough fuel for
* one update.
* one update's worth of food.
*/
static int
@ -435,25 +419,6 @@ get_minimum(struct lndstr *lp, i_type type)
case I_SHELL:
want = lcp->l_ammo;
break;
/*
* 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 = lcp->l_fuelu * ((float)etu_per_update * land_mob_scale)
/ 10.0;
want -= lp->lnd_fuel;
if (want > 0) {
want = want / 10;
if (want == 0)
want++;
}
max = want;
break;
default:
return 0;
}
@ -469,7 +434,6 @@ has_supply(struct lndstr *lp)
{
int shells_needed, shells, keepshells;
int food, food_needed, keepfood;
int fuel_needed, fuel, petrol_needed, petrol, keeppetrol;
if (!opt_NOFOOD) {
food_needed = get_minimum(lp, I_FOOD);
@ -501,29 +465,5 @@ has_supply(struct lndstr *lp)
if (shells < shells_needed)
return 0;
if (opt_FUEL) {
fuel_needed = lchr[lp->lnd_type].l_fuelu;
fuel = lp->lnd_fuel;
if (fuel < fuel_needed) {
petrol_needed =
ldround((fuel_needed - fuel) / 10.0, 1);
petrol = keeppetrol = lp->lnd_item[I_PETROL];
if (petrol < petrol_needed) {
lp->lnd_item[I_PETROL] = 0;
putland(lp->lnd_uid, lp);
petrol += try_supply_commod(lp->lnd_own,
lp->lnd_x, lp->lnd_y,
I_PETROL,
(petrol_needed - petrol));
lp->lnd_item[I_PETROL] = keeppetrol;
putland(lp->lnd_uid, lp);
}
fuel += petrol * 10;
}
if (fuel < fuel_needed)
return 0;
}
/* end opt_FUEL */
return 1;
}

View file

@ -60,7 +60,7 @@ unit_list(struct emp_qelem *unit_list)
return;
if (type == EF_LAND)
pr("lnd# land type x,y a eff sh gun xl mu tech retr fuel\n");
pr("lnd# land type x,y a eff sh gun xl mu tech retr\n");
else
pr("shp# ship type x,y fl eff mil sh gun pn he xl ln mob tech\n");
@ -97,7 +97,6 @@ unit_list(struct emp_qelem *unit_list)
pr("%4d", unit->tech);
if (type == EF_LAND) {
pr("%4d%%", lnd->lnd_retreat);
pr("%5d", lnd->lnd_fuel);
}
pr("\n");
}

View file

@ -181,10 +181,7 @@ mob_ship(void)
static void
do_mob_ship(struct shpstr *sp, int etus)
{
int newfuel = 0;
int value;
int can_add, have_fuel_for, total_add;
double d;
if (CANT_HAPPEN(etus < 0))
etus = 0;
@ -192,72 +189,10 @@ do_mob_ship(struct shpstr *sp, int etus)
if (sp->shp_own == 0)
return;
if (opt_FUEL == 0 || mchr[(int)sp->shp_type].m_fuelu == 0) {
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 {
if (sp->shp_mobil >= ship_mob_max) {
sp->shp_mobil = ship_mob_max;
return;
}
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 > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
d = need;
d *= mchr[(int)sp->shp_type].m_fuelu;
d /= fuel_mult;
d /= 5.0;
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
I_PETROL, need);
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);
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
d = need;
d *= mchr[(int)sp->shp_type].m_fuelu;
d /= fuel_mult;
d /= 50.0;
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
I_OIL, need);
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);
if (can_add > have_fuel_for)
total_add = have_fuel_for;
else
total_add = can_add;
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;
}
value = sp->shp_mobil + (float)etus * ship_mob_scale;
if (value > ship_mob_max)
value = ship_mob_max;
sp->shp_mobil = (signed char)value;
}
void
@ -281,11 +216,7 @@ mob_land(void)
static void
do_mob_land(struct lndstr *lp, int etus)
{
int newfuel = 0;
int value;
int can_add, have_fuel_for, total_add;
double d;
struct lchrstr *lcp = lchr + lp->lnd_type;
if (CANT_HAPPEN(etus < 0))
etus = 0;
@ -293,85 +224,24 @@ do_mob_land(struct lndstr *lp, int etus)
if (lp->lnd_own == 0)
return;
if (opt_FUEL == 0 || lcp->l_fuelu == 0) {
value = lp->lnd_mobil + ((float)etus * land_mob_scale);
if (value > land_mob_max) {
if (lp->lnd_harden < land_mob_max && !opt_MOB_ACCESS) {
/*
* Automatic fortification on excess mobility.
* Disabled for MOB_ACCESS, because it leads to
* excessively deep recursion and thus miserable
* performance as the number of land units grows.
*
* Provide mobility to be used in lnd_fortify()
* without overflowing lnd_mobil.
*/
lp->lnd_mobil = land_mob_max;
lnd_fortify(lp, value - land_mob_max);
}
value = land_mob_max;
}
lp->lnd_mobil = value;
} else {
if (lp->lnd_mobil >= land_mob_max) {
value = lp->lnd_mobil + ((float)etus * land_mob_scale);
if (value > land_mob_max) {
if (lp->lnd_harden < land_mob_max && !opt_MOB_ACCESS) {
/*
* Automatic fortification on excess mobility.
* Disabled for MOB_ACCESS, because it leads to
* excessively deep recursion and thus miserable
* performance as the number of land units grows.
*
* Provide mobility to be used in lnd_fortify()
* without overflowing lnd_mobil.
*/
lp->lnd_mobil = land_mob_max;
return;
lnd_fortify(lp, value - land_mob_max);
}
can_add = land_mob_max - lp->lnd_mobil;
if (can_add > (float)etus * land_mob_scale)
can_add = (float)etus * land_mob_scale;
have_fuel_for = (lp->lnd_fuel / lcp->l_fuelu) * fuel_mult;
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
d = need;
d *= lcp->l_fuelu;
d /= fuel_mult;
d /= 5.0;
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(lp->lnd_own, lp->lnd_x, lp->lnd_y,
I_PETROL, need);
lp->lnd_fuel += newfuel * 5;
}
have_fuel_for = (lp->lnd_fuel / lcp->l_fuelu) * fuel_mult;
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
d = need;
d *= lcp->l_fuelu;
d /= fuel_mult;
d /= 50.0;
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(lp->lnd_own, lp->lnd_x, lp->lnd_y,
I_OIL, need);
lp->lnd_fuel += newfuel * 50;
}
have_fuel_for = (lp->lnd_fuel / lcp->l_fuelu) * fuel_mult;
if (can_add > have_fuel_for) {
total_add = have_fuel_for;
} else
total_add = can_add;
d = total_add;
d *= lcp->l_fuelu;
d /= fuel_mult;
lp->lnd_fuel -= ldround(d, 1);
lp->lnd_fuel = MIN(lp->lnd_fuel, lcp->l_fuelc);
lp->lnd_mobil += total_add;
/* No excess mobility here, hence no automatic fortification */
value = land_mob_max;
}
lp->lnd_mobil = value;
}
void

View file

@ -239,9 +239,6 @@ nav_load_ship_at_sea(struct shpstr *sp)
* Continue to loop until the ship runs out of mobility, a load fails,
* the ship gets sunk (forts,ect..), the ship hits a mine.
*
* A check has been added for fuel so ships don't end up running
* out of mobility in the ocean.
*
* Questions, bugs (fixes) , or new ideas should be directed at
* Chad Zabel.
* 6-1-94
@ -250,7 +247,6 @@ nav_load_ship_at_sea(struct shpstr *sp)
int
nav_ship(struct shpstr *sp)
{
struct sctstr *sectp;
char *cp;
int stopping;
int quit;
@ -287,14 +283,6 @@ nav_ship(struct shpstr *sp)
sp->shp_own);
if (QEMPTY(&ship_list))
return RET_OK;
/* before we move check to see if ship needs fuel. */
sectp = getsectp(sp->shp_x, sp->shp_y);
if (opt_FUEL &&
sectp->sct_own != 0 &&
sp->shp_fuel <= 0 &&
((struct mchrstr *)mlp->chrp)->m_fuelu != 0)
auto_fuel_ship(sp);
mlp->unit.ship.shp_fuel = sp->shp_fuel;
cp = BestShipPath(buf, sp->shp_x, sp->shp_y,
sp->shp_destx[0], sp->shp_desty[0],

View file

@ -178,59 +178,3 @@ unload_it(struct shpstr *sp)
sectp->sct_pstage = PLG_EXPOSED;
}
}
/* auto_fuel_ship
* Assume a check for fuel=0 has already been made and passed.
* Try to fill a ship using petro. and then oil.
* new autonav code.
* This should be merged with the fuel command someday.
* Chad Zabel 6/1/94
*/
void
auto_fuel_ship(struct shpstr *sp)
{
double d;
int totalfuel = 0;
int need;
int maxfuel;
int newfuel = 0;
int add_fuel = 0;
if (opt_FUEL == 0)
return;
getship(sp->shp_uid, sp); /* refresh */
/* fill with petrol */
maxfuel = mchr[(int)sp->shp_type].m_fuelc;
d = maxfuel / 5.0;
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
I_PETROL, need);
add_fuel += newfuel * 5;
if (add_fuel > maxfuel)
add_fuel = maxfuel;
sp->shp_fuel += add_fuel;
totalfuel += add_fuel;
if (totalfuel == maxfuel) {
putship(sp->shp_uid, sp);
return; /* the ship is full */
}
add_fuel = 0;
/* fill with oil */
d = (maxfuel - totalfuel) / 50.0;
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
I_OIL, need);
add_fuel = newfuel * 50;
if (add_fuel > maxfuel)
add_fuel = maxfuel;
sp->shp_fuel += add_fuel;
putship(sp->shp_uid, sp);
}