[freeciv-dev] When city happiness state changes

  • From: Dean <ddeanbrown@xxxxxxxxxxx>
  • To: freeciv-dev@xxxxxxxxxxxxx
  • Date: Sun, 1 Nov 2020 21:27:01 -0500

Since I brought this up, I should volunteer to post something to the forum. Here's my first draft - please comment, criticize etc. In particular - is my example correct? Also - not sure where on the forum to post it, nothing seems obviously right and "General discussion" may be best option.

When city happiness state changes

Background - noticed this in the context of the bug in Issue #885093. Example of that bug - govt is Despotism, city happiness state is Peace, city is working a Buffalo tile, which normally gives 3 production, but is 2 under Despotism. In the city dialog, if you rearrange the worked tiles so that the city should celebrate, the city dialog will now say "celebrating" and the Buffalo tile will show 3 production. Both of those are WYSIWTF - in fact at the turn change you will get 2 production from the Buffalo, and then the city happiness state will change to "celebrating" and the city starts celebrating at the start of the next turn. This behaviour matches what is said on the "Turn" page on the wiki (https://freeciv.fandom.com/wiki/Turn). The bug fix would, with this example, have the city dialog show 2 production from the Buffalo and for the happiness state show "Celebrating (Next Turn)".

However, things are different when the state changes from/to "disorder" - that takes effect immediately. Using the same example, if anything causes the city to fall into disorder, then at the turn change you get no surplus food, no surplus production, 0 science and 0 gold, which is what the city dialog says.

I think it would be better to be consistent about when a city's happiness state changes, and have changes to/from "celebrating" and changes to/from "disorder" happen at the same time, either immediately or at the turn change. This should also simplify the underlying code. Thoughts? Opinions?

On 25.10.2020 00:41, Dean wrote:
Whether all changes of city happiness states should happen at the same
time is a different issue than Issue #885093. I think they should - it
would be more consistent and should make the code simpler. I think
this would be worth having a discussion on the forum.

I agree, it's a different issue.

Other related posts: