forked from github/server
report 2682: simplify tree growth
each spring, 2/3 of all saplings become trees over a 6 week period (1/9 per week).
This commit is contained in:
parent
b2689e3a9e
commit
6ccaaee4ea
15
src/laws.c
15
src/laws.c
|
@ -681,8 +681,8 @@ growing_trees(region * r, const season_t current_season, const season_t last_wee
|
||||||
a = a_find(r->attribs, &at_germs);
|
a = a_find(r->attribs, &at_germs);
|
||||||
if (!a) {
|
if (!a) {
|
||||||
a = a_add(&r->attribs, a_new(&at_germs));
|
a = a_add(&r->attribs, a_new(&at_germs));
|
||||||
a->data.sa[0] = (short)cap_int(rtrees(r, 0), 0, SHRT_MAX);
|
a->data.sa[0] = (short)cap_int(rtrees(r, 0) / 9, 0, SHRT_MAX);
|
||||||
a->data.sa[1] = (short)cap_int(rtrees(r, 1), 0, SHRT_MAX);
|
a->data.sa[1] = (short)cap_int(rtrees(r, 1) / 9, 0, SHRT_MAX);
|
||||||
}
|
}
|
||||||
else if (a->data.sa[0] < 0 || a->data.sa[1] < 0) {
|
else if (a->data.sa[0] < 0 || a->data.sa[1] < 0) {
|
||||||
a->data.sa[0] = (short)cap_int(a->data.sa[0], 0, SHRT_MAX);
|
a->data.sa[0] = (short)cap_int(a->data.sa[0], 0, SHRT_MAX);
|
||||||
|
@ -692,9 +692,7 @@ growing_trees(region * r, const season_t current_season, const season_t last_wee
|
||||||
/* Baumwachstum */
|
/* Baumwachstum */
|
||||||
sprout = rtrees(r, 1);
|
sprout = rtrees(r, 1);
|
||||||
if (sprout > a->data.sa[1]) sprout = a->data.sa[1];
|
if (sprout > a->data.sa[1]) sprout = a->data.sa[1];
|
||||||
grownup_trees = sprout / 6;
|
grownup_trees = sprout;
|
||||||
/* aus dem Sproesslingepool dieses Jahres abziehen */
|
|
||||||
a->data.sa[1] = (short)(sprout - grownup_trees);
|
|
||||||
/* aus dem gesamt Sproesslingepool abziehen */
|
/* aus dem gesamt Sproesslingepool abziehen */
|
||||||
rsettrees(r, 1, rtrees(r, 1) - grownup_trees);
|
rsettrees(r, 1, rtrees(r, 1) - grownup_trees);
|
||||||
/* zu den Baeumen hinzufuegen */
|
/* zu den Baeumen hinzufuegen */
|
||||||
|
@ -703,13 +701,10 @@ growing_trees(region * r, const season_t current_season, const season_t last_wee
|
||||||
/* Samenwachstum */
|
/* Samenwachstum */
|
||||||
seeds = rtrees(r, 0);
|
seeds = rtrees(r, 0);
|
||||||
if (seeds > a->data.sa[0]) seeds = a->data.sa[0];
|
if (seeds > a->data.sa[0]) seeds = a->data.sa[0];
|
||||||
sprout = seeds / 6;
|
|
||||||
/* aus dem Samenpool dieses Jahres abziehen */
|
|
||||||
a->data.sa[0] = (short)(seeds - sprout);
|
|
||||||
/* aus dem gesamt Samenpool abziehen */
|
/* aus dem gesamt Samenpool abziehen */
|
||||||
rsettrees(r, 0, rtrees(r, 0) - sprout);
|
rsettrees(r, 0, rtrees(r, 0) - seeds);
|
||||||
/* zu den Sproesslinge hinzufuegen */
|
/* zu den Sproesslinge hinzufuegen */
|
||||||
rsettrees(r, 1, rtrees(r, 1) + sprout);
|
rsettrees(r, 1, rtrees(r, 1) + seeds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue