Town directory window: Only resort on population change if necessary

pull/128/head
Jonathan G Rennison 4 years ago
parent 68fa46d351
commit b868ce8605

@ -204,6 +204,7 @@ enum TownRatingCheckType {
enum TownDirectoryInvalidateWindowData {
TDIWD_FORCE_REBUILD,
TDIWD_FILTER_CHANGES, ///< The filename filter has changed (via the editbox)
TDIWD_POPULATION_CHANGE,
TDIWD_FORCE_RESORT,
};

@ -548,7 +548,7 @@ static void ChangePopulation(Town *t, int mod)
InvalidateWindowData(WC_TOWN_VIEW, t->index); // Cargo requirements may appear/vanish for small populations
if (_settings_client.gui.population_in_label) t->UpdateVirtCoord();
InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_FORCE_RESORT);
InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_POPULATION_CHANGE);
}
/**

@ -1001,6 +1001,11 @@ public:
this->vscroll->SetCount((int)this->towns.size()); // Update scrollbar as well.
}
break;
case TDIWD_POPULATION_CHANGE:
if (this->towns.SortType() == 1) this->towns.ForceResort();
break;
default:
this->towns.ForceResort();
}

Loading…
Cancel
Save