Fix starvation not to starve one more than it should
Commit 109dad1b
(v4.3.5) promised to round victim fractions down, but
got it wrong for odd population when exactly half of it rounded down
could be fed. This could starve the last man on a boat or land unit.
Fix famine_victims().
This commit is contained in:
parent
9a7628f05b
commit
b37ebbbde3
1 changed files with 2 additions and 2 deletions
|
@ -192,9 +192,9 @@ famine_victims(short *vec, int etu)
|
|||
{
|
||||
double can_eat = vec[I_FOOD] / (etu * eatrate);
|
||||
int people = vec[I_CIVIL] + vec[I_MILIT] + vec[I_UW];
|
||||
if (people < can_eat)
|
||||
if (people <= can_eat)
|
||||
return 0;
|
||||
if (can_eat < people / 2)
|
||||
if (can_eat <= people / 2)
|
||||
return people / 2;
|
||||
return (int)(people - can_eat);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue