Codechange: Apply suggestions from code review

This commit is contained in:
rubidium42 2023-06-05 09:24:29 +02:00
parent 2dd2b698d2
commit 921f5afc4d
2 changed files with 6 additions and 2 deletions

View File

@ -207,7 +207,7 @@ void Town::InitializeLayout(TownLayout layout)
void Town::FillCachedName() const
{
this->cached_name.assign(GetTownName(this));
this->cached_name = GetTownName(this);
}
/**

View File

@ -116,7 +116,11 @@ bool VerifyTownName(uint32 r, const TownNameParams *par, TownNames *town_names)
for (const Town *t : Town::Iterate()) {
/* We can't just compare the numbers since
* several numbers may map to a single name. */
if (name == (t->name.empty() ? GetTownName(t) : t->name)) return false;
if (t->name.empty()) {
if (name == GetTownName(t)) return false;
} else {
if (name == t->name) return false;
}
}
}