(prod): Round the final cost instead of truncating along the way.
(prod, produce): Simplify calculation TECH_POP cost factor slightly.
This commit is contained in:
parent
898d1422fa
commit
739b5ac6fb
2 changed files with 5 additions and 6 deletions
|
@ -78,7 +78,7 @@ prod(void)
|
||||||
int work;
|
int work;
|
||||||
int totpop;
|
int totpop;
|
||||||
int act; /* actual production */
|
int act; /* actual production */
|
||||||
int cost;
|
double cost;
|
||||||
int i;
|
int i;
|
||||||
int max; /* production w/infinite materials */
|
int max; /* production w/infinite materials */
|
||||||
int nsect;
|
int nsect;
|
||||||
|
@ -250,12 +250,12 @@ prod(void)
|
||||||
} else
|
} else
|
||||||
mtake = take = 0.0;
|
mtake = take = 0.0;
|
||||||
|
|
||||||
cost = (int)(take * (double)pp->p_cost);
|
cost = take * pp->p_cost;
|
||||||
if (opt_TECH_POP) {
|
if (opt_TECH_POP) {
|
||||||
if (pp->p_level == NAT_TLEV) {
|
if (pp->p_level == NAT_TLEV) {
|
||||||
totpop = count_pop(sect.sct_own);
|
totpop = count_pop(sect.sct_own);
|
||||||
if (totpop > 50000)
|
if (totpop > 50000)
|
||||||
cost = (int)((double)cost * (double)totpop / 50000.0);
|
cost *= totpop / 50000.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ prod(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
pr(" %.2f", prodeff);
|
pr(" %.2f", prodeff);
|
||||||
pr(" $%-5d", cost);
|
pr(" $%-5.0f", cost);
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (i < MAXPRCON && cmnem[i])
|
if (i < MAXPRCON && cmnem[i])
|
||||||
pr("%4d%c", cuse[i], cmnem[i]);
|
pr("%4d%c", cuse[i], cmnem[i]);
|
||||||
|
|
|
@ -165,8 +165,7 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
||||||
if (opt_TECH_POP) {
|
if (opt_TECH_POP) {
|
||||||
if (product->p_level == NAT_TLEV) {
|
if (product->p_level == NAT_TLEV) {
|
||||||
if (tpops[sp->sct_own] > 50000)
|
if (tpops[sp->sct_own] > 50000)
|
||||||
*cost =
|
*cost *= tpops[sp->sct_own] / 50000.0;
|
||||||
(double)*cost * (double)tpops[sp->sct_own] / 50000.0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue