Refactor missile interception code

Keep only the common part in msl_intercept(), and give it internal
linkage.  Wrap new msl_abm_intercept() and msl_asat_intercept() around
it.  They are simpler to use.
This commit is contained in:
Markus Armbruster 2009-10-10 18:26:31 -04:00
parent de2fae0ee6
commit 0060e48ea4
3 changed files with 51 additions and 51 deletions

View file

@ -360,9 +360,8 @@ launch_sat(struct plnstr *pp)
pr("Your trajectory was a little off.\n");
}
nreport(player->cnum, N_LAUNCH, 0, 1);
if (msl_intercept(sx, sy, pp->pln_own, pln_def(pp), 0, P_O, 0)) {
if (msl_asat_intercept(pp, sx, sy))
return RET_OK;
}
pp->pln_x = sx;
pp->pln_y = sy;
CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED);