forked from github/server
begin to declutter config.c
This commit is contained in:
parent
03a94d1264
commit
c1f468ceb0
|
@ -2908,7 +2908,7 @@ void auto_work(region * r)
|
|||
}
|
||||
}
|
||||
if (nextworker != workers) {
|
||||
expandwork(r, workers, nextworker, maxworkingpeasants(r));
|
||||
expandwork(r, workers, nextworker, region_maxworkers(r));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3112,7 +3112,7 @@ void produce(struct region *r)
|
|||
if (entertaining)
|
||||
expandentertainment(r);
|
||||
if (!rule_autowork()) {
|
||||
expandwork(r, workers, nextworker, maxworkingpeasants(r));
|
||||
expandwork(r, workers, nextworker, region_maxworkers(r));
|
||||
}
|
||||
if (taxorders)
|
||||
expandtax(r, taxorders);
|
||||
|
|
|
@ -433,13 +433,6 @@ int newcontainerid(void)
|
|||
return random_no;
|
||||
}
|
||||
|
||||
int maxworkingpeasants(const struct region *r)
|
||||
{
|
||||
int size = production(r);
|
||||
int treespace = (rtrees(r, 2) + rtrees(r, 1) / 2) * TREESIZE;
|
||||
return _max(size - treespace, _min(size / 10, 200));
|
||||
}
|
||||
|
||||
static const char * parameter_key(int i)
|
||||
{
|
||||
assert(i < MAXPARAMS && i >= 0);
|
||||
|
|
|
@ -114,7 +114,6 @@ struct param;
|
|||
#define GF_PURE 64
|
||||
/* untranslated */
|
||||
|
||||
int maxworkingpeasants(const struct region *r);
|
||||
bool markets_module(void);
|
||||
int wage(const struct region *r, const struct faction *f,
|
||||
const struct race *rc, int in_turn);
|
||||
|
|
|
@ -134,6 +134,13 @@ const char *regionname(const region * r, const faction * f)
|
|||
return write_regionname(r, f, buf[index], sizeof(buf[index]));
|
||||
}
|
||||
|
||||
int region_maxworkers(const region *r)
|
||||
{
|
||||
int size = production(r);
|
||||
int treespace = (rtrees(r, 2) + rtrees(r, 1) / 2) * TREESIZE;
|
||||
return _max(size - treespace, _min(size / 10, 200));
|
||||
}
|
||||
|
||||
int deathcount(const region * r)
|
||||
{
|
||||
attrib *a = a_find(r->attribs, &at_deathcount);
|
||||
|
@ -1207,7 +1214,7 @@ void terraform_region(region * r, const terrain_type * terrain)
|
|||
|
||||
if (!fval(r, RF_CHAOTIC)) {
|
||||
int peasants;
|
||||
peasants = (maxworkingpeasants(r) * (20 + dice_rand("6d10"))) / 100;
|
||||
peasants = (region_maxworkers(r) * (20 + dice_rand("6d10"))) / 100;
|
||||
rsetpeasants(r, _max(100, peasants));
|
||||
rsetmoney(r, rpeasants(r) * ((wage(r, NULL, NULL,
|
||||
INT_MAX) + 1) + rng_int() % 5));
|
||||
|
|
|
@ -264,6 +264,7 @@ extern "C" {
|
|||
|
||||
const char *regionname(const struct region *r, const struct faction *f);
|
||||
|
||||
int region_maxworkers(const struct region *r);
|
||||
const char *region_getname(const struct region *self);
|
||||
void region_setname(struct region *self, const char *name);
|
||||
const char *region_getinfo(const struct region *self);
|
||||
|
|
|
@ -19,14 +19,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef ERESSEA_TYPES_H
|
||||
#define ERESSEA_TYPES_H
|
||||
|
||||
/*
|
||||
* Features enabled:
|
||||
* If you are lacking the settings.h, create a new file common/settings.h,
|
||||
* and write #include <settings-config.h> (or whatever settings you want
|
||||
* your game to use) in there.
|
||||
* !!! DO NOT COMMIT THE SETTINGS.H FILE TO CVS !!!
|
||||
* settings.h should always be the first thing you include (after platform.h).
|
||||
*/
|
||||
#include <settings.h>
|
||||
#include <util/variant.h>
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ extern "C"
|
|||
K_PAY,
|
||||
K_LOOT,
|
||||
MAXKEYWORDS,
|
||||
NOKEYWORD = -1
|
||||
NOKEYWORD
|
||||
} keyword_t;
|
||||
|
||||
extern const char *keywords[MAXKEYWORDS];
|
||||
|
|
12
src/laws.c
12
src/laws.c
|
@ -221,7 +221,7 @@ static void live(region * r)
|
|||
static void calculate_emigration(region * r)
|
||||
{
|
||||
int i;
|
||||
int maxp = maxworkingpeasants(r);
|
||||
int maxp = region_maxworkers(r);
|
||||
int rp = rpeasants(r);
|
||||
int max_immigrants = MAX_IMMIGRATION(maxp - rp);
|
||||
|
||||
|
@ -236,7 +236,7 @@ static void calculate_emigration(region * r)
|
|||
|
||||
if (rc != NULL && fval(rc->terrain, LAND_REGION)) {
|
||||
int rp2 = rpeasants(rc);
|
||||
int maxp2 = maxworkingpeasants(rc);
|
||||
int maxp2 = region_maxworkers(rc);
|
||||
int max_emigration = MAX_EMIGRATION(rp2 - maxp2);
|
||||
|
||||
if (max_emigration > 0) {
|
||||
|
@ -419,7 +419,7 @@ static void horses(region * r)
|
|||
direction_t n;
|
||||
|
||||
/* Logistisches Wachstum, Optimum bei halbem Maximalbesatz. */
|
||||
maxhorses = maxworkingpeasants(r) / 10;
|
||||
maxhorses = region_maxworkers(r) / 10;
|
||||
maxhorses = _max(0, maxhorses);
|
||||
horses = rhorses(r);
|
||||
if (horses > 0) {
|
||||
|
@ -621,7 +621,7 @@ growing_trees(region * r, const int current_season, const int last_weeks_season)
|
|||
* verfügbaren Fläche ab. In Gletschern gibt es weniger
|
||||
* Möglichkeiten als in Ebenen. */
|
||||
sprout = 0;
|
||||
seedchance = (1000 * maxworkingpeasants(r2)) / r2->terrain->size;
|
||||
seedchance = (1000 * region_maxworkers(r2)) / r2->terrain->size;
|
||||
for (i = 0; i < seeds / MAXDIRECTIONS; i++) {
|
||||
if (rng_int() % 10000 < seedchance)
|
||||
sprout++;
|
||||
|
@ -720,7 +720,7 @@ void immigration(void)
|
|||
if (repopulate) {
|
||||
int peasants = rpeasants(r);
|
||||
int income = wage(r, NULL, NULL, turn) - maintenance_cost(NULL) + 1;
|
||||
if (income >= 0 && r->land && (peasants < repopulate) && maxworkingpeasants(r) >(peasants + 30) * 2) {
|
||||
if (income >= 0 && r->land && (peasants < repopulate) && region_maxworkers(r) >(peasants + 30) * 2) {
|
||||
int badunit = 0;
|
||||
unit *u;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
|
@ -816,7 +816,7 @@ void demographics(void)
|
|||
calculate_emigration(r);
|
||||
peasants(r);
|
||||
if (r->age > 20) {
|
||||
double mwp = _max(maxworkingpeasants(r), 1);
|
||||
double mwp = _max(region_maxworkers(r), 1);
|
||||
double prob =
|
||||
pow(rpeasants(r) / (mwp * wage(r, NULL, NULL, turn) * 0.13), 4.0)
|
||||
* PLAGUE_CHANCE;
|
||||
|
|
Loading…
Reference in New Issue