]> git.pond.sub.org Git - empserver/commit
Rewrite the broken code to move cargo with its carrier
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 12 Sep 2008 23:31:48 +0000 (19:31 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 13 Sep 2008 01:34:07 +0000 (21:34 -0400)
commit3cf29456fe07d91a05b003d372c696fd8cdb41ae
tree04ccc2478adeab4d23d7089337ae0258d248d91d
parente7f5b517a025ee3fbecef2d7854f1fee62d2425c
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".
include/unit.h
src/lib/subs/land.c
src/lib/subs/nuke.c
src/lib/subs/plane.c
src/lib/subs/ship.c
src/lib/subs/unitsub.c