]> git.pond.sub.org Git - empserver/commit
update budget produce: Count loaded civilians for TECH_POP
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 19 Jun 2016 11:21:35 +0000 (13:21 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:08:30 +0000 (20:08 +0200)
commit4be4a2c540edcde259dc0b3d9f4273451350d5a9
tree701bd2d016bdd56ca6363d640422b37ad85a9344
parent14f3bd9717b6ef793ade234fdd6904eea6adde0a
update budget produce: Count loaded civilians for TECH_POP

When option TECH_POP is enabled, the cost of tech increases when
civilian population exceeds 50000.  Only civilians in old-owned
sectors count.  This differs from education and happiness, where
civilians loaded on ships and land units count, too.

The update counts population for TECH_POP with count_pop().  This is
an extra pass over all sectors.

produce also uses count_pop(), once per tech center examined.
Wasteful.

budget avoids count_pop(): it uses tax()'s civilian count.  More
efficient, but the difference to the update is ugly.

Change TECH_POP to use the same civilian count as education and
happiness, i.e. count civilians on ships and land units, too.

This count is available in nat_budget[] in time for produce(): it's
computed by tax() and by ship and land unit maintenance.  So use it
there.  This takes care of the update and budget.  produce doesn't run
enough update code to do the same.  Keep calling count_pop() there.
Update it to match the update, and give it internal linkage.
Duplicating update's workings there is ugly, so mark it FIXME.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
include/prototypes.h
include/update.h
src/lib/commands/budg.c
src/lib/commands/prod.c
src/lib/update/main.c
src/lib/update/produce.c