(flee, army, wing): Print how many new members were added.
Previously, it printed how many were selected, which can include old members of the group. (flee, army): The rather obscure feature to assign the fleet's / army's retreat orders to members was broken. It ignored ownership, and thus could copy some other player's retreat orders. Abusable. Copying the first member's retreat orders is less than useful, in particular for group ~. The code now chooses the first one in the same sector with RET_GROUP set. RET_GROUP is never set for group ~.
This commit is contained in:
parent
33ae33b556
commit
18ee9a2f35
4 changed files with 39 additions and 24 deletions
|
@ -49,7 +49,6 @@ army(void)
|
|||
struct nstr_item nstr;
|
||||
struct nstr_item ni;
|
||||
struct lndstr land2;
|
||||
int r;
|
||||
s_char buf[1024];
|
||||
|
||||
cp = getstarg(player->argp[1], "army? ", buf);
|
||||
|
@ -65,17 +64,24 @@ army(void)
|
|||
if (!snxtitem(&nstr, EF_LAND, player->argp[2]))
|
||||
return RET_SYN;
|
||||
count = 0;
|
||||
while (nxtitem(&nstr, (s_char *)&land)) {
|
||||
while (nxtitem(&nstr, &land)) {
|
||||
if (!player->owner)
|
||||
continue;
|
||||
land.lnd_army = c;
|
||||
snxtitem(&ni, EF_LAND, cp);
|
||||
while ((r = nxtitem(&ni, (s_char *)&land2)) &&
|
||||
(land2.lnd_army != c)) ;
|
||||
if (r) {
|
||||
memcpy(land.lnd_rpath, land2.lnd_rpath, sizeof(land.lnd_rpath));
|
||||
land.lnd_rflags = land2.lnd_rflags;
|
||||
if (land.lnd_army == c)
|
||||
continue;
|
||||
land.lnd_rflags &= ~RET_GROUP;
|
||||
snxtitem_group(&ni, EF_LAND, c);
|
||||
while (nxtitem(&ni, &land2)) {
|
||||
if ((land2.lnd_rflags & RET_GROUP) == 0)
|
||||
continue;
|
||||
if (land2.lnd_x == land.lnd_x && land2.lnd_y == land.lnd_y) {
|
||||
memcpy(land.lnd_rpath, land2.lnd_rpath,
|
||||
sizeof(land.lnd_rpath));
|
||||
land.lnd_rflags = land2.lnd_rflags;
|
||||
break;
|
||||
}
|
||||
}
|
||||
land.lnd_army = c;
|
||||
putland(land.lnd_uid, &land);
|
||||
count++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue