Simplify calling of pln_arm() & friends
pln_arm(), pln_equip(), mission_pln_arm() mission_pln_equip() took a mission parameter encoding the kind of sortie (strategic bomb, pinpoint bomb, transport, ...), a flag parameter to further specify the plane's role, and a parameter ip to specify the load. The flags argument was always either P_F (intercept), P_F | P_ESC (escort), or zero (any other role). With non-zero flags, mission and ip argument were not used in any way. Use mission 'e' and null load for escorts, and remove flags. Intercept can still be identified by mission zero. Also change pln_mobcost() to take a mission parameter instead of flags, so that pln_arm() and mission_pln_arm() can simply pass on their mission.
This commit is contained in:
parent
b1dd82fa61
commit
0fe43096bc
10 changed files with 147 additions and 152 deletions
|
@ -476,7 +476,7 @@ extern int share_bmap(natid, natid, struct nstr_sect *, char, char *);
|
||||||
/* mission.c */
|
/* mission.c */
|
||||||
extern char *mission_name(short);
|
extern char *mission_name(short);
|
||||||
extern int collateral_damage(coord, coord, int);
|
extern int collateral_damage(coord, coord, int);
|
||||||
extern int mission_pln_equip(struct plist *, struct ichrstr *, int, char);
|
extern int mission_pln_equip(struct plist *, struct ichrstr *, char);
|
||||||
extern int ground_interdict(coord, coord, natid, char *);
|
extern int ground_interdict(coord, coord, natid, char *);
|
||||||
extern int unit_interdict(coord, coord, natid, char *, int, int);
|
extern int unit_interdict(coord, coord, natid, char *, int, int);
|
||||||
extern int off_support(coord, coord, natid, natid);
|
extern int off_support(coord, coord, natid, natid);
|
||||||
|
@ -547,8 +547,8 @@ extern int pln_airbase_ok(struct plnstr *, int, int);
|
||||||
extern int carrier_planes(struct shpstr *, int);
|
extern int carrier_planes(struct shpstr *, int);
|
||||||
extern void pln_sel(struct nstr_item *, struct emp_qelem *,
|
extern void pln_sel(struct nstr_item *, struct emp_qelem *,
|
||||||
struct sctstr *, int, int, int, int);
|
struct sctstr *, int, int, int, int);
|
||||||
extern void pln_arm(struct emp_qelem *, int, char, struct ichrstr *, int);
|
extern void pln_arm(struct emp_qelem *, int, char, struct ichrstr *);
|
||||||
extern int pln_mobcost(int, struct plnstr *, int);
|
extern int pln_mobcost(int, struct plnstr *, char);
|
||||||
extern void pln_put(struct emp_qelem *);
|
extern void pln_put(struct emp_qelem *);
|
||||||
extern void pln_put1(struct plist *);
|
extern void pln_put1(struct plist *);
|
||||||
extern void plane_sweep(struct emp_qelem *, coord, coord);
|
extern void plane_sweep(struct emp_qelem *, coord, coord);
|
||||||
|
|
|
@ -137,12 +137,12 @@ bomb(void)
|
||||||
/*
|
/*
|
||||||
* now arm and equip the bombers, transports, whatever.
|
* now arm and equip the bombers, transports, whatever.
|
||||||
*/
|
*/
|
||||||
pln_arm(&bomb_list, 2 * ap_to_target, mission, ip, 0);
|
pln_arm(&bomb_list, 2 * ap_to_target, mission, ip);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes could be equipped for the mission.\n");
|
pr("No planes could be equipped for the mission.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
pln_arm(&esc_list, 2 * ap_to_target, mission, ip, P_F | P_ESC);
|
pln_arm(&esc_list, 2 * ap_to_target, 'e', NULL);
|
||||||
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, 0);
|
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, 0);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes got through fighter defenses\n");
|
pr("No planes got through fighter defenses\n");
|
||||||
|
|
|
@ -110,12 +110,12 @@ drop(void)
|
||||||
*/
|
*/
|
||||||
pln_arm(&bomb_list, 2 * ap_to_target,
|
pln_arm(&bomb_list, 2 * ap_to_target,
|
||||||
wantflags & P_MINE ? 'm' : 'd',
|
wantflags & P_MINE ? 'm' : 'd',
|
||||||
ip, 0);
|
ip);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes could be equipped for the mission.\n");
|
pr("No planes could be equipped for the mission.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
pln_arm(&esc_list, 2 * ap_to_target, 'd', ip, P_ESC | P_F);
|
pln_arm(&esc_list, 2 * ap_to_target, 'e', NULL);
|
||||||
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, 0);
|
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, 0);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes got through fighter defenses\n");
|
pr("No planes got through fighter defenses\n");
|
||||||
|
|
|
@ -111,12 +111,12 @@ fly(void)
|
||||||
/*
|
/*
|
||||||
* now arm and equip the bombers, transports, whatever.
|
* now arm and equip the bombers, transports, whatever.
|
||||||
*/
|
*/
|
||||||
pln_arm(&bomb_list, ap_to_target, 't', ip, 0);
|
pln_arm(&bomb_list, ap_to_target, 't', ip);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes could be equipped for the mission.\n");
|
pr("No planes could be equipped for the mission.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
pln_arm(&esc_list, ap_to_target, 't', ip, P_ESC | P_F);
|
pln_arm(&esc_list, ap_to_target, 'e', NULL);
|
||||||
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, 0);
|
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, 0);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes got through fighter defenses\n");
|
pr("No planes got through fighter defenses\n");
|
||||||
|
|
|
@ -90,12 +90,12 @@ para(void)
|
||||||
/*
|
/*
|
||||||
* now arm and equip the bombers, transports, whatever.
|
* now arm and equip the bombers, transports, whatever.
|
||||||
*/
|
*/
|
||||||
pln_arm(&bomb_list, 2 * ap_to_target, 'a', &ichr[I_MILIT], 0);
|
pln_arm(&bomb_list, 2 * ap_to_target, 'a', &ichr[I_MILIT]);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes could be equipped for the mission.\n");
|
pr("No planes could be equipped for the mission.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
pln_arm(&esc_list, 2 * ap_to_target, 'a', &ichr[I_MILIT], P_ESC | P_F);
|
pln_arm(&esc_list, 2 * ap_to_target, 'e', NULL);
|
||||||
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, 0);
|
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, 0);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes got through fighter defenses\n");
|
pr("No planes got through fighter defenses\n");
|
||||||
|
|
|
@ -97,12 +97,12 @@ reco(void)
|
||||||
/*
|
/*
|
||||||
* now arm and equip the bombers, transports, whatever.
|
* now arm and equip the bombers, transports, whatever.
|
||||||
*/
|
*/
|
||||||
pln_arm(&bomb_list, ap_to_target, 'r', NULL, 0);
|
pln_arm(&bomb_list, ap_to_target, 'r', NULL);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes could be equipped for the mission.\n");
|
pr("No planes could be equipped for the mission.\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
pln_arm(&esc_list, ap_to_target, 'r', NULL, P_F | P_ESC);
|
pln_arm(&esc_list, ap_to_target, 'e', NULL);
|
||||||
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath,
|
ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath,
|
||||||
*player->argp[0] == 's' ? PM_R | PM_S : PM_R);
|
*player->argp[0] == 's' ? PM_R | PM_S : PM_R);
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
|
|
|
@ -295,7 +295,7 @@ sam_intercept(struct emp_qelem *att_list, struct emp_qelem *def_list,
|
||||||
&& pp->pln_radius < mapdist(x, y, pp->pln_opx, pp->pln_opy))
|
&& pp->pln_radius < mapdist(x, y, pp->pln_opx, pp->pln_opy))
|
||||||
continue;
|
continue;
|
||||||
if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
|
if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
|
||||||
|| mission_pln_equip(dplp, NULL, P_F, 0) < 0) {
|
|| mission_pln_equip(dplp, NULL, 0) < 0) {
|
||||||
emp_remque(dqp);
|
emp_remque(dqp);
|
||||||
free(dqp);
|
free(dqp);
|
||||||
continue;
|
continue;
|
||||||
|
@ -369,7 +369,7 @@ ac_intercept(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
||||||
&& pp->pln_radius < mapdist(x, y, pp->pln_opx, pp->pln_opy))
|
&& pp->pln_radius < mapdist(x, y, pp->pln_opx, pp->pln_opy))
|
||||||
continue;
|
continue;
|
||||||
if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
|
if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
|
||||||
|| mission_pln_equip(plp, NULL, P_F, 0) < 0) {
|
|| mission_pln_equip(plp, NULL, 0) < 0) {
|
||||||
emp_remque(qp);
|
emp_remque(qp);
|
||||||
free(qp);
|
free(qp);
|
||||||
continue;
|
continue;
|
||||||
|
@ -378,7 +378,7 @@ ac_intercept(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
|
||||||
emp_remque(qp);
|
emp_remque(qp);
|
||||||
emp_insque(qp, &int_list);
|
emp_insque(qp, &int_list);
|
||||||
pp->pln_flags |= PLN_LAUNCHED;
|
pp->pln_flags |= PLN_LAUNCHED;
|
||||||
pp->pln_mobil -= pln_mobcost(dist, pp, P_F);
|
pp->pln_mobil -= pln_mobcost(dist, pp, 0);
|
||||||
putplane(pp->pln_uid, pp);
|
putplane(pp->pln_uid, pp);
|
||||||
icount++;
|
icount++;
|
||||||
if (icount > att_count)
|
if (icount > att_count)
|
||||||
|
|
|
@ -71,7 +71,7 @@ static void divide(struct emp_qelem *, struct emp_qelem *, coord, coord);
|
||||||
static int dosupport(struct genlist *, coord, coord, natid, natid);
|
static int dosupport(struct genlist *, coord, coord, natid, natid);
|
||||||
static int find_airport(struct emp_qelem *, coord, coord);
|
static int find_airport(struct emp_qelem *, coord, coord);
|
||||||
static void mission_pln_arm(struct emp_qelem *, coord, coord, int,
|
static void mission_pln_arm(struct emp_qelem *, coord, coord, int,
|
||||||
int, struct ichrstr *, int);
|
int, struct ichrstr *);
|
||||||
static void mission_pln_sel(struct emp_qelem *, int, int, int);
|
static void mission_pln_sel(struct emp_qelem *, int, int, int);
|
||||||
static int perform_mission(coord, coord, natid, struct emp_qelem *, int,
|
static int perform_mission(coord, coord, natid, struct emp_qelem *, int,
|
||||||
char *, int);
|
char *, int);
|
||||||
|
@ -610,12 +610,12 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
|
||||||
/* Split off the escorts at this base into e */
|
/* Split off the escorts at this base into e */
|
||||||
divide(&escorts, &e, air->x, air->y);
|
divide(&escorts, &e, air->x, air->y);
|
||||||
|
|
||||||
mission_pln_arm(&b, air->x, air->y, 2 * md, 'p', NULL, 0);
|
mission_pln_arm(&b, air->x, air->y, 2 * md, 'p', NULL);
|
||||||
|
|
||||||
if (QEMPTY(&b))
|
if (QEMPTY(&b))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mission_pln_arm(&e, air->x, air->y, 2 * md, 'p', NULL, P_F | P_ESC);
|
mission_pln_arm(&e, air->x, air->y, 2 * md, 'e', NULL);
|
||||||
|
|
||||||
pp = BestAirPath(buf, air->x, air->y, x, y);
|
pp = BestAirPath(buf, air->x, air->y, x, y);
|
||||||
if (CANT_HAPPEN(!pp))
|
if (CANT_HAPPEN(!pp))
|
||||||
|
@ -840,7 +840,7 @@ mission_pln_sel(struct emp_qelem *list, int wantflags, int nowantflags,
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
mission_pln_arm(struct emp_qelem *list, coord x, coord y, int dist,
|
mission_pln_arm(struct emp_qelem *list, coord x, coord y, int dist,
|
||||||
int mission, struct ichrstr *ip, int flags)
|
int mission, struct ichrstr *ip)
|
||||||
{
|
{
|
||||||
struct emp_qelem *qp;
|
struct emp_qelem *qp;
|
||||||
struct emp_qelem *next;
|
struct emp_qelem *next;
|
||||||
|
@ -858,21 +858,20 @@ mission_pln_arm(struct emp_qelem *list, coord x, coord y, int dist,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
|
if (CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED)
|
||||||
|| mission_pln_equip(plp, ip, flags, mission) < 0) {
|
|| mission_pln_equip(plp, ip, mission) < 0) {
|
||||||
emp_remque(qp);
|
emp_remque(qp);
|
||||||
free(qp);
|
free(qp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pp->pln_flags |= PLN_LAUNCHED;
|
pp->pln_flags |= PLN_LAUNCHED;
|
||||||
pp->pln_mobil -= pln_mobcost(dist, pp, flags);
|
pp->pln_mobil -= pln_mobcost(dist, pp, mission);
|
||||||
putplane(pp->pln_uid, pp);
|
putplane(pp->pln_uid, pp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
|
mission_pln_equip(struct plist *plp, struct ichrstr *ip, char mission)
|
||||||
char mission)
|
|
||||||
{
|
{
|
||||||
struct plchrstr *pcp;
|
struct plchrstr *pcp;
|
||||||
struct plnstr *pp;
|
struct plnstr *pp;
|
||||||
|
@ -899,7 +898,6 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
item[I_PETROL] -= pcp->pl_fuel;
|
item[I_PETROL] -= pcp->pl_fuel;
|
||||||
if (!(flags & P_F)) {
|
|
||||||
load = pln_load(pp);
|
load = pln_load(pp);
|
||||||
itype = I_NONE;
|
itype = I_NONE;
|
||||||
needed = 0;
|
needed = 0;
|
||||||
|
@ -931,11 +929,11 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'r': /* reconnaissance */
|
case 'r': /* reconnaissance */
|
||||||
|
case 'e': /* escort */
|
||||||
case 0: /* plane interception */
|
case 0: /* plane interception */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CANT_REACH();
|
CANT_REACH();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (itype != I_NONE && needed <= 0)
|
if (itype != I_NONE && needed <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -956,7 +954,6 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
|
||||||
plp->bombs = needed;
|
plp->bombs = needed;
|
||||||
else
|
else
|
||||||
plp->misc = needed;
|
plp->misc = needed;
|
||||||
}
|
|
||||||
if (pp->pln_ship >= 0)
|
if (pp->pln_ship >= 0)
|
||||||
putship(ship.shp_uid, &ship);
|
putship(ship.shp_uid, &ship);
|
||||||
else if (pp->pln_land >= 0)
|
else if (pp->pln_land >= 0)
|
||||||
|
|
|
@ -61,7 +61,7 @@ msl_equip(struct plnstr *pp, char mission)
|
||||||
memset(&pl, 0, sizeof(struct plist));
|
memset(&pl, 0, sizeof(struct plist));
|
||||||
pl.pcp = plchr + pp->pln_type;
|
pl.pcp = plchr + pp->pln_type;
|
||||||
pl.plane = *pp;
|
pl.plane = *pp;
|
||||||
return mission_pln_equip(&pl, NULL, 0, mission);
|
return mission_pln_equip(&pl, NULL, mission);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -271,7 +271,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
||||||
if (pp->pln_own != sect.sct_own)
|
if (pp->pln_own != sect.sct_own)
|
||||||
continue;
|
continue;
|
||||||
pcp = ip->pcp;
|
pcp = ip->pcp;
|
||||||
if (mission_pln_equip(ip, NULL, 0, 'i') < 0) {
|
if (mission_pln_equip(ip, NULL, 'i') < 0) {
|
||||||
emp_remque(qp);
|
emp_remque(qp);
|
||||||
free(qp);
|
free(qp);
|
||||||
continue;
|
continue;
|
||||||
|
@ -290,7 +290,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
|
||||||
ip = (struct plist *)qp;
|
ip = (struct plist *)qp;
|
||||||
pp = &ip->plane;
|
pp = &ip->plane;
|
||||||
pcp = ip->pcp;
|
pcp = ip->pcp;
|
||||||
if (mission_pln_equip(ip, NULL, 0, 'i') < 0) {
|
if (mission_pln_equip(ip, NULL, 'i') < 0) {
|
||||||
emp_remque(qp);
|
emp_remque(qp);
|
||||||
free(qp);
|
free(qp);
|
||||||
continue;
|
continue;
|
||||||
|
@ -401,7 +401,7 @@ msl_launch_mindam(struct emp_qelem *list, coord x, coord y, int hardtarget,
|
||||||
next = qp->q_back;
|
next = qp->q_back;
|
||||||
plp = (struct plist *)qp;
|
plp = (struct plist *)qp;
|
||||||
|
|
||||||
if (mission_pln_equip(plp, NULL, 0, 'p') >= 0) {
|
if (mission_pln_equip(plp, NULL, 'p') >= 0) {
|
||||||
if (msl_hit(&plp->plane,
|
if (msl_hit(&plp->plane,
|
||||||
hardtarget, type, news_item, snews_item,
|
hardtarget, type, news_item, snews_item,
|
||||||
whatp, x, y, victim)) {
|
whatp, x, y, victim)) {
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
#include "xy.h"
|
#include "xy.h"
|
||||||
|
|
||||||
static int pln_equip(struct plist *, struct ichrstr *, int, char);
|
static int pln_equip(struct plist *, struct ichrstr *, char);
|
||||||
static int fit_plane_on_ship(struct plnstr *, struct shpstr *);
|
static int fit_plane_on_ship(struct plnstr *, struct shpstr *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -582,8 +582,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pln_arm(struct emp_qelem *list, int dist, char mission, struct ichrstr *ip,
|
pln_arm(struct emp_qelem *list, int dist, char mission, struct ichrstr *ip)
|
||||||
int flags)
|
|
||||||
{
|
{
|
||||||
struct emp_qelem *qp;
|
struct emp_qelem *qp;
|
||||||
struct emp_qelem *next;
|
struct emp_qelem *next;
|
||||||
|
@ -596,20 +595,20 @@ pln_arm(struct emp_qelem *list, int dist, char mission, struct ichrstr *ip,
|
||||||
pp = &plp->plane;
|
pp = &plp->plane;
|
||||||
getplane(pp->pln_uid, pp);
|
getplane(pp->pln_uid, pp);
|
||||||
if ((pp->pln_flags & PLN_LAUNCHED)
|
if ((pp->pln_flags & PLN_LAUNCHED)
|
||||||
|| pln_equip(plp, ip, flags, mission) < 0) {
|
|| pln_equip(plp, ip, mission) < 0) {
|
||||||
emp_remque(qp);
|
emp_remque(qp);
|
||||||
free(qp);
|
free(qp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pp->pln_flags |= PLN_LAUNCHED;
|
pp->pln_flags |= PLN_LAUNCHED;
|
||||||
pp->pln_mobil -= pln_mobcost(dist, pp, flags);
|
pp->pln_mobil -= pln_mobcost(dist, pp, mission);
|
||||||
putplane(pp->pln_uid, pp);
|
putplane(pp->pln_uid, pp);
|
||||||
pr("%s equipped\n", prplane(pp));
|
pr("%s equipped\n", prplane(pp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
|
pln_equip(struct plist *plp, struct ichrstr *ip, char mission)
|
||||||
{
|
{
|
||||||
struct plchrstr *pcp;
|
struct plchrstr *pcp;
|
||||||
struct plnstr *pp;
|
struct plnstr *pp;
|
||||||
|
@ -642,7 +641,6 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
item[I_PETROL] -= pcp->pl_fuel;
|
item[I_PETROL] -= pcp->pl_fuel;
|
||||||
if ((flags & P_F) == 0) {
|
|
||||||
load = pln_load(pp);
|
load = pln_load(pp);
|
||||||
itype = I_NONE;
|
itype = I_NONE;
|
||||||
needed = 0;
|
needed = 0;
|
||||||
|
@ -674,6 +672,7 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
|
||||||
needed = load / ip->i_lbs;
|
needed = load / ip->i_lbs;
|
||||||
break;
|
break;
|
||||||
case 'r': /* reconnaissance */
|
case 'r': /* reconnaissance */
|
||||||
|
case 'e': /* escort */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CANT_REACH();
|
CANT_REACH();
|
||||||
|
@ -706,7 +705,6 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
|
||||||
plp->bombs = needed;
|
plp->bombs = needed;
|
||||||
else
|
else
|
||||||
plp->misc = needed;
|
plp->misc = needed;
|
||||||
}
|
|
||||||
if (pp->pln_ship >= 0) {
|
if (pp->pln_ship >= 0) {
|
||||||
if (pp->pln_own != ship.shp_own) {
|
if (pp->pln_own != ship.shp_own) {
|
||||||
wu(0, ship.shp_own,
|
wu(0, ship.shp_own,
|
||||||
|
@ -1034,13 +1032,13 @@ pln_identchance(struct plnstr *pp, int hardtarget, int type)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pln_mobcost(int dist, struct plnstr *pp, int flags)
|
pln_mobcost(int dist, struct plnstr *pp, char mission)
|
||||||
{
|
{
|
||||||
double cost;
|
double cost;
|
||||||
|
|
||||||
cost = 20.0 / (pp->pln_effic / 100.0);
|
cost = 20.0 / (pp->pln_effic / 100.0);
|
||||||
if ((flags & P_F) || (flags & P_ESC))
|
if (mission == 'e' || mission == 0)
|
||||||
cost /= 2;
|
cost /= 2; /* escort or intercept */
|
||||||
|
|
||||||
return ldround(cost * dist / pln_range_max(pp) + 5, 1);
|
return ldround(cost * dist / pln_range_max(pp) + 5, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue