(pln_mine, pln_dropoff): Split off aerial mining into new pln_mine().

Callers changed.

(drop): Do not disclose anything about target sector before planes
actually got there, unless the target sector is owned by the player or
an ally.  This plugs a major loophole.  Consequently, the command can
no longer always refuse to attempt to drop stuff where it won't work.
Instead, the planes fly out to try.  Other plane commands (para, bomb)
behave exactly the same.  Also closes #909859.
(pln_dropoff): Cope with planes trying to drop where they can't.

(drop): Refuse to drop civilians into allied sectors, for consistency
with other means to move around stuff.
This commit is contained in:
Markus Armbruster 2004-08-14 17:12:20 +00:00
parent 003e068615
commit d993fdef90
3 changed files with 76 additions and 36 deletions

View file

@ -279,15 +279,22 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
}
if (type == EF_SECTOR) {
sectp = ptr;
if (sectp->sct_type == SCT_WATER && ip->i_vtype == V_SHELL) {
/* aerial mining */
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 (amt > 0
&& map_set(player->cnum, sectp->sct_x, sectp->sct_y, 'X', 0))
writemap(player->cnum);
putsect(sectp);
if (!sectp->sct_own) {
if (sectp->sct_type == SCT_WATER)
pr("Your %s sink like a rock!\n", ip->i_name);
else
pr("Your %s vanish without a trace.\n", ip->i_name);
return;
}
if (sectp->sct_own != player->cnum
&& getrel(getnatp(sectp->sct_own), player->cnum) != ALLIED) {
pr("You don't own %s! Cargo jettisoned...\n",
xyas(tx, ty, player->cnum));
return;
}
if (ip->i_vtype == V_CIVIL && sectp->sct_own != sectp->sct_oldown) {
pr("%s is occupied. Your civilians suffer from identity crisis and die.\n",
xyas(tx, ty, player->cnum));
return;
}
there = sectp->sct_item[ip->i_vtype];
@ -326,6 +333,29 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty,
}
}
void
pln_mine(struct emp_qelem *list, struct sctstr *sectp)
{
struct emp_qelem *qp;
struct plist *plp;
int amt;
amt = 0;
for (qp = list->q_forw; qp != list; qp = qp->q_forw) {
plp = (struct plist *)qp;
amt += plp->misc;
}
if (amt > 0) {
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))
writemap(player->cnum);
putsect(sectp);
}
}
void
pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
int ap_to_target, int rangemult, int wantflags, int nowantflags)