(prod, upd_buildeff): Truncated work to even before sector building.

Fix.
This commit is contained in:
Markus Armbruster 2004-04-08 16:31:31 +00:00
parent 5a0216893f
commit b985192f6f
2 changed files with 4 additions and 4 deletions

View file

@ -141,7 +141,7 @@ prod(void)
} }
if (work > 999) work = 999; if (work > 999) work = 999;
} }
bwork = (int)((double)work / 2.0); bwork = work / 2;
if (sect.sct_off) if (sect.sct_off)
continue; continue;
@ -207,7 +207,7 @@ prod(void)
bwork -= twork; bwork -= twork;
eff += twork; eff += twork;
} }
work = work / 2 + bwork; work = (work + 1) / 2 + bwork;
if (eff < 60 || (type != SCT_ENLIST && eff < 61)) if (eff < 60 || (type != SCT_ENLIST && eff < 61))
continue; continue;

View file

@ -91,7 +91,7 @@ upd_buildeff(struct natstr *np, register struct sctstr *sp, int *workp,
short *vec, int etu, int *desig, int sctwork, int *cost) short *vec, int etu, int *desig, int sctwork, int *cost)
{ {
register int work_cost = 0; register int work_cost = 0;
int buildeff_work = (int)(*workp / 2); int buildeff_work = *workp / 2;
int n, hcms, lcms, neweff; int n, hcms, lcms, neweff;
u_char old_type = *desig; u_char old_type = *desig;
@ -159,7 +159,7 @@ upd_buildeff(struct natstr *np, register struct sctstr *sp, int *workp,
} }
} }
} }
*workp = *workp / 2 + buildeff_work; *workp = (*workp + 1) / 2 - buildeff_work;
return neweff; return neweff;
} }