Fix launch to require petrol for launching satellites

launch_sat() failed to call msl_equip().  Change msl_equip() to take
the mission character as argument, because the old hardcoded 'p' isn't
appropriate for satellites.  Best fit for satellites is 'r' for
reconnaissance, but mission_pln_equip() doesn't accept that
(pln_equip() does).  Fix that as well.
This commit is contained in:
Markus Armbruster 2008-03-24 16:23:03 +01:00
parent ee863c5d25
commit 15fab1c9a5
4 changed files with 10 additions and 5 deletions

View file

@ -504,7 +504,7 @@ extern int move_ground(struct sctstr *, struct sctstr *,
extern int fly_map(coord, coord);
/* mslsub.c */
extern int msl_intercept(coord, coord, natid, int, int, int, int);
extern int msl_equip(struct plnstr *);
extern int msl_equip(struct plnstr *, char);
extern int msl_hit(struct plnstr *, int, int, int, int, char *,
coord, coord, int);
extern void msl_sel(struct emp_qelem *, coord, coord, natid, int,

View file

@ -171,7 +171,7 @@ launch_as(struct plnstr *pp)
int dam, nukedam;
natid oldown;
if (msl_equip(pp) < 0) {
if (msl_equip(pp, 'p') < 0) {
pr("%s not enough petrol or shells!\n", prplane(pp));
return RET_FAIL;
}
@ -280,7 +280,7 @@ launch_missile(struct plnstr *pp, int sublaunch)
pr("Range too great; try again!\n");
return RET_FAIL;
}
if (msl_equip(pp) < 0) {
if (msl_equip(pp, 'p') < 0) {
pr("%s not enough shells!\n", prplane(pp));
return RET_FAIL;
}
@ -390,6 +390,10 @@ launch_sat(struct plnstr *pp, int sublaunch)
return RET_SYN;
if (!check_plane_ok(pp))
return RET_FAIL;
if (msl_equip(pp, 'r') < 0) {
pr("%s not enough petrol!\n", prplane(pp));
return RET_FAIL;
}
pp->pln_theta = 0;
pp->pln_flags |= PLN_SYNCHRONOUS;
if (*p == 0 || *p == 'n')

View file

@ -1036,6 +1036,7 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
needed = load;
}
break;
case 'r': /* reconnaissance */
case 0: /* plane interception */
break;
default:

View file

@ -53,14 +53,14 @@
#include "xy.h"
int
msl_equip(struct plnstr *pp)
msl_equip(struct plnstr *pp, char mission)
{
struct plist pl;
memset(&pl, 0, sizeof(struct plist));
pl.pcp = plchr + pp->pln_type;
pl.plane = *pp;
return mission_pln_equip(&pl, 0, 0, 'p');
return mission_pln_equip(&pl, 0, 0, mission);
}
int