]> git.pond.sub.org Git - empserver/commit
Update lost file from prewrite callbacks
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 6 Sep 2008 15:21:32 +0000 (11:21 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 9 Sep 2008 01:26:42 +0000 (21:26 -0400)
commit0d139ee1d1605069dc9759d578ac4356e8f3335f
tree5bc6ee05de30ed33b7092c390c17003cd5f280c2
parentc5482e4bfbc4833e7e113d33d15f043ad15b2627
Update lost file from prewrite callbacks

Losses of sectors, ships, planes, land units and nukes are tracked in
the lost file.  To keep it current, makelost() and makenotlost() were
called whenever one of these changed owners.  Cumbersome and
error-prone.  In fact, the lost file was never perfectly accurate.

Detect the ownership change in the prewrite callback and call
makelost() / makenotlost() from there.  Remove lost file updates from
where they're no longer needed: right before a put.  takeover() is a
bit more involved: it doesn't put the sectors, but all callers do,
except for guerrilla().  So remove the lost file update from
takeover(), but add it to guerrilla().

This takes care of lost file update for all ownership changes that go
through ef_write().  It can't take care of any missing updates for
changes that don't go through it.
19 files changed:
src/lib/commands/anti.c
src/lib/commands/buil.c
src/lib/commands/cede.c
src/lib/commands/coll.c
src/lib/commands/edit.c
src/lib/commands/load.c
src/lib/commands/scra.c
src/lib/commands/setsect.c
src/lib/commands/trad.c
src/lib/subs/attsub.c
src/lib/subs/bridgefall.c
src/lib/subs/detonate.c
src/lib/subs/land.c
src/lib/subs/nuke.c
src/lib/subs/plane.c
src/lib/subs/sect.c
src/lib/subs/ship.c
src/lib/subs/takeover.c
src/lib/update/revolt.c