arm: Rework "cannot carry nukes" test for robustness
We reject satellites, ABMs, anti-ship missiles, and SAMs. That's enumerating badness. More robust replacement: accept only bomber, tactical, cargo, except for anti-ship missiles. Throw in PLN_LAUNCHED sanity checking while there. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
0d6130246c
commit
e5ea07b61a
1 changed files with 7 additions and 3 deletions
|
@ -30,7 +30,7 @@
|
||||||
* Dave Pare, 1986
|
* Dave Pare, 1986
|
||||||
* Ken Stevens, 1995
|
* Ken Stevens, 1995
|
||||||
* Steve McClure, 2000
|
* Steve McClure, 2000
|
||||||
* Markus Armbruster, 2006-2011
|
* Markus Armbruster, 2006-2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -61,11 +61,13 @@ arm(void)
|
||||||
&& relations_with(pl.pln_own, player->cnum) != ALLIED)
|
&& relations_with(pl.pln_own, player->cnum) != ALLIED)
|
||||||
continue;
|
continue;
|
||||||
plc = &plchr[(int)pl.pln_type];
|
plc = &plchr[(int)pl.pln_type];
|
||||||
if ((plc->pl_flags & (P_O | P_N | P_MAR))
|
if (!(plc->pl_flags & (P_B | P_T | P_C))
|
||||||
|| (plc->pl_flags & (P_M | P_F)) == (P_M | P_F)) {
|
|| (plc->pl_flags & P_MAR)) {
|
||||||
pr("A %s cannot carry nuclear devices!\n", plc->pl_name);
|
pr("A %s cannot carry nuclear devices!\n", plc->pl_name);
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
if (CANT_HAPPEN(pl.pln_flags & PLN_LAUNCHED))
|
||||||
|
continue;
|
||||||
if (opt_MARKET) {
|
if (opt_MARKET) {
|
||||||
if (ontradingblock(EF_PLANE, &pl)) {
|
if (ontradingblock(EF_PLANE, &pl)) {
|
||||||
pr("You cannot arm %s while it is on the trading block!\n",
|
pr("You cannot arm %s while it is on the trading block!\n",
|
||||||
|
@ -145,6 +147,8 @@ disarm(void)
|
||||||
continue;
|
continue;
|
||||||
if (!getnuke(nuk_on_plane(&pl), &nuke))
|
if (!getnuke(nuk_on_plane(&pl), &nuke))
|
||||||
continue;
|
continue;
|
||||||
|
if (CANT_HAPPEN(pl.pln_flags & PLN_LAUNCHED))
|
||||||
|
continue;
|
||||||
if (opt_MARKET) {
|
if (opt_MARKET) {
|
||||||
if (ontradingblock(EF_PLANE, &pl)) {
|
if (ontradingblock(EF_PLANE, &pl)) {
|
||||||
pr("You cannot disarm %s while it is on the trading block!\n",
|
pr("You cannot disarm %s while it is on the trading block!\n",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue