(pchrstr, pchr_ca, pchr, sctstr, dchr_ca, dchr): Replace pchrstr
member p_effic by sctstr member d_peffic. Tables updated. (show_sect_capab): Adapted. (prod_eff): Adapted; requires changing first parameter to sector type. Callers changed. (P_MDUST): Remove, because pchr[P_MDUST] now identical to pchr[P_DUST].
This commit is contained in:
parent
568b9d6639
commit
da88d91899
10 changed files with 69 additions and 72 deletions
|
@ -100,7 +100,7 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
|||
material_consume = worker_limit;
|
||||
if (material_consume == 0)
|
||||
return 0;
|
||||
prodeff = prod_eff(product, np->nat_level[product->p_nlndx]);
|
||||
prodeff = prod_eff(desig, np->nat_level[product->p_nlndx]);
|
||||
if (prodeff <= 0.0 && !player->simulation) {
|
||||
wu(0, sp->sct_own,
|
||||
"%s level too low to produce in %s (need %d)\n",
|
||||
|
@ -219,14 +219,16 @@ materials_charge(struct pchrstr *pp, short *vec, int count)
|
|||
}
|
||||
|
||||
/*
|
||||
* Return level p.e. for product PP.
|
||||
* Return level p.e. for sector type TYPE.
|
||||
* Zero means level is too low for production.
|
||||
* LEVEL is the affecting production of PP; it must match PP->p_nlndx.
|
||||
*/
|
||||
double
|
||||
prod_eff(struct pchrstr *pp, float level)
|
||||
prod_eff(int type, float level)
|
||||
{
|
||||
double level_p_e;
|
||||
struct dchrstr *dp = &dchr[type];
|
||||
struct pchrstr *pp = &pchr[dp->d_prd];
|
||||
|
||||
if (pp->p_nlndx < 0)
|
||||
level_p_e = 1.0;
|
||||
|
@ -240,5 +242,5 @@ prod_eff(struct pchrstr *pp, float level)
|
|||
level_p_e = delta / (delta + pp->p_nllag);
|
||||
}
|
||||
|
||||
return level_p_e * pp->p_effic * 0.01;
|
||||
return level_p_e * dp->d_peffic * 0.01;
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ upd_ship(struct shpstr *sp, int etus,
|
|||
|
||||
/* produce oil */
|
||||
if ((mp->m_flags & M_OIL) && sectp->sct_type == SCT_WATER) {
|
||||
product = &pchr[P_OIL];
|
||||
product = &pchr[dchr[SCT_OIL].d_prd];
|
||||
oil_gained = roundavg(total_work(100, etus,
|
||||
sp->shp_item[I_CIVIL],
|
||||
sp->shp_item[I_MILIT],
|
||||
|
@ -175,7 +175,7 @@ upd_ship(struct shpstr *sp, int etus,
|
|||
ITEM_MAX)
|
||||
* sp->shp_effic / 100.0
|
||||
* sectp->sct_oil / 100.0
|
||||
* prod_eff(product, sp->shp_tech));
|
||||
* prod_eff(SCT_OIL, sp->shp_tech));
|
||||
max_oil = mp->m_item[I_OIL];
|
||||
if (sp->shp_item[I_OIL] + oil_gained > max_oil)
|
||||
oil_gained = max_oil - sp->shp_item[I_OIL];
|
||||
|
@ -192,7 +192,6 @@ upd_ship(struct shpstr *sp, int etus,
|
|||
}
|
||||
/* produce fish */
|
||||
if ((mp->m_flags & M_FOOD) && sectp->sct_type == SCT_WATER) {
|
||||
product = &pchr[P_FOOD];
|
||||
sp->shp_item[I_FOOD]
|
||||
+= roundavg(total_work(100, etus,
|
||||
sp->shp_item[I_CIVIL],
|
||||
|
@ -201,7 +200,7 @@ upd_ship(struct shpstr *sp, int etus,
|
|||
ITEM_MAX)
|
||||
* sp->shp_effic / 100.0
|
||||
* sectp->sct_fertil / 100.0
|
||||
* prod_eff(product, sp->shp_tech));
|
||||
* prod_eff(SCT_AGRI, sp->shp_tech));
|
||||
}
|
||||
/* feed */
|
||||
if ((n = feed_ship(sp, etus)) > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue