Wipe orders when ship, plane, land unit or nuke changes owner
Use new unit_wipe_orders() for violent takeover (takeover_unit() on behalf of assault, attack, board, lboard, paradrop and pboard), and peaceful takeover (unit_give_away() on behalf of arm, disarm, load, unload, lload, lunload, scrap, scuttle, tend, trade). Before, takeover_unit() cleared only group, mission and ship retreat orders, and unit_give_away() only group and mission. Orders that weren't cleared: * Mission op area (visible in xdump) * Ship autonav orders * Ship sail path including ship to follow and mobility quota * Plane range limit * Land unit retreat orders and retreat percentage
This commit is contained in:
parent
5f6e27ff80
commit
e7ce50405e
4 changed files with 57 additions and 8 deletions
|
@ -47,6 +47,7 @@
|
|||
#include "prototypes.h"
|
||||
#include "sect.h"
|
||||
#include "ship.h"
|
||||
#include "unit.h"
|
||||
#include "xy.h"
|
||||
|
||||
static void takeover_unit(struct empobj *, natid);
|
||||
|
@ -231,14 +232,11 @@ takeover_unit(struct empobj *unit, natid newown)
|
|||
unit->own = newown;
|
||||
if (opt_MARKET)
|
||||
trdswitchown(unit->ef_type, unit, newown);
|
||||
unit->group = 0;
|
||||
unit->mission = 0;
|
||||
unit_wipe_orders(unit);
|
||||
|
||||
switch (unit->ef_type) {
|
||||
case EF_SHIP:
|
||||
sp = (struct shpstr *)unit;
|
||||
sp->shp_rflags = 0;
|
||||
memset(sp->shp_rpath, 0, sizeof(sp->shp_rpath));
|
||||
break;
|
||||
case EF_PLANE:
|
||||
pp = (struct plnstr *)unit;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue