* Change the town's population as recorded in the town cache, town label, and town directory. * @param t The town which has changed. * @param mod The population change (can be positive or negative). */
| 440 | * @param mod The population change (can be positive or negative). |
| 441 | */ |
| 442 | static void ChangePopulation(Town *t, int mod) |
| 443 | { |
| 444 | t->cache.population += mod; |
| 445 | if (_generating_town) [[unlikely]] return; |
| 446 | |
| 447 | InvalidateWindowData(WC_TOWN_VIEW, t->index); // Cargo requirements may appear/vanish for small populations |
| 448 | if (_settings_client.gui.population_in_label) t->UpdateVirtCoord(); |
| 449 | |
| 450 | InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_POPULATION_CHANGE); |
| 451 | } |
| 452 | |
| 453 | /** |
| 454 | * Get the total population, the sum of all towns in the world. |
no test coverage detected