From 1cce4927a00d1dce0f645d5fc66ddcca3c359d50 Mon Sep 17 00:00:00 2001 From: CTD Date: Fri, 12 Dec 2014 15:50:02 +0100 Subject: [PATCH] Bauern in leeren Regionen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eine recht einfache Funktion die ein paar zusätzliche Bauern in leeren Regionen erschafft. --- src/laws.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/laws.c b/src/laws.c index 6420ab366..e42015151 100755 --- a/src/laws.c +++ b/src/laws.c @@ -750,8 +750,27 @@ void demographics(void) int rp = rpeasants(r) + r->land->newpeasants; rsetpeasants(r, _max(0, rp)); } + /* Genereate some (0-2 to 0-6 depending on the income) peasants out of nothing */ + /*if less then 50 are in the region and there is space and no monster or deamon units in the region */ + int peasants = rpeasants(r); + if (r->land && (peasants < 50) && maxworkingpeasants(r) > (peasants+30)*2) + { + int badunit = 0; + unit *u; + for (u = r->units; u; u = u->next) { + if (!playerrace(u_race(u)) || u_race(u) == get_race(RC_DAEMON)) + { + badunit = 1; + break; + } + } + if (badunit == 0) + { + peasants += (int)(rng_double()*(wage(r, NULL, NULL, turn) - 9)); + rsetpeasants(r, peasants); + } + } } - checkorders(); }