Town directory window: Only resort on population change if necessary
This commit is contained in:
@@ -204,6 +204,7 @@ enum TownRatingCheckType {
|
|||||||
enum TownDirectoryInvalidateWindowData {
|
enum TownDirectoryInvalidateWindowData {
|
||||||
TDIWD_FORCE_REBUILD,
|
TDIWD_FORCE_REBUILD,
|
||||||
TDIWD_FILTER_CHANGES, ///< The filename filter has changed (via the editbox)
|
TDIWD_FILTER_CHANGES, ///< The filename filter has changed (via the editbox)
|
||||||
|
TDIWD_POPULATION_CHANGE,
|
||||||
TDIWD_FORCE_RESORT,
|
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
|
InvalidateWindowData(WC_TOWN_VIEW, t->index); // Cargo requirements may appear/vanish for small populations
|
||||||
if (_settings_client.gui.population_in_label) t->UpdateVirtCoord();
|
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.
|
this->vscroll->SetCount((int)this->towns.size()); // Update scrollbar as well.
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TDIWD_POPULATION_CHANGE:
|
||||||
|
if (this->towns.SortType() == 1) this->towns.ForceResort();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
this->towns.ForceResort();
|
this->towns.ForceResort();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user