Baumwachstum, WIP

This commit is contained in:
Enno Rehling 2009-07-19 15:17:08 +00:00
parent 64631a8ed1
commit c64905d1b4
3 changed files with 44 additions and 7 deletions

View file

@ -719,6 +719,27 @@ count_race(const region *r, const race *rc)
extern struct attrib_type at_germs; extern struct attrib_type at_germs;
static void
growing_trees_e3(region * r, const int current_season, const int last_weeks_season)
{
const int transform[4][3] = {
{ -1, -1, 0 },
{ TREE_SEED, TREE_SAPLING, 2 },
{ TREE_SAPLING, TREE_TREE, 2 },
{ TREE_TREE, TREE_SEED, 2 }
};
if (current_season!=last_weeks_season && transform[current_season][2]) {
int src_type = transform[current_season][0];
int dst_type = transform[current_season][1];
int src = rtrees(r, src_type);
int dst = rtrees(r, dst_type);
int grow = src/transform[current_season][2];
rsettrees(r, src_type, src-grow);
rsettrees(r, dst_type, dst+grow);
}
}
static void static void
growing_trees(region * r, const int current_season, const int last_weeks_season) growing_trees(region * r, const int current_season, const int last_weeks_season)
{ {
@ -844,15 +865,18 @@ growing_trees(region * r, const int current_season, const int last_weeks_season)
/* zu den Bäumen hinzufügen */ /* zu den Bäumen hinzufügen */
rsettrees(r, 2, rtrees(r, 2) + grownup_trees); rsettrees(r, 2, rtrees(r, 2) + grownup_trees);
} }
}
static void
growing_herbs(region * r, const int current_season, const int last_weeks_season)
{
/* Jetzt die Kräutervermehrung. Vermehrt wird logistisch: /* Jetzt die Kräutervermehrung. Vermehrt wird logistisch:
* *
* Jedes Kraut hat eine Wahrscheinlichkeit von (100-(vorhandene * Jedes Kraut hat eine Wahrscheinlichkeit von (100-(vorhandene
* Kräuter))% sich zu vermehren. */ * Kräuter))% sich zu vermehren. */
if(current_season == SEASON_SPRING || current_season == SEASON_SUMMER if (current_season != SEASON_WINTER) {
|| current_season == SEASON_AUTUMN) int i;
{ for (i = rherbs(r); i > 0; i--) {
for(i = rherbs(r); i > 0; i--) {
if (rng_int()%100 < (100-rherbs(r))) rsetherbs(r, (short)(rherbs(r)+1)); if (rng_int()%100 < (100-rherbs(r))) rsetherbs(r, (short)(rherbs(r)+1));
} }
} }
@ -882,6 +906,11 @@ demographics(void)
/* die Nachfrage nach Produkten steigt. */ /* die Nachfrage nach Produkten steigt. */
struct demand * dmd; struct demand * dmd;
if (r->land) { if (r->land) {
static int plant_rules = -1;
if (plant_rules<0) {
plant_rules = get_param_int(global.parameters, "rules.economy.grow", 0);
}
for (dmd=r->land->demands;dmd;dmd=dmd->next) { for (dmd=r->land->demands;dmd;dmd=dmd->next) {
if (dmd->value>0 && dmd->value < MAXDEMAND) { if (dmd->value>0 && dmd->value < MAXDEMAND) {
float rise = DMRISE; float rise = DMRISE;
@ -898,8 +927,11 @@ demographics(void)
plagues(r, false); plagues(r, false);
} }
horses(r); horses(r);
if (current_season != SEASON_WINTER) { if (plant_rules==0) { /* E1 */
growing_trees(r, current_season, last_weeks_season); growing_trees(r, current_season, last_weeks_season);
growing_herbs(r, current_season, last_weeks_season);
} else { /* E3 */
growing_trees_e3(r, current_season, last_weeks_season);
} }
} }

View file

@ -198,6 +198,12 @@ void rsetroad(struct region * r, direction_t d, short value);
int is_coastregion(struct region *r); int is_coastregion(struct region *r);
int rtrees(const struct region * r, int ageclass); int rtrees(const struct region * r, int ageclass);
enum {
TREE_SEED = 0,
TREE_SAPLING = 1,
TREE_TREE = 2
};
int rsettrees(const struct region *r, int ageclass, int value); int rsettrees(const struct region *r, int ageclass, int value);
int rpeasants(const struct region * r); int rpeasants(const struct region * r);

View file

@ -144,7 +144,6 @@
<param name="rules.ship.capacity" value="1"/> <!-- --> <param name="rules.ship.capacity" value="1"/> <!-- -->
<param name="rules.ship.damage_drift" value="0.00"/> <!-- percent damage from drifting--> <param name="rules.ship.damage_drift" value="0.00"/> <!-- percent damage from drifting-->
<param name="rules.alliances" value="1"/> <param name="rules.alliances" value="1"/>
<param name="rules.combat.nat_armor" value="1"/>
<param name="rules.combat.herospeed" value="3"/> <param name="rules.combat.herospeed" value="3"/>
<param name="rules.combat.demon_vampire" value="5"/> <!-- regen 1 hp per X points of damage done --> <param name="rules.combat.demon_vampire" value="5"/> <!-- regen 1 hp per X points of damage done -->
<param name="rules.combat.skill_bonus" value="0"/> <param name="rules.combat.skill_bonus" value="0"/>
@ -164,7 +163,7 @@
<param name="rules.economy.wages" value="1"/> <param name="rules.economy.wages" value="1"/>
<param name="rules.economy.roqf" value="5"/> <param name="rules.economy.roqf" value="5"/>
<param name="rules.economy.herbrot" value="0"/> <param name="rules.economy.herbrot" value="0"/>
<param name="rules.economy.herbrot" value="0"/> <param name="rules.economy.grow" value="1"/>
<param name="rules.tactics.formula" value="1"/> <!-- 10% per skilldiff --> <param name="rules.tactics.formula" value="1"/> <!-- 10% per skilldiff -->
<param name="rules.help.mask" value="fight guard money"/> <param name="rules.help.mask" value="fight guard money"/>
<param name="movement.shipspeed.skillbonus" value="6"/> <param name="movement.shipspeed.skillbonus" value="6"/>