forked from github/server
- Fix Bauernmigration, negative Bauern wandern nicht.
This commit is contained in:
parent
5d1676dd09
commit
c42b27d211
|
@ -437,9 +437,11 @@ calculate_emigration(region *r)
|
||||||
{
|
{
|
||||||
direction_t i;
|
direction_t i;
|
||||||
int overpopulation = rpeasants(r) - maxworkingpeasants(r);
|
int overpopulation = rpeasants(r) - maxworkingpeasants(r);
|
||||||
int weight[MAXDIRECTIONS];
|
int weight[MAXDIRECTIONS], weightall;
|
||||||
int weightall = 0;
|
|
||||||
|
|
||||||
|
if(overpopulation <= 0) return;
|
||||||
|
|
||||||
|
weightall = 0;
|
||||||
|
|
||||||
for (i = 0; i != MAXDIRECTIONS; i++) {
|
for (i = 0; i != MAXDIRECTIONS; i++) {
|
||||||
region *rc = rconnect(r,i);
|
region *rc = rconnect(r,i);
|
||||||
|
@ -458,14 +460,16 @@ calculate_emigration(region *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weightall !=0 ) for (i = 0; i != MAXDIRECTIONS; i++) {
|
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;
|
int wandering_peasants = (overpopulation * weight[i])/weightall;
|
||||||
if (wandering_peasants==0 || rc==NULL) continue;
|
if (wandering_peasants > 0) {
|
||||||
|
|
||||||
r->land->newpeasants -= wandering_peasants;
|
r->land->newpeasants -= wandering_peasants;
|
||||||
rc->land->newpeasants += wandering_peasants;
|
rc->land->newpeasants += wandering_peasants;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue