forked from github/server
Merge branch 'master' into develop
Conflicts: src/buildno.h src/kernel/item.c src/kernel/region.c src/laws.c
This commit is contained in:
commit
c08235693d
3 changed files with 22 additions and 10 deletions
|
@ -568,11 +568,15 @@ struct order *ord)
|
||||||
{
|
{
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
int use = use_pooled(s, item2resource(itype), GET_SLACK, n);
|
int use = use_pooled(s, item2resource(itype), GET_SLACK, n);
|
||||||
if (use < n)
|
region *r = s->region;
|
||||||
|
if (use < n) {
|
||||||
use +=
|
use +=
|
||||||
use_pooled(s, item2resource(itype), GET_RESERVE | GET_POOLED_SLACK,
|
use_pooled(s, item2resource(itype), GET_RESERVE | GET_POOLED_SLACK,
|
||||||
n - use);
|
n - use);
|
||||||
rsethorses(s->region, rhorses(s->region) + use);
|
}
|
||||||
|
if (r->land) {
|
||||||
|
rsethorses(r, rhorses(r) + use);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return -1; /* use the mechanism */
|
return -1; /* use the mechanism */
|
||||||
|
@ -584,12 +588,14 @@ struct order *ord)
|
||||||
{
|
{
|
||||||
if (d == NULL) {
|
if (d == NULL) {
|
||||||
int use = use_pooled(s, item2resource(itype), GET_SLACK, n);
|
int use = use_pooled(s, item2resource(itype), GET_SLACK, n);
|
||||||
if (use < n)
|
region *r = s->region;
|
||||||
|
if (use < n) {
|
||||||
use +=
|
use +=
|
||||||
use_pooled(s, item2resource(itype), GET_RESERVE | GET_POOLED_SLACK,
|
use_pooled(s, item2resource(itype), GET_RESERVE | GET_POOLED_SLACK,
|
||||||
n - use);
|
n - use);
|
||||||
if (s->region->land) {
|
}
|
||||||
rsetmoney(s->region, rmoney(s->region) + use);
|
if (r->land) {
|
||||||
|
rsetmoney(r, rmoney(r) + use);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -633,8 +633,9 @@ int rhorses(const region * r)
|
||||||
|
|
||||||
void rsetmoney(region * r, int value)
|
void rsetmoney(region * r, int value)
|
||||||
{
|
{
|
||||||
|
assert(r->land || value==0);
|
||||||
|
assert(value >= 0);
|
||||||
if (r->land) {
|
if (r->land) {
|
||||||
assert(value >= 0);
|
|
||||||
r->land->money = value;
|
r->land->money = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -646,8 +647,9 @@ int rherbs(const struct region *r)
|
||||||
|
|
||||||
void rsetherbs(const struct region *r, int value)
|
void rsetherbs(const struct region *r, int value)
|
||||||
{
|
{
|
||||||
|
assert(r->land || value==0);
|
||||||
|
assert(value >= 0);
|
||||||
if (r->land) {
|
if (r->land) {
|
||||||
assert(value >= 0);
|
|
||||||
r->land->herbs = (short)(value);
|
r->land->herbs = (short)(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
src/laws.c
10
src/laws.c
|
@ -721,9 +721,13 @@ void immigration(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (badunit == 0) {
|
if (badunit == 0)
|
||||||
peasants += (int)(rng_double() * (income + 1));
|
{
|
||||||
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