summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2020-01-05 22:55:57 +0100
committerCharles Pigott <charlespigott@googlemail.com>2020-01-05 22:51:27 +0000
commit39e6247bec6b958b11c6ab58430a4197eb1deb6a (patch)
tree2db0ec84c21ab333c44381aef9efd7e620b97860 /src
parentac3bc30a30d3daeb912c989accbb0fb08ea6e582 (diff)
downloadopenttd-39e6247bec6b958b11c6ab58430a4197eb1deb6a.tar.xz
Fix #7899, 196d5868: don't trigger filter changes more than expected
Diffstat (limited to 'src')
-rw-r--r--src/town.h1
-rw-r--r--src/town_cmd.cpp8
2 files changed, 5 insertions, 4 deletions
diff --git a/src/town.h b/src/town.h
index c8903d4ff..1f04cf155 100644
--- a/src/town.h
+++ b/src/town.h
@@ -162,6 +162,7 @@ enum TownRatingCheckType {
enum TownDirectoryInvalidateWindowData {
TDIWD_FORCE_REBUILD,
TDIWD_FILTER_CHANGES, ///< The filename filter has changed (via the editbox)
+ TDIWD_FORCE_RESORT,
};
/**
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 31e11ae45..994977513 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -153,7 +153,7 @@ Town::~Town()
*/
void Town::PostDestructor(size_t index)
{
- InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 0);
+ InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_FORCE_REBUILD);
UpdateNearestTownForRoadTiles(false);
/* Give objects a new home! */
@@ -423,7 +423,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, 1);
+ InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_FORCE_RESORT);
}
/**
@@ -1777,7 +1777,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSize
t->townnameparts = townnameparts;
t->UpdateVirtCoord();
- InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 0);
+ InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_FORCE_REBUILD);
t->InitializeLayout(layout);
@@ -2685,7 +2685,7 @@ CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
t->name = reset ? nullptr : stredup(text);
t->UpdateVirtCoord();
- InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
+ InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_FORCE_RESORT);
UpdateAllStationVirtCoords();
}
return CommandCost();