From fa55f84b414f28065d6bde0581c784f368ea0ef5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 16 Dec 2015 13:32:02 +0100 Subject: [PATCH] remove unnecessary assert that prevents throwing away money on an ocean github issue #437 https://bugs.eressea.de/view.php?id=2173#c6411 --- src/kernel/item.c | 4 +++- src/kernel/region.c | 12 ++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/kernel/item.c b/src/kernel/item.c index aa975fb8e..e484e6c35 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -588,7 +588,9 @@ struct order *ord) use += use_pooled(s, item2resource(itype), GET_RESERVE | GET_POOLED_SLACK, n - use); - rsetmoney(s->region, rmoney(s->region) + use); + if (s->region->land) { + rsetmoney(s->region, rmoney(s->region) + use); + } return 0; } return -1; /* use the mechanism */ diff --git a/src/kernel/region.c b/src/kernel/region.c index aa4c86425..ed56851ee 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -603,8 +603,7 @@ void rsetpeasants(region * r, int value) if (r->land) { assert(value >= 0); r->land->peasants = value; - } else - assert(value == 0); + } } int rmoney(const region * r) @@ -617,8 +616,7 @@ void rsethorses(const region * r, int value) if (r->land) { assert(value >= 0); r->land->horses = value; - } else - assert(value == 0); + } } int rhorses(const region * r) @@ -631,8 +629,7 @@ void rsetmoney(region * r, int value) if (r->land) { assert(value >= 0); r->land->money = value; - } else - assert(value == 0); + } } int rherbs(const struct region *r) @@ -645,8 +642,7 @@ void rsetherbs(const struct region *r, int value) if (r->land) { assert(value >= 0); r->land->herbs = (short)(value); - } else - assert(value == 0); + } }