diff --git a/src/lib/commands/load.c b/src/lib/commands/load.c index 3fc96ba1..56001d48 100644 --- a/src/lib/commands/load.c +++ b/src/lib/commands/load.c @@ -494,6 +494,12 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy, char buf[1024]; int load_spy = 0; + if (!mchr[(int)sp->shp_type].m_nland + && !(mchr[sp->shp_type].m_flags & M_SUB)) { + if (noisy) + pr("%s cannot carry land units!\n", prship(sp)); + return 0; + } if (loading) { if ((mchr[(int)sp->shp_type].m_flags & M_SUB) && (mchr[(int)sp->shp_type].m_nland == 0)) { @@ -506,11 +512,8 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy, } if (!load_spy && shp_nland(sp) >= mchr[sp->shp_type].m_nland) { if (noisy) { - if (mchr[(int)sp->shp_type].m_nland) - pr("%s doesn't have room for any more land units!\n", - prship(sp)); - else - pr("%s cannot carry land units!\n", prship(sp)); + pr("%s doesn't have room for any more land units!\n", + prship(sp)); } return 0; } @@ -874,14 +877,15 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy, char prompt[512]; char buf[1024]; + if (!lchr[lp->lnd_type].l_nland) { + if (noisy) + pr("%s cannot carry land units!\n", prland(lp)); + return 0; + } if (loading && lnd_nland(lp) >= lchr[lp->lnd_type].l_nland) { - if (noisy) { - if (lchr[lp->lnd_type].l_nland) - pr("%s doesn't have room for any more land units!\n", - prland(lp)); - else - pr("%s cannot carry land units!\n", prland(lp)); - } + if (noisy) + pr("%s doesn't have room for any more land units!\n", + prland(lp)); return 0; } sprintf(prompt, "Land unit(s) to %s %s? ", diff --git a/tests/load-tend/01-load-1 b/tests/load-tend/01-load-1 index 92f4c42d..8aa01eea 100644 --- a/tests/load-tend/01-load-1 +++ b/tests/load-tend/01-load-1 @@ -520,8 +520,6 @@ unload land b B | not capable load land 25 unload land 25 -* -| odd: prompts for lands, unlike unload plane | no room load land 115 | @@ -577,8 +575,6 @@ lunload land b D | not capable lload land 0 lunload land 0 -* -| odd: prompts for lands, unlike unload plane | while on a ship or land | TODO need a non-heavy land that can carry lands to test this | no room diff --git a/tests/load-tend/journal.log b/tests/load-tend/journal.log index 826e0f21..3be7b461 100644 --- a/tests/load-tend/journal.log +++ b/tests/load-tend/journal.log @@ -1705,8 +1705,7 @@ Play#1 output Play#1 6 0 456 Play#1 input unload land 25 Play#1 command unload - Play#1 output Play#1 4 Land unit(s) to unload from fb fishing boat (#25)? - Play#1 input * + Play#1 output Play#1 1 fb fishing boat (#25) cannot carry land units! Play#1 output Play#1 1 No ships affected Play#1 output Play#1 6 0 455 Play#1 input load land 115 @@ -1843,8 +1842,7 @@ Play#1 output Play#1 6 0 434 Play#1 input lunload land 0 Play#1 command lunload - Play#1 output Play#1 4 Land unit(s) to unload from linf light infantry #0? - Play#1 input * + Play#1 output Play#1 1 linf light infantry #0 cannot carry land units! Play#1 output Play#1 1 No units affected Play#1 output Play#1 6 0 433 Play#1 input lload land 115