From 8fbcf3f3798c69eebbc523271d9cb067bec4d542 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 11 Feb 2021 15:03:41 +0100 Subject: [PATCH] =?UTF-8?q?Neue=20Option=20f=C3=BCr=20schnelleres=20Samenw?= =?UTF-8?q?achstum.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/laws.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/laws.c b/src/laws.c index aadd4784b..3fdbc1117 100644 --- a/src/laws.c +++ b/src/laws.c @@ -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);