From 1cce4927a00d1dce0f645d5fc66ddcca3c359d50 Mon Sep 17 00:00:00 2001 From: CTD Date: Fri, 12 Dec 2014 15:50:02 +0100 Subject: [PATCH 1/4] 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(); } From 7f39763ee1165081d791dad39c478d179fe38987 Mon Sep 17 00:00:00 2001 From: CTD Date: Mon, 15 Dec 2014 09:48:43 +0100 Subject: [PATCH 2/4] Konfigurierbar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ich habe zumindest mal fix eine eigene Funktion draus gemacht und es mit einer XML Option versehen. Es ist Default an, da auch in E3 die Bauern rückläufig sind, und da E4 auf den selben Regeln aufbaut es auch da sinnvoll wäre "tote" Regionen wiederzubeleben. --- src/laws.c | 62 ++++++++++++++++++++++++++++++------------------------ src/laws.h | 1 + 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/laws.c b/src/laws.c index e42015151..69f2e90fe 100755 --- a/src/laws.c +++ b/src/laws.c @@ -676,6 +676,39 @@ growing_herbs(region * r, const int current_season, const int last_weeks_season) } } +void immigration(void) +{ + region *r; + log_info(" - Einwanderung..."); + int repopulate=get_param_int(global.parameters, "rules.economy.repopulate", 1); + for (r = regions; r; r = r->next) { + if (r->land && r->land->newpeasants) { + 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 (repopulate && 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); + } + } + } +} + void demographics(void) { region *r; @@ -743,34 +776,7 @@ void demographics(void) }; remove_empty_units(); - - log_info(" - Einwanderung..."); - for (r = regions; r; r = r->next) { - if (r->land && r->land->newpeasants) { - 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); - } - } - } + immigration(); checkorders(); } diff --git a/src/laws.h b/src/laws.h index 5a7cd8024..f5209ac3f 100755 --- a/src/laws.h +++ b/src/laws.h @@ -34,6 +34,7 @@ extern "C" { int writepasswd(void); void demographics(void); + void immigration(void); void update_guards(void); void update_subscriptions(void); void deliverMail(struct faction *f, struct region *r, struct unit *u, From cc09e958878f0fc8a75a2132205ad4097b4dd109 Mon Sep 17 00:00:00 2001 From: CTD Date: Mon, 15 Dec 2014 13:07:39 +0100 Subject: [PATCH 3/4] Bauerngrenze angepasst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Maximum Bauerngrenze bei der noch zusätzlich Bauern hinzukommen können auf 90 erhöht und auch gleich Konfigurierbar gemacht. Das sollte immer noch zu wenig sein um ernsthaft missbrauch damit zu betreiben. --- src/laws.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/laws.c b/src/laws.c index 69f2e90fe..4689d21d1 100755 --- a/src/laws.c +++ b/src/laws.c @@ -680,7 +680,7 @@ void immigration(void) { region *r; log_info(" - Einwanderung..."); - int repopulate=get_param_int(global.parameters, "rules.economy.repopulate", 1); + int repopulate=get_param_int(global.parameters, "rules.economy.repopulate_maximum", 90); for (r = regions; r; r = r->next) { if (r->land && r->land->newpeasants) { int rp = rpeasants(r) + r->land->newpeasants; @@ -689,7 +689,7 @@ void immigration(void) /* 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 (repopulate && r->land && (peasants < 50) && maxworkingpeasants(r) > (peasants+30)*2) + if (repopulate && r->land && (peasants < repopulate) && maxworkingpeasants(r) > (peasants+30)*2) { int badunit = 0; unit *u; From c914c83947d37715f897f4fae55214f8933c8f3a Mon Sep 17 00:00:00 2001 From: CTD Date: Thu, 18 Dec 2014 11:57:30 +0100 Subject: [PATCH 4/4] =?UTF-8?q?Grenze=20f=C3=BCr=20E2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit auf 500 Bauern erhöht. --- conf/e2/config.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/e2/config.xml b/conf/e2/config.xml index 51aaa133d..170621b48 100644 --- a/conf/e2/config.xml +++ b/conf/e2/config.xml @@ -103,6 +103,7 @@ +