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:
parent
581732dcd1
commit
607f15a6f6
3 changed files with 20 additions and 50 deletions
|
@ -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)
|
||||
|
|
|
@ -108,7 +108,6 @@ load f b 1
|
|||
realm 1 0:9,0:5
|
||||
load f #1 1
|
||||
load f 0:9,0:5 1
|
||||
| BUG: 0:9,0:5 loads friendly #92/93, unlike the other areas
|
||||
load f -1:9,0:5 1
|
||||
| load to desired level rather than an amount
|
||||
| list of own and foreign ships: #0/15/25/92/93 work
|
||||
|
@ -147,7 +146,6 @@ lload f D 1
|
|||
| area: none of army b works
|
||||
lload f #1 1 ?army=b
|
||||
lload f 0:9,0:5 1 ?army=b
|
||||
| BUG: 0:9,0:5 loads allied #92, unlike the other areas
|
||||
lload f -0:9,0:5 1 ?army=b
|
||||
|
|
||||
| load to desired level rather than an amount
|
||||
|
|
|
@ -154,33 +154,9 @@
|
|||
Play#1 input load f 0:9,0:5 1
|
||||
Play#1 command load
|
||||
Play#1 output Play#1 1 1 food loaded onto ls landing ship (#0) at 0,0
|
||||
Play#1 output Play#1 1 You don't own 2,0
|
||||
Play#1 output Play#1 1 You don't own 4,0
|
||||
Play#1 output Play#1 1 You don't own 6,0
|
||||
Play#1 output Play#1 1 The harbor at 1,1 is not 2% efficient yet.
|
||||
Play#1 output Play#1 1 You don't own 3,1
|
||||
Play#1 output Play#1 1 You don't own 5,1
|
||||
Play#1 output Play#1 1 You don't own 7,1
|
||||
Play#1 output Play#1 1 Sector 1,3 is not a harbor or canal.
|
||||
Play#1 output Play#1 1 1 food loaded onto ls landing ship (#15) at 0,4
|
||||
Play#1 output Play#1 1 You don't own 2,4
|
||||
Play#1 output Play#1 1 You don't own 4,4
|
||||
Play#1 output Play#1 1 You don't own 6,4
|
||||
Play#1 output Play#1 1 The city at 1,5 is not 2% efficient yet.
|
||||
Play#1 output Play#1 1 You don't own 3,5
|
||||
Play#1 output Play#1 1 You don't own 5,5
|
||||
Play#1 output Play#1 1 You don't own 7,5
|
||||
Play#1 output Play#1 1 1 food loaded onto fb fishing boat (#25) at 0,4
|
||||
Play#1 output Play#1 1 You don't own 2,4
|
||||
Play#1 output Play#1 1 You don't own 4,4
|
||||
Play#1 output Play#1 1 You don't own 6,4
|
||||
Play#1 output Play#1 1 The city at 1,5 is not 2% efficient yet.
|
||||
Play#1 output Play#1 1 You don't own 3,5
|
||||
Play#1 output Play#1 1 You don't own 5,5
|
||||
Play#1 output Play#1 1 You don't own 7,5
|
||||
Play#1 output Play#1 1 1 food loaded onto ls landing ship (#92) at 0,0
|
||||
Play#1 output Play#1 1 1 food loaded onto ls landing ship (#93) at 0,0
|
||||
Play#1 output Play#1 1 5 ships loaded
|
||||
Play#1 output Play#1 1 3 ships loaded
|
||||
Play#1 output Play#1 6 0 630
|
||||
Play#1 input load f -1:9,0:5 1
|
||||
Play#1 command load
|
||||
|
@ -216,8 +192,8 @@
|
|||
Play#1 output Play#1 1 You don't own 3,5
|
||||
Play#1 output Play#1 1 You don't own 5,5
|
||||
Play#1 output Play#1 1 You don't own 7,5
|
||||
Play#1 output Play#1 1 4 food loaded onto ls landing ship (#92) at 0,0
|
||||
Play#1 output Play#1 1 4 food loaded onto ls landing ship (#93) at 0,0
|
||||
Play#1 output Play#1 1 5 food loaded onto ls landing ship (#92) at 0,0
|
||||
Play#1 output Play#1 1 5 food loaded onto ls landing ship (#93) at 0,0
|
||||
Play#1 output Play#1 1 5 ships loaded
|
||||
Play#1 output Play#1 6 0 628
|
||||
Play#1 input load f a -7
|
||||
|
@ -393,8 +369,7 @@
|
|||
Play#1 output Play#1 6 0 612
|
||||
Play#1 input lload f 0:9,0:5 1 ?army=b
|
||||
Play#1 command lload
|
||||
Play#1 output Play#1 1 1 food loaded onto tra train #92 at 0,0
|
||||
Play#1 output Play#1 1 1 unit loaded
|
||||
Play#1 output Play#1 1 No units affected
|
||||
Play#1 output Play#1 6 0 611
|
||||
Play#1 input lload f -0:9,0:5 1 ?army=b
|
||||
Play#1 command lload
|
||||
|
@ -407,7 +382,7 @@
|
|||
Play#1 output Play#1 1 Sector 4,0 is not yours.
|
||||
Play#1 output Play#1 1 Sector 6,0 is not yours.
|
||||
Play#1 output Play#1 1 Sector 8,0 is not yours.
|
||||
Play#1 output Play#1 1 4 food loaded onto tra train #92 at 0,0
|
||||
Play#1 output Play#1 1 5 food loaded onto tra train #92 at 0,0
|
||||
Play#1 output Play#1 1 2 units loaded
|
||||
Play#1 output Play#1 6 0 609
|
||||
Play#1 input lload f a -7
|
||||
|
@ -3452,14 +3427,12 @@
|
|||
Play#0 output Play#0 1
|
||||
Play#0 output Play#0 1 > BULLETIN from POGO, (#0) dated Thu Jan 1 00:00:00 1970
|
||||
Play#0 output Play#0 1 1 loaded 1 food onto ls landing ship (#92) at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 1 food onto ls landing ship (#92) at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 4 food onto ls landing ship (#92) at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 5 food onto ls landing ship (#92) at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 1 civilians onto cs cargo ship (#85) at -2,0
|
||||
Play#0 output Play#0 1 1 loaded 1 food onto tra train #92 at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 1 food onto linf light infantry #222 at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 1 food onto linf light infantry #252 at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 1 food onto tra train #92 at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 4 food onto tra train #92 at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 5 food onto tra train #92 at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 5 food onto linf light infantry #222 at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 5 food onto linf light infantry #252 at 0,0
|
||||
Play#0 output Play#0 1 1 unloaded 3 military from ls landing ship (#1) at 2,0
|
||||
|
@ -3525,8 +3498,7 @@
|
|||
Play#0 output Play#0 1
|
||||
Play#0 output Play#0 1 > BULLETIN from POGO, (#0) dated Thu Jan 1 00:00:00 1970
|
||||
Play#0 output Play#0 1 1 loaded 1 food onto ls landing ship (#93) at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 1 food onto ls landing ship (#93) at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 4 food onto ls landing ship (#93) at 0,0
|
||||
Play#0 output Play#0 1 1 loaded 5 food onto ls landing ship (#93) at 0,0
|
||||
Play#0 output Play#0 1 1 unloaded 3 military from ls landing ship (#2) at 4,0
|
||||
Play#0 output Play#0 1 1 unloaded 3 military from ls landing ship (#17) at 4,4
|
||||
Play#0 output Play#0 1 1 unloaded 3 military from fb fishing boat (#27) at 4,4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue