Change pln_dropoff() parameters to match pln_newlanding()
This moves getting the target sector or ship from caller into pln_dropoff(). Makes sense, because that's where it's put.
This commit is contained in:
parent
42d9475d89
commit
27edba1f1b
4 changed files with 29 additions and 45 deletions
|
@ -543,7 +543,7 @@ extern void pln_newlanding(struct emp_qelem *, coord, coord, int);
|
||||||
extern int could_be_on_ship(struct plnstr *, struct shpstr *);
|
extern int could_be_on_ship(struct plnstr *, struct shpstr *);
|
||||||
extern int put_plane_on_ship(struct plnstr *, struct shpstr *);
|
extern int put_plane_on_ship(struct plnstr *, struct shpstr *);
|
||||||
extern void pln_dropoff(struct emp_qelem *, struct ichrstr *,
|
extern void pln_dropoff(struct emp_qelem *, struct ichrstr *,
|
||||||
coord, coord, void *, int);
|
coord, coord, int);
|
||||||
extern void pln_mine(struct emp_qelem *list, struct sctstr *sectp);
|
extern void pln_mine(struct emp_qelem *list, struct sctstr *sectp);
|
||||||
extern int pln_capable(struct plnstr *, int, int);
|
extern int pln_capable(struct plnstr *, int, int);
|
||||||
extern int pln_airbase_ok(struct plnstr *, int, int);
|
extern int pln_airbase_ok(struct plnstr *, int, int);
|
||||||
|
|
|
@ -133,7 +133,7 @@ drop(void)
|
||||||
if (wantflags & P_MINE)
|
if (wantflags & P_MINE)
|
||||||
pln_mine(&bomb_list, &target);
|
pln_mine(&bomb_list, &target);
|
||||||
else
|
else
|
||||||
pln_dropoff(&bomb_list, ip, tx, ty, &target, EF_SECTOR);
|
pln_dropoff(&bomb_list, ip, tx, ty, -1);
|
||||||
}
|
}
|
||||||
pln_put(&bomb_list);
|
pln_put(&bomb_list);
|
||||||
pln_put(&esc_list);
|
pln_put(&esc_list);
|
||||||
|
|
|
@ -49,7 +49,6 @@ fly(void)
|
||||||
int ap_to_target;
|
int ap_to_target;
|
||||||
struct ichrstr *ip;
|
struct ichrstr *ip;
|
||||||
char flightpath[MAX_PATH_LEN];
|
char flightpath[MAX_PATH_LEN];
|
||||||
struct shpstr ship;
|
|
||||||
int cno;
|
int cno;
|
||||||
struct nstr_item ni_bomb;
|
struct nstr_item ni_bomb;
|
||||||
struct nstr_item ni_esc;
|
struct nstr_item ni_esc;
|
||||||
|
@ -58,8 +57,6 @@ fly(void)
|
||||||
struct emp_qelem esc_list;
|
struct emp_qelem esc_list;
|
||||||
int wantflags;
|
int wantflags;
|
||||||
struct sctstr ap_sect;
|
struct sctstr ap_sect;
|
||||||
int dst_type;
|
|
||||||
void *dst_ptr;
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
wantflags = 0;
|
wantflags = 0;
|
||||||
|
@ -133,16 +130,7 @@ fly(void)
|
||||||
if (QEMPTY(&bomb_list)) {
|
if (QEMPTY(&bomb_list)) {
|
||||||
pr("No planes got through fighter defenses\n");
|
pr("No planes got through fighter defenses\n");
|
||||||
} else {
|
} else {
|
||||||
getsect(tx, ty, &target);
|
pln_dropoff(&bomb_list, ip, tx, ty, cno);
|
||||||
if (cno < 0) {
|
|
||||||
dst_ptr = ⌖
|
|
||||||
dst_type = EF_SECTOR;
|
|
||||||
} else {
|
|
||||||
getship(cno, &ship);
|
|
||||||
dst_ptr = &ship;
|
|
||||||
dst_type = EF_SHIP;
|
|
||||||
}
|
|
||||||
pln_dropoff(&bomb_list, ip, tx, ty, dst_ptr, dst_type);
|
|
||||||
pln_newlanding(&bomb_list, tx, ty, cno);
|
pln_newlanding(&bomb_list, tx, ty, cno);
|
||||||
pln_newlanding(&esc_list, tx, ty, cno);
|
pln_newlanding(&esc_list, tx, ty, cno);
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,16 +239,15 @@ pln_newlanding(struct emp_qelem *list, coord tx, coord ty, int cno)
|
||||||
|
|
||||||
void
|
void
|
||||||
pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
|
pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
|
||||||
void *ptr, int type)
|
int cno)
|
||||||
{
|
{
|
||||||
struct emp_qelem *qp;
|
struct emp_qelem *qp;
|
||||||
struct plist *plp;
|
struct plist *plp;
|
||||||
int amt;
|
int amt;
|
||||||
struct sctstr *sectp;
|
struct sctstr sect;
|
||||||
struct shpstr *sp;
|
struct shpstr ship;
|
||||||
int there;
|
int there;
|
||||||
int max;
|
int max;
|
||||||
struct mchrstr *mp;
|
|
||||||
|
|
||||||
if (ip == 0)
|
if (ip == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -257,33 +256,32 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
|
||||||
plp = (struct plist *)qp;
|
plp = (struct plist *)qp;
|
||||||
amt += plp->misc;
|
amt += plp->misc;
|
||||||
}
|
}
|
||||||
if (type == EF_SECTOR) {
|
if (cno < 0) {
|
||||||
sectp = ptr;
|
getsect(tx, ty, §);
|
||||||
if (!sectp->sct_own) {
|
if (!sect.sct_own) {
|
||||||
if (sectp->sct_type == SCT_WATER)
|
if (sect.sct_type == SCT_WATER)
|
||||||
pr("Your %s sink like a rock!\n", ip->i_name);
|
pr("Your %s sink like a rock!\n", ip->i_name);
|
||||||
else
|
else
|
||||||
pr("Your %s vanish without a trace.\n", ip->i_name);
|
pr("Your %s vanish without a trace.\n", ip->i_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sectp->sct_own != player->cnum
|
if (sect.sct_own != player->cnum
|
||||||
&& getrel(getnatp(sectp->sct_own), player->cnum) != ALLIED) {
|
&& getrel(getnatp(sect.sct_own), player->cnum) != ALLIED) {
|
||||||
pr("You don't own %s! Cargo jettisoned...\n",
|
pr("You don't own %s! Cargo jettisoned...\n",
|
||||||
xyas(tx, ty, player->cnum));
|
xyas(tx, ty, player->cnum));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ip->i_uid == I_CIVIL && sectp->sct_own != sectp->sct_oldown) {
|
if (ip->i_uid == I_CIVIL && sect.sct_own != sect.sct_oldown) {
|
||||||
pr("%s is occupied. Your civilians suffer from identity crisis and die.\n",
|
pr("%s is occupied. Your civilians suffer from identity crisis and die.\n",
|
||||||
xyas(tx, ty, player->cnum));
|
xyas(tx, ty, player->cnum));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
there = sectp->sct_item[ip->i_uid];
|
there = sect.sct_item[ip->i_uid];
|
||||||
max = ITEM_MAX;
|
max = ITEM_MAX;
|
||||||
} else {
|
} else {
|
||||||
sp = ptr;
|
getship(cno, &ship);
|
||||||
there = sp->shp_item[ip->i_uid];
|
there = ship.shp_item[ip->i_uid];
|
||||||
mp = &mchr[(int)sp->shp_type];
|
max = mchr[ship.shp_type].m_item[ip->i_uid];
|
||||||
max = mp->m_item[ip->i_uid];
|
|
||||||
}
|
}
|
||||||
there += amt;
|
there += amt;
|
||||||
if (there > max) {
|
if (there > max) {
|
||||||
|
@ -292,23 +290,21 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
|
||||||
there = max;
|
there = max;
|
||||||
}
|
}
|
||||||
pr("%d %s landed safely", amt, ip->i_name);
|
pr("%d %s landed safely", amt, ip->i_name);
|
||||||
if (type == EF_SECTOR) {
|
if (cno < 0) {
|
||||||
sectp = ptr;
|
sect.sct_item[ip->i_uid] = there;
|
||||||
sectp->sct_item[ip->i_uid] = there;
|
if (sect.sct_own != player->cnum)
|
||||||
if (sectp->sct_own != player->cnum)
|
wu(0, sect.sct_own, "%s planes drop %d %s in %s\n",
|
||||||
wu(0, sectp->sct_own, "%s planes drop %d %s in %s\n",
|
|
||||||
cname(player->cnum), amt, ip->i_name,
|
cname(player->cnum), amt, ip->i_name,
|
||||||
xyas(sectp->sct_x, sectp->sct_y, sectp->sct_own));
|
xyas(tx, ty, sect.sct_own));
|
||||||
pr(" at %s\n", xyas(tx, ty, player->cnum));
|
pr(" at %s\n", xyas(tx, ty, player->cnum));
|
||||||
putsect((struct sctstr *)ptr);
|
putsect(§);
|
||||||
} else {
|
} else {
|
||||||
struct shpstr *sp = (struct shpstr *)ptr;
|
ship.shp_item[ip->i_uid] = there;
|
||||||
sp->shp_item[ip->i_uid] = there;
|
if (ship.shp_own != player->cnum)
|
||||||
if (sp->shp_own != player->cnum)
|
wu(0, ship.shp_own, "%s planes land %d %s on carrier %d\n",
|
||||||
wu(0, sp->shp_own, "%s planes land %d %s on carrier %d\n",
|
cname(player->cnum), amt, ip->i_name, ship.shp_uid);
|
||||||
cname(player->cnum), amt, ip->i_name, sp->shp_uid);
|
pr(" on carrier #%d\n", ship.shp_uid);
|
||||||
pr(" on carrier #%d\n", sp->shp_uid);
|
putship(ship.shp_uid, &ship);
|
||||||
putship(sp->shp_uid, sp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue