unknown-horizons/unknown-horizons — pull request #30 by vonmixer (2012-03-05 17:35:06+00:00)
Title: Inhabitant counter in the top middle doesn't update properly - trac.unknown-horizons.org/t/ticket/1377

Ticket: trac.unknown-horizons.org/t/ticket/1377

I've closed my previous pull request to remove 2 redundant commits. I've made the following changes to fix the issue:

Removing residences: When a building was destroyed by tearingtool.py the inhabitant counter would not update until the mouse was moved. buildingtool.py handles this by hiding the counter by calling ingame_gui.resourceinfo_set(None). I have tried a similar solution for the tearingtool.py by adding a call to ingame_gui.resourceinfo_set(None) in the mouseReleased function. I also added a check to see if inhabitants actually decreased before the call is made.

Unhappy residents moving out: I used the same approach as above. When an unhappy resident moves out, i.e. level == 0 in level_down() in settler.py, if the owner of the building is the player, ingame_gui.resourceinfo_set(None) is called to hide the counter until the mouse moves.

Looking forward to your feedback.