From cacc393c53bb9fa0f4e81e445652adf9a7215e0e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 26 Oct 2008 13:08:01 -0400 Subject: [PATCH] Age che just like reserves (1% per 24 ETUs) Factor aging out of age_levels() into new age_people(). Use it in do_feed() to age che. --- include/prototypes.h | 1 + src/lib/update/age.c | 17 ++++++++--------- src/lib/update/human.c | 3 +++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/prototypes.h b/include/prototypes.h index adc389e2d..11c32e391 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -704,6 +704,7 @@ extern int wu(natid, natid, char *, ...) ATTRIBUTE((format (printf, 3, 4))); * src/lib/update/ *.c */ /* age.c */ +extern int age_people(int, int); extern void age_levels(int); /* anno.c */ extern void delete_old_announcements(void); diff --git a/src/lib/update/age.c b/src/lib/update/age.c index 7f34f1537..7dd94e690 100644 --- a/src/lib/update/age.c +++ b/src/lib/update/age.c @@ -35,6 +35,13 @@ #include "update.h" +int +age_people(int n, int etu) +{ + /* age by 1% per 24 etus */ + return roundavg(n * (1.0 - etu / 2400.0)); +} + void age_levels(int etu) { @@ -43,7 +50,6 @@ age_levels(int etu) int i; double level; double delta; - int deltares; best_tech = 0.0; best_res = 0.0; @@ -61,14 +67,7 @@ age_levels(int etu) delta = np->nat_level[NAT_TLEV] * etu / (100 * level_age_rate); np->nat_level[NAT_TLEV] -= delta; } - /* - * age reserves by 1% per every 24 etus - */ - deltares = -roundavg(np->nat_reserve * etu / 2400.0); - if (deltares != 0) - np->nat_reserve += deltares; - /* Chad Zabel - above number is negative ( was a -= there - which was wrong. */ + np->nat_reserve = age_people(np->nat_reserve, etu); } best_tech /= 5; best_res /= 5; diff --git a/src/lib/update/human.c b/src/lib/update/human.c index 74997d637..564f0bf73 100644 --- a/src/lib/update/human.c +++ b/src/lib/update/human.c @@ -114,6 +114,9 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec, if (!player->simulation) sp->sct_work = sctwork; grow_people(sp, etu, np, &work_avail, sctwork, vec); + /* age che */ + if (!player->simulation) + sp->sct_che = age_people(sp->sct_che, etu); } if (manna) /* Take away food we conjured up */ -- 2.43.0