Rewrite the broken code to move cargo with its carrier
The old code did not move a carrier's cargo (planes, land units, nukes) when the carrier moved. Instead, it fixed up the location in the postread callback. Anything not going through ef_read(), in particular the update, saw it in its old, incorrect location, until a fixed up copy got written back. Moreover, the timestamp did not change when cargo moved, so incremental dumps did not pick up the movement. The new code moves the cargo along with the carrier. New unit_update_cargo() moves or destroys a carrier's cargo (planes, land units, nukes) along with the carrier. Call it from shp_prewrite(), pln_prewrite() and lnd_prewrite() when the carrier moves or gets destroyed. Remove the code to destroy cargo from shp_prewrite(), pln_prewrite(), lnd_prewrite(). Remove the code to fix up cargo location from pln_postread(), lnd_postread(), nuk_postread(). This changes the message for ship and land unit cargo getting destroyed from "sunk" and "MIA" to "lost".
This commit is contained in:
parent
e7f5b517a0
commit
3cf29456fe
6 changed files with 45 additions and 181 deletions
|
@ -56,3 +56,4 @@ extern void unit_list(struct emp_qelem *);
|
|||
extern void unit_put(struct emp_qelem *list, natid actor);
|
||||
extern char *unit_path(int, struct empobj *, char *);
|
||||
extern void unit_view(struct emp_qelem *);
|
||||
extern void unit_update_cargo(struct empobj *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue