load: Move check for hardened plane into plane_loadable()

This de-duplicates the check, and skips it when unloading.  It never
made sense there, and can't happen anymore since the previous commit.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2018-05-11 18:58:51 +02:00
parent 8b9ce7be43
commit bf9cb33fc2

View file

@ -380,6 +380,12 @@ plane_loadable(struct plnstr *pp, int noisy)
prplane(pp), pp->pln_land); prplane(pp), pp->pln_land);
return 0; return 0;
} }
if (pp->pln_harden) {
if (noisy)
pr("%s has been hardened and can't be loaded\n",
prplane(pp));
return 0;
}
return 1; return 1;
} }
@ -463,12 +469,6 @@ load_plane_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
} }
if (loading && !plane_loadable(&pln, noisy)) if (loading && !plane_loadable(&pln, noisy))
continue; continue;
if (pln.pln_harden != 0) {
if (noisy)
pr("%s has been hardened and can't be loaded\n",
prplane(&pln));
continue;
}
if (!loading) { if (!loading) {
if (pln.pln_ship != sp->shp_uid) if (pln.pln_ship != sp->shp_uid)
@ -756,12 +756,6 @@ load_plane_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
} }
if (loading && !plane_loadable(&pln, noisy)) if (loading && !plane_loadable(&pln, noisy))
continue; continue;
if (pln.pln_harden != 0) {
if (noisy)
pr("%s has been hardened and can't be loaded\n",
prplane(&pln));
continue;
}
/* Plane sanity done */ /* Plane sanity done */
/* Find the right unit */ /* Find the right unit */