Refuse to auto-scuttle where it doesn't pay

When called from the scuttle command, scuttle_tradeship() asks for
confirmation when scuttling doesn't pay.  When called from the autonav
code, it can't ask.  Change it to fail then, and use that in
nav_ship() to avoid scuttle where it doesn't pay.  Also simplify some.
This commit is contained in:
Markus Armbruster 2008-09-13 15:57:36 -04:00
parent 693c1a64c3
commit faca0eeac5
2 changed files with 20 additions and 26 deletions

View file

@ -53,23 +53,19 @@ scuttle_it(struct shpstr *sp)
sp->shp_x, sp->shp_y, sp->shp_uid);
return;
}
if (sectp->sct_type != SCT_HARBR || sectp->sct_effic < 2) {
wu(0, sp->shp_own,
"%s is not in a harbor at least 2%% eff! Not scuttling.\n",
prship(sp));
return;
}
if (opt_TRADESHIPS) {
if (!(mchr[(int)sp->shp_type].m_flags & M_TRADE)) {
wu(0, sp->shp_own, "You can only autoscuttle trade ships!\n");
return;
}
}
if (!scuttle_tradeship(sp, 0)) {
wu(0, sp->shp_own,
"%s doesn't pay here! Not scuttled.\n", prship(sp));
return;
}
wu(0, sp->shp_own, "Scuttling %s in sector %s\n",
prship(sp), xyas(sp->shp_x, sp->shp_y, sp->shp_own));
if (opt_TRADESHIPS) {
scuttle_tradeship(sp, 0);
}
scuttle_ship(sp);
}