From 1feaff94ad81f39ac00d2a9e7a5aaa1581ffb5b0 Mon Sep 17 00:00:00 2001 From: dark-ether Date: Mon, 18 Jul 2022 20:48:51 -0300 Subject: [PATCH] server/cityturn.c: Changed city_increase_size to return false if the city didn't increase in size due to a assertion failure on city_size_add. it probably is still necessary to make further changes to at least make it not take so long to stop. also it repeats the assertion failure a few times, but stops, if i was right it should fail the assertion only once. --- server/cityturn.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/cityturn.c b/server/cityturn.c index 00cb254891..4fbbfcb6e7 100644 --- a/server/cityturn.c +++ b/server/cityturn.c @@ -917,7 +917,9 @@ static void city_reset_foodbox(struct city *pcity, int new_size) static bool city_increase_size(struct city *pcity, struct player *nationality) { int new_food; + int old_size = city_size_get(pcity); int savings_pct = granary_savings(pcity); + bool ok = TRUE; bool have_square = FALSE; bool rapture_grow = city_rapture_grow(pcity); /* check before size increase! */ struct tile *pcenter = city_tile(pcity); @@ -948,6 +950,9 @@ static bool city_increase_size(struct city *pcity, struct player *nationality) } city_size_add(pcity, 1); + if (old_size == city_size_get(pcity)) { + ok = FALSE; + } /* Do not empty food stock if city is growing by celebrating */ if (rapture_grow) { @@ -1009,7 +1014,7 @@ static bool city_increase_size(struct city *pcity, struct player *nationality) } sync_cities(); - return TRUE; + return ok; } /**********************************************************************//** -- 2.37.1