]> git.pond.sub.org Git - empserver/commit
Fix march not to wipe out concurrent updates
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 18 May 2012 14:29:19 +0000 (16:29 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 22 May 2012 18:38:19 +0000 (20:38 +0200)
commit0dd59211aa2c59eb3053c0030947b9b42716bdf4
treea08e36cb8f800634969976ce3039a854fd41b51d
parenta694e4934359deca1662dabd3441c4bb63e08789
Fix march not to wipe out concurrent updates

March code reads the land units into a land unit list, and writes them
back when it changes them, e.g. when a land unit stops.  If a land
unit changes in the land unit file while it is in such a land unit
list, the copy in the land unit list becomes stale, and must not be
used.

To that end, do_unit_move() calls lnd_mar() after prompting for path
or destination.  lnd_mar() re-reads all the land units.
Unfortunately, it still writes back stale copies in certain
circumstances.  Known ways to trigger such writes:

* Deity loads land unit onto a ship or land unit

* Land unit's crew killed just right, e.g. by collateral damage from
  interdiction, followed by additional updates, such as shell fire
  damage

* Sector no longer owned or allied, e.g. allied sector captured by an
  enemy (own sector would kill or retreat the land unit)

Writing a stale copy wipes out the updates that made the copy stale,
and triggers a seqno mismatch oops.  For instance, damage that follows
killing of all crew by collateral damage from interdiction is wiped
out.  If no damage follows, we still get a generation oops.
src/lib/subs/lndsub.c