mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use cached town name for town list window filtering
parent
d35f35a968
commit
87700bfe0e
|
@ -686,8 +686,6 @@ private:
|
||||||
void BuildSortTownList()
|
void BuildSortTownList()
|
||||||
{
|
{
|
||||||
if (this->towns.NeedRebuild()) {
|
if (this->towns.NeedRebuild()) {
|
||||||
char buf[MAX_LENGTH_TOWN_NAME_CHARS * MAX_CHAR_LENGTH];
|
|
||||||
|
|
||||||
this->towns.clear();
|
this->towns.clear();
|
||||||
|
|
||||||
for (const Town *t : Town::Iterate()) {
|
for (const Town *t : Town::Iterate()) {
|
||||||
|
@ -696,11 +694,7 @@ private:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
this->string_filter.ResetState();
|
this->string_filter.ResetState();
|
||||||
|
this->string_filter.AddLine(t->GetCachedName());
|
||||||
SetDParam(0, t->index);
|
|
||||||
GetString(buf, STR_TOWN_NAME, lastof(buf));
|
|
||||||
|
|
||||||
this->string_filter.AddLine(buf);
|
|
||||||
if (this->string_filter.GetState()) this->towns.push_back(t);
|
if (this->string_filter.GetState()) this->towns.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue