- Neue Wanderungsroutine. Einfacher. Ansehen!

This commit is contained in:
Christian Schlittchen 2002-02-24 19:29:21 +00:00
parent 4049d28e1c
commit 921add5ac1
2 changed files with 43 additions and 1 deletions

View File

@ -425,6 +425,46 @@ live(region * r)
* - movement because of low loyalty relating to present parties.
*/
#if NEW_MIGRATION == 1
/* Arbeitsversion */
void
calculate_emigration(region *r)
{
direction_t i;
int overpopulation = rpeasants(r) - maxworkingpeasants(r);
int weight[MAXDIRECTIONS];
int weightall = 0;
for (i = 0; i != MAXDIRECTIONS; i++) {
region *rc = rconnect(r,i);
int w;
if(rterrain(rc) == T_OCEAN) {
w = 0;
} else {
w = rpeasants(rc) - maxworkingpeasants(rc);
}
if(rterrain(rc) == T_VOLCANO || rterrain(rc) == T_VOLCANO_SMOKING) {
w = w/10;
}
weight[i] = w;
weightall += w;
}
for (i = 0; i != MAXDIRECTIONS; i++) {
region *rc = rconnect(r,i);
int wandering_peasants = (overpopulation * weight[i])/weightall;
r->land->newpeasants -= wandering_peasants;
rc->land->newpeasants += wandering_peasants;
}
}
#else
void
calculate_emigration(region *r)
{
@ -496,6 +536,7 @@ calculate_emigration(region *r)
}
}
}
#endif
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */

View File

@ -26,3 +26,4 @@
#define TEACHDIFFERENCE 2
#define PEASANT_ADJUSTMENT 1
#define SKILLPOINTS 0
#define NEW_MIGRATION 1