Fixed bug in matching categories for one-word classificator type.

This commit is contained in:
vng 2014-08-05 17:36:57 +03:00 committed by Alex Zolotarev
parent 69d65a9066
commit bfdb2314bf

View file

@ -402,12 +402,19 @@ string Engine::GetCountryName(string const & id)
bool Engine::GetNameByType(uint32_t type, int8_t locale, string & name) const
{
uint8_t level = ftype::GetLevel(type);
while (level >= 2)
ASSERT_GREATER(level, 0, ());
while (true)
{
if (m_pData->m_categories.GetNameByType(type, locale, name))
return true;
ftype::TruncValue(type, --level);
if (--level == 0)
break;
ftype::TruncValue(type, level);
}
return false;
}