power: Include nukes in power factor, like other units
Building nukes makes you rate *lower* on the power chart, because the power factor ignores nukes. Fix that. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
ea5c8a6598
commit
5635fc212f
Notes:
Markus Armbruster
2017-08-14 20:31:02 +02:00
Partial fix for bug#133.
2 changed files with 16 additions and 3 deletions
|
@ -72,7 +72,7 @@ power factor = ( power value of money
|
||||||
+ power value of commodities in sectors
|
+ power value of commodities in sectors
|
||||||
+ power value of commodities loaded on ships and land units)
|
+ power value of commodities loaded on ships and land units)
|
||||||
* (20 + nation tech level) / 500
|
* (20 + nation tech level) / 500
|
||||||
+ power value of ships, planes and land units
|
+ power value of ships, planes, land units and nukes
|
||||||
* (20 + their tech level) / 500
|
* (20 + their tech level) / 500
|
||||||
.FI
|
.FI
|
||||||
.s1
|
.s1
|
||||||
|
@ -80,8 +80,8 @@ 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 efficiency / 10.
|
||||||
.s1
|
.s1
|
||||||
The power value of a ship, plane or land unit is the power value of
|
The power value of a ship, plane, land unit or nuke is the power value
|
||||||
the materials and money needed to build * efficiency / 100.
|
of the materials and money needed to build * efficiency / 100.
|
||||||
.s1
|
.s1
|
||||||
The power value of commodities is amount * type factor. \*Qshow
|
The power value of commodities is amount * type factor. \*Qshow
|
||||||
item\*U shows the type factor in column \*Qpower\*U.
|
item\*U shows the type factor in column \*Qpower\*U.
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include "land.h"
|
#include "land.h"
|
||||||
|
#include "nuke.h"
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
#include "plane.h"
|
#include "plane.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
@ -230,6 +231,8 @@ gen_power(struct powstr *powbuf, int save)
|
||||||
struct mchrstr *mcp;
|
struct mchrstr *mcp;
|
||||||
struct lndstr land;
|
struct lndstr land;
|
||||||
struct lchrstr *lcp;
|
struct lchrstr *lcp;
|
||||||
|
struct nukstr nuke;
|
||||||
|
struct nchrstr *ncp;
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
struct nstr_sect ns;
|
struct nstr_sect ns;
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
|
@ -282,6 +285,16 @@ gen_power(struct powstr *powbuf, int save)
|
||||||
pcp->pl_mat, pcp->pl_cost);
|
pcp->pl_mat, pcp->pl_cost);
|
||||||
pow->p_planes += 1.0;
|
pow->p_planes += 1.0;
|
||||||
}
|
}
|
||||||
|
snxtitem_all(&ni, EF_NUKE);
|
||||||
|
while (nxtitem(&ni, &nuke)) {
|
||||||
|
if (nuke.nuk_own == 0)
|
||||||
|
continue;
|
||||||
|
ncp = &nchr[nuke.nuk_type];
|
||||||
|
pow = &powbuf[nuke.nuk_own];
|
||||||
|
upower[nuke.nuk_own] += empunit_power(nuke.nuk_effic,
|
||||||
|
nuke.nuk_tech,
|
||||||
|
ncp->n_mat, ncp->n_cost);
|
||||||
|
}
|
||||||
for (i = 1; NULL != (natp = getnatp(i)); i++) {
|
for (i = 1; NULL != (natp = getnatp(i)); i++) {
|
||||||
pow = &powbuf[i];
|
pow = &powbuf[i];
|
||||||
pow->p_nation = i;
|
pow->p_nation = i;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue