forked from github/server
This commit is contained in:
parent
f3ab4d5ca6
commit
c557778731
2 changed files with 17 additions and 6 deletions
|
@ -567,11 +567,15 @@ struct order *ord)
|
|||
{
|
||||
if (d == NULL) {
|
||||
int use = use_pooled(s, item2resource(itype), GET_SLACK, n);
|
||||
if (use < n)
|
||||
region *r = s->region;
|
||||
if (use < n) {
|
||||
use +=
|
||||
use_pooled(s, item2resource(itype), GET_RESERVE | GET_POOLED_SLACK,
|
||||
n - use);
|
||||
rsethorses(s->region, rhorses(s->region) + use);
|
||||
}
|
||||
if (r->land) {
|
||||
rsethorses(r, rhorses(r) + use);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1; /* use the mechanism */
|
||||
|
@ -583,11 +587,15 @@ struct order *ord)
|
|||
{
|
||||
if (d == NULL) {
|
||||
int use = use_pooled(s, item2resource(itype), GET_SLACK, n);
|
||||
if (use < n)
|
||||
region *r = s->region;
|
||||
if (use < n) {
|
||||
use +=
|
||||
use_pooled(s, item2resource(itype), GET_RESERVE | GET_POOLED_SLACK,
|
||||
n - use);
|
||||
rsetmoney(s->region, rmoney(s->region) + use);
|
||||
}
|
||||
if (r->land) {
|
||||
rsetmoney(r, rmoney(r) + use);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return -1; /* use the mechanism */
|
||||
|
|
|
@ -720,8 +720,11 @@ void immigration(void)
|
|||
}
|
||||
if (badunit == 0)
|
||||
{
|
||||
peasants += (int)(rng_double()*(wage(r, NULL, NULL, turn) - 9));
|
||||
rsetpeasants(r, peasants);
|
||||
int x = wage(r, NULL, NULL, turn) - 9;
|
||||
if (x>0) {
|
||||
peasants += (int)(rng_double()*x);
|
||||
rsetpeasants(r, peasants);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue