From 71bbd642dfcdec64100ab0d276ca3203e92d836e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 27 Jul 2008 18:02:06 -0400 Subject: [PATCH] New show product This is the human-readable buddy of xdump product, which dumps pchr[]. It duplicates much of the information in show sect c, but in more accessible form. It's in show_product(). Remove product information from info Quick-ref. show reflects the actual game, is more complete, and should be just as readable. --- include/prototypes.h | 1 + info/Products.t | 160 +++++++++++++--------------------------- info/Quick-ref.t | 25 +------ info/show.t | 8 +- src/lib/commands/show.c | 4 + src/lib/player/empmod.c | 2 +- src/lib/subs/show.c | 37 ++++++++++ 7 files changed, 101 insertions(+), 136 deletions(-) diff --git a/include/prototypes.h b/include/prototypes.h index c76c63e5..f3ed1be7 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -652,6 +652,7 @@ extern void show_sect_stats(int); extern void show_sect_capab(int); extern void show_item(int); extern void show_news(int); +extern void show_product(int); extern void show_updates(int); /* shpsub.c */ extern void shp_sel(struct nstr_item *, struct emp_qelem *); diff --git a/info/Products.t b/info/Products.t index 2fed2258..45fbad5d 100644 --- a/info/Products.t +++ b/info/Products.t @@ -8,121 +8,65 @@ Some of those products may, in turn, be considered raw materials for other industries which produce other products. .s1 -This table gives the constituents and costs for each type of product. +The show command displays characteristics of products: .s1 -All costs given in the table are for 100% production efficiency. -Many processes depend on technology level -or educational level of the country; -a note like \*Qp.e.=(tlev+10)/(tlev+20)\*U means -that a country with a technology level of 0 -has a production efficiency of 50% -and will only produce one-half of the specified product amount -for the given costs, -whereas a country with a technology level of 100 -will have a production efficiency of 92%. +.EX show product +.NF +product cost raw materials reso dep level p.e. + iron i $0 min 0 1.0 + dust d $0 gold 20 1.0 + food f $0 fert 0 (tech+10)/(tech+20) + oil o $0 ocont 10 (tech+10)/(tech+20) + rad r $2 uran 35 (tech-40)/(tech-30) + shells s $3 2l 1h (tech-20)/(tech-10) + guns g $30 1o 5l 10h (tech-20)/(tech-10) + petrol p $1 1o (tech-20)/(tech-10) + bars b $10 5d 1.0 + lcm l $0 1i (tech+10)/(tech+20) + hcm h $0 2i (tech+10)/(tech+20) + tech $300 1d 5o 10l (educ-5)/(educ+5) +medical $90 1d 5o 10l (educ-5)/(educ+5) + edu $9 1l 1.0 + happy $9 1l 1.0 +.FI .s1 -In addition, some sectors don't produce raw materials as well as others, -and some produce much better than others. Use the "show sector capabilities" -command to see production efficiencies and other useful information on -producing sectors. +The columns are: +.in \w'raw materials\0\0'u +.L product +The name of the product and the one-letter mnemonic of the commodity +made, if any. +.L cost +Cost per unit of production. +.L "raw materials" +Raw materials for one unit of production. +.L "reso dep" +Natural resource exploited, and its rate of depletion. +.L "level p.e." +Level production efficiency, for 100% sector type production +efficiency +.in .s1 -The rate at which constituents can be turned into products +How much a sector can produce is governed by the amount of \*Qwork\*U performed by its populace, -divided by the units of constituents -per unit of product. +divided by the amount of raw materials +per unit of production. E.g., it takes 3 units of \*Qwork\*U to produce 1 shell; 2 units to incorporate the light construction materials and 1 unit for the heavy. -\*QNatural resources\*U such as fertility -count as one unit of constituents; +Mining a \*Qnatural resource\*U such as fertility +takes one unit of work; e.g., it takes 1 unit of work per unit of food produced. .s1 -.in \w'technology\0\0'u -.L shells -Shell production efficiency depends on technology level; -p.e.=(tlev-20)/(tlev-10) -Shells cost $3 each to manufacture. -Each requires 2 units of light construction materials -and 1 unit of heavy construction materials. -You must have a minimum technology of 20 to produce shells. -.L guns -Gun production depends on technology level; -p.e.=(tlev-20)/(tlev-10) -Guns cost $30 each to manufacture. -Each requires 5 units of light construction materials, -10 units of heavy construction materials, -and 1 unit of oil. -You must have a minimum technology of 20 to produce guns. -.L iron -Iron ore production depends on the mine's mineral richness. -Extracting iron ore is free, -and doesn't deplete the sector's mineral richness. -.L dust -Gold dust production depends on the mine's gold richness. -Extracting gold dust is free, -but depletes the sector's gold richness. -.L bars -Gold bars cost $10 to produce and require 5 units of gold dust each. -.L food -Food production efficiency depends on technology level -and the fertility of the sector; -p.e.=(tlev+10)/(tlev+20). -Growing food is free, -and doesn't deplete the sector's fertility. -.L oil -Oil production efficiency depends on technology level -and the oil content of the sector; -p.e.=(tlev+10)/(tlev+20). -Pumping oil is free, -but depletes the sector's oil content. -.L petrol -Petrol production depends on technology level; -p.e.=(tlev-20)/(tlev-10). -A unit of petrol costs $1 to manufacture. -Every 10 units of petrol require 1 unit of oil to produce. -You must have a minimum technology of 20 to produce petrol. -.L lcm -Light construction material production efficiency -depends on technology level; -p.e.=(tlev+10)/(tlev+20). -Producing lcms does not cost money, but requires 1 unit of iron ore. -.L hcm -Heavy construction material production efficiency -depends on technology level; -p.e.=(tlev+10)/(tlev+20). -Producing hcms does not cost money, but requires 2 unit of iron ore. -.L rad -Radioactive material production efficiency depends on technology level, -which must be at least 40. -p.e.=(tlev-40)/(tlev-30). -Producing rads cost $2 per ton, -and depletes the uranium content of the sector. -.L education -A unit of education (a \*Qclass of graduates\*U), -costs $10 to produce and requires 1 unit -of light construction materials (see "info Education"). -.L happiness -A unit of happiness (\*Qhappy strollers\*U), -costs $10 to produce and requires 1 unit -of light construction materials (see "info Happiness"). -.L technology -Technology production efficiency depends on education level; -p.e.=(elev-5)/(elev+5). -A unit of technology (a \*Qtechnological breakthrough\*U), -costs $5 times the number of ETUs per update -to produce, and requires 10 units -of light construction materials, -5 units of oil and 1 unit of gold dust. For more details about how -technology level is calculated from technology units, see "info Technology". -.L research -Research production efficiency depends on education level; -p.e.=(elev-5)/(elev+5). -A unit of research (a \*Qmedical discovery\*U), -costs $90 to produce and requires 10 units -of light construction materials, -5 units of oil and 1 unit of gold dust (see "info Research"). +How many products each unit of production makes depends on the level +production efficiency, which is the product's level p.e. (shown by +"show product") times the sector type's p.e. (shown by "show sect +stats"). Production requires a level p.e. above zero, obviously. .s1 -Note that the resource depletion documented above can be customized by -the deity. -.in -.SA "Producing, Updates" +Say your country is at tech level 25. Then your agribusinesses' level +p.e. is (25+10)/(25+20) * 900% = 7, i.e. they'll make 7 food per unit +of production. Your shell industries' level p.e. is only +(25-20)/(25-10) * 100% = 1/3, i.e. they'll make 1 shell per three +units of production. Your uranium mines can't produce at all, because +their level p.e. is negative. +.s1 +.SA "Producing, Updates, Item-types" diff --git a/info/Quick-ref.t b/info/Quick-ref.t index ea828824..652436ef 100644 --- a/info/Quick-ref.t +++ b/info/Quick-ref.t @@ -1,8 +1,7 @@ .TH Concept "Quick Reference Card" -.NA Quick-ref "A quick reference card for sector types and production" +.NA Quick-ref "A quick reference card for sector types" .LV Basic .NF - Sector-types: BASICS INDUSTRIES MILITARY / SCIENTIFIC . sea d defense plant t technical center @@ -18,25 +17,5 @@ Sector-types: j light manufacturing # bridge head k heavy manufacturing = bridge span % refinery - -(Petrol is per 10 units; others per unit) - -Products: -Item $ Lcm Hcm Iron Dust Oil Rad Tech Production Eff. -Shells: 3 2 1 0 0 0 0 20 (tech-20)/(tech-10) -Guns: 30 5 10 0 0 1 0 20 (tech-20)/(tech-10) -Iron: 0 0 0 0 0 0 0 0 0 -Dust: 0 0 0 0 0 0 0 0 0 -Bars: 10 0 0 0 5 0 0 0 0 -Food: 0 0 0 0 0 0 0 0 (tech+10)/(tech+20) -Oil: 0 0 0 0 0 0 0 0 (tech+10)/(tech+20) -Petrol 1 0 0 0 0 1 0 20 (tech-20)/(tech-10) -Lcm: 0 0 0 1 0 0 0 0 (tech+10)/(tech+20) -Hcm: 0 0 0 2 0 0 0 0 (tech+10)/(tech+20) -Rad: 2 0 0 0 0 0 0 40 (tech-40)/(tech-30) -Educate: 9 1 0 0 0 0 0 0 0 -Happy: 9 1 0 0 0 0 0 0 0 -Tech: 5*ETUS 10 0 0 1 5 0 0 (edu-5)/(edu+5) -Resrch: 90 10 0 0 1 5 0 0 (edu-5)/(edu+5) .FI -.SA "Sectors, Producing" +.SA "Sectors" diff --git a/info/show.t b/info/show.t index 2a0e5dce..168bd8d4 100644 --- a/info/show.t +++ b/info/show.t @@ -2,11 +2,11 @@ .NA show "Characteristics of sectors, units, updates and more" .LV Basic .SY "show [b|s|c] [tech]" -.SY "show " +.SY "show " .SY "show [number]" The show command shows characteristics of sectors, units (ships, -planes, land units and nukes), bridges (spans and towers), items and -news, as well as information on updates. +planes, land units and nukes), bridges (spans and towers), items, news +and products, as well as information on updates. .s1 Characteristics are more fully described in separate info pages (Ship-types, Nuke-types, etc.). @@ -36,4 +36,4 @@ Printing for tech level '325' 75kt fusion 3 90 3 320 106 $ 20000 .FI .s1 -.SA "Ship-types, Nuke-types, Plane-types, Unit-types, Sector-types, Ships, Planes, LandUnits, Nukes, Bridges, Item-types, newspaper, Updates" +.SA "Ship-types, Nuke-types, Plane-types, Unit-types, Sector-types, Ships, Planes, LandUnits, Nukes, Bridges, Item-types, Products, newspaper, Updates" diff --git a/src/lib/commands/show.c b/src/lib/commands/show.c index 85b7a4f7..081133da 100644 --- a/src/lib/commands/show.c +++ b/src/lib/commands/show.c @@ -98,6 +98,10 @@ show(void) cfunc = show_land_capab; break; case 'p': + if (p[1] == 'r') { + show_product(99999); + return RET_OK; + } bfunc = show_plane_build; sfunc = show_plane_stats; cfunc = show_plane_capab; diff --git a/src/lib/player/empmod.c b/src/lib/player/empmod.c index 8108f570..621d4413 100644 --- a/src/lib/player/empmod.c +++ b/src/lib/player/empmod.c @@ -230,7 +230,7 @@ struct cmndstr player_coms[] = { {"ship ", 0, shi, 0, NORM}, {"shoot ", 3, shoo, C_MOD, NORM + MONEY + CAP}, {"show <\"build\"|\"stats\"|\"cap\"> []\n" - "\tshow \n" + "\tshow \n" "\tshow updates []>", 0, show, 0, VIS}, {"shutdown ", 0, shut, 0, GOD}, diff --git a/src/lib/subs/show.c b/src/lib/subs/show.c index 8e4b34f2..33040c2b 100644 --- a/src/lib/subs/show.c +++ b/src/lib/subs/show.c @@ -597,6 +597,43 @@ show_item(int tlev) } } +void +show_product(int tlev) +{ + struct pchrstr *pp; + int i; + char *lev; + + pr("product cost raw materials reso dep level p.e.\n"); + + for (pp = pchr; pp->p_sname; pp++) { + pr("%7.7s %c $%-3d ", + pp->p_sname, + pp->p_type < 0 ? ' ' : ichr[pp->p_type].i_mnem, + pp->p_cost); + (void)CANT_HAPPEN(MAXPRCON > 3); /* output has only three columns */ + for (i = 0; i < 3; i++) { + if (i < MAXPRCON && pp->p_camt[i] + && pp->p_ctype[i] > I_NONE && pp->p_ctype[i] <= I_MAX) + pr(" %2d%c", pp->p_camt[i], ichr[pp->p_ctype[i]].i_mnem); + else + pr(" "); + } + if (pp->p_nrndx) + pr(" %5.5s %3d ", + symbol_by_value(pp->p_nrndx, resources), pp->p_nrdep); + else + pr(" "); + if (pp->p_nlndx < 0) + pr("1.0\n"); + else { + lev = symbol_by_value(pp->p_nlndx, level); + pr("(%.4s%+d)/(%.4s%+d)\n", + lev, -pp->p_nlmin, lev, pp->p_nllag - pp->p_nlmin); + } + } +} + void show_news(int tlev) {