power: Include sector materials and cost in power factor
Building sectors can make you rate *lower* on the power chart, because the power factor treats all sectors the same, regardless of build materials and cost. To avoid that, replace the term efficiency / 10.0 by (power value of materials + power value of cost + 9) * efficiency/100.0 The value of ordinary sectors, which take no materials and cost $100, doesn't change. The stock game's fortress is now worth 80% more due to its materials and higher cost. The stock game's wilderness is worth 10% less, because it costs nothing. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
2ffd7b948d
commit
e8451c7343
Notes:
Markus Armbruster
2017-08-14 20:31:27 +02:00
Fixes bug#133.
4 changed files with 28 additions and 21 deletions
|
@ -78,7 +78,8 @@ power factor = ( power value of money
|
||||||
.s1
|
.s1
|
||||||
The power value of money is dollars / 100.
|
The power value of money is dollars / 100.
|
||||||
.s1
|
.s1
|
||||||
The power value of a sector is efficiency / 10.
|
The power value of a sector is (the power value of the materials and
|
||||||
|
money needed to build + 9) * efficiency / 100.
|
||||||
.s1
|
.s1
|
||||||
The power value of a ship, plane, land unit or nuke is the power value
|
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.
|
of the materials and money needed to build * efficiency / 100.
|
||||||
|
|
|
@ -52,6 +52,7 @@ static void out5(double, int, int);
|
||||||
static void gen_power(struct powstr *, int);
|
static void gen_power(struct powstr *, int);
|
||||||
static int powcmp(const void *, const void *);
|
static int powcmp(const void *, const void *);
|
||||||
static void addtopow(short *, struct powstr *);
|
static void addtopow(short *, struct powstr *);
|
||||||
|
static float empobj_power(int, short[], int);
|
||||||
static float empunit_power(int, int, short[], int);
|
static float empunit_power(int, int, short[], int);
|
||||||
static float money_power(int);
|
static float money_power(int);
|
||||||
static float power_tech_factor(float);
|
static float power_tech_factor(float);
|
||||||
|
@ -225,6 +226,7 @@ gen_power(struct powstr *powbuf, int save)
|
||||||
struct powstr *pow;
|
struct powstr *pow;
|
||||||
int i;
|
int i;
|
||||||
struct sctstr sect;
|
struct sctstr sect;
|
||||||
|
struct dchrstr *dcp;
|
||||||
struct plnstr plane;
|
struct plnstr plane;
|
||||||
struct plchrstr *pcp;
|
struct plchrstr *pcp;
|
||||||
struct shpstr ship;
|
struct shpstr ship;
|
||||||
|
@ -244,10 +246,14 @@ gen_power(struct powstr *powbuf, int save)
|
||||||
while (nxtsct(&ns, §)) {
|
while (nxtsct(&ns, §)) {
|
||||||
if (sect.sct_own == 0)
|
if (sect.sct_own == 0)
|
||||||
continue;
|
continue;
|
||||||
|
dcp = &dchr[sect.sct_type];
|
||||||
pow = &powbuf[sect.sct_own];
|
pow = &powbuf[sect.sct_own];
|
||||||
pow->p_sects += 1.0;
|
pow->p_sects += 1.0;
|
||||||
pow->p_effic += sect.sct_effic;
|
pow->p_effic += sect.sct_effic;
|
||||||
addtopow(sect.sct_item, pow);
|
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;
|
||||||
}
|
}
|
||||||
snxtitem_all(&ni, EF_LAND);
|
snxtitem_all(&ni, EF_LAND);
|
||||||
while (nxtitem(&ni, &land)) {
|
while (nxtitem(&ni, &land)) {
|
||||||
|
@ -304,11 +310,6 @@ gen_power(struct powstr *powbuf, int save)
|
||||||
}
|
}
|
||||||
pow->p_money = natp->nat_money;
|
pow->p_money = natp->nat_money;
|
||||||
pow->p_power += money_power(natp->nat_money);
|
pow->p_power += money_power(natp->nat_money);
|
||||||
|
|
||||||
if (pow->p_sects > 0)
|
|
||||||
pow->p_power += pow->p_sects
|
|
||||||
* (pow->p_effic / pow->p_sects / 100.0)
|
|
||||||
* 10.0;
|
|
||||||
pow->p_power *= power_tech_factor(natp->nat_level[NAT_TLEV]);
|
pow->p_power *= power_tech_factor(natp->nat_level[NAT_TLEV]);
|
||||||
pow->p_power += upower[i];
|
pow->p_power += upower[i];
|
||||||
/* ack. add this vec to the "world power" element */
|
/* ack. add this vec to the "world power" element */
|
||||||
|
@ -364,11 +365,16 @@ addtopow(short *vec, struct powstr *pow)
|
||||||
pow->p_power += item_power(vec);
|
pow->p_power += item_power(vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float
|
||||||
|
empobj_power(int effic, short mat[], int cost)
|
||||||
|
{
|
||||||
|
return (item_power(mat) + money_power(cost)) * (effic / 100.0);
|
||||||
|
}
|
||||||
|
|
||||||
static float
|
static float
|
||||||
empunit_power(int effic, int tech, short mat[], int cost)
|
empunit_power(int effic, int tech, short mat[], int cost)
|
||||||
{
|
{
|
||||||
return (item_power(mat) + money_power(cost)) * (effic / 100.0)
|
return empobj_power(effic, mat, cost) * power_tech_factor(tech);
|
||||||
* power_tech_factor(tech);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static float
|
static float
|
||||||
|
|
|
@ -7167,7 +7167,7 @@
|
||||||
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 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 224.27
|
||||||
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 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.11
|
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
|
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 32K
|
||||||
Play#0 output Play#0 1 39.11
|
Play#0 output Play#0 1 39.11
|
||||||
Play#0 output Play#0 1 3 3 100% 3.0K 110 0 0 0 0 361 0 0 0 0 32K
|
Play#0 output Play#0 1 3 3 100% 3.0K 110 0 0 0 0 361 0 0 0 0 32K
|
||||||
|
@ -7975,7 +7975,7 @@
|
||||||
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 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.94
|
||||||
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 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.72
|
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
|
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 33K
|
||||||
Play#0 output Play#0 1 42.72
|
Play#0 output Play#0 1 42.72
|
||||||
Play#0 output Play#0 1 3 3 100% 3.0K 110 0 0 0 0 361 0 0 0 0 33K
|
Play#0 output Play#0 1 3 3 100% 3.0K 110 0 0 0 0 361 0 0 0 0 33K
|
||||||
|
@ -8677,7 +8677,7 @@
|
||||||
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 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 356.59
|
||||||
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 8 29 44% 11K 110 0 0 0 10K 1.9K 482 0 0 0 32K
|
||||||
Play#0 output Play#0 1 136.22
|
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
|
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 33K
|
||||||
Play#0 output Play#0 1 46.46
|
Play#0 output Play#0 1 46.46
|
||||||
Play#0 output Play#0 1 3 3 100% 3.0K 110 0 0 0 0 361 0 0 0 0 33K
|
Play#0 output Play#0 1 3 3 100% 3.0K 110 0 0 0 0 361 0 0 0 0 33K
|
||||||
|
@ -10216,7 +10216,7 @@
|
||||||
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 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 422.02
|
||||||
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 8 29 58% 15K 110 0 0 0 12K 1.8K 485 0 0 0 29K
|
||||||
Play#0 output Play#0 1 189.03
|
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
|
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 34K
|
||||||
Play#0 output Play#0 1 50.24
|
Play#0 output Play#0 1 50.24
|
||||||
Play#0 output Play#0 1 3 3 100% 3.0K 110 0 0 0 0 361 0 0 0 0 34K
|
Play#0 output Play#0 1 3 3 100% 3.0K 110 0 0 0 0 361 0 0 0 0 34K
|
||||||
|
@ -11377,7 +11377,7 @@
|
||||||
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 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 503.55
|
||||||
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 8 29 72% 19K 110 0 0 0 13K 2.1K 367 0 0 0 25K
|
||||||
Play#0 output Play#0 1 268.46
|
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
|
Play#0 output Play#0 1 2 30 15% 3.7K 0 0 0 0 0 1.1K 0 0 0 0 34K
|
||||||
Play#0 output Play#0 1 70.61
|
Play#0 output Play#0 1 70.61
|
||||||
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 35K
|
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 35K
|
||||||
|
@ -12428,7 +12428,7 @@
|
||||||
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 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 596.32
|
||||||
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 8 29 92% 25K 110 101 0 0 14K 2.8K 537 0 0 0 21K
|
||||||
Play#0 output Play#0 1 384.63
|
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
|
Play#0 output Play#0 1 2 30 28% 4.9K 0 0 0 0 1.7K 1.3K 169 0 0 0 35K
|
||||||
Play#0 output Play#0 1 92.10
|
Play#0 output Play#0 1 92.10
|
||||||
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 36K
|
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 36K
|
||||||
|
@ -13522,7 +13522,7 @@
|
||||||
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 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 688.71
|
||||||
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 8 29 100% 29K 105 214 5 0 16K 2.4K 545 0 0 0 22K
|
||||||
Play#0 output Play#0 1 485.48
|
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
|
Play#0 output Play#0 1 2 30 33% 6.3K 0 0 0 0 3.2K 1.2K 527 0 0 0 36K
|
||||||
Play#0 output Play#0 1 122.83
|
Play#0 output Play#0 1 122.83
|
||||||
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 37K
|
Play#0 output Play#0 1 6 3 100% 3.0K 110 0 0 0 0 413 0 0 0 0 37K
|
||||||
|
|
|
@ -481,17 +481,17 @@
|
||||||
Play#0 output Play#0 1
|
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 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 1 96 62% 28K 1.2K 0 0 0 2.5K 340 580 21 32 16 25K
|
||||||
Play#0 output Play#0 1 890.36
|
Play#0 output Play#0 1 896.93
|
||||||
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 2 32 22% 7.1K 1.9K 0 0 0 0 1 5 3 3 3 100
|
||||||
Play#0 output Play#0 1 440.95
|
Play#0 output Play#0 1 459.65
|
||||||
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 4 64 8% 25K 1.1K 0 0 0 20K 21 4.0K 0 10 10 25K
|
||||||
Play#0 output Play#0 1 284.01
|
Play#0 output Play#0 1 285.91
|
||||||
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 3 64 14% 17K 170 0 0 0 0 0 0 0 0 0 -100
|
||||||
Play#0 output Play#0 1 231.59
|
Play#0 output Play#0 1 236.15
|
||||||
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 6 8 88% 4.0K 168 0 0 0 0 0 0 3 1 3 25K
|
||||||
Play#0 output Play#0 1 193.20
|
Play#0 output Play#0 1 199.68
|
||||||
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 7 8 88% 4.0K 160 0 0 0 0 0 0 0 3 0 25K
|
||||||
Play#0 output Play#0 1 175.02
|
Play#0 output Play#0 1 181.50
|
||||||
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 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 60.00
|
||||||
Play#0 output Play#0 1 ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
Play#0 output Play#0 1 ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue