C90 has no inline keyword

This commit is contained in:
Enno Rehling 2021-03-13 09:01:40 +01:00
parent a9ca16e767
commit b9a20bb378
1 changed files with 3 additions and 5 deletions

View File

@ -325,9 +325,7 @@ static double peasant_luck_factor(void)
return config_get_flt("rules.peasants.peasantluck.factor", PEASANTLUCK); return config_get_flt("rules.peasants.peasantluck.factor", PEASANTLUCK);
} }
inline int round_births(double growth) { #define ROUND_BIRTHS(growth) ((int)growth)
return (int)growth;
}
int peasant_luck_effect(int peasants, int luck, int maxp, double variance) int peasant_luck_effect(int peasants, int luck, int maxp, double variance)
{ {
@ -338,7 +336,7 @@ int peasant_luck_effect(int peasants, int luck, int maxp, double variance)
mean *= peasant_luck_factor() * peasant_growth_factor(); mean *= peasant_luck_factor() * peasant_growth_factor();
mean *= ((peasants / (double)maxp < .9) ? 1 : PEASANTFORCE); mean *= ((peasants / (double)maxp < .9) ? 1 : PEASANTFORCE);
births = round_births(normalvariate(mean, variance * mean)); births = ROUND_BIRTHS(normalvariate(mean, variance * mean));
if (births <= 0) if (births <= 0)
births = 1; births = 1;
if (births > peasants / 2) if (births > peasants / 2)
@ -357,7 +355,7 @@ static void peasants(region * r, int rule)
if (peasants > 0 && rule > 0) { if (peasants > 0 && rule > 0) {
int luck = 0; int luck = 0;
double fraction = peasants * peasant_growth_factor(); double fraction = peasants * peasant_growth_factor();
int births = round_births(fraction); int births = ROUND_BIRTHS(fraction);
attrib *a = a_find(r->attribs, &at_peasantluck); attrib *a = a_find(r->attribs, &at_peasantluck);
if (a != NULL) { if (a != NULL) {