forked from github/server
*** empty log message ***
This commit is contained in:
parent
caee0c7993
commit
d2d19ceb55
|
@ -2816,6 +2816,9 @@ heal_all(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PEASANT_ADJUSTMENT == 1
|
#if PEASANT_ADJUSTMENT == 1
|
||||||
|
|
||||||
|
#define WEIGHT ((double)0.5)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
peasant_adjustment(void)
|
peasant_adjustment(void)
|
||||||
{
|
{
|
||||||
|
@ -2828,6 +2831,7 @@ peasant_adjustment(void)
|
||||||
|
|
||||||
if(terrain[ter].production_max <= 0) continue;
|
if(terrain[ter].production_max <= 0) continue;
|
||||||
|
|
||||||
|
c = 0;
|
||||||
sum = 0;
|
sum = 0;
|
||||||
pool = 0;
|
pool = 0;
|
||||||
freeall = 0;
|
freeall = 0;
|
||||||
|
@ -2847,13 +2851,21 @@ peasant_adjustment(void)
|
||||||
unit *u;
|
unit *u;
|
||||||
int playerp = 0;
|
int playerp = 0;
|
||||||
int p_weg;
|
int p_weg;
|
||||||
|
int soll;
|
||||||
|
|
||||||
for(u = r->units; u; u=u->next) {
|
for(u = r->units; u; u=u->next) {
|
||||||
if(lifestyle(u) > 0) playerp += u->number;
|
if(lifestyle(u) > 0) playerp += u->number;
|
||||||
}
|
}
|
||||||
p_weg = min((playerp + rpeasants(r)) - avg, rpeasants(r));
|
|
||||||
pool += p_weg;
|
soll = (avg + playerp + rpeasants(r)) * WEIGHT;
|
||||||
rsetpeasants(r, rpeasants(r) - p_weg);
|
|
||||||
|
if(playerp + rpeasants(r) > soll) {
|
||||||
|
p_weg = min((playerp + rpeasants(r)) - soll, rpeasants(r));
|
||||||
|
assert(p_weg >= 0);
|
||||||
|
pool += p_weg;
|
||||||
|
rsetpeasants(r, rpeasants(r) - p_weg);
|
||||||
|
assert(rpeasants(r) >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
freeall += max(0,production(r) * MAXPEASANTS_PER_AREA
|
freeall += max(0,production(r) * MAXPEASANTS_PER_AREA
|
||||||
- ((rtrees(r,2)+rtrees(r,1)/2) * TREESIZE) - playerp);
|
- ((rtrees(r,2)+rtrees(r,1)/2) * TREESIZE) - playerp);
|
||||||
|
@ -2875,6 +2887,8 @@ peasant_adjustment(void)
|
||||||
newp = (pool * free)/freeall;
|
newp = (pool * free)/freeall;
|
||||||
|
|
||||||
rsetpeasants(r, rpeasants(r)+newp);
|
rsetpeasants(r, rpeasants(r)+newp);
|
||||||
|
|
||||||
|
assert(rpeasants(r) >= 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue