From 70deb72184e0dd4df3ef1c65cd715baceb3e2f84 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 26 Sep 2022 02:31:48 +0300 Subject: [PATCH 37/37] Server CMA: Try with default parameters after cancelling user's It used to go directly to fallback where it adjusted current parameter - which was still user provided one at that point. With this change, after user's parameter fails - First it tries with the default parameter - If that too fails, then it tries with parameters adjusted from the default one See osdn #45727 Signed-off-by: Marko Lindqvist --- server/cityturn.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/server/cityturn.c b/server/cityturn.c index 94d5be36e5..065d53861b 100644 --- a/server/cityturn.c +++ b/server/cityturn.c @@ -409,12 +409,19 @@ void auto_arrange_workers(struct city *pcity) _("The citizen governor can't fulfill the requirements " "for %s. Passing back control."), city_link(pcity)); + + /* Switch to default parameters, and try with them */ + set_default_city_manager(&cmp, pcity); + cm_query_result(pcity, &cmp, cmr, FALSE); + } + + if (!cmr->found_a_valid) { + /* Drop surpluses and try again. */ + cmp.minimal_surplus[O_FOOD] = 0; + cmp.minimal_surplus[O_SHIELD] = 0; + cmp.minimal_surplus[O_GOLD] = -FC_INFINITY; + cm_query_result(pcity, &cmp, cmr, FALSE); } - /* Drop surpluses and try again. */ - cmp.minimal_surplus[O_FOOD] = 0; - cmp.minimal_surplus[O_SHIELD] = 0; - cmp.minimal_surplus[O_GOLD] = -FC_INFINITY; - cm_query_result(pcity, &cmp, cmr, FALSE); } if (!cmr->found_a_valid) { /* Emergency management. Get _some_ result. This doesn't use -- 2.35.1