Editing a city to have size 255 freezes the server
i tested this and could reproduce in freeciv 3.0, first it sends the message
1: Did not find a cm solution in 27500 iterations for Kraków.
until 206 times, then it does
1: in city_size_add() [city.c::1106]: assertion '0xFF - size > add' failed.
1: Please report this message at https://osdn.net/projects/freeciv/ticket/
and then repeats both messages the cm solution message comes from common/aicore/cm i haven't yet searched for the assertion failure. do note that the city needs to actually reach 255 size to reproduce the bug, so if it doesn't have a sewer system it is not possible to reproduce the bug
Reply To dark-ether
i tested this and could reproduce in freeciv 3.0, first it sends the message 1: Did not find a cm solution in 27500 iterations for Kraków. until 206 times, then it does 1: in city_size_add() [city.c::1106]: assertion '0xFF - size > add' failed. 1: Please report this message at https://osdn.net/projects/freeciv/ticket/ and then repeats both messages the cm solution message comes from common/aicore/cm i haven't yet searched for the assertion failure. do note that the city needs to actually reach 255 size to reproduce the bug, so if it doesn't have a sewer system it is not possible to reproduce the bug
ok i was browsing the code and if we look at the city_size_change function it calls with a while loop city_increase_size, and besides when it can't grow becuase it grew to the size limit it always returns true this means that if something prevents size from increasing the loop will go on forever, the assertion that fails is a return assertion, so it causes the code to return, i assume this causes size to not increase, i may be wrong and some other thing prevents size from increasing. actually i am blind that is exactly what happens the function that changes size is the city_size_add which gets cancelled when the assert fails
i have a half fix, i call it half because although it fixes the infinite loop it still takes too long to stop, however to fix it taking too long it would need a substantial change in how it works,
my suggestion would be to remove things that should happen only once from city_increase_size to a new function city_has_grown which is called only once, however that seems to big for only one ticket.
Reply To dark-ether
it calculates for each value along the way
That's probably easier part to address currently.
There's also #44703 trying to achieve something similar.
Reply To (Anonymous)
- set the size to 255 (the maximum allowed)
Should be allowed, but causes an assert failure -> #48296
Patch applies, as is, also to S3_1. I want to test it on development branches first, but it's something to likely push to S3_1 after beta3 release.
Pushed to main and S3_2
To reproduce: - enter edit mode - select a city - set the size to 255 (the maximum allowed) - go do some sport while waiting for the server to complete the growth (killed it after 9 hours on my machine)