From c55777873196fac75f529b7f721a2462c0f59d22 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 30 Jan 2016 23:04:41 +0100 Subject: [PATCH] fix https://bugs.eressea.de/view.php?id=2183 --- src/kernel/item.c | 16 ++++++++++++---- src/laws.c | 7 +++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/kernel/item.c b/src/kernel/item.c index ca6c2f32d..83e787ec2 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -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 */ diff --git a/src/laws.c b/src/laws.c index 121b9d814..3ca95b61f 100755 --- a/src/laws.c +++ b/src/laws.c @@ -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); + } } } }