load unload lload lunload: Fix for areas starting with a digit

load and lload skip foreign ships unless explicitly named, and
suppress some error messages for ships not explicitly named.  Makes
sense, except the check for "explicitly named" is flawed: it checks
whether the argument starts with a digit.  Works as intended for lists
like 1/2/3.  Broken for areas that happen to start with a digit, such
as 0:9,0:5.  Visible in the load-tend test.

Screwed up when the feature was added in Empire 2.

Fix the obvious way: test for NS_LIST instead.  While there, drop the
p && *p guard, because it's always true after snxtitem().

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2017-09-16 17:07:10 +02:00
parent 581732dcd1
commit 607f15a6f6
3 changed files with 20 additions and 50 deletions

View file

@ -95,11 +95,11 @@ load(void)
if (!p || !*p)
return RET_SYN;
noisy = isdigit(*p);
if (!snxtitem(&nbst, EF_SHIP, p, NULL))
return RET_SYN;
noisy = nbst.sel == NS_LIST;
nships = 0;
while (nxtitem(&nbst, &ship)) {
if (!ship.shp_own)
@ -224,11 +224,11 @@ lload(void)
if (!p || !*p)
return RET_SYN;
noisy = isdigit(*p);
if (!snxtitem(&nbst, EF_LAND, p, NULL))
return RET_SYN;
noisy = nbst.sel == NS_LIST;
nunits = 0;
while (nxtitem(&nbst, &land)) {
if (land.lnd_own == 0)
@ -399,8 +399,8 @@ load_plane_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
if (!still_ok_ship(sectp, sp))
return RET_SYN;
if (noisy && p && *p)
noisy = isdigit(*p);
if (noisy)
noisy = ni.sel == NS_LIST;
while (nxtitem(&ni, &pln)) {
if (!player->owner)
@ -526,8 +526,8 @@ load_land_ship(struct sctstr *sectp, struct shpstr *sp, int noisy,
if (!still_ok_ship(sectp, sp))
return RET_SYN;
if (noisy && p && *p)
noisy = isdigit(*p);
if (noisy)
noisy = ni.sel == NS_LIST;
while (nxtitem(&ni, &land)) {
if (!player->owner)
@ -737,8 +737,8 @@ load_plane_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
if (!still_ok_land(sectp, lp))
return RET_SYN;
if (noisy && p && *p)
noisy = isdigit(*p);
if (noisy)
noisy = ni.sel == NS_LIST;
while (nxtitem(&ni, &pln)) {
if (!player->owner)
@ -895,8 +895,8 @@ load_land_land(struct sctstr *sectp, struct lndstr *lp, int noisy,
if (!still_ok_land(sectp, lp))
return RET_SYN;
if (noisy && p && *p)
noisy = isdigit(*p);
if (noisy)
noisy = ni.sel == NS_LIST;
while (nxtitem(&ni, &land)) {
if (!player->owner)