From: Markus Armbruster Date: Mon, 6 Jun 2016 05:55:09 +0000 (+0200) Subject: power: Include sector maximum population in power factor X-Git-Tag: v4.4.0~223 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=cb32c60294089e5a1188cb4d4c5dfad67ba72c61 power: Include sector maximum population in power factor Replace the term power value of materials and cost + 9 by power value of materials and cost + maximum population / 1000 * 8 + 1 The value of ordinary sectors (maximum population 1000) doesn't change. The stock game's mountains, plains and bridges are now worth only 28% as much. This concludes my tweaking of the power factor for now. I tested it with data from a real game (Hvy Metal II). The effect is small: #5 overtakes #4, and the lead of #1 over #2 and #3 shrinks some. Closer analysis finds the following reasons. The game had very expensive big cities. Valuing them correctly gives countries with many cities a noticeable boost. Planes are worth less than before, but the difference is much larger for cheap planes. Big piles of construction materials are worth much less, and shells, guns and bars are worth more. Signed-off-by: Markus Armbruster --- diff --git a/info/power.t b/info/power.t index 5e83556a1..71c4003fe 100644 --- a/info/power.t +++ b/info/power.t @@ -79,7 +79,8 @@ power factor = ( power value of money The power value of money is dollars / 100. .s1 The power value of a sector is (the power value of the materials and -money needed to build + 9) * efficiency / 100. +money needed to build + maximum population / 1000 * 8 + 1) * +efficiency / 100. .s1 The power value of a ship, plane, land unit or nuke is the power value of the materials and money needed to build * efficiency / 100. diff --git a/src/lib/commands/powe.c b/src/lib/commands/powe.c index 16381b641..40bf9701d 100644 --- a/src/lib/commands/powe.c +++ b/src/lib/commands/powe.c @@ -224,7 +224,7 @@ gen_power(struct powstr *powbuf, int save) float *f_ptr; float *f_pt2; struct powstr *pow; - int i; + int i, maxpop; struct sctstr sect; struct dchrstr *dcp; struct plnstr plane; @@ -247,13 +247,15 @@ gen_power(struct powstr *powbuf, int save) if (sect.sct_own == 0) continue; dcp = &dchr[sect.sct_type]; + natp = getnatp(sect.sct_own); pow = &powbuf[sect.sct_own]; pow->p_sects += 1.0; pow->p_effic += sect.sct_effic; addtopow(sect.sct_item, pow); pow->p_power += empobj_power(sect.sct_effic, dcp->d_mat, dcp->d_cost); - pow->p_power += sect.sct_effic / 100.0 * 9.0; + maxpop = max_pop(natp->nat_level[NAT_RLEV], §); + pow->p_power += (1.0 + maxpop / 1000.0 * 8) * sect.sct_effic / 100.0; } snxtitem_all(&ni, EF_LAND); while (nxtitem(&ni, &land)) { diff --git a/tests/smoke/journal.log b/tests/smoke/journal.log index 0c5dad86b..866b12ec9 100644 --- a/tests/smoke/journal.log +++ b/tests/smoke/journal.log @@ -4789,7 +4789,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 32 44% 11K 48 0 0 0 5.4K 722 235 0 1 0 20K - Play#0 output Play#0 1 77.46 + Play#0 output Play#0 1 77.37 Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 29K Play#0 output Play#0 1 29.72 Play#0 output Play#0 1 8 29 10% 3.0K 110 0 0 0 0 398 0 0 0 0 29K @@ -5500,7 +5500,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 32 54% 13K 48 0 0 0 6.2K 1.6K 246 0 1 0 20K - Play#0 output Play#0 1 115.60 + Play#0 output Play#0 1 115.35 Play#0 output Play#0 1 8 29 17% 3.9K 110 0 0 0 475 1.5K 0 0 0 0 29K Play#0 output Play#0 1 47.86 Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 30K @@ -6239,7 +6239,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 32 73% 17K 48 0 0 0 7.6K 1.7K 618 0 1 0 20K - Play#0 output Play#0 1 158.29 + Play#0 output Play#0 1 157.76 Play#0 output Play#0 1 8 29 21% 5.1K 110 0 0 0 2.4K 1.8K 0 0 0 0 30K Play#0 output Play#0 1 60.95 Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 31K @@ -7165,7 +7165,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 33 87% 22K 48 0 0 0 8.7K 2.5K 788 0 1 0 20K - Play#0 output Play#0 1 224.27 + Play#0 output Play#0 1 223.52 Play#0 output Play#0 1 8 29 29% 6.7K 110 0 0 0 5.0K 2.3K 0 0 0 0 30K Play#0 output Play#0 1 82.10 Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 32K @@ -7973,7 +7973,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 33 95% 28K 78 51 0 0 9.2K 2.2K 810 0 1 0 23K - Play#0 output Play#0 1 294.94 + Play#0 output Play#0 1 294.12 Play#0 output Play#0 1 8 29 38% 8.7K 110 0 0 0 7.4K 2.1K 301 0 0 0 31K Play#0 output Play#0 1 107.71 Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 33K @@ -8675,7 +8675,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 33 98% 31K 111 136 5 0 9.3K 1.8K 709 0 4 5 28K - Play#0 output Play#0 1 356.59 + Play#0 output Play#0 1 355.48 Play#0 output Play#0 1 8 29 44% 11K 110 0 0 0 10K 1.9K 482 0 0 0 32K Play#0 output Play#0 1 136.20 Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 33K @@ -10214,7 +10214,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 33 100% 31K 143 244 11 0 9.6K 1.5K 588 0 2 4 32K - Play#0 output Play#0 1 422.02 + Play#0 output Play#0 1 420.39 Play#0 output Play#0 1 8 29 58% 15K 110 0 0 0 12K 1.8K 485 0 0 0 29K Play#0 output Play#0 1 189.01 Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 34K @@ -11375,7 +11375,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 33 100% 31K 176 373 18 0 9.6K 1.2K 846 0 3 4 39K - Play#0 output Play#0 1 503.55 + Play#0 output Play#0 1 501.68 Play#0 output Play#0 1 8 29 72% 19K 110 0 0 0 13K 2.1K 367 0 0 0 25K Play#0 output Play#0 1 268.44 Play#0 output Play#0 1 2 30 15% 3.7K 0 0 0 0 0 1.1K 0 0 0 0 34K @@ -12426,7 +12426,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 33 100% 31K 209 516 26 0 9.9K 851 1.2K 3 5 4 46K - Play#0 output Play#0 1 596.32 + Play#0 output Play#0 1 594.26 Play#0 output Play#0 1 8 29 92% 25K 110 101 0 0 14K 2.8K 537 0 0 0 21K Play#0 output Play#0 1 384.58 Play#0 output Play#0 1 2 30 28% 4.9K 0 0 0 0 1.7K 1.3K 169 0 0 0 35K @@ -13520,7 +13520,7 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 33 100% 31K 231 661 34 994 10K 526 1.0K 3 5 4 51K - Play#0 output Play#0 1 688.71 + Play#0 output Play#0 1 686.44 Play#0 output Play#0 1 8 29 100% 29K 105 214 5 0 16K 2.4K 545 0 0 0 22K Play#0 output Play#0 1 486.16 Play#0 output Play#0 1 2 30 33% 6.3K 0 0 0 0 3.2K 1.2K 527 0 0 0 36K diff --git a/tests/update/journal.log b/tests/update/journal.log index 654aad2e7..dfa69334e 100644 --- a/tests/update/journal.log +++ b/tests/update/journal.log @@ -481,17 +481,17 @@ Play#0 output Play#0 1 Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money Play#0 output Play#0 1 1 96 62% 28K 1.2K 0 0 0 2.5K 340 580 21 32 16 25K - Play#0 output Play#0 1 896.93 + Play#0 output Play#0 1 912.48 Play#0 output Play#0 1 2 32 22% 7.1K 1.9K 0 0 0 0 1 5 3 3 3 100 - Play#0 output Play#0 1 459.65 + Play#0 output Play#0 1 528.93 Play#0 output Play#0 1 4 64 8% 25K 1.1K 0 0 0 20K 21 4.0K 0 10 10 25K - Play#0 output Play#0 1 285.91 + Play#0 output Play#0 1 293.10 Play#0 output Play#0 1 3 64 14% 17K 170 0 0 0 0 0 0 0 0 0 -100 - Play#0 output Play#0 1 236.15 + Play#0 output Play#0 1 251.70 Play#0 output Play#0 1 6 8 88% 4.0K 168 0 0 0 0 0 0 3 1 3 25K - Play#0 output Play#0 1 199.68 + Play#0 output Play#0 1 216.96 Play#0 output Play#0 1 7 8 88% 4.0K 160 0 0 0 0 0 0 0 3 0 25K - Play#0 output Play#0 1 181.50 + Play#0 output Play#0 1 198.77 Play#0 output Play#0 1 5 0 0% 0 0 0 0 0 0 0 0 0 0 0 25K Play#0 output Play#0 1 60.00 Play#0 output Play#0 1 ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----