implemented Enno's suggestions for peasant growth

This commit is contained in:
Steffen Mecke 2015-01-29 23:50:45 +01:00
parent 531ab0e7a2
commit 4c391ae6f6
2 changed files with 15 additions and 3 deletions

View File

@ -3663,7 +3663,7 @@
<arg name="births" type="int"/>
</type>
<text locale="de">"$if($eq($births,1),"Einen Bauern","$int($births) Bauern") besucht unverhofft der Storch."</text>
<text locale="en">"The stork paid an unexpected visit to $if($eq($births,1),"one peasant","$int($births) peasants")."</text>
<text locale="en">"The stork paid an unexpected visit to $if($eq($births,1),"a peasant","$int($births) peasants")."</text>
</message>
<message name="shipsink" section="events">
<type>

View File

@ -259,9 +259,21 @@ static void calculate_emigration(region * r)
}
static float peasant_luck_factor(void) {
static float factor = -1;
if (factor < 0)
get_param_int(global.parameters, "rules.peasants.peasantluck.factor", PEASANTLUCK);
return factor;
}
static float peasant_growth_factor(void) {
return get_param_flt(global.parameters, "rules.peasants.growth.factor",
static float factor = -1;
if (factor < 0)
factor = get_param_flt(global.parameters, "rules.peasants.growth.factor",
0.0001F * PEASANTGROWTH);
return factor;
}
/** Bauern vermehren sich */
@ -269,7 +281,7 @@ static float peasant_growth_factor(void) {
int peasant_luck_effect(int peasants, int luck, int maxp) {
int births=0;
double mean = _min(luck, peasants)
* get_param_int(global.parameters, "rules.peasants.peasantluck.factor", PEASANTLUCK)
* peasant_luck_factor()
* peasant_growth_factor()
* ((peasants/(float)maxp < .9)?1:PEASANTFORCE);