Refactor and fix scuttle and scrap code

Factor unit_drop_cargo() out of scra(), scuttle_ship(),
scuttle_land(), fix it up:

* Some messages were sent as bulletins instead of printing them.

* Nukes were always destroyed.  They're now treated exactly like other
  cargo.

* scuttle destroyed some cargo silently, and listed other cargo as
  "scuttled".  It now simply lets unit_update_cargo() running from
  carrier prewrite callbacks list all cargo "lost".

Simplify its callers.  scuttle_ship() and scuttle_land() are now
trivial, inline and remove.
This commit is contained in:
Markus Armbruster 2008-09-13 18:35:50 -04:00
parent 3318e4e4e5
commit f3651f17e5
6 changed files with 74 additions and 196 deletions

View file

@ -66,7 +66,10 @@ scuttle_it(struct shpstr *sp)
}
wu(0, sp->shp_own, "Scuttling %s in sector %s\n",
prship(sp), xyas(sp->shp_x, sp->shp_y, sp->shp_own));
scuttle_ship(sp);
if (sectp->sct_own == sp->shp_own)
unit_drop_cargo((struct empobj *)sp, sectp->sct_own);
sp->shp_effic = 0;
putship(sp->shp_uid, sp);
}
static void