]> git.pond.sub.org Git - empserver/commit
update: Fix work inconsistency with neweff, production
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 1 Jun 2016 20:37:28 +0000 (22:37 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 17:59:56 +0000 (19:59 +0200)
commit60450f1637505aaa317719d28b693513c1c5d647
treec8492bc8174c17889dfd387976ee52e1f69151e6
parent3bcad4c0dc7e296f620e594db7ce812ff9c64664
update: Fix work inconsistency with neweff, production

In Empire, even babies work.

neweff and production compute the projected population's work,
discarding fractions.

The update first computes the adults' work (discarding fractions),
then newborns' work (discarding fractions), then adds them together.
Double rounding.  Moreover, it uses the old work percentage for the
adults' work, and the new one for the newborns' work.  Broken in
Empire 3.

Fix by recomputing work after grow_people().  This is how things
worked before the regression.  Also restores a bug: growfood()'s work
use is ignored.  Harmless, because fcrate and fgrate are too low for
growfood() to produce anything, and nobody customizes them.  Mark
FIXME anyway.

Update test output changes as expected: available work differs in
sectors where double rounding discards work, an in sectors with
changing work percentage.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
13 files changed:
src/lib/update/human.c
tests/smoke/05/01-1
tests/smoke/06/01-1
tests/smoke/07/01-1
tests/smoke/10/08-8
tests/smoke/11/08-8
tests/smoke/12/08-8
tests/smoke/13/08-8
tests/smoke/14/08-8
tests/smoke/final.xdump
tests/smoke/journal.log
tests/update/final.xdump
tests/update/journal.log