Skip to content

Commit

Permalink
Fix OpenTTD#7899, 196d586: don't trigger filter changes more than exp…
Browse files Browse the repository at this point in the history
…ected
  • Loading branch information
glx22 committed Jan 5, 2020
1 parent 596fb5d commit 0672e00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/town.h
Expand Up @@ -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,
};

/**
Expand Down
8 changes: 4 additions & 4 deletions src/town_cmd.cpp
Expand Up @@ -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! */
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 0672e00

Please sign in to comment.