]> git.pond.sub.org Git - empserver/commit - tests/update/journal.log
update: Fix income and level use after revolt or revert to deity
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 4 Jun 2016 15:59:52 +0000 (17:59 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 17:59:58 +0000 (19:59 +0200)
commitfdde783278620e322ac6887123dbe217941769b4
treee08ede9b9d62c16b71826a94eb94d72e7d94f9a6
parent1e8d290e57e6fe65fc3e928b541694cbf00b4aa9
update: Fix income and level use after revolt or revert to deity

prepare_sects() caches the sector owner's getnatp() across
guerrilla(), do_plague() and populace().  This is wrong, because the
owner may change.  The mistake can be traced back all the way back to
BSD Empire 1.1.

If the sector revolts or reverts to deity, the ex-owner still receives
taxes and bank interest.  The update test demonstrates this bug.

If the sector revolts, we use the ex-owner's instead of the owner's
tech and research for plague, and we use the ex-owners happiness and
required happiness instead of the owner's for loyalty update and civil
unrest.

Change do_plague() and populace() to call getnatp() themselves.  Call
it in prepare_sects() only after we're done messing with the sector
owner.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
include/prototypes.h
src/lib/update/plague.c
src/lib/update/populace.c
src/lib/update/prepare.c
tests/update/99-POGO
tests/update/final.xdump
tests/update/journal.log