From f2294d67a4497a0d686409e7f4b582fef00e567e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 12 Jul 2008 14:43:35 -0400 Subject: [PATCH] Change pln_mine() parameters to match pln_dropoff() This moves getting the target sector from caller into pln_mine(). Makes sense, because that's where it's put. --- include/prototypes.h | 2 +- src/lib/commands/drop.c | 3 +-- src/lib/subs/plnsub.c | 15 ++++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/prototypes.h b/include/prototypes.h index 57e8b8cf..8c7791e8 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -544,7 +544,7 @@ extern int could_be_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 *, coord, coord, int); -extern void pln_mine(struct emp_qelem *list, struct sctstr *sectp); +extern void pln_mine(struct emp_qelem *, coord, coord); extern int pln_capable(struct plnstr *, int, int); extern int pln_airbase_ok(struct plnstr *, int, int); extern int carrier_planes(struct shpstr *, int); diff --git a/src/lib/commands/drop.c b/src/lib/commands/drop.c index 004bab6b..a3317af5 100644 --- a/src/lib/commands/drop.c +++ b/src/lib/commands/drop.c @@ -129,9 +129,8 @@ drop(void) if (QEMPTY(&bomb_list)) { pr("No planes got through fighter defenses\n"); } else { - getsect(tx, ty, &target); if (wantflags & P_MINE) - pln_mine(&bomb_list, &target); + pln_mine(&bomb_list, tx, ty); else pln_dropoff(&bomb_list, ip, tx, ty, -1); } diff --git a/src/lib/subs/plnsub.c b/src/lib/subs/plnsub.c index defe08ab..cd380137 100644 --- a/src/lib/subs/plnsub.c +++ b/src/lib/subs/plnsub.c @@ -309,11 +309,12 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty, } void -pln_mine(struct emp_qelem *list, struct sctstr *sectp) +pln_mine(struct emp_qelem *list, coord tx, coord ty) { struct emp_qelem *qp; struct plist *plp; int amt; + struct sctstr sect; amt = 0; for (qp = list->q_forw; qp != list; qp = qp->q_forw) { @@ -322,16 +323,16 @@ pln_mine(struct emp_qelem *list, struct sctstr *sectp) } if (amt > 0) { - if (sectp->sct_type != SCT_WATER) { + getsect(tx, ty, §); + if (sect.sct_type != SCT_WATER) { pr("Your seamines have no effect here.\n"); return; } - sectp->sct_mines = MIN(sectp->sct_mines + amt, MINES_MAX); - pr("%d mines laid in %s.\n", amt, - xyas(sectp->sct_x, sectp->sct_y, player->cnum)); - if (map_set(player->cnum, sectp->sct_x, sectp->sct_y, 'X', 0)) + sect.sct_mines = MIN(sect.sct_mines + amt, MINES_MAX); + pr("%d mines laid in %s.\n", amt, xyas(tx, ty, player->cnum)); + if (map_set(player->cnum, tx, ty, 'X', 0)) writemap(player->cnum); - putsect(sectp); + putsect(§); } }