Improve message when refusing to load plane on unsuitable ship

Test more specific causes before more general ones.  Also get rid of
silly strcpy().
This commit is contained in:
Markus Armbruster 2009-10-04 16:44:06 -04:00
parent 0100402e5f
commit 7312693936

View file

@ -456,27 +456,24 @@ load_plane_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
continue; continue;
} }
/* Plane sanity done */
/* Find the right ship */
if (load_unload == UNLOAD) { if (load_unload == UNLOAD) {
if (pln.pln_ship != sp->shp_uid) if (pln.pln_ship != sp->shp_uid)
continue; continue;
} else if (sp->shp_x != pln.pln_x || sp->shp_y != pln.pln_y) } else if (sp->shp_x != pln.pln_x || sp->shp_y != pln.pln_y)
continue; continue;
/* ship to (plane or missle) sanity */
if (!could_be_on_ship(&pln, sp, 0, 0, 0, 0)) { if (!could_be_on_ship(&pln, sp, 0, 0, 0, 0)) {
if (plchr[(int)pln.pln_type].pl_flags & P_L) { if (noisy) {
strcpy(buf, "planes"); if (plchr[(int)pln.pln_type].pl_flags & P_K)
} else if (plchr[(int)pln.pln_type].pl_flags & P_K) { p = "choppers";
strcpy(buf, "choppers"); else if (plchr[(int)pln.pln_type].pl_flags & P_E)
} else if (plchr[(int)pln.pln_type].pl_flags & P_M) { p = "extra light planes";
strcpy(buf, "missiles"); else if (plchr[(int)pln.pln_type].pl_flags & P_M)
} else if (plchr[(int)pln.pln_type].pl_flags & P_E) { p = "missiles";
strcpy(buf, "extra light planes"); else
} /* else impossible */ p = "planes";
if (noisy) pr("%s cannot carry %s.\n", prship(sp), p);
pr("%s cannot carry %s.\n", prship(sp), buf); }
continue; continue;
} }
/* Fit plane on ship */ /* Fit plane on ship */