empserver/include
Markus Armbruster 25a6cf92b2 update: Don't double-round money, fixing mil pay and more
The update tallies income and expenses in full dollars.  Each debit or
credit is rounded before it is added to the tally.  Different things
are rounded differently.  Examples:

* Each sector's military pay is rounded down.  In the stock game, 1m
  is paid $4.999998, so n mil cost n*$5 -$1, for all practical n.  10m
  in one sector cost $49, but spread over ten sectors they cost only
  $40.

* Total pay for military in ships and land units is rounded down.

* Each plane's military pay is rounded down (used to be rounded up
  except for broke countries until recent commit 2eb08f4).  In the
  stock game, flight pay is 5 * $4.999998 = $24.99999.  For a plane
  with n mil, that's n * $25 - $1.  Filed under plane maintenance, not
  military payroll.

* Each sector's civilian tax is rounded.  In the stock game, 1c pays
  $0.499998.  10c in one sector pay $5, but spread over ten sectors
  they pay nothing.

* An occupied sector's civilian tax is first rounded, then divided by
  four and rounded down *boggle*.

* Each sector's uw tax is rounded.  In the stock game, 1u pays
  $0.106662.  1-4u in one sector pay nothing.  5-14u pay $1.

This is madness.  Has always been that way.

Drop the rounding and track money in type double throughout the
update.  Round only the final amount, randomly.  This is similar to
how commands accumulate a money delta in player->dolcost.

Likewise, tally the subtotals for budget in type double.  Display them
rounded to full dollars.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:07:55 +02:00
..
actofgod.h Update copyright notice 2017-07-02 17:45:44 +02:00
chance.h Fix PRNG seeding to resist guessing 2013-05-08 06:55:21 +02:00
com.h Update copyright notice 2017-07-02 17:45:44 +02:00
combat.h Update copyright notice 2017-07-02 17:45:44 +02:00
commands.h Update copyright notice 2017-07-02 17:45:44 +02:00
commodity.h Update copyright notice 2017-07-02 17:45:44 +02:00
damage.h Update copyright notice 2017-07-02 17:45:44 +02:00
econfig-spec.h Update copyright notice 2017-07-02 17:45:44 +02:00
empio.h Update copyright notice 2017-07-02 17:45:44 +02:00
empobj.h empobj: Drop unused get_empobj_mob_max() 2017-08-06 19:59:59 +02:00
empthread.h Update copyright notice 2017-07-02 17:45:44 +02:00
file.h config: Add sect-chr flags, replace cost by flag "deity" 2017-08-06 19:59:58 +02:00
game.h Update copyright notice 2017-07-02 17:45:44 +02:00
ioqueue.h Update copyright notice 2017-07-02 17:45:44 +02:00
item.h collect: Derive collection value from power value 2017-08-06 19:59:59 +02:00
journal.h Update copyright notice 2017-07-02 17:45:44 +02:00
land.h config: Generalize unit build materials storage 2017-08-06 14:05:11 +02:00
loan.h Update copyright notice 2017-07-02 17:45:44 +02:00
lost.h Update copyright notice 2017-07-02 17:45:44 +02:00
lwp.h Update copyright notice 2017-07-02 17:45:44 +02:00
map.h Update copyright notice 2017-07-02 17:45:44 +02:00
match.h Update copyright notice 2017-07-02 17:45:44 +02:00
misc.h Update copyright notice 2017-07-02 17:45:44 +02:00
mission.h Update copyright notice 2017-07-02 17:45:44 +02:00
nat.h Update copyright notice 2017-07-02 17:45:44 +02:00
news.h Update copyright notice 2017-07-02 17:45:44 +02:00
nsc.h config: Add sect-chr flags, replace cost by flag "deity" 2017-08-06 19:59:58 +02:00
nuke.h config: Generalize unit build materials storage 2017-08-06 14:05:11 +02:00
optlist.h Update copyright notice 2017-07-02 17:45:44 +02:00
path.h Update copyright notice 2017-07-02 17:45:44 +02:00
plague.h Update copyright notice 2017-07-02 17:45:44 +02:00
plane.h config: Generalize unit build materials storage 2017-08-06 14:05:11 +02:00
player.h Update copyright notice 2017-07-02 17:45:44 +02:00
power.h Update copyright notice 2017-07-02 17:45:44 +02:00
product.h Update copyright notice 2017-07-02 17:45:44 +02:00
proto.h Update copyright notice 2017-07-02 17:45:44 +02:00
prototypes.h include: Move update stuff from prototypes.h to update.h 2017-08-06 19:59:59 +02:00
queue.h Update copyright notice 2017-07-02 17:45:44 +02:00
retreat.h Update copyright notice 2017-07-02 17:45:44 +02:00
sect.h collect: Derive collection value from power value 2017-08-06 19:59:59 +02:00
server.h Update copyright notice 2017-07-02 17:45:44 +02:00
service.h Update copyright notice 2017-07-02 17:45:44 +02:00
ship.h include: Bury dead remnants of TREATIES and SAIL 2017-08-06 19:59:59 +02:00
tel.h Update copyright notice 2017-07-02 17:45:44 +02:00
testing.h Update copyright notice 2017-07-02 17:45:44 +02:00
trade.h Update copyright notice 2017-07-02 17:45:44 +02:00
types.h include: Bury dead remnants of TREATIES and SAIL 2017-08-06 19:59:59 +02:00
unit.h Update copyright notice 2017-07-02 17:45:44 +02:00
update.h update: Don't double-round money, fixing mil pay and more 2017-08-06 20:07:55 +02:00
version.h Update copyright notice 2017-07-02 17:45:44 +02:00
xdump.h Update copyright notice 2017-07-02 17:45:44 +02:00
xy.h Update copyright notice 2017-07-02 17:45:44 +02:00