- Fix Bauernmigration, negative Bauern wandern nicht.

This commit is contained in:
Christian Schlittchen 2002-03-03 14:53:59 +00:00
parent 5d1676dd09
commit c42b27d211
1 changed files with 14 additions and 10 deletions

View File

@ -437,9 +437,11 @@ calculate_emigration(region *r)
{
direction_t i;
int overpopulation = rpeasants(r) - maxworkingpeasants(r);
int weight[MAXDIRECTIONS];
int weightall = 0;
int weight[MAXDIRECTIONS], weightall;
if(overpopulation <= 0) return;
weightall = 0;
for (i = 0; i != MAXDIRECTIONS; i++) {
region *rc = rconnect(r,i);
@ -458,14 +460,16 @@ calculate_emigration(region *r)
}
if (weightall !=0 ) for (i = 0; i != MAXDIRECTIONS; i++) {
region *rc = rconnect(r,i);
region *rc;
if((rc = rconnect(r,i)) != NULL) {
int wandering_peasants = (overpopulation * weight[i])/weightall;
if (wandering_peasants==0 || rc==NULL) continue;
if (wandering_peasants > 0) {
r->land->newpeasants -= wandering_peasants;
rc->land->newpeasants += wandering_peasants;
}
}
}
}
#else
void