config: Make product work independently configurable

The work required for a product is traditionally the amount of raw
materials, plus 1 for resource usage, or 1 if using neither.  Make it
independently configurable instead, via new product selector bwork,
backed by new struct pchrstr member p_bwork.  Keep the required work
exactly the same in the default configuration.

Clients that compute work from materials need to be updated.  Easy,
since build work is now exposed in xdump.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2021-01-07 07:14:27 +01:00
parent 8c9a383fa1
commit 1d8451e87b
10 changed files with 83 additions and 84 deletions

View file

@ -20,6 +20,7 @@ tests/empdump/xundump-errors/colhdr-miss:2: header 'camt(0)' ... 'camt(2)' missi
tests/empdump/xundump-errors/colhdr-miss:2: header 'nllag' missing
tests/empdump/xundump-errors/colhdr-miss2:21: header 'ctype(0)' ... 'ctype(2)' missing
tests/empdump/xundump-errors/colhdr-miss2:21: header 'camt(0)' ... 'camt(2)' missing
tests/empdump/xundump-errors/colhdr-miss2:21: header 'bwork' missing
tests/empdump/xundump-errors/colhdr-miss2:21: header 'type' missing
tests/empdump/xundump-errors/colhdr-miss2:21: header 'level' missing
tests/empdump/xundump-errors/colhdr-miss2:21: header 'cost' missing
@ -105,7 +106,7 @@ tests/empdump/xundump-errors/fld-sep:2: bad field separator after field 1
tests/empdump/xundump-errors/fld-strbig:3: field 19 takes at most 9 characters
tests/empdump/xundump-errors/fld-unexpid:6: table's first part doesn't have this row
tests/empdump/xundump-errors/fld-unexpid1:7: value for field 1 must be 2
tests/empdump/xundump-errors/fld-unksym:2: unknown level symbol 'xxx' in field 11
tests/empdump/xundump-errors/fld-unksym:2: unknown type symbol 'xxx' in field 11
tests/empdump/xundump-errors/fld-unparen:2: unmatched '(' in field 19
tests/empdump/xundump-errors/ftr-fewrows:2: expected 34 more rows
tests/empdump/xundump-errors/ftr-fewrows2:4: expected 13 more rows

View file

@ -1,5 +1,5 @@
config product
name sname ctype(0) ctype(1) type level cost nrndx nrdep nlndx nlmin
name sname ctype(0) ctype(1) bwork type level cost nrndx nrdep nlndx nlmin
# header 'uid' missing
# header 'ctype(2)' missing
# header 'camt(0)' ... 'camt(2)' missing

View file

@ -21,6 +21,7 @@ config product
name
# header 'ctype(0)' ... 'ctype(2)' missing
# header 'camt(0)' ... 'camt(2)' missing
# header 'bwork' missing
# header 'type' missing
# header 'level' missing
# header 'cost' missing

View file

@ -1,3 +1,3 @@
XDUMP product 1
0 "iron ore" "iron" 0 0 0 0 0 0 0 xxx
# unknown level symbol 'xxx' in field 11
# unknown type symbol 'xxx' in field 11

View file

@ -601,22 +601,22 @@
Play#0 output Play#0 6 0 640
Play#0 input show product
Play#0 command show
Play#0 output Play#0 1 product cost raw materials reso dep level p.e.
Play#0 output Play#0 1 iron i $0 min 0 1.0
Play#0 output Play#0 1 dust d $0 gold 20 1.0
Play#0 output Play#0 1 food f $0 fert 0 (tech+10)/(tech+20)
Play#0 output Play#0 1 oil o $0 ocont 10 (tech+10)/(tech+20)
Play#0 output Play#0 1 rad r $2 uran 35 (tech-40)/(tech-30)
Play#0 output Play#0 1 shells s $3 2l 1h (tech-20)/(tech-10)
Play#0 output Play#0 1 guns g $30 1o 5l 10h (tech-20)/(tech-10)
Play#0 output Play#0 1 petrol p $1 1o (tech-20)/(tech-10)
Play#0 output Play#0 1 bars b $10 5d 1.0
Play#0 output Play#0 1 lcm l $0 1i (tech+10)/(tech+20)
Play#0 output Play#0 1 hcm h $0 2i (tech+10)/(tech+20)
Play#0 output Play#0 1 tech $300 1d 5o 10l (educ-5)/(educ+5)
Play#0 output Play#0 1 medical $90 1d 5o 10l (educ-5)/(educ+5)
Play#0 output Play#0 1 edu $9 1l 1.0
Play#0 output Play#0 1 happy $9 1l 1.0
Play#0 output Play#0 1 product cost raw materials avail reso dep level p.e.
Play#0 output Play#0 1 iron i $0 1 min 0 1.0
Play#0 output Play#0 1 dust d $0 1 gold 20 1.0
Play#0 output Play#0 1 food f $0 1 fert 0 (tech+10)/(tech+20)
Play#0 output Play#0 1 oil o $0 1 ocont 10 (tech+10)/(tech+20)
Play#0 output Play#0 1 rad r $2 1 uran 35 (tech-40)/(tech-30)
Play#0 output Play#0 1 shells s $3 2l 1h 3 (tech-20)/(tech-10)
Play#0 output Play#0 1 guns g $30 1o 5l 10h 16 (tech-20)/(tech-10)
Play#0 output Play#0 1 petrol p $1 1o 1 (tech-20)/(tech-10)
Play#0 output Play#0 1 bars b $10 5d 5 1.0
Play#0 output Play#0 1 lcm l $0 1i 1 (tech+10)/(tech+20)
Play#0 output Play#0 1 hcm h $0 2i 2 (tech+10)/(tech+20)
Play#0 output Play#0 1 tech $300 1d 5o 10l 16 (educ-5)/(educ+5)
Play#0 output Play#0 1 medical $90 1d 5o 10l 16 (educ-5)/(educ+5)
Play#0 output Play#0 1 edu $9 1l 1 1.0
Play#0 output Play#0 1 happy $9 1l 1 1.0
Play#0 output Play#0 6 0 640
Play#0 input show news
Play#0 command show
@ -1235,6 +1235,7 @@
Play#0 output Play#0 1 "sname" 3 0 0 -1
Play#0 output Play#0 1 "ctype" 1 0 3 19
Play#0 output Play#0 1 "camt" 1 0 3 -1
Play#0 output Play#0 1 "bwork" 1 0 0 -1
Play#0 output Play#0 1 "type" 1 0 0 19
Play#0 output Play#0 1 "level" 1 0 0 34
Play#0 output Play#0 1 "cost" 1 0 0 -1
@ -1243,7 +1244,7 @@
Play#0 output Play#0 1 "nlndx" 1 0 0 34
Play#0 output Play#0 1 "nlmin" 1 0 0 -1
Play#0 output Play#0 1 "nllag" 1 0 0 -1
Play#0 output Play#0 1 /13
Play#0 output Play#0 1 /14
Play#0 output Play#0 6 0 640
Play#0 input xdump meta 21
Play#0 command xdump
@ -1816,21 +1817,21 @@
Play#0 input xdump product *
Play#0 command xdump
Play#0 output Play#0 1 XDUMP product 0
Play#0 output Play#0 1 0 "iron\\040ore" "iron" -1 -1 -1 0 0 0 5 -1 0 0 0 -1 0 0
Play#0 output Play#0 1 1 "gold\\040dust" "dust" -1 -1 -1 0 0 0 6 -1 0 0 20 -1 0 0
Play#0 output Play#0 1 2 "food" "food" -1 -1 -1 0 0 0 8 -1 0 0 0 0 -10 10
Play#0 output Play#0 1 3 "oil" "oil" -1 -1 -1 0 0 0 9 -1 0 0 10 0 -10 10
Play#0 output Play#0 1 4 "radioactive\\040materials" "rad" -1 -1 -1 0 0 0 13 -1 2 0 35 0 40 10
Play#0 output Play#0 1 5 "shells" "shells" 10 11 -1 2 1 0 2 -1 3 0 0 0 20 10
Play#0 output Play#0 1 6 "guns" "guns" 9 10 11 1 5 10 3 -1 30 0 0 0 20 10
Play#0 output Play#0 1 7 "petrol" "petrol" 9 -1 -1 1 0 0 4 -1 1 0 0 0 20 10
Play#0 output Play#0 1 8 "gold\\040bars" "bars" 6 -1 -1 5 0 0 7 -1 10 0 0 -1 0 0
Play#0 output Play#0 1 9 "light\\040construction\\040materials" "lcm" 5 -1 -1 1 0 0 10 -1 0 0 0 0 -10 10
Play#0 output Play#0 1 10 "heavy\\040construction\\040materials" "hcm" 5 -1 -1 2 0 0 11 -1 0 0 0 0 -10 10
Play#0 output Play#0 1 11 "technological\\040breakthroughs" "tech" 6 9 10 1 5 10 -1 0 300 0 0 2 5 10
Play#0 output Play#0 1 12 "medical\\040discoveries" "medical" 6 9 10 1 5 10 -1 1 90 0 0 2 5 10
Play#0 output Play#0 1 13 "a\\040class\\040of\\040graduates" "edu" 10 -1 -1 1 0 0 -1 2 9 0 0 -1 0 0
Play#0 output Play#0 1 14 "happy\\040strollers" "happy" 10 -1 -1 1 0 0 -1 3 9 0 0 -1 0 0
Play#0 output Play#0 1 0 "iron\\040ore" "iron" -1 -1 -1 0 0 0 1 5 -1 0 45 0 -1 0 0
Play#0 output Play#0 1 1 "gold\\040dust" "dust" -1 -1 -1 0 0 0 1 6 -1 0 46 20 -1 0 0
Play#0 output Play#0 1 2 "food" "food" -1 -1 -1 0 0 0 1 8 -1 0 47 0 0 -10 10
Play#0 output Play#0 1 3 "oil" "oil" -1 -1 -1 0 0 0 1 9 -1 0 48 10 0 -10 10
Play#0 output Play#0 1 4 "radioactive\\040materials" "rad" -1 -1 -1 0 0 0 1 13 -1 0 49 35 0 40 10
Play#0 output Play#0 1 5 "shells" "shells" 10 11 -1 2 1 0 3 2 -1 0 0 0 0 20 10
Play#0 output Play#0 1 6 "guns" "guns" 9 10 11 1 5 10 16 3 -1 0 0 0 0 20 10
Play#0 output Play#0 1 7 "petrol" "petrol" 9 -1 -1 1 0 0 1 4 -1 0 0 0 0 20 10
Play#0 output Play#0 1 8 "gold\\040bars" "bars" 6 -1 -1 5 0 0 5 7 -1 0 0 0 -1 0 0
Play#0 output Play#0 1 9 "light\\040construction\\040materials" "lcm" 5 -1 -1 1 0 0 1 10 -1 0 0 0 0 -10 10
Play#0 output Play#0 1 10 "heavy\\040construction\\040materials" "hcm" 5 -1 -1 2 0 0 2 11 -1 0 0 0 0 -10 10
Play#0 output Play#0 1 11 "technological\\040breakthroughs" "tech" 6 9 10 1 5 10 16 -1 0 0 0 0 2 5 10
Play#0 output Play#0 1 12 "medical\\040discoveries" "medical" 6 9 10 1 5 10 16 -1 1 0 0 0 2 5 10
Play#0 output Play#0 1 13 "a\\040class\\040of\\040graduates" "edu" 10 -1 -1 1 0 0 1 -1 2 0 0 0 -1 0 0
Play#0 output Play#0 1 14 "happy\\040strollers" "happy" 10 -1 -1 1 0 0 1 -1 3 0 0 0 -1 0 0
Play#0 output Play#0 1 /15
Play#0 output Play#0 6 0 640
Play#0 input xdump sect-chr *
@ -2532,21 +2533,21 @@
Play#1 input xdump product *
Play#1 command xdump
Play#1 output Play#1 1 XDUMP product 0
Play#1 output Play#1 1 0 "iron\\040ore" "iron" -1 -1 -1 0 0 0 5 -1 0 0 0 -1 0 0
Play#1 output Play#1 1 1 "gold\\040dust" "dust" -1 -1 -1 0 0 0 6 -1 0 0 20 -1 0 0
Play#1 output Play#1 1 2 "food" "food" -1 -1 -1 0 0 0 8 -1 0 0 0 0 -10 10
Play#1 output Play#1 1 3 "oil" "oil" -1 -1 -1 0 0 0 9 -1 0 0 10 0 -10 10
Play#1 output Play#1 1 4 "radioactive\\040materials" "rad" -1 -1 -1 0 0 0 13 -1 2 0 35 0 40 10
Play#1 output Play#1 1 5 "shells" "shells" 10 11 -1 2 1 0 2 -1 3 0 0 0 20 10
Play#1 output Play#1 1 6 "guns" "guns" 9 10 11 1 5 10 3 -1 30 0 0 0 20 10
Play#1 output Play#1 1 7 "petrol" "petrol" 9 -1 -1 1 0 0 4 -1 1 0 0 0 20 10
Play#1 output Play#1 1 8 "gold\\040bars" "bars" 6 -1 -1 5 0 0 7 -1 10 0 0 -1 0 0
Play#1 output Play#1 1 9 "light\\040construction\\040materials" "lcm" 5 -1 -1 1 0 0 10 -1 0 0 0 0 -10 10
Play#1 output Play#1 1 10 "heavy\\040construction\\040materials" "hcm" 5 -1 -1 2 0 0 11 -1 0 0 0 0 -10 10
Play#1 output Play#1 1 11 "technological\\040breakthroughs" "tech" 6 9 10 1 5 10 -1 0 300 0 0 2 5 10
Play#1 output Play#1 1 12 "medical\\040discoveries" "medical" 6 9 10 1 5 10 -1 1 90 0 0 2 5 10
Play#1 output Play#1 1 13 "a\\040class\\040of\\040graduates" "edu" 10 -1 -1 1 0 0 -1 2 9 0 0 -1 0 0
Play#1 output Play#1 1 14 "happy\\040strollers" "happy" 10 -1 -1 1 0 0 -1 3 9 0 0 -1 0 0
Play#1 output Play#1 1 0 "iron\\040ore" "iron" -1 -1 -1 0 0 0 1 5 -1 0 45 0 -1 0 0
Play#1 output Play#1 1 1 "gold\\040dust" "dust" -1 -1 -1 0 0 0 1 6 -1 0 46 20 -1 0 0
Play#1 output Play#1 1 2 "food" "food" -1 -1 -1 0 0 0 1 8 -1 0 47 0 0 -10 10
Play#1 output Play#1 1 3 "oil" "oil" -1 -1 -1 0 0 0 1 9 -1 0 48 10 0 -10 10
Play#1 output Play#1 1 4 "radioactive\\040materials" "rad" -1 -1 -1 0 0 0 1 13 -1 0 49 35 0 40 10
Play#1 output Play#1 1 5 "shells" "shells" 10 11 -1 2 1 0 3 2 -1 0 0 0 0 20 10
Play#1 output Play#1 1 6 "guns" "guns" 9 10 11 1 5 10 16 3 -1 0 0 0 0 20 10
Play#1 output Play#1 1 7 "petrol" "petrol" 9 -1 -1 1 0 0 1 4 -1 0 0 0 0 20 10
Play#1 output Play#1 1 8 "gold\\040bars" "bars" 6 -1 -1 5 0 0 5 7 -1 0 0 0 -1 0 0
Play#1 output Play#1 1 9 "light\\040construction\\040materials" "lcm" 5 -1 -1 1 0 0 1 10 -1 0 0 0 0 -10 10
Play#1 output Play#1 1 10 "heavy\\040construction\\040materials" "hcm" 5 -1 -1 2 0 0 2 11 -1 0 0 0 0 -10 10
Play#1 output Play#1 1 11 "technological\\040breakthroughs" "tech" 6 9 10 1 5 10 16 -1 0 0 0 0 2 5 10
Play#1 output Play#1 1 12 "medical\\040discoveries" "medical" 6 9 10 1 5 10 16 -1 1 0 0 0 2 5 10
Play#1 output Play#1 1 13 "a\\040class\\040of\\040graduates" "edu" 10 -1 -1 1 0 0 1 -1 2 0 0 0 -1 0 0
Play#1 output Play#1 1 14 "happy\\040strollers" "happy" 10 -1 -1 1 0 0 1 -1 3 0 0 0 -1 0 0
Play#1 output Play#1 1 /15
Play#1 output Play#1 6 0 0
Play#1 input xdump sect-chr *