Neue Option für schnelleres Samenwachstum.

This commit is contained in:
Enno Rehling 2021-02-11 15:03:41 +01:00
parent cc5e062b68
commit 8fbcf3f379
1 changed files with 26 additions and 8 deletions

View File

@ -598,15 +598,27 @@ static int cap_int(int i, int imin, int imax) {
return imin;
}
static bool
increased_growth(const region* r, const struct race *rc_elf) {
const unit* u;
for (u = r->units; u; u = u->next) {
if (u_race(u) != rc_elf) {
return false;
}
}
return true;
}
static void
growing_trees(region * r, const season_t current_season, const season_t last_weeks_season)
growing_trees(region * r, const season_t current_season, const season_t last_weeks_season, int rules)
{
int grownup_trees, i, seeds, sprout;
attrib *a;
double seedchance = config_get_flt("rules.treeseeds.chance", 0.01F) * RESOURCE_QUANTITY;
if (current_season == SEASON_SUMMER || current_season == SEASON_AUTUMN) {
int mp, elves = count_race(r, get_race(RC_ELF));
const struct race* rc_elf = get_race(RC_ELF);
int mp, elves = count_race(r, rc_elf);
direction_t d;
a = a_find(r->attribs, &at_germs);
@ -644,6 +656,12 @@ growing_trees(region * r, const season_t current_season, const season_t last_wee
++seeds;
}
if (seeds > 0) {
if (rules > 2) {
if (increased_growth(r, rc_elf)) {
/* in empty regions, plant twice the seeds */
seeds += seeds;
}
}
seeds += rtrees(r, 0);
rsettrees(r, 0, seeds);
}
@ -803,7 +821,7 @@ void nmr_warnings(void)
void demographics(void)
{
region *r;
int plant_rules = config_get_int("rules.grow.formula", 2);
int plant_rules = config_get_int("rules.grow.formula", 3);
int horse_rules = config_get_int("rules.horses.growth", 1);
int peasant_rules = config_get_int("rules.peasants.growth", 1);
const struct building_type *bt_harbour = bt_find("harbour");
@ -850,13 +868,13 @@ void demographics(void)
if (horse_rules > 0) {
horses(r);
}
if (plant_rules == 2) { /* E2 */
growing_trees(r, current_season, last_weeks_season);
growing_herbs(r, current_season, last_weeks_season);
}
else if (plant_rules==1) { /* E3 */
if (plant_rules==1) { /* E3 */
growing_trees_e3(r, current_season, last_weeks_season);
}
else { /* E2 */
growing_trees(r, current_season, last_weeks_season, plant_rules);
growing_herbs(r, current_season, last_weeks_season);
}
}
update_resources(r);