config: Define infra build cost and mobility use per 100%

Infrastructure build cost is defined by infra column dcost (struct
sctintrins member in_dcost).  It's the cost per point of efficiency.
In contrast, sector and unit build cost is defined for 100%, by
sect-chr, ship-chr, plane-chr, land-chr, nuke-chr column cost.

Switch to build cost per 100%, for flexibility and consistency:
replace struct sctintrins member in_dcost by in_cost, and selector
dcost by cost.

With cost values that aren't multiple of 100, the build cost may have
to be rounded.  Do this exactly like we round sector build cost: the
amount is limited to money * 100 / cost rounded down, but the money
charged is actual amount * money / 100 rounded randomly.

Do the same for mobility use: replace struct sctintrins member
in_mcost by in_bmobil, and selector mcost by bmobil, with similar
rounding.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-08-17 20:00:02 +02:00
parent f9114aecd8
commit c8b51ec1a8
8 changed files with 42 additions and 43 deletions

View file

@ -1,4 +1,4 @@
config infrastructure
name lcms hcms dcost mcost enable
name lcms hcms bmobil cost enable
"lala" 1 1 1 1 1
# value for field 1 must be "road network"

View file

@ -1,7 +1,7 @@
config infrastructure
name lcm hcm dcost mcost enab
"road network" 2 2 2 1 1
"rail network" 1 1 1 1 1
"defense factor" 1 1 1 1 0
name lcm hcm bmob cost enab
"road network" 2 2 100 200 1
"rail network" 1 1 100 100 1
"defense factor" 1 1 100 100 0
/con
# malformed table footer

View file

@ -1196,8 +1196,8 @@
Play#0 output Play#0 1 "name" 3 0 0 -1
Play#0 output Play#0 1 "lcms" 1 0 0 -1
Play#0 output Play#0 1 "hcms" 1 0 0 -1
Play#0 output Play#0 1 "dcost" 1 0 0 -1
Play#0 output Play#0 1 "mcost" 1 0 0 -1
Play#0 output Play#0 1 "bmobil" 1 0 0 -1
Play#0 output Play#0 1 "cost" 1 0 0 -1
Play#0 output Play#0 1 "enable" 1 0 0 -1
Play#0 output Play#0 1 /6
Play#0 output Play#0 6 0 640
@ -1801,9 +1801,9 @@
Play#0 input xdump infrastructure *
Play#0 command xdump
Play#0 output Play#0 1 XDUMP infrastructure 0
Play#0 output Play#0 1 "road\\040network" 2 2 2 1 1
Play#0 output Play#0 1 "rail\\040network" 1 1 1 1 0
Play#0 output Play#0 1 "defense\\040factor" 1 1 1 1 0
Play#0 output Play#0 1 "road\\040network" 2 2 100 200 1
Play#0 output Play#0 1 "rail\\040network" 1 1 100 100 0
Play#0 output Play#0 1 "defense\\040factor" 1 1 100 100 0
Play#0 output Play#0 1 /3
Play#0 output Play#0 6 0 640
Play#0 input xdump updates *
@ -2451,9 +2451,9 @@
Play#1 input xdump infrastructure *
Play#1 command xdump
Play#1 output Play#1 1 XDUMP infrastructure 0
Play#1 output Play#1 1 "road\\040network" 2 2 2 1 1
Play#1 output Play#1 1 "rail\\040network" 1 1 1 1 0
Play#1 output Play#1 1 "defense\\040factor" 1 1 1 1 0
Play#1 output Play#1 1 "road\\040network" 2 2 100 200 1
Play#1 output Play#1 1 "rail\\040network" 1 1 100 100 0
Play#1 output Play#1 1 "defense\\040factor" 1 1 100 100 0
Play#1 output Play#1 1 /3
Play#1 output Play#1 6 0 0
Play#1 input xdump updates *