(add, plane_bomb, pinflak_planedamage, doship, dounit, doplane, laun)

(launch_sat, scra, scut, scuttle_ship, scuttle_land, knockdown)
(ac_planedamage, detonate, attack_val, defense_val, air_damage)
(msl_intercept, msl_launch_mindam, pln_prewrite, shp_prewrite):
Simplify unit destruction: just zero efficiency, leave makelost()
etc. to the prewrite callback.
This commit is contained in:
Markus Armbruster 2006-05-27 19:25:12 +00:00
parent 1b94ddedc3
commit 0c1bd8e98b
14 changed files with 26 additions and 98 deletions

View file

@ -107,9 +107,7 @@ laun(void)
if (!ship.shp_own) {
pr("%s: ship #%d was sunk!\n",
prplane(&plane), ship.shp_uid);
makelost(EF_PLANE, plane.pln_own, plane.pln_uid,
plane.pln_x, plane.pln_y);
plane.pln_own = 0;
plane.pln_effic = 0;
putplane(plane.pln_uid, &plane);
continue;
}
@ -118,9 +116,7 @@ laun(void)
if (ship.shp_own != player->cnum && rel != ALLIED) {
pr("%s: you or an ally do not own ship #%d\n",
prplane(&plane), ship.shp_uid);
makelost(EF_PLANE, plane.pln_own, plane.pln_uid,
plane.pln_x, plane.pln_y);
plane.pln_own = 0;
plane.pln_effic = 0;
putplane(plane.pln_uid, &plane);
continue;
}
@ -159,9 +155,7 @@ laun(void)
if (retval != RET_OK)
return retval;
if (gone) {
makelost(EF_PLANE, plane.pln_own, plane.pln_uid,
plane.pln_x, plane.pln_y);
plane.pln_own = 0;
plane.pln_effic = 0;
putplane(plane.pln_uid, &plane);
}
}
@ -410,8 +404,7 @@ launch_sat(struct plnstr *pp, int sublaunch)
pr("3... 2... 1... Blastoff!!!\n");
if (chance(0.07 + (100 - pp->pln_effic) / 100.0)) {
pr("KABOOOOM! Range safety officer detonates booster!\n");
makelost(EF_PLANE, pp->pln_own, pp->pln_uid, pp->pln_x, pp->pln_y);
pp->pln_own = 0;
pp->pln_effic = 0;
return RET_OK;
}
i = pp->pln_tech + pp->pln_effic;