(P_SHELL, P_GUN, P_PETROL, P_IRON, P_DUST, P_BAR, P_FOOD, P_OIL)
(P_LCM, P_HCM, P_TLEV, P_RLEV, P_ELEV, P_HLEV, P_URAN): Use -1 instead of 0 for `no product', shift down product indexes and update product.config and sector.config accordingly. (budg, prod, show_sect_capab, produce, produce_sect): Adapt test for no product. (ef_elt_byname): Remove the hack to hide pchr[0]. (prod_eff): Oops on no product.
This commit is contained in:
parent
08937006d7
commit
f284b0beab
9 changed files with 62 additions and 60 deletions
|
@ -70,9 +70,9 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
|||
int material_consume;
|
||||
int val;
|
||||
|
||||
product = &pchr[dchr[desig].d_prd];
|
||||
if (product == &pchr[0])
|
||||
if (dchr[desig].d_prd < 0)
|
||||
return 0;
|
||||
product = &pchr[dchr[desig].d_prd];
|
||||
item = product->p_type;
|
||||
*amount = 0;
|
||||
*cost = 0;
|
||||
|
@ -230,6 +230,9 @@ prod_eff(int type, float level)
|
|||
struct dchrstr *dp = &dchr[type];
|
||||
struct pchrstr *pp = &pchr[dp->d_prd];
|
||||
|
||||
if (CANT_HAPPEN(dp->d_prd < 0))
|
||||
return 0.0;
|
||||
|
||||
if (pp->p_nlndx < 0)
|
||||
level_p_e = 1.0;
|
||||
else {
|
||||
|
|
|
@ -361,7 +361,7 @@ produce_sect(int natnum, int etu, int *bp, long p_sect[][2])
|
|||
*/
|
||||
|
||||
if (neweff >= 60) {
|
||||
if (np->nat_money > 0 && dchr[desig].d_prd)
|
||||
if (np->nat_money > 0 && dchr[desig].d_prd >= 0)
|
||||
work -= produce(np, sp, vec, work, desig, neweff,
|
||||
&pcost, &amount);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue