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>
This commit is contained in:
Markus Armbruster 2016-06-04 17:59:52 +02:00
parent 1e8d290e57
commit fdde783278
7 changed files with 22 additions and 22 deletions

View file

@ -43,8 +43,9 @@
static int infect_people(struct natstr *, struct sctstr *);
void
do_plague(struct sctstr *sp, struct natstr *np, int etu)
do_plague(struct sctstr *sp, int etu)
{
struct natstr *np = getnatp(sp->sct_own);
int pstage, ptime;
int n;