Fix cargo giveaway in load, lload, unload, lunload and tend
Use unit_give_away() in gift(). This fixes a number of bugs: * Nukes on planes weren't given away along with the plane. * Likewise for land units on land units (can't happen in the stock game). * Mission was not cleared by unload land/plane, lunload land/plane, and lload plane, except for planes on land units. * Wing and army were never cleared. It also happens to suppress information on planes given away along with their land unit carriers. Shrug.
This commit is contained in:
parent
d2b1bef0f5
commit
8cf32c4854
2 changed files with 5 additions and 78 deletions
|
@ -207,8 +207,6 @@ tend_land(struct shpstr *tenderp, char *units)
|
|||
struct nstr_item targets;
|
||||
struct shpstr target;
|
||||
struct lndstr land;
|
||||
struct plnstr plane;
|
||||
struct nstr_item pni;
|
||||
char buf[1024];
|
||||
|
||||
if (!snxtitem(&lni, EF_LAND, units, NULL))
|
||||
|
@ -277,22 +275,10 @@ tend_land(struct shpstr *tenderp, char *units)
|
|||
gift(target.shp_own, player->cnum, &land, buf);
|
||||
land.lnd_ship = target.shp_uid;
|
||||
land.lnd_harden = 0;
|
||||
land.lnd_mission = 0;
|
||||
putland(land.lnd_uid, &land);
|
||||
expose_ship(tenderp, &target);
|
||||
putship(target.shp_uid, &target);
|
||||
putship(tenderp->shp_uid, tenderp);
|
||||
snxtitem_xy(&pni, EF_PLANE, land.lnd_x, land.lnd_y);
|
||||
while (nxtitem(&pni, &plane)) {
|
||||
if (plane.pln_flags & PLN_LAUNCHED)
|
||||
continue;
|
||||
if (plane.pln_land != land.lnd_uid)
|
||||
continue;
|
||||
sprintf(buf, "loaded on %s", prship(&target));
|
||||
gift(target.shp_own, player->cnum, &plane, buf);
|
||||
plane.pln_mission = 0;
|
||||
putplane(plane.pln_uid, &plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue